:root {
    --hm-bg: #f4f6fb;
    --hm-sidebar-bg: #10223a;
    --hm-sidebar-accent: #1d3f68;
    --hm-primary: #3ba272;
    --hm-primary-soft: rgba(59, 162, 114, 0.12);
    --hm-highlight: #527dde;
    --hm-border: rgba(16, 34, 58, 0.08);
    --hm-text: #1f2933;
    --hm-muted: #5c6b80;
    --hm-card-bg: #ffffff;
    --hm-radius-lg: 18px;
    --hm-radius-md: 12px;
    --hm-shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.08);
    --hm-shadow-lg: 0 35px 60px rgba(15, 23, 42, 0.08);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    background: var(--hm-bg);
    color: var(--hm-text);
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

.hm-layout {
    min-height: 100vh;
    display: flex;
    background: linear-gradient(180deg, #f6f7fb 0%, #eef1f9 100%);
}

.hm-sidebar {
    width: 280px;
    background: radial-gradient(circle at top, rgba(59, 162, 114, 0.18), transparent 58%), linear-gradient(180deg, var(--hm-sidebar-bg) 0%, #0b1726 100%);
    color: #f8fbff;
    padding: 30px 24px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.hm-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 24px;
}

.hm-brand-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(59, 162, 114, 0.8), rgba(82, 125, 222, 0.5));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #ffffff;
}

.hm-brand-title {
    display: block;
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: 0.4px;
}

.hm-brand-subtitle {
    display: block;
    margin-top: 2px;
    font-size: 0.8rem;
    opacity: 0.7;
}

.hm-sidebar-section + .hm-sidebar-section {
    margin-top: 16px;
}

.hm-section-label {
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 2px;
    opacity: 0.55;
    margin-bottom: 6px;
}

.hm-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hm-nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: transparent;
    transition: background 0.2s ease, transform 0.2s ease;
}

.hm-nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(2px);
}

.hm-nav-item.active {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 0 0 1px rgba(248, 251, 255, 0.18);
}

.hm-nav-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #ebf5ff;
    flex-shrink: 0;
    letter-spacing: 0.4px;
}

.hm-nav-title {
    font-size: 0.92rem;
    font-weight: 500;
}

.hm-nav-desc {
    display: block;
    font-size: 0.75rem;
    opacity: 0.58;
    margin-top: 2px;
}

.hm-nav-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 4px 0;
    padding: 4px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.hm-nav-group[data-expanded="true"] {
    background: rgba(255, 255, 255, 0.07);
    box-shadow: inset 0 0 0 1px rgba(248, 251, 255, 0.08);
}

.hm-nav-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: transparent;
    border: none;
    color: rgba(226, 232, 240, 0.7);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.hm-nav-group-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.hm-nav-group[data-expanded="true"] .hm-nav-group-toggle {
    color: #ffffff;
}

.hm-nav-group-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.6px;
    color: rgba(226, 232, 240, 0.6);
    font-weight: 600;
    transition: color 0.2s ease;
}

.hm-nav-group.active .hm-nav-group-title,
.hm-nav-group-title.active {
    color: #ffffff;
}

.hm-nav-caret {
    width: 8px;
    height: 8px;
    border-right: 2px solid rgba(226, 232, 240, 0.7);
    border-bottom: 2px solid rgba(226, 232, 240, 0.7);
    transform: rotate(-45deg);
    transition: transform 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0;
}

.hm-nav-group[data-expanded="true"] .hm-nav-caret {
    transform: rotate(45deg);
    border-color: #ffffff;
}

.hm-subnav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-left: 18px;
}

.hm-nav-group[data-expanded="false"] .hm-subnav {
    display: none;
}

.hm-nav-group[data-expanded="true"] .hm-subnav {
    display: flex;
}

.hm-nav-subitem {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    color: rgba(226, 232, 240, 0.85);
    transition: background 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.hm-nav-subitem:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(2px);
}

.hm-nav-subitem.active {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.18);
}

.hm-mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid rgba(16, 34, 58, 0.12);
    background: rgba(255, 255, 255, 0.86);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.hm-mobile-menu-btn:hover {
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
    transform: translateY(-1px);
}

.hm-mobile-menu-icon {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.hm-mobile-menu-icon span {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 999px;
    background: var(--hm-text);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.hm-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 20, 35, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 80;
}

.hm-sidebar-overlay.is-active {
    opacity: 1;
    pointer-events: auto;
}

.hm-mobile-nav-open .hm-mobile-menu-icon span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.hm-mobile-nav-open .hm-mobile-menu-icon span:nth-child(2) {
    opacity: 0;
}

.hm-mobile-nav-open .hm-mobile-menu-icon span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.hm-focus-card {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.hm-focus-metric {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.hm-focus-label {
    opacity: 0.72;
}

.hm-focus-value {
    font-weight: 600;
}

.hm-progress-track {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.hm-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(59, 162, 114, 0.6), rgba(82, 125, 222, 0.6));
}

.hm-sidebar-footer {
    margin-top: auto;
    padding-top: 28px;
    opacity: 0.55;
    font-size: 0.75rem;
    letter-spacing: 0.4px;
}

.hm-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.hm-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 28px 34px 0;
    gap: 24px;
}

.hm-page-title h1 {
    margin: 0;
    font-size: 1.85rem;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.hm-page-subtitle {
    margin: 6px 0 0;
    font-size: 0.9rem;
    color: var(--hm-muted);
}

.hm-top-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}

.hm-top-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hm-ghost-btn,
.hm-primary-btn,
.hm-secondary-btn {
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hm-primary-btn {
    background: linear-gradient(135deg, var(--hm-primary) 0%, var(--hm-highlight) 100%);
    color: #ffffff;
    box-shadow: 0 15px 25px rgba(59, 162, 114, 0.25);
}

.hm-primary-btn:hover {
    transform: translateY(-2px);
}

.hm-secondary-btn {
    background: rgba(82, 125, 222, 0.12);
    color: var(--hm-highlight);
    border: 1px solid rgba(82, 125, 222, 0.2);
}

.hm-secondary-btn:hover {
    transform: translateY(-2px);
}

.hm-ghost-btn {
    background: rgba(255, 255, 255, 0.7);
    color: var(--hm-text);
    border: 1px solid rgba(16, 34, 58, 0.12);
}

.hm-ghost-btn:hover {
    transform: translateY(-2px);
}

.hm-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(16, 34, 58, 0.08);
}

.hm-profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(82, 125, 222, 0.85), rgba(59, 162, 114, 0.65));
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.hm-profile-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.hm-profile-role {
    display: block;
    font-size: 0.7rem;
    color: var(--hm-muted);
}

.hm-profile-dropdown {
    position: relative;
}

.hm-profile-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(16, 34, 58, 0.12);
    background: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.hm-profile-trigger:hover {
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
    transform: translateY(-1px);
}

.hm-profile-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.hm-profile-caret {
    width: 8px;
    height: 8px;
    border-right: 2px solid rgba(16, 34, 58, 0.6);
    border-bottom: 2px solid rgba(16, 34, 58, 0.6);
    transform: rotate(45deg);
    margin-left: 4px;
}

.hm-profile-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 180px;
    background: #ffffff;
    border: 1px solid rgba(16, 34, 58, 0.12);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
    padding: 6px;
    display: none;
    z-index: 120;
}

.hm-profile-menu.is-open {
    display: block;
}

.hm-profile-menu-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 0.9rem;
    color: var(--hm-text);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.hm-profile-menu-item:hover {
    background: rgba(82, 125, 222, 0.08);
    color: var(--hm-highlight);
}

.hm-profile-dropdown {
    position: relative;
}

.hm-profile-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(16, 34, 58, 0.12);
    background: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.hm-profile-trigger:hover {
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
    transform: translateY(-1px);
}

.hm-profile-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.hm-profile-caret {
    width: 8px;
    height: 8px;
    border-right: 2px solid rgba(16, 34, 58, 0.6);
    border-bottom: 2px solid rgba(16, 34, 58, 0.6);
    transform: rotate(45deg);
    margin-left: 4px;
}

.hm-profile-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 180px;
    background: #ffffff;
    border: 1px solid rgba(16, 34, 58, 0.12);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
    padding: 6px;
    display: none;
    z-index: 120;
}

.hm-profile-menu.is-open {
    display: block;
}

.hm-profile-menu-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 0.9rem;
    color: var(--hm-text);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.hm-profile-menu-item:hover {
    background: rgba(82, 125, 222, 0.08);
    color: var(--hm-highlight);
}

.hm-main-content {
    flex: 1;
    padding: 26px 34px 40px;
}

.hm-card {
    background: var(--hm-card-bg);
    border-radius: var(--hm-radius-lg);
    padding: 22px;
    box-shadow: var(--hm-shadow-sm);
    border: 1px solid var(--hm-border);
    min-height: 120px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hm-card--highlight {
    background: linear-gradient(135deg, rgba(59, 162, 114, 0.12), rgba(82, 125, 222, 0.16));
    border: 1px solid rgba(82, 125, 222, 0.18);
}

.hm-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--hm-muted);
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.hm-metric-value {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.hm-metric-caption {
    font-size: 0.85rem;
    color: var(--hm-muted);
}

.hm-grid {
    display: grid;
    gap: 20px;
}

.hm-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.hm-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hm-dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 24px;
    margin-bottom: 28px;
}

.hm-hero-card {
    background: var(--hm-card-bg);
    padding: 26px;
    border-radius: var(--hm-radius-lg);
    box-shadow: var(--hm-shadow-sm);
    border: 1px solid var(--hm-border);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.hm-hero-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.1px;
}

.hm-hero-message {
    font-size: 0.95rem;
    color: var(--hm-muted);
    margin: 0;
}

.hm-pill-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hm-pill {
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--hm-primary-soft);
    color: var(--hm-primary);
    font-size: 0.8rem;
    font-weight: 600;
}

.hm-insight-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hm-insight-item {
    padding: 12px 14px;
    border-radius: var(--hm-radius-md);
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--hm-border);
    font-size: 0.85rem;
    color: var(--hm-text);
}

.hm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.hm-table thead {
    background: rgba(82, 125, 222, 0.08);
}

.hm-table th,
.hm-table td {
    padding: 12px 14px;
    text-align: left;
}

.hm-table tbody tr + tr {
    border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.hm-table-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 10px;
    color: var(--hm-muted);
    font-weight: 600;
    text-align: center;
}

.hm-table-status.info {
    color: var(--hm-highlight);
}

.hm-table-status.success {
    color: var(--hm-primary);
}

.hm-table-status.error {
    color: #ef4444;
}

.hm-table-status .hm-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(82, 125, 222, 0.25);
    border-top-color: var(--hm-highlight);
    border-radius: 50%;
    animation: hm-spin 0.9s linear infinite;
}

@keyframes hm-spin {
    to {
        transform: rotate(360deg);
    }
}

.hm-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    background: rgba(82, 125, 222, 0.12);
    color: var(--hm-highlight);
    font-weight: 600;
}

.hm-progress-legend {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.8rem;
}

.hm-progress-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hm-progress-bullet {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.hm-divider {
    height: 1px;
    background: rgba(15, 23, 42, 0.06);
    margin: 10px 0;
}

.hm-micro-chart {
    height: 120px;
    border-radius: var(--hm-radius-md);
    background: linear-gradient(135deg, rgba(82, 125, 222, 0.08), rgba(59, 162, 114, 0.1));
    border: 1px dashed rgba(82, 125, 222, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(82, 125, 222, 0.7);
    font-size: 0.8rem;
    letter-spacing: 0.4px;
}

.hm-empty-state {
    border: 1px dashed rgba(15, 23, 42, 0.16);
    border-radius: var(--hm-radius-md);
    padding: 18px;
    font-size: 0.85rem;
    color: var(--hm-muted);
    background: rgba(255, 255, 255, 0.8);
}

.hm-toast-container {
    position: fixed;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 130;
    pointer-events: none;
}

.hm-toast {
    pointer-events: auto;
    min-width: 280px;
    max-width: 450px;
    padding: 18px 20px;
    border-radius: 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    color: #1e293b;
    border: 2px solid rgba(16, 34, 58, 0.15);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.5;
    transform: translateY(-15px) scale(0.95);
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 60px;
}

.hm-toast.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.hm-toast-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1rem;
    font-weight: 900;
    background: rgba(16, 34, 58, 0.1);
    color: #475569;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.hm-toast-success .hm-toast-icon {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.hm-toast-error .hm-toast-icon {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.hm-toast-info .hm-toast-icon {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.hm-toast-text {
    display: inline-block;
    line-height: 1.5;
    font-weight: 600;
    color: #1e293b;
    flex: 1;
}

.hm-toast-success {
    border-color: rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
    box-shadow: 0 20px 50px rgba(16, 185, 129, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

.hm-toast-success .hm-toast-text {
    color: #065f46;
}

.hm-toast-error {
    border-color: rgba(239, 68, 68, 0.4);
    background: linear-gradient(135deg, #ffffff 0%, #fef2f2 100%);
    box-shadow: 0 20px 50px rgba(239, 68, 68, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

.hm-toast-error .hm-toast-text {
    color: #991b1b;
}

.hm-toast-info {
    border-color: rgba(59, 130, 246, 0.4);
    background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
    box-shadow: 0 20px 50px rgba(59, 130, 246, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

.hm-toast-info .hm-toast-text {
    color: #1e40af;
}

@media (max-width: 1200px) {
    .hm-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hm-dashboard-hero {
        grid-template-columns: 1fr;
    }

    .hm-layout {
        flex-direction: column;
    }

    .hm-sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 20px;
        gap: 20px;
    }

    .hm-sidebar-section {
        min-width: 220px;
        flex: 1;
    }

    .hm-main {
        padding-top: 0;
    }
}

@media (max-width: 900px) {
    .hm-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .hm-top-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 12px;
    }

    .hm-grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    body.hm-mobile-nav-open {
        overflow: hidden;
    }

    .hm-layout {
        background: var(--hm-bg);
    }

    .hm-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(80vw, 280px);
        max-width: 320px;
        transform: translateX(-100%);
        padding: 26px 22px;
        overflow-y: auto;
        z-index: 90;
        gap: 18px;
    }

    .hm-sidebar.is-open {
        transform: translateX(0);
    }

    .hm-sidebar-section {
        width: 100%;
    }

    .hm-main {
        width: 100%;
        min-height: 100vh;
    }

    .hm-topbar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 18px 20px 0;
        gap: 16px;
    }

    .hm-page-title {
        flex: 1;
    }

    .hm-top-actions {
        width: auto;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 10px;
    }

    .hm-mobile-menu-btn {
        display: inline-flex;
    }

    .hm-main-content {
        padding: 20px;
    }

    .hm-grid-4,
    .hm-grid-2 {
        grid-template-columns: 1fr;
    }
}

.hm-panel-grid {
    display: grid;
    gap: 22px;
}

.hm-panel-grid--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hm-panel-title-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.hm-panel {
    background: var(--hm-card-bg);
    border-radius: var(--hm-radius-lg);
    border: 1px solid var(--hm-border);
    box-shadow: var(--hm-shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.hm-panel-header {
    padding: 20px 24px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hm-help-btn {
    min-width: 42px;
    min-height: 42px;
    padding: 0;
    font-weight: 700;
    font-size: 1rem;
}

.hm-panel-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.1px;
}

.hm-panel-header p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--hm-muted);
}

.hm-panel-body {
    padding: 20px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.hm-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 120;
}

.hm-modal.is-active {
    display: flex;
}

.hm-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 23, 41, 0.55);
    backdrop-filter: blur(2px);
}

.hm-modal-card {
    position: relative;
    background: #ffffff;
    color: var(--hm-text);
    border-radius: 16px;
    padding: 18px 18px 16px;
    width: min(640px, 92vw);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2);
    z-index: 1;
    max-height: 86vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.hm-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    position: relative;
}

.hm-modal-body {
    overflow-y: auto;
    padding-right: 6px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 60vh;
}

.hm-category-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 0;
}

.hm-category-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}

.hm-remove-btn {
    border: 1px solid rgba(16, 34, 58, 0.12);
    background: #ffffff;
    color: var(--hm-text);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.hm-remove-btn:hover {
    background: rgba(16, 34, 58, 0.06);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
    transform: translateY(-1px);
}

.hm-modal-footer {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.hm-modal-close {
    border: 1px solid rgba(16, 34, 58, 0.12);
    background: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    line-height: 1;
    color: var(--hm-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.hm-modal-close:hover {
    background: rgba(16, 34, 58, 0.06);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
    transform: translateY(-1px);
}

.hm-list {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

body.hm-modal-open {
    overflow: hidden;
}

.hm-form-grid {
    display: grid;
    gap: 18px;
}

.hm-form-grid--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hm-inline-field-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.hm-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hm-field label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: var(--hm-muted);
}

.hm-required {
    color: #ef4444;
    margin-left: 4px;
}

.hm-input,
.hm-select,
.hm-textarea {
    border-radius: 12px;
    border: 1px solid rgba(16, 34, 58, 0.1);
    padding: 12px 14px;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.96);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    color: var(--hm-text);
}

.hm-input:focus,
.hm-select:focus,
.hm-textarea:focus {
    outline: none;
    border-color: rgba(82, 125, 222, 0.45);
    box-shadow: 0 0 0 3px rgba(82, 125, 222, 0.12);
}

.hm-textarea {
    min-height: 110px;
    resize: vertical;
}

.hm-field-hint {
    font-size: 0.75rem;
    color: var(--hm-muted);
    letter-spacing: 0.2px;
}

.hm-toggle-group {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.hm-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid rgba(16, 34, 58, 0.12);
    background: rgba(255, 255, 255, 0.92);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.hm-toggle input {
    accent-color: var(--hm-highlight);
}

.hm-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.hm-type-card {
    border-radius: 14px;
    border: 1px solid rgba(16, 34, 58, 0.12);
    padding: 16px;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.hm-type-card.active {
    border-color: rgba(82, 125, 222, 0.4);
    box-shadow: 0 12px 24px rgba(82, 125, 222, 0.18);
    transform: translateY(-2px);
}

.hm-type-card strong {
    font-size: 0.95rem;
}

.hm-type-card span {
    font-size: 0.78rem;
    color: var(--hm-muted);
}

.hm-type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(82, 125, 222, 0.12);
    color: var(--hm-highlight);
    font-weight: 600;
    font-size: 0.8rem;
}

.hm-pill-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.hm-pill-list .hm-pill {
    background: rgba(82, 125, 222, 0.08);
    color: var(--hm-highlight);
    border: 1px dashed rgba(82, 125, 222, 0.25);
}

.hm-status-callout {
    border: 1px dashed rgba(16, 34, 58, 0.14);
    border-radius: var(--hm-radius-md);
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.85);
    font-size: 0.85rem;
    color: var(--hm-muted);
}

.hm-status-callout.info {
    border-color: rgba(82, 125, 222, 0.35);
    background: rgba(82, 125, 222, 0.08);
    color: var(--hm-highlight);
}

.hm-status-callout strong {
    color: var(--hm-text);
}

.hm-tag-neutral {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    background: rgba(16, 34, 58, 0.08);
    color: var(--hm-text);
    font-weight: 600;
}

.hm-separator {
    height: 1px;
    width: 100%;
    background: rgba(16, 34, 58, 0.08);
}

.hm-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.hm-list-item {
    padding: 12px 16px;
    border-radius: var(--hm-radius-md);
    border: 1px solid rgba(16, 34, 58, 0.08);
    background: rgba(255, 255, 255, 0.92);
    font-size: 0.85rem;
    color: var(--hm-text);
}

.hm-list-item strong {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.hm-category-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hm-category-item {
    display: flex;
    gap: 10px;
    align-items: center;
}

.hm-category-item .hm-input {
    flex: 1;
    margin: 0;
}

.hm-remove-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0;
}

.hm-remove-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.5);
}

.hm-input-with-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hm-input-with-control .hm-input {
    flex: 1;
}

.hm-inline-btn {
    padding: 10px 16px;
}

.hm-input-with-unit {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hm-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(82, 125, 222, 0.12);
    color: var(--hm-highlight);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.4px;
}

.hm-badge.neutral {
    background: rgba(16, 34, 58, 0.08);
    color: var(--hm-text);
    border: 1px solid rgba(16, 34, 58, 0.12);
}

.hm-toolbar-inline {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.hm-category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hm-chip {
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(82, 125, 222, 0.35);
    background: rgba(82, 125, 222, 0.1);
    color: var(--hm-highlight);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.hm-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(82, 125, 222, 0.18);
    background: rgba(82, 125, 222, 0.16);
}

.hm-chip.active {
    background: linear-gradient(135deg, var(--hm-highlight), #3b6ae0);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 8px 20px rgba(82, 125, 222, 0.4);
}

.hm-log-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hm-log-item {
    display: grid;
    grid-template-columns: 80px 220px 1fr;
    gap: 16px;
    align-items: start;
    padding: 14px 16px;
    border-radius: var(--hm-radius-md);
    border: 1px solid rgba(16, 34, 58, 0.08);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--hm-shadow-sm);
}

.hm-log-time {
    font-weight: 600;
    letter-spacing: 0.4px;
    color: var(--hm-muted);
}

.hm-log-metric {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hm-log-metric strong {
    font-size: 1rem;
}

.hm-log-note {
    font-size: 0.85rem;
    color: var(--hm-text);
    line-height: 1.5;
}

.hm-micro-text {
    display: block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--hm-muted);
    letter-spacing: 0.3px;
}

.hm-metric-summary {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hm-summary-card {
    padding: 16px;
    border-radius: var(--hm-radius-md);
    border: 1px solid rgba(16, 34, 58, 0.08);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--hm-shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hm-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hm-summary-progress {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--hm-text);
}

.hm-summary-note {
    font-size: 0.85rem;
    color: var(--hm-muted);
    line-height: 1.5;
}

.hm-progress-track--warning {
    background: rgba(249, 115, 22, 0.12);
}

.hm-progress-fill--warning {
    background: linear-gradient(90deg, #f97316, #fb923c);
}

.hm-insight-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.hm-insight-card {
    padding: 16px;
    border-radius: var(--hm-radius-md);
    border: 1px solid rgba(16, 34, 58, 0.08);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--hm-shadow-sm);
}

.hm-insight-card strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.hm-insight-card p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--hm-muted);
    line-height: 1.5;
}

.hm-muted {
    color: var(--hm-muted);
    font-style: italic;
    text-align: center;
}

.hm-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.hm-actions-group {
    display: inline-flex;
    gap: 8px;
}

.hm-actions-group .hm-secondary-btn,
.hm-actions-group .hm-ghost-btn {
    padding: 8px 14px;
    font-size: 0.8rem;
}

.hm-test-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hm-test-status {
    margin-left: 6px;
    font-size: 0.85rem;
    color: var(--hm-muted);
    font-weight: 600;
}

.hm-test-status.success {
    color: var(--hm-primary);
}

.hm-test-status.error {
    color: #ef4444;
}

.hm-test-status.info {
    color: var(--hm-highlight);
}

.hm-loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 20% 20%, rgba(82, 125, 222, 0.14), transparent 35%), radial-gradient(circle at 80% 40%, rgba(59, 162, 114, 0.14), transparent 32%), rgba(12, 19, 33, 0.58);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.hm-loading-overlay.is-active {
    opacity: 1;
    pointer-events: all;
}

.hm-loading-card {
    min-width: 280px;
    max-width: 360px;
    padding: 22px 24px;
    border-radius: var(--hm-radius-lg);
    background: linear-gradient(180deg, #ffffff 0%, #f7f9ff 100%);
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.18);
    border: 1px solid rgba(16, 34, 58, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
    animation: hmCardLift 0.35s ease;
}

.hm-loading-spinner {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 4px solid rgba(82, 125, 222, 0.2);
    border-top-color: var(--hm-primary);
    border-right-color: rgba(59, 162, 114, 0.65);
    animation: hmSpin 0.9s linear infinite, hmPulse 1.8s ease-in-out infinite;
    box-shadow: 0 8px 24px rgba(59, 162, 114, 0.25);
}

.hm-loading-text {
    font-weight: 700;
    font-size: 1rem;
    color: var(--hm-text);
    letter-spacing: 0.2px;
}

.hm-loading-subtext {
    font-size: 0.9rem;
    color: var(--hm-muted);
}

body.hm-loading-active {
    cursor: progress;
}

@keyframes hmSpin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes hmPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 162, 114, 0.25);
    }

    100% {
        box-shadow: 0 0 0 16px rgba(59, 162, 114, 0);
    }
}

@keyframes hmCardLift {
    from {
        transform: translateY(6px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 1024px) {
    .hm-panel-grid--two {
        grid-template-columns: 1fr;
    }

    .hm-form-grid--two {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .hm-mobile-menu-btn {
        display: flex !important;
    }
    
    .hm-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.2);
    }
    
    body.hm-mobile-nav-open .hm-sidebar {
        transform: translateX(0);
    }
    
    .hm-sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    
    body.hm-mobile-nav-open .hm-sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }
    
    .hm-main {
        width: 100%;
    }
}

/* Comprehensive Mobile Optimizations */
@media (max-width: 768px) {
    /* Base font size reduction */
    body {
        font-size: 14px;
    }
    
    /* Ensure images and media scale properly */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Prevent horizontal overflow */
    html, body {
        overflow-x: hidden;
        width: 100%;
    }
    
    .hm-main-content,
    .hm-card,
    .hm-panel {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* Topbar adjustments */
    .hm-topbar {
        padding: 12px 14px 0;
        gap: 12px;
    }
    
    .hm-page-title h1 {
        font-size: 1.35rem;
        line-height: 1.3;
    }
    
    .hm-page-subtitle {
        font-size: 0.8rem;
        margin-top: 4px;
    }
    
    /* Profile/user menu adjustments */
    .hm-user-toggle {
        padding: 6px 10px;
    }
    
    .hm-user-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
    
    .hm-user-name {
        font-size: 0.8rem;
        max-width: 100px;
    }
    
    /* Main content padding reduction */
    .hm-main-content {
        padding: 14px 12px 20px;
    }
    
    /* Card adjustments */
    .hm-card {
        padding: 16px 14px;
        border-radius: 14px;
    }
    
    .hm-card-title {
        font-size: 0.85rem;
    }
    
    .hm-metric-value {
        font-size: 1.6rem;
    }
    
    .hm-metric-caption {
        font-size: 0.75rem;
    }
    
    /* Panel adjustments */
    .hm-panel-header {
        padding: 16px 14px 12px;
    }
    
    .hm-panel-header h3 {
        font-size: 1.15rem;
        margin-bottom: 6px;
    }
    
    .hm-panel-header p {
        font-size: 0.8rem;
    }
    
    .hm-panel-body {
        padding: 16px 14px;
        gap: 14px;
    }
    
    /* Grid adjustments - ensure single column */
    .hm-grid-4,
    .hm-grid-2,
    .hm-panel-grid--two,
    .hm-form-grid--two,
    .hm-inline-field-pair {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    
    /* Form field adjustments */
    .hm-field label {
        font-size: 0.75rem;
        margin-bottom: 6px;
    }
    
    .hm-input,
    .hm-select,
    .hm-textarea {
        padding: 10px 12px;
        font-size: 0.85rem;
        border-radius: 10px;
    }
    
    .hm-textarea {
        min-height: 90px;
    }
    
    /* Button adjustments */
    .hm-primary-btn,
    .hm-secondary-btn,
    .hm-ghost-btn {
        padding: 10px 16px;
        font-size: 0.8rem;
    }
    
    .hm-top-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .hm-top-buttons .hm-primary-btn,
    .hm-top-buttons .hm-secondary-btn,
    .hm-top-buttons .hm-ghost-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Hero card adjustments */
    .hm-dashboard-hero {
        grid-template-columns: 1fr;
        gap: 16px;
        margin-bottom: 20px;
    }
    
    .hm-hero-card {
        padding: 18px 16px;
    }
    
    .hm-hero-title {
        font-size: 1.2rem;
    }
    
    .hm-hero-message {
        font-size: 0.85rem;
    }
    
    /* Summary chip adjustments */
    .hm-summary-chip {
        padding: 12px 16px;
        gap: 10px;
    }
    
    .hm-summary-number {
        font-size: 1.8rem;
    }
    
    .hm-summary-label {
        font-size: 0.85rem;
    }
    
    /* Metric cards grid */
    .hm-metric-cards {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .hm-metric-summary {
        grid-template-columns: 1fr;
        gap: 14px;
        margin-bottom: 24px;
    }
    
    /* Type grid adjustments */
    .hm-type-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .hm-type-card {
        padding: 14px;
    }
    
    .hm-type-card strong {
        font-size: 0.9rem;
    }
    
    .hm-type-card span {
        font-size: 0.75rem;
    }
    
    /* Status callout */
    .hm-status-callout {
        padding: 12px 14px;
        font-size: 0.8rem;
    }
    
    /* Toggle group adjustments */
    .hm-toggle-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .hm-toggle {
        padding: 10px 14px;
        font-size: 0.8rem;
        width: 100%;
        justify-content: center;
    }
    
    /* Chip adjustments */
    .hm-chip {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
    
    .hm-category-chips {
        gap: 8px;
    }
    
    /* Log item adjustments */
    .hm-log-item {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 12px 14px;
    }
    
    .hm-log-time {
        font-size: 0.8rem;
    }
    
    .hm-log-metric strong {
        font-size: 0.9rem;
    }
    
    .hm-log-note {
        font-size: 0.8rem;
    }
    
    /* Summary card adjustments */
    .hm-summary-card {
        padding: 14px;
    }
    
    .hm-summary-progress {
        font-size: 0.85rem;
    }
    
    .hm-summary-note {
        font-size: 0.8rem;
    }
    
    /* Insight card adjustments */
    .hm-insight-card {
        padding: 14px;
    }
    
    .hm-insight-card strong {
        font-size: 0.9rem;
    }
    
    .hm-insight-card p {
        font-size: 0.8rem;
    }
    
    /* Table adjustments - ensure horizontal scroll */
    .hm-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .hm-table {
        font-size: 0.8rem;
        min-width: 600px;
    }
    
    .hm-table th,
    .hm-table td {
        padding: 10px 12px;
    }
    
    /* Modal adjustments */
    .hm-modal-card {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        padding: 16px 14px;
        margin: 12px;
        max-height: calc(100vh - 24px);
    }
    
    .hm-modal-header {
        margin-bottom: 12px;
    }
    
    .hm-modal-body {
        max-height: calc(100vh - 180px);
        padding-right: 4px;
    }
    
    .hm-modal-footer {
        margin-top: 16px;
        flex-direction: column;
        gap: 10px;
    }
    
    .hm-modal-footer .hm-primary-btn,
    .hm-modal-footer .hm-secondary-btn {
        width: 100%;
    }
    
    /* Badge adjustments */
    .hm-badge {
        padding: 5px 10px;
        font-size: 0.7rem;
    }
    
    /* List adjustments */
    .hm-list-item {
        padding: 10px 14px;
        font-size: 0.8rem;
    }
    
    .hm-list-item strong {
        font-size: 0.85rem;
    }
    
    /* Pill adjustments */
    .hm-pill {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
    
    /* Input with unit adjustments */
    .hm-input-with-unit {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .hm-input-with-unit .hm-badge {
        align-self: flex-start;
    }
    
    /* Field stack adjustments */
    .hm-field-stack {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    
    .hm-field-grid-two {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    
    /* Panel title row adjustments */
    .hm-panel-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .hm-help-btn {
        min-width: 38px;
        min-height: 38px;
        font-size: 0.95rem;
    }
    
    /* Toast adjustments */
    .hm-toast {
        min-width: calc(100vw - 40px);
        max-width: calc(100vw - 40px);
        padding: 14px 16px;
        font-size: 0.85rem;
    }
    
    /* Loading card adjustments */
    .hm-loading-card {
        min-width: calc(100vw - 40px);
        max-width: calc(100vw - 40px);
        padding: 20px;
    }
    
    .hm-loading-text {
        font-size: 0.9rem;
    }
    
    .hm-loading-subtext {
        font-size: 0.8rem;
    }
    
    /* Brand adjustments */
    .hm-brand {
        padding-bottom: 18px;
        margin-bottom: 18px;
    }
    
    .hm-brand-icon {
        width: 40px;
        height: 40px;
    }
    
    .hm-brand-title {
        font-size: 0.95rem;
    }
    
    .hm-brand-subtitle {
        font-size: 0.75rem;
    }
    
    /* Nav adjustments */
    .hm-nav-item {
        padding: 10px 12px;
    }
    
    .hm-nav-title {
        font-size: 0.85rem;
    }
    
    .hm-nav-desc {
        font-size: 0.7rem;
    }
    
    .hm-nav-icon {
        width: 30px;
        height: 30px;
        font-size: 0.7rem;
    }
    
    /* Actions group adjustments */
    .hm-actions-group {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }
    
    .hm-actions-group .hm-secondary-btn,
    .hm-actions-group .hm-ghost-btn {
        width: 100%;
    }
    
    /* Test card actions */
    .hm-test-card-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .hm-test-card-actions button {
        width: 100%;
    }
}

/* Extra small mobile devices (phones in portrait) */
@media (max-width: 480px) {
    /* Further reduction for very small screens */
    body {
        font-size: 13px;
    }
    
    .hm-main-content {
        padding: 12px 10px 18px;
    }
    
    .hm-topbar {
        padding: 10px 12px 0;
    }
    
    .hm-page-title h1 {
        font-size: 1.2rem;
    }
    
    .hm-page-subtitle {
        font-size: 0.75rem;
    }
    
    .hm-card {
        padding: 14px 12px;
    }
    
    .hm-panel-header {
        padding: 14px 12px 10px;
    }
    
    .hm-panel-header h3 {
        font-size: 1.05rem;
    }
    
    .hm-panel-body {
        padding: 14px 12px;
    }
    
    .hm-metric-value {
        font-size: 1.4rem;
    }
    
    .hm-summary-number {
        font-size: 1.6rem;
    }
    
    .hm-input,
    .hm-select,
    .hm-textarea {
        padding: 9px 11px;
        font-size: 0.85rem;
    }
    
    .hm-primary-btn,
    .hm-secondary-btn,
    .hm-ghost-btn {
        padding: 9px 14px;
        font-size: 0.75rem;
    }
    
    .hm-modal-card {
        width: calc(100vw - 20px);
        max-width: calc(100vw - 20px);
        padding: 14px 12px;
        margin: 10px;
    }
    
    .hm-toast {
        min-width: calc(100vw - 32px);
        max-width: calc(100vw - 32px);
        padding: 12px 14px;
    }
}

/* Dashboard-specific mobile overrides */
@media (max-width: 768px) {
    /* Override Dashboard.aspx inline styles */
    .hm-dashboard {
        margin: 0;
        padding: 0;
    }
    
    .hm-panel-header {
        padding: 16px 14px 12px !important;
    }
    
    .hm-panel-header h3 {
        font-size: 1.15rem !important;
    }
    
    .hm-panel-header p {
        font-size: 0.8rem !important;
    }
    
    .hm-metric-summary {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
        margin-bottom: 24px !important;
    }
    
    .hm-summary-chip {
        padding: 12px 16px !important;
        gap: 10px !important;
    }
    
    .hm-summary-number {
        font-size: 1.8rem !important;
    }
    
    .hm-summary-label {
        font-size: 0.85rem !important;
    }
    
    .hm-metric-cards {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        margin-top: 16px !important;
    }
    
    .hm-metric-card {
        padding: 14px 12px !important;
    }
    
    .hm-metric-title {
        font-size: 0.9rem !important;
    }
    
    .hm-metric-sub {
        font-size: 0.75rem !important;
    }
    
    .hm-metric-info-text {
        font-size: 0.8rem !important;
        margin: 10px 0 12px !important;
    }
    
    .hm-metric-input {
        gap: 10px !important;
        margin-top: 12px !important;
    }
    
    .hm-metric-input .hm-input,
    .hm-metric-input .hm-select,
    .hm-metric-input .hm-textarea {
        padding: 10px 12px !important;
        font-size: 0.85rem !important;
    }
    
    .hm-inline-inputs {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }
    
    .hm-inline-inputs .hm-toggle {
        width: 100% !important;
        justify-content: center !important;
    }
    
    .hm-table-wrapper {
        margin-top: 20px !important;
    }
    
    .hm-table {
        font-size: 0.8rem !important;
        min-width: 600px;
    }
    
    .hm-table th,
    .hm-table td {
        padding: 10px 12px !important;
        font-size: 0.8rem !important;
    }
    
    .hm-date-selector {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .hm-date-selector input[type="date"] {
        min-width: 100% !important;
        width: 100% !important;
    }
    
    .hm-date-buttons {
        flex-direction: column !important;
        width: 100% !important;
    }
    
    .hm-date-btn,
    .hm-date-reset {
        width: 100% !important;
        justify-content: center !important;
    }
}

@media (max-width: 480px) {
    /* Further Dashboard-specific reductions */
    .hm-panel-header {
        padding: 14px 12px 10px !important;
    }
    
    .hm-panel-header h3 {
        font-size: 1.05rem !important;
    }
    
    .hm-summary-number {
        font-size: 1.6rem !important;
    }
    
    .hm-metric-card {
        padding: 12px 10px !important;
    }
    
    .hm-table th,
    .hm-table td {
        padding: 8px 10px !important;
        font-size: 0.75rem !important;
    }
}

