:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-strong: #101828;
    --text: #172033;
    --muted: #667085;
    --line: #d9e0ea;
    --primary: #2563eb;
    --primary-strong: #1d4ed8;
    --accent: #2563eb;
    --good: #15803d;
    --warn: #b45309;
    --radius: 8px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.tax-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

.tax-actions form {
    margin: 0;
}

.field-label-row {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.field-inline-link {
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.field-inline-link:hover,
.field-inline-link:focus {
    text-decoration: underline;
}

.inline-warning {
    margin: 0;
    border: 1px solid #fde68a;
    border-radius: 14px;
    background: #fffbeb;
    color: #92400e;
    padding: 12px 14px;
    font-weight: 700;
}

.browser-cert-test-panel .panel-header {
    gap: 14px;
}

.browser-cert-test-panel .button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.browser-cert-test-panel .button svg {
    width: 17px;
    height: 17px;
}

.browser-cert-actions {
    display: flex;
    justify-content: flex-start;
    margin: 0 0 12px;
}

.browser-cert-actions .button {
    border-radius: 999px;
    padding-inline: 18px;
    min-width: 0;
}

.browser-cert-status {
    display: grid;
    gap: 10px;
}

.browser-cert-status-row {
    display: grid;
    grid-template-columns: minmax(130px, 0.9fr) minmax(120px, 1fr);
    gap: 8px 14px;
    align-items: start;
    border: 1px solid rgba(216, 226, 239, 0.9);
    border-radius: 14px;
    background: #ffffff;
    padding: 12px 14px;
}

.browser-cert-status-row span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.browser-cert-status-row strong {
    color: var(--text);
    font-size: 13px;
}

.browser-cert-status-row small {
    grid-column: 1 / -1;
    color: var(--muted);
    line-height: 1.45;
}

.browser-cert-status-row.is-ok {
    border-color: rgba(34, 197, 94, 0.28);
    background: #f0fdf4;
}

.browser-cert-status-row.is-warning,
.browser-cert-status-row.is-pending {
    border-color: rgba(245, 158, 11, 0.28);
    background: #fffbeb;
}

.browser-cert-status-row.is-danger {
    border-color: rgba(239, 68, 68, 0.28);
    background: #fef2f2;
}

/* Final cascade guard: keep the refined blue/mobile design after module CSS. */
@media screen {
    :root {
        --primary: #2563eb;
        --primary-strong: #1d4ed8;
        --accent: #2563eb;
        --primary-soft: #dbeafe;
        --blue: #60a5fa;
        --blue-soft: #eff6ff;
        --app-bg: #eef4fb;
        --bg: #f6f9fd;
        --surface: rgba(255, 255, 255, 0.9);
        --surface-strong: #ffffff;
        --line: #d8e2ef;
        --line-strong: #c8d6e6;
        --text: #172033;
        --muted: #64748b;
        --radius: 12px;
        --radius-inner: 8px;
        --shadow-shell: 0 18px 48px rgba(30, 41, 59, 0.08);
        --shadow-card: 0 10px 26px rgba(30, 41, 59, 0.07);
    }

    body {
        background:
            radial-gradient(circle at 86% 12%, rgba(96, 165, 250, 0.14), transparent 28%),
            linear-gradient(135deg, #f8fbff 0%, #eef4fb 46%, #f6f9fd 100%);
    }

    a {
        color: var(--primary-strong);
    }

    .main {
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(246, 249, 253, 0.96));
    }

    .panel,
    .doc-action-card,
    .stat-card,
    .modern-card,
    .glass-card,
    .document-preview-shell,
    .accounting-action-grid .doc-action-card {
        border-color: rgba(216, 226, 239, 0.88) !important;
        box-shadow: var(--shadow-card) !important;
    }

    .panel .panel,
    .panel .doc-action-card,
    .panel .modern-card,
    .panel .glass-card,
    .document-preview-shell .panel,
    .document-paper .panel,
    .table-shell .panel {
        box-shadow: none !important;
    }

    .button,
    button.button,
    .mobile-action {
        min-height: 40px;
        border-radius: var(--radius-inner);
        border-color: var(--primary);
        background: var(--primary);
        color: #ffffff;
        box-shadow: none;
        white-space: nowrap;
    }

    .button:hover,
    button.button:hover,
    .mobile-action:hover {
        border-color: var(--primary-strong);
        background: var(--primary-strong);
        color: #ffffff;
    }

    .button.secondary,
    .button.ghost,
    a.button.secondary,
    a.button.ghost {
        border-color: var(--line);
        background: #ffffff;
        color: var(--text);
    }

    .button.secondary:hover,
    .button.ghost:hover,
    a.button.secondary:hover,
    a.button.ghost:hover {
        border-color: rgba(37, 99, 235, 0.38);
        background: #f8fbff;
        color: var(--primary-strong);
    }

    .button.danger,
    button.danger,
    .danger {
        border-color: #dc2626;
        background: #dc2626;
        color: #ffffff;
    }

    .sidebar {
        background: rgba(255, 255, 255, 0.72);
        border-color: rgba(216, 226, 239, 0.9);
        box-shadow: none;
    }

    .sidebar nav,
    .main-nav {
        gap: 4px;
    }

    .sidebar nav a,
    .main-nav a {
        min-height: 44px;
        border: 1px solid transparent !important;
        border-radius: 10px !important;
        background: transparent !important;
        box-shadow: none !important;
        color: #334155;
        font-weight: 760;
        letter-spacing: 0;
    }

    .sidebar nav a:hover,
    .main-nav a:hover {
        border-color: rgba(37, 99, 235, 0.14) !important;
        background: rgba(239, 246, 255, 0.72) !important;
        color: var(--primary-strong) !important;
    }

    .sidebar nav a.active,
    .main-nav a.active {
        border-color: var(--primary) !important;
        background: var(--primary) !important;
        color: #ffffff !important;
    }

    .nav-icon {
        width: 24px !important;
        height: 24px !important;
        min-width: 24px !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        color: currentColor !important;
    }

    .sidebar nav a.active .nav-icon,
    .main-nav a.active .nav-icon,
    .sidebar nav a:hover .nav-icon,
    .main-nav a:hover .nav-icon {
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        color: currentColor !important;
    }

    .nav-icon svg {
        width: 20px !important;
        height: 20px !important;
        stroke-width: 1.85;
    }

    .subnav,
    .employees-subnav,
    .accounting-subnav,
    .stock-subnav,
    .material-subnav,
    .payroll-subnav {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 6px;
        max-width: 100%;
        margin: 0 0 18px;
        padding: 0 0 8px;
        overflow-x: auto;
        overflow-y: hidden;
        border-bottom: 1px solid rgba(216, 226, 239, 0.92);
        background: transparent;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    .subnav a,
    .employees-subnav a,
    .accounting-subnav a,
    .stock-subnav a,
    .material-subnav a,
    .payroll-subnav a {
        flex: 0 0 auto;
        min-height: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0 12px;
        border: 1px solid #e2e8f0 !important;
        border-bottom: 2px solid transparent !important;
        border-radius: var(--radius-inner) !important;
        background: #f1f5f9 !important;
        box-shadow: none !important;
        color: #475569;
        font-weight: 760;
        line-height: 1;
        white-space: nowrap;
    }

    .subnav a:hover,
    .employees-subnav a:hover,
    .accounting-subnav a:hover,
    .stock-subnav a:hover,
    .material-subnav a:hover,
    .payroll-subnav a:hover {
        border-color: #dbe6f3 !important;
        border-bottom-color: var(--primary) !important;
        background: #f8fbff !important;
        color: var(--primary-strong) !important;
    }

    .subnav a.active,
    .employees-subnav a.active,
    .accounting-subnav a.active,
    .stock-subnav a.active,
    .material-subnav a.active,
    .payroll-subnav a.active {
        border-color: var(--primary) !important;
        border-bottom-color: var(--primary) !important;
        background: var(--primary) !important;
        color: #ffffff !important;
    }

    .doc-action-card:hover,
    .stat-card:hover,
    tbody tr:hover {
        border-color: rgba(37, 99, 235, 0.22) !important;
    }

    tbody tr:hover {
        background: rgba(37, 99, 235, 0.035) !important;
    }

    .line-chart span {
        background: linear-gradient(180deg, var(--primary), var(--blue));
        box-shadow: 0 10px 20px rgba(37, 99, 235, 0.16);
    }

    .donut,
    .status-donut,
    .sales-donut {
        border-radius: 999px !important;
        background:
            radial-gradient(circle at center, #ffffff 0 34%, transparent 35%),
            conic-gradient(var(--primary) 0 28%, #8fc6f1 28% 62%, #d9efff 62% 82%, #edf3fa 82% 100%) !important;
    }

    .legend-red {
        background: var(--primary) !important;
    }

    .mobile-menu-toggle,
    .mobile-drawer-backdrop {
        display: none;
    }
}

@media screen and (max-width: 760px) {
    body {
        display: block;
        padding: 0;
        overflow-x: hidden;
    }

    .mobile-bar {
        position: sticky;
        top: 0;
        z-index: 65;
        display: grid !important;
        grid-template-columns: 42px minmax(0, 1fr) auto;
        align-items: center;
        gap: 10px;
        width: 100%;
        min-height: 64px;
        padding: 10px 14px;
        border-bottom: 1px solid rgba(216, 226, 239, 0.9);
        background: rgba(248, 251, 255, 0.94);
        backdrop-filter: blur(18px);
        box-shadow: 0 10px 24px rgba(30, 41, 59, 0.06);
    }

    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border: 1px solid rgba(216, 226, 239, 0.95);
        border-radius: 10px;
        background: #ffffff;
        color: var(--text);
        box-shadow: none;
    }

    .mobile-menu-toggle svg {
        width: 21px;
        height: 21px;
    }

    .compact-brand {
        min-width: 0;
        gap: 8px;
    }

    .compact-brand span:last-child {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-action {
        min-height: 40px;
        padding: 0 12px;
        border-radius: 10px;
        font-size: 13px;
    }

    .sidebar {
        position: fixed !important;
        inset: 0 auto 0 0 !important;
        z-index: 80 !important;
        width: min(84vw, 330px) !important;
        height: 100dvh !important;
        min-height: 100dvh !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
        padding: 18px 14px !important;
        border-radius: 0 18px 18px 0 !important;
        border: 0 !important;
        border-right: 1px solid rgba(216, 226, 239, 0.94) !important;
        background: rgba(255, 255, 255, 0.96) !important;
        box-shadow: 24px 0 54px rgba(15, 23, 42, 0.16) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        transform: translateX(-105%);
        transition: transform 0.22s ease;
    }

    body.mobile-menu-open .sidebar {
        transform: translateX(0);
    }

    .sidebar > .brand,
    .sidebar-footer {
        display: flex !important;
    }

    .sidebar nav,
    .main-nav {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 4px !important;
        overflow: visible !important;
        padding: 0 !important;
    }

    .sidebar nav a,
    .main-nav a {
        width: auto !important;
        min-width: 0 !important;
        height: auto !important;
        min-height: 44px !important;
        flex: initial !important;
        justify-content: flex-start !important;
        padding: 0 12px !important;
    }

    .sidebar nav a span:last-child,
    .main-nav a span:last-child {
        display: inline !important;
    }

    .mobile-drawer-backdrop {
        position: fixed;
        inset: 0;
        z-index: 70;
        display: block;
        background: rgba(15, 23, 42, 0.34);
        opacity: 0;
        pointer-events: none;
        backdrop-filter: blur(2px);
        transition: opacity 0.18s ease;
    }

    body.mobile-menu-open .mobile-drawer-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .main {
        width: 100%;
        min-width: 0;
        padding: 16px 12px 28px !important;
    }

    .topbar {
        gap: 12px;
        margin-top: 0;
    }

    .top-actions {
        width: 100%;
        display: grid;
        grid-template-columns: minmax(0, 1fr) 40px 40px 44px;
        gap: 8px;
        align-items: center;
    }

    .company-badge {
        min-width: 0;
    }

    .search-pill {
        grid-column: 1 / -1;
        order: 2;
        width: 100%;
    }

    .subnav,
    .employees-subnav,
    .accounting-subnav,
    .stock-subnav,
    .material-subnav,
    .payroll-subnav {
        margin-left: -12px;
        margin-right: -12px;
        padding: 0 12px 8px;
    }
}

@media screen {
    .accounting-action-grid .doc-action-card {
        border-radius: var(--radius);
        box-shadow: inset 0 0 0 1px rgba(215, 225, 236, 0.82), 0 10px 24px rgba(84, 103, 130, 0.06);
    }

    .accounting-line {
        grid-template-columns: minmax(220px, 1.2fr) minmax(180px, 0.9fr) minmax(180px, 1fr) repeat(2, minmax(120px, 0.55fr)) minmax(140px, 0.7fr) auto auto;
        align-items: end;
        box-shadow: none !important;
    }

    .accounting-split > .panel .panel-header,
    .accounting-side-stack .panel-header {
        border-bottom: 1px solid rgba(215, 225, 236, 0.72);
        padding-bottom: 12px;
    }

    @media (max-width: 1280px) {
        .accounting-line {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }
    }

    @media (max-width: 760px) {
        .accounting-line {
            grid-template-columns: 1fr;
        }
    }
}

/* Final design system pass: calmer ERP shell, blue accent, drawer mobile menu. */
@media screen {
    :root {
        --primary: #2563eb;
        --primary-strong: #1d4ed8;
        --accent: #2563eb;
        --primary-soft: #dbeafe;
        --blue: #60a5fa;
        --blue-soft: #eff6ff;
        --app-bg: #eef4fb;
        --bg: #f6f9fd;
        --surface: rgba(255, 255, 255, 0.9);
        --surface-strong: #ffffff;
        --line: #d8e2ef;
        --line-strong: #c8d6e6;
        --text: #172033;
        --muted: #64748b;
        --radius: 12px;
        --radius-inner: 8px;
        --shadow-shell: 0 18px 48px rgba(30, 41, 59, 0.08);
        --shadow-card: 0 10px 26px rgba(30, 41, 59, 0.07);
    }

    body {
        background:
            radial-gradient(circle at 86% 12%, rgba(96, 165, 250, 0.14), transparent 28%),
            linear-gradient(135deg, #f8fbff 0%, #eef4fb 46%, #f6f9fd 100%);
    }

    a {
        color: var(--primary-strong);
    }

    .main {
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(246, 249, 253, 0.96));
    }

    .panel,
    .doc-action-card,
    .stat-card,
    .modern-card,
    .glass-card,
    .document-preview-shell,
    .accounting-action-grid .doc-action-card {
        border-color: rgba(216, 226, 239, 0.88) !important;
        box-shadow: var(--shadow-card) !important;
    }

    .panel .panel,
    .panel .doc-action-card,
    .panel .modern-card,
    .panel .glass-card,
    .document-preview-shell .panel,
    .document-paper .panel,
    .table-shell .panel {
        box-shadow: none !important;
    }

    .button,
    button.button,
    .mobile-action {
        min-height: 40px;
        border-radius: var(--radius-inner);
        border-color: var(--primary);
        background: var(--primary);
        color: #ffffff;
        box-shadow: none;
        white-space: nowrap;
    }

    .button:hover,
    button.button:hover,
    .mobile-action:hover {
        border-color: var(--primary-strong);
        background: var(--primary-strong);
        color: #ffffff;
    }

    .button.secondary,
    .button.ghost,
    a.button.secondary,
    a.button.ghost {
        border-color: var(--line);
        background: #ffffff;
        color: var(--text);
    }

    .button.secondary:hover,
    .button.ghost:hover,
    a.button.secondary:hover,
    a.button.ghost:hover {
        border-color: rgba(37, 99, 235, 0.38);
        background: #f8fbff;
        color: var(--primary-strong);
    }

    .button.danger,
    button.danger,
    .danger {
        border-color: #dc2626;
        background: #dc2626;
        color: #ffffff;
    }

    .sidebar {
        background: rgba(255, 255, 255, 0.72);
        border-color: rgba(216, 226, 239, 0.9);
        box-shadow: none;
    }

    .sidebar nav,
    .main-nav {
        gap: 4px;
    }

    .sidebar nav a,
    .main-nav a {
        min-height: 44px;
        border: 1px solid transparent !important;
        border-radius: 10px !important;
        background: transparent !important;
        box-shadow: none !important;
        color: #334155;
        font-weight: 760;
        letter-spacing: 0;
    }

    .sidebar nav a:hover,
    .main-nav a:hover {
        border-color: rgba(37, 99, 235, 0.14) !important;
        background: rgba(239, 246, 255, 0.72) !important;
        color: var(--primary-strong) !important;
    }

    .sidebar nav a.active,
    .main-nav a.active {
        border-color: var(--primary) !important;
        background: var(--primary) !important;
        color: #ffffff !important;
    }

    .nav-icon {
        width: 24px !important;
        height: 24px !important;
        min-width: 24px !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        color: currentColor !important;
    }

    .sidebar nav a.active .nav-icon,
    .main-nav a.active .nav-icon,
    .sidebar nav a:hover .nav-icon,
    .main-nav a:hover .nav-icon {
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        color: currentColor !important;
    }

    .nav-icon svg {
        width: 20px !important;
        height: 20px !important;
        stroke-width: 1.85;
    }

    .subnav,
    .employees-subnav,
    .accounting-subnav,
    .stock-subnav,
    .material-subnav,
    .payroll-subnav {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 6px;
        max-width: 100%;
        margin: 0 0 18px;
        padding: 0 0 8px;
        overflow-x: auto;
        overflow-y: hidden;
        border-bottom: 1px solid rgba(216, 226, 239, 0.92);
        background: transparent;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    .subnav::-webkit-scrollbar,
    .employees-subnav::-webkit-scrollbar,
    .accounting-subnav::-webkit-scrollbar,
    .stock-subnav::-webkit-scrollbar,
    .material-subnav::-webkit-scrollbar,
    .payroll-subnav::-webkit-scrollbar {
        height: 6px;
    }

    .subnav::-webkit-scrollbar-thumb,
    .employees-subnav::-webkit-scrollbar-thumb,
    .accounting-subnav::-webkit-scrollbar-thumb,
    .stock-subnav::-webkit-scrollbar-thumb,
    .material-subnav::-webkit-scrollbar-thumb,
    .payroll-subnav::-webkit-scrollbar-thumb {
        border-radius: 999px;
        background: rgba(148, 163, 184, 0.5);
    }

    .subnav a,
    .employees-subnav a,
    .accounting-subnav a,
    .stock-subnav a,
    .material-subnav a,
    .payroll-subnav a {
        flex: 0 0 auto;
        min-height: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0 12px;
        border: 1px solid #e2e8f0 !important;
        border-bottom: 2px solid transparent !important;
        border-radius: var(--radius-inner) !important;
        background: #f1f5f9 !important;
        box-shadow: none !important;
        color: #475569;
        font-weight: 760;
        line-height: 1;
        white-space: nowrap;
    }

    .subnav a:hover,
    .employees-subnav a:hover,
    .accounting-subnav a:hover,
    .stock-subnav a:hover,
    .material-subnav a:hover,
    .payroll-subnav a:hover {
        border-color: #dbe6f3 !important;
        border-bottom-color: var(--primary) !important;
        background: #f8fbff !important;
        color: var(--primary-strong) !important;
    }

    .subnav a.active,
    .employees-subnav a.active,
    .accounting-subnav a.active,
    .stock-subnav a.active,
    .material-subnav a.active,
    .payroll-subnav a.active {
        border-color: var(--primary) !important;
        border-bottom-color: var(--primary) !important;
        background: var(--primary) !important;
        color: #ffffff !important;
    }

    .doc-action-card:hover,
    .stat-card:hover,
    tbody tr:hover {
        border-color: rgba(37, 99, 235, 0.22) !important;
    }

    tbody tr:hover {
        background: rgba(37, 99, 235, 0.035) !important;
    }

    .line-chart span {
        background: linear-gradient(180deg, var(--primary), var(--blue));
        box-shadow: 0 10px 20px rgba(37, 99, 235, 0.16);
    }

    .donut,
    .status-donut,
    .sales-donut {
        border-radius: 999px !important;
        background:
            radial-gradient(circle at center, #ffffff 0 34%, transparent 35%),
            conic-gradient(var(--primary) 0 28%, #8fc6f1 28% 62%, #d9efff 62% 82%, #edf3fa 82% 100%) !important;
    }

    .legend-red {
        background: var(--primary) !important;
    }

    .mobile-menu-toggle,
    .mobile-drawer-backdrop {
        display: none;
    }
}

@media screen and (max-width: 760px) {
    body {
        display: block;
        padding: 0;
        overflow-x: hidden;
    }

    .mobile-bar {
        position: sticky;
        top: 0;
        z-index: 65;
        display: grid !important;
        grid-template-columns: 42px minmax(0, 1fr) auto;
        align-items: center;
        gap: 10px;
        width: 100%;
        min-height: 64px;
        padding: 10px 14px;
        border-bottom: 1px solid rgba(216, 226, 239, 0.9);
        background: rgba(248, 251, 255, 0.94);
        backdrop-filter: blur(18px);
        box-shadow: 0 10px 24px rgba(30, 41, 59, 0.06);
    }

    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border: 1px solid rgba(216, 226, 239, 0.95);
        border-radius: 10px;
        background: #ffffff;
        color: var(--text);
        box-shadow: none;
    }

    .mobile-menu-toggle svg {
        width: 21px;
        height: 21px;
    }

    .compact-brand {
        min-width: 0;
        gap: 8px;
    }

    .compact-brand span:last-child {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-action {
        min-height: 40px;
        padding: 0 12px;
        border-radius: 10px;
        font-size: 13px;
    }

    .sidebar {
        position: fixed !important;
        inset: 0 auto 0 0 !important;
        z-index: 80 !important;
        width: min(84vw, 330px) !important;
        height: 100dvh !important;
        min-height: 100dvh !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
        padding: 18px 14px !important;
        border-radius: 0 18px 18px 0 !important;
        border: 0 !important;
        border-right: 1px solid rgba(216, 226, 239, 0.94) !important;
        background: rgba(255, 255, 255, 0.96) !important;
        box-shadow: 24px 0 54px rgba(15, 23, 42, 0.16) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        transform: translateX(-105%);
        transition: transform 0.22s ease;
    }

    body.mobile-menu-open .sidebar {
        transform: translateX(0);
    }

    .sidebar > .brand,
    .sidebar-footer {
        display: flex !important;
    }

    .sidebar nav,
    .main-nav {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 4px !important;
        overflow: visible !important;
        padding: 0 !important;
    }

    .sidebar nav a,
    .main-nav a {
        width: auto !important;
        min-width: 0 !important;
        height: auto !important;
        min-height: 44px !important;
        flex: initial !important;
        justify-content: flex-start !important;
        padding: 0 12px !important;
    }

    .sidebar nav a span:last-child,
    .main-nav a span:last-child {
        display: inline !important;
    }

    .mobile-drawer-backdrop {
        position: fixed;
        inset: 0;
        z-index: 70;
        display: block;
        background: rgba(15, 23, 42, 0.34);
        opacity: 0;
        pointer-events: none;
        backdrop-filter: blur(2px);
        transition: opacity 0.18s ease;
    }

    body.mobile-menu-open .mobile-drawer-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .main {
        width: 100%;
        min-width: 0;
        padding: 16px 12px 28px !important;
    }

    .topbar {
        gap: 12px;
        margin-top: 0;
    }

    .top-actions {
        width: 100%;
        display: grid;
        grid-template-columns: minmax(0, 1fr) 40px 40px 44px;
        gap: 8px;
        align-items: center;
    }

    .company-badge {
        min-width: 0;
    }

    .search-pill {
        grid-column: 1 / -1;
        order: 2;
        width: 100%;
    }

    .subnav,
    .employees-subnav,
    .accounting-subnav,
    .stock-subnav,
    .material-subnav,
    .payroll-subnav {
        margin-left: -12px;
        margin-right: -12px;
        padding: 0 12px 8px;
    }
}

@media screen {
    .payroll-action-grid {
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 14px;
        margin-bottom: 18px;
    }

    .payroll-metrics {
        margin-bottom: 18px;
    }

    .payroll-toolbar {
        align-items: end;
        gap: 12px;
    }

    .payroll-toolbar label {
        flex: 1 1 150px;
        min-width: 140px;
    }

    .payroll-table-wrap table {
        min-width: 1280px;
    }

    .payroll-line-table table {
        min-width: 1780px;
    }

    .payroll-form-panel,
    .payroll-annual-panel {
        max-width: none;
    }

    .payroll-form-section,
    .payroll-form-section p {
        margin: 0;
    }

    .payroll-form-section {
        padding-bottom: 8px;
        border-bottom: 1px solid rgba(215, 225, 236, 0.78);
    }

    .payroll-check-row {
        grid-column: 1 / -1;
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        padding: 10px 0;
    }

    .payroll-preview .panel-header,
    .payroll-guidance .panel-header {
        border-bottom: 1px solid rgba(215, 225, 236, 0.78);
        padding-bottom: 14px;
    }

    .payroll-preview-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
        justify-content: flex-end;
    }

    .payroll-preview-actions form,
    .actions form {
        margin: 0;
        display: inline-flex;
    }

    .payroll-summary-grid,
    .payroll-note-grid {
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 10px;
        margin-top: 16px;
    }

    .payroll-note-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .payroll-summary-grid article,
    .payroll-note-grid article {
        min-height: 78px;
        padding: 13px;
        border: 1px solid rgba(215, 225, 236, 0.86);
        border-radius: var(--radius-inner);
        background: rgba(248, 251, 254, 0.72);
        box-shadow: none !important;
    }

    .payroll-summary-grid span,
    .payroll-note-grid span {
        color: var(--muted);
        font-size: 12px;
        font-weight: 760;
    }

    .payroll-summary-grid strong,
    .payroll-note-grid strong {
        display: block;
        color: var(--text);
        font-size: 16px;
        margin-top: 4px;
    }

    .table-input {
        width: 96px;
        min-height: 36px;
        padding: 6px 8px;
        border-radius: 8px;
        font-size: 13px;
        text-align: right;
    }

    .payroll-line-table td {
        vertical-align: top;
    }

    .payroll-mpin-editor {
        margin-top: 16px;
        border: 1px solid rgba(215, 225, 236, 0.86);
        border-radius: var(--radius-inner);
        background: rgba(248, 251, 254, 0.72);
        overflow: hidden;
    }

    .payroll-mpin-editor summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding: 14px 16px;
        cursor: pointer;
        list-style: none;
        border-bottom: 1px solid rgba(215, 225, 236, 0.78);
    }

    .payroll-mpin-editor summary::-webkit-details-marker {
        display: none;
    }

    .payroll-mpin-editor summary span {
        color: var(--text);
        font-weight: 860;
    }

    .payroll-mpin-editor summary small {
        color: var(--muted);
        font-size: 12px;
        text-align: right;
    }

    .payroll-mpin-cards {
        display: grid;
        gap: 12px;
        padding: 14px;
    }

    .payroll-mpin-card {
        border: 1px solid rgba(215, 225, 236, 0.86);
        border-radius: var(--radius-inner);
        background: #fff;
        padding: 14px;
        box-shadow: none !important;
    }

    .payroll-mpin-card-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 12px;
    }

    .payroll-mpin-card-head strong,
    .payroll-mpin-card-head span {
        display: block;
    }

    .payroll-mpin-card-head strong {
        color: var(--text);
        font-size: 15px;
    }

    .payroll-mpin-card-head span {
        color: var(--muted);
        font-size: 12px;
        font-weight: 760;
    }

    .payroll-mpin-fieldset {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 10px;
        padding-top: 10px;
        margin-top: 10px;
        border-top: 1px solid rgba(229, 236, 245, 0.92);
    }

    .payroll-mpin-fieldset:first-of-type {
        border-top: 0;
        padding-top: 0;
        margin-top: 0;
    }

    .payroll-mpin-fieldset label {
        min-width: 0;
    }

    .payroll-mpin-fieldset input {
        min-height: 38px;
        text-align: left;
    }

    .payroll-bottom-grid,
    .payroll-reports-grid {
        align-items: start;
    }

    .payroll-settings-form {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        align-items: end;
    }

    .payroll-field-picker {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        padding: 12px;
        border: 1px solid rgba(215, 225, 236, 0.82);
        border-radius: var(--radius-inner);
        background: rgba(248, 251, 254, 0.68);
        box-shadow: none !important;
    }

    .payroll-export-inline {
        margin-top: 12px;
    }

    .panel .payroll-summary-grid article,
    .panel .payroll-note-grid article,
    .panel .payroll-field-picker {
        box-shadow: none !important;
    }

    @media (max-width: 1280px) {
        .payroll-action-grid,
        .payroll-summary-grid {
            grid-template-columns: repeat(3, minmax(0, 1fr));
        }

        .payroll-settings-form {
            grid-template-columns: repeat(3, minmax(0, 1fr));
        }

        .payroll-field-picker {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .payroll-mpin-fieldset {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }
    }

    @media (max-width: 900px) {
        .payroll-action-grid,
        .payroll-summary-grid,
        .payroll-note-grid,
        .payroll-settings-form {
            grid-template-columns: 1fr;
        }

        .payroll-toolbar label,
        .payroll-toolbar .button {
            flex: 1 1 100%;
            min-width: 0;
        }

        .payroll-preview-actions,
        .payroll-preview-actions form,
        .payroll-preview-actions .button {
            width: 100%;
        }

        .payroll-mpin-editor summary,
        .payroll-mpin-card-head {
            align-items: flex-start;
            flex-direction: column;
        }

        .payroll-mpin-editor summary small {
            text-align: left;
        }
    }

    @media (max-width: 680px) {
        .payroll-field-picker,
        .payroll-mpin-fieldset {
            grid-template-columns: 1fr;
        }
    }
}

@media screen {
    .employees-subnav {
        margin-bottom: 18px;
    }

    .employees-action-grid {
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 12px;
        margin-bottom: 18px;
    }

    .employees-action-grid .doc-action-card {
        min-height: 104px;
        border-radius: var(--radius);
        box-shadow: inset 0 0 0 1px rgba(215, 225, 236, 0.82), 0 10px 24px rgba(84, 103, 130, 0.06);
    }

    .employees-metrics .metric strong,
    .employee-summary-grid .metric strong {
        font-size: clamp(22px, 1.8vw, 30px);
    }

    .employees-toolbar {
        align-items: end;
    }

    .employees-toolbar label:first-child {
        flex: 2 1 440px;
    }

    .employees-table-wrap table {
        min-width: 1220px;
    }

    .employees-table-wrap.compact-table table,
    .compact-table.employees-table-wrap table,
    .employee-profile-grid .compact-table table {
        min-width: 760px;
    }

    .employee-form-panel {
        max-width: none;
    }

    .employee-form-section {
        margin-top: 6px;
        padding-top: 12px;
        border-top: 1px solid rgba(215, 225, 236, 0.78);
    }

    .employee-form-section:first-child {
        margin-top: 0;
        padding-top: 0;
        border-top: 0;
    }

    .employee-form-section h2 {
        margin: 0;
        font-size: 18px;
        font-weight: 840;
        color: var(--text);
    }

    .employee-check-grid {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 10px;
    }

    .employee-check-grid .checkbox-label,
    .employee-inline-form .checkbox-label,
    .mini-form .checkbox-label {
        box-shadow: none !important;
    }

    .employee-hero {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr) auto;
        gap: 18px;
        align-items: center;
        margin-bottom: 18px;
    }

    .employee-hero h2 {
        margin: 10px 0 4px;
        font-size: clamp(24px, 2vw, 32px);
        line-height: 1.12;
    }

    .employee-hero p {
        margin: 0;
        color: var(--muted);
        font-weight: 680;
    }

    .employee-summary-grid {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 14px;
        margin-bottom: 18px;
    }

    .employee-profile-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px;
        align-items: start;
    }

    .employee-profile-grid .span-2 {
        grid-column: 1 / -1;
    }

    .employee-section-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 360px;
        gap: 18px;
        align-items: start;
        margin-bottom: 18px;
    }

    .employee-side-stack {
        display: grid;
        gap: 16px;
    }

    .employee-inline-form {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 10px;
        align-items: end;
        margin-top: 14px;
        padding-top: 14px;
        border-top: 1px solid rgba(215, 225, 236, 0.78);
        box-shadow: none !important;
    }

    .employee-inline-form .button {
        align-self: end;
    }

    .employee-mini-columns {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .employee-mini-columns .mini-form,
    .employee-side-stack .mini-form,
    .employee-section-grid aside .mini-form {
        padding: 12px;
        border: 1px solid rgba(215, 225, 236, 0.86);
        border-radius: var(--radius-inner);
        background: rgba(248, 251, 254, 0.62);
        box-shadow: none !important;
    }

    .employee-profile-grid .panel .table-wrap,
    .employee-section-grid .panel .table-wrap,
    .panel .employee-inline-form,
    .panel .employee-mini-columns .mini-form,
    .panel .employee-side-stack .mini-form,
    .panel .employee-section-grid aside .mini-form,
    .panel .compact-list > div {
        box-shadow: none !important;
    }

    .employee-profile-grid td small,
    .employees-table-wrap td small {
        display: block;
        margin-top: 3px;
        color: var(--muted);
        font-size: 12px;
        font-weight: 680;
    }

    @media (max-width: 1340px) {
        .employees-action-grid {
            grid-template-columns: repeat(3, minmax(0, 1fr));
        }

        .employee-inline-form {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }
    }

    @media (max-width: 1180px) {
        .employee-hero,
        .employee-profile-grid,
        .employee-section-grid {
            grid-template-columns: 1fr;
        }

        .employee-summary-grid,
        .employee-check-grid,
        .employee-mini-columns {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .employee-hero .hero-actions {
            justify-content: flex-start;
            flex-wrap: wrap;
        }
    }

    @media (max-width: 760px) {
        .employees-action-grid,
        .employee-summary-grid,
        .employee-check-grid,
        .employee-mini-columns,
        .employee-inline-form {
            grid-template-columns: 1fr;
        }

        .employees-toolbar {
            align-items: stretch;
        }

        .employees-toolbar label,
        .employees-toolbar label:first-child,
        .employees-toolbar .button,
        .employee-inline-form .button,
        .employee-section-grid aside .button,
        .employee-mini-columns .button {
            flex: 1 1 100%;
            min-width: 0;
            width: 100%;
        }

        .employee-hero .hero-actions,
        .employee-hero .hero-actions form,
        .employee-hero .hero-actions .button,
        .employee-hero .hero-actions button {
            width: 100%;
        }
    }
}

@media screen {
    .accounting-subnav {
        align-items: center;
        scrollbar-width: thin;
    }

    .accounting-action-grid {
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 12px;
        margin-bottom: 18px;
    }

    .accounting-action-grid .doc-action-card {
        min-height: 104px;
        align-content: center;
    }

    .accounting-toolbar {
        width: 100%;
        align-items: end;
        gap: 12px;
    }

    .accounting-toolbar label {
        flex: 1 1 180px;
        min-width: 160px;
    }

    .accounting-toolbar label:has(input[type="search"]) {
        flex: 2 1 320px;
    }

    .accounting-table-wrap table {
        min-width: 1180px;
    }

    .compact-accounting-table table {
        min-width: 820px;
    }

    .accounting-form-panel {
        max-width: none;
    }

    .accounting-form {
        align-items: end;
    }

    .accounting-lines {
        box-shadow: none !important;
    }

    .accounting-line {
        grid-template-columns: minmax(220px, 1.2fr) minmax(180px, 0.9fr) minmax(180px, 1fr) repeat(2, minmax(120px, 0.55fr)) minmax(140px, 0.7fr) auto auto;
        align-items: end;
        box-shadow: none !important;
    }

    .accounting-line .button {
        align-self: end;
    }

    .accounting-live-total,
    .accounting-totals {
        display: flex;
        justify-content: flex-end;
        gap: 10px;
        flex-wrap: wrap;
        margin-top: 14px;
        padding-top: 14px;
        border-top: 1px solid rgba(215, 225, 236, 0.78);
    }

    .accounting-live-total span,
    .accounting-totals span {
        min-height: 42px;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        border: 1px solid rgba(215, 225, 236, 0.86);
        border-radius: var(--radius-inner);
        padding: 0 12px;
        background: rgba(248, 251, 254, 0.72);
        color: var(--muted);
        font-size: 12px;
        font-weight: 820;
        text-transform: uppercase;
        box-shadow: none !important;
    }

    .accounting-live-total strong,
    .accounting-totals strong {
        color: var(--text);
        font-size: 15px;
        white-space: nowrap;
    }

    .accounting-preview .panel-header {
        border-bottom: 1px solid rgba(215, 225, 236, 0.78);
        padding-bottom: 14px;
    }

    .accounting-preview-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: flex-end;
        align-items: center;
    }

    .accounting-preview-actions form {
        margin: 0;
    }

    .accounting-doc-meta,
    .accounting-summary-grid {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 10px;
        margin: 0 0 14px;
    }

    .annual-summary-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .accounting-doc-meta article,
    .accounting-summary-grid article,
    .accounting-note {
        display: grid;
        gap: 4px;
        min-height: 82px;
        padding: 13px;
        border: 1px solid rgba(215, 225, 236, 0.86);
        border-radius: var(--radius-inner);
        background: rgba(255, 255, 255, 0.62);
        box-shadow: none !important;
    }

    .accounting-doc-meta span,
    .accounting-summary-grid span,
    .accounting-note span,
    .accounting-inline-form span {
        color: var(--muted);
        font-size: 12px;
        font-weight: 760;
        line-height: 1.4;
    }

    .accounting-doc-meta strong,
    .accounting-summary-grid strong,
    .accounting-note strong {
        color: var(--text);
        font-size: 16px;
        overflow-wrap: anywhere;
    }

    .accounting-split {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(340px, 0.38fr);
        gap: 16px;
        align-items: start;
    }

    .accounting-side-stack {
        display: grid;
        gap: 16px;
    }

    .compact-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .accounting-inline-form {
        display: flex;
        align-items: center;
        gap: 12px;
        flex-wrap: wrap;
        margin: 12px 0;
        padding: 12px;
        border: 1px solid rgba(215, 225, 236, 0.86);
        border-radius: var(--radius-inner);
        background: rgba(248, 251, 254, 0.62);
        box-shadow: none !important;
    }

    .accounting-lines-head {
        margin-top: 18px;
        padding-top: 14px;
        border-top: 1px solid rgba(215, 225, 236, 0.78);
    }

    .checkbox-label {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 0 10px;
        border: 1px solid rgba(215, 225, 236, 0.86);
        border-radius: var(--radius-inner);
        background: rgba(255, 255, 255, 0.62);
        box-shadow: none !important;
    }

    .checkbox-label input {
        width: 16px;
        height: 16px;
    }

    .panel .accounting-lines,
    .panel .accounting-line,
    .panel .accounting-doc-meta article,
    .panel .accounting-summary-grid article,
    .panel .accounting-note,
    .panel .accounting-inline-form {
        box-shadow: none !important;
    }

    @media (max-width: 1280px) {
        .accounting-action-grid {
            grid-template-columns: repeat(3, minmax(0, 1fr));
        }

        .accounting-line {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .accounting-line .button {
            grid-column: 1 / -1;
        }

        .accounting-split {
            grid-template-columns: 1fr;
        }

        .annual-summary-grid,
        .accounting-summary-grid,
        .accounting-doc-meta {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }
    }

    @media (max-width: 760px) {
        .accounting-action-grid,
        .accounting-line,
        .accounting-doc-meta,
        .accounting-summary-grid,
        .annual-summary-grid,
        .compact-form {
            grid-template-columns: 1fr;
        }

        .accounting-toolbar {
            align-items: stretch;
        }

        .accounting-toolbar label,
        .accounting-toolbar label:has(input[type="search"]),
        .accounting-toolbar .button,
        .accounting-preview-actions .button,
        .accounting-preview-actions form,
        .accounting-preview-actions button,
        .accounting-live-total span,
        .accounting-totals span {
            width: 100%;
            flex: 1 1 100%;
            min-width: 0;
        }

        .accounting-preview-actions,
        .accounting-live-total,
        .accounting-totals {
            justify-content: stretch;
        }
    }
}

@media screen {
    .subnav {
        width: 100%;
        display: flex;
        gap: 8px;
        align-items: center;
        margin: 0 0 18px;
        padding: 8px;
        border: 1px solid rgba(215, 225, 236, 0.86);
        border-radius: var(--radius);
        background: rgba(255, 255, 255, 0.56);
        overflow-x: auto;
    }

    .subnav a {
        min-height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0 14px;
        border-radius: var(--radius-inner);
        color: #4a5568;
        font-weight: 780;
        white-space: nowrap;
    }

    .subnav a.active,
    .subnav a:hover {
        background: #ffffff;
        color: #172033;
        box-shadow: inset 0 0 0 1px rgba(255, 19, 55, 0.22);
    }

    .crm-toolbar {
        width: 100%;
        align-items: end;
    }

    .crm-toolbar label:first-child {
        flex: 999 1 460px;
    }

    .crm-metrics .metric strong {
        font-size: clamp(22px, 1.8vw, 30px);
        word-break: keep-all;
    }

    .crm-table-wrap table {
        min-width: 1180px;
    }

    .crm-form {
        max-width: none;
    }

    .customer-hero {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr) auto;
        gap: 18px;
        align-items: center;
        margin-bottom: 18px;
    }

    .customer-hero h2 {
        margin: 10px 0 4px;
        font-size: clamp(24px, 2vw, 32px);
    }

    .customer-hero p {
        margin: 0;
        color: var(--muted);
        font-weight: 680;
    }

    .hero-actions {
        display: flex;
        gap: 8px;
        align-items: center;
        justify-content: flex-end;
    }

    .crm-360-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px;
        align-items: start;
    }

    .crm-360-grid .span-2 {
        grid-column: 1 / -1;
    }

    .detail-list {
        margin: 0;
        display: grid;
        gap: 10px;
    }

    .detail-list.compact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px 12px;
    }

    .detail-list div {
        display: grid;
        gap: 3px;
        padding: 10px 0;
        border-bottom: 1px solid rgba(215, 225, 236, 0.78);
    }

    .detail-list dt {
        color: var(--muted);
        font-size: 12px;
        font-weight: 780;
    }

    .detail-list dd {
        margin: 0;
        color: #172033;
        font-weight: 760;
    }

    .flat-note {
        margin-top: 14px;
        padding: 12px;
        border: 1px solid rgba(215, 225, 236, 0.86);
        border-radius: var(--radius-inner);
        background: rgba(248, 251, 254, 0.72);
        color: #475569;
        line-height: 1.5;
    }

    .compact-list {
        margin-bottom: 14px;
    }

    .compact-list > div {
        width: 100%;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 4px 10px;
        align-items: start;
        border: 1px solid rgba(215, 225, 236, 0.76);
        border-radius: var(--radius-inner) !important;
        background: rgba(250, 253, 255, 0.70);
        box-shadow: none !important;
    }

    .compact-list > div > strong,
    .compact-list > div > span,
    .compact-list > div > small {
        grid-column: 1;
        min-width: 0;
    }

    .compact-list > div > form {
        grid-column: 2;
        grid-row: 1 / span 3;
        align-self: center;
        margin: 0;
    }

    .inline-delete {
        min-height: 30px;
        border: 1px solid rgba(255, 19, 55, 0.20);
        border-radius: var(--radius-inner);
        padding: 0 10px;
        background: rgba(255, 19, 55, 0.08);
        color: var(--primary-strong);
        font: inherit;
        font-size: 12px;
        font-weight: 800;
        white-space: nowrap;
        cursor: pointer;
    }

    .mini-form {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        width: 100%;
    }

    .mini-form.stacked,
    .side-form {
        grid-template-columns: 1fr;
        align-content: start;
    }

    .mini-form h2 {
        margin: 0 0 4px;
        font-size: 18px;
    }

    .mini-form textarea,
    .mini-form button,
    .mini-form .check-line {
        grid-column: 1 / -1;
    }

    .form-two {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .split-inner {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 320px;
        gap: 16px;
        align-items: start;
    }

    .vip-layout {
        grid-template-columns: minmax(0, 1fr) 340px;
    }

    .payment-history {
        margin-top: 14px;
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }

    .payment-history span,
    .status-pill.good,
    .status-pill.muted-pill,
    .muted-pill {
        border-radius: 999px !important;
    }

    .payment-history span {
        min-height: 30px;
        display: inline-flex;
        align-items: center;
        padding: 0 10px;
        background: rgba(255, 255, 255, 0.72);
        border: 1px solid rgba(215, 225, 236, 0.86);
        color: #475569;
        font-size: 12px;
        font-weight: 760;
    }

    .timeline-list {
        display: grid;
        gap: 12px;
        margin-bottom: 14px;
    }

    .timeline-list div {
        position: relative;
        display: grid;
        gap: 4px;
        padding: 0 0 12px 22px;
        border-bottom: 1px solid rgba(215, 225, 236, 0.78);
    }

    .activity-dot {
        position: absolute;
        left: 0;
        top: 5px;
        width: 10px;
        height: 10px;
        border-radius: 999px;
        background: var(--primary);
    }

    .timeline-list p {
        margin: 4px 0 0;
        color: #475569;
        line-height: 1.45;
    }

    .region-grid {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 10px;
    }

    .region-grid div {
        display: grid;
        gap: 4px;
        padding: 12px;
        border: 1px solid rgba(215, 225, 236, 0.86);
        border-radius: var(--radius-inner);
        background: rgba(255, 255, 255, 0.62);
    }

    .mini-progress {
        width: 150px;
        max-width: 100%;
        height: 8px;
        display: block;
        margin-top: 6px;
        border-radius: 999px;
        background: #e8eef6;
        overflow: hidden;
    }

    .mini-progress i {
        display: block;
        height: 100%;
        border-radius: 999px;
        background: var(--primary);
    }

    .mono {
        font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
        font-weight: 760;
    }

    .danger-text {
        color: var(--primary-strong);
    }

    .muted,
    .empty-cell {
        color: var(--muted);
    }

    .empty-cell {
        padding: 18px 10px;
        text-align: center;
        font-weight: 720;
    }

    .status-pill.good {
        background: rgba(46, 200, 102, 0.12);
        color: #13723a;
    }

    .status-pill.muted-pill,
    .muted-pill {
        background: rgba(100, 112, 132, 0.12);
        color: #475569;
    }

    td small,
    .compact-list small {
        display: block;
        margin-top: 3px;
        color: var(--muted);
        font-size: 12px;
        font-weight: 620;
    }

    .button,
    button.button,
    a.button {
        white-space: nowrap;
    }

    @media (max-width: 1180px) {
        .customer-hero,
        .split-inner,
        .vip-layout,
        .crm-360-grid {
            grid-template-columns: 1fr;
        }

        .region-grid {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }
    }

    @media (max-width: 760px) {
        .subnav,
        .customer-hero,
        .hero-actions,
        .crm-toolbar {
            align-items: stretch;
        }

        .subnav {
            border-radius: 0;
            margin-left: -18px;
            margin-right: -18px;
            width: calc(100% + 36px);
        }

        .hero-actions,
        .form-two,
        .detail-list.compact,
        .mini-form,
        .region-grid {
            grid-template-columns: 1fr;
        }

        .hero-actions {
            display: grid;
        }
    }
}

@media screen {
    .stock-subnav {
        overflow-x: auto;
    }

    .stock-metrics .metric {
        min-height: 118px;
    }

    .stock-toolbar {
        align-items: end;
        gap: 12px;
    }

    .stock-toolbar label {
        flex: 1 1 210px;
        min-width: 180px;
    }

    .stock-toolbar label:nth-child(2) {
        flex: 2 1 360px;
    }

    .stock-toolbar .button {
        flex: 0 0 auto;
    }

    .stock-table-wrap table {
        min-width: 1180px;
    }

    .extended-stock-table table {
        min-width: 1600px;
    }

    .movement-card-table table,
    .count-lines-table table {
        min-width: 980px;
    }

    .lot-table-wrap table {
        min-width: 1160px;
    }

    .num {
        text-align: right;
        font-variant-numeric: tabular-nums;
    }

    td small,
    th small {
        display: block;
        margin-top: 4px;
        color: var(--muted);
        font-size: 12px;
        font-weight: 650;
        white-space: normal;
    }

    .status-pill.warning {
        background: #fff7d6;
        color: #8a5b00;
    }

    .status-pill.danger {
        background: #ffe4e9;
        color: var(--primary-strong);
    }

    .inline-critical-form {
        display: grid;
        grid-template-columns: repeat(3, minmax(78px, 1fr)) auto;
        gap: 7px;
        min-width: 360px;
    }

    .inline-critical-form input {
        min-height: 34px;
        border-radius: var(--radius-inner);
        padding: 7px 8px;
        font-size: 12px;
    }

    .inline-critical-form .button {
        min-height: 34px;
        padding: 0 11px;
    }

    .stock-card-summary {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 10px;
        margin: 0 0 14px;
    }

    .stock-card-summary article {
        display: grid;
        gap: 5px;
        min-height: 92px;
        border: 1px solid rgba(215, 225, 236, 0.86);
        border-radius: var(--radius-inner);
        background: rgba(255, 255, 255, 0.66);
        padding: 14px;
        box-shadow: none !important;
    }

    .stock-card-summary span {
        color: var(--muted);
        font-size: 12px;
        font-weight: 820;
        text-transform: uppercase;
    }

    .stock-card-summary strong {
        color: var(--text);
        font-size: 18px;
    }

    .stock-alert-panel .panel-header {
        border-bottom: 1px solid rgba(215, 225, 236, 0.78);
        margin-bottom: 14px;
        padding-bottom: 14px;
    }

    .stock-lot-layout {
        grid-template-columns: minmax(0, 1fr) 360px;
        align-items: start;
    }

    .stock-lot-form textarea {
        min-height: 86px;
    }

    .stock-count-layout {
        display: grid;
        grid-template-columns: 360px minmax(0, 1fr);
        gap: 18px;
        align-items: start;
    }

    .count-list {
        display: grid;
        gap: 9px;
        margin-top: 16px;
    }

    .count-list a {
        display: grid;
        gap: 4px;
        border: 1px solid rgba(215, 225, 236, 0.86);
        border-radius: var(--radius-inner);
        background: rgba(255, 255, 255, 0.66);
        padding: 12px;
        color: var(--text);
        text-decoration: none;
        box-shadow: none !important;
    }

    .count-list a.active,
    .count-list a:hover {
        border-color: rgba(255, 19, 55, 0.34);
        background: rgba(255, 255, 255, 0.9);
    }

    .count-list span {
        color: #4b5567;
        font-size: 13px;
        font-weight: 760;
    }

    .count-list em {
        justify-self: start;
        font-style: normal;
        margin-top: 4px;
    }

    .count-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: flex-end;
    }

    .count-actions form {
        margin: 0;
    }

    .count-line-form {
        display: grid;
        grid-template-columns: minmax(210px, 1.5fr) minmax(180px, 1fr) minmax(120px, 0.7fr) minmax(160px, 1fr) auto;
        gap: 10px;
        align-items: end;
        border: 1px solid rgba(215, 225, 236, 0.82);
        border-radius: var(--radius-inner);
        background: rgba(248, 251, 254, 0.62);
        padding: 12px;
        margin-bottom: 14px;
        box-shadow: none !important;
    }

    .panel .stock-card-summary article,
    .panel .count-list a,
    .panel .count-line-form {
        box-shadow: none !important;
    }

    @media (max-width: 1180px) {
        .stock-lot-layout,
        .stock-count-layout {
            grid-template-columns: 1fr;
        }

        .stock-card-summary {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .count-line-form {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .count-line-form .button {
            grid-column: 1 / -1;
        }
    }

    @media (max-width: 760px) {
        .stock-toolbar {
            align-items: stretch;
        }

        .stock-toolbar label,
        .stock-toolbar label:nth-child(2),
        .stock-toolbar .button {
            flex: 1 1 100%;
            min-width: 0;
        }

        .stock-card-summary,
        .count-line-form {
            grid-template-columns: 1fr;
        }

        .inline-critical-form {
            grid-template-columns: 1fr;
            min-width: 0;
        }

        .count-actions {
            justify-content: stretch;
        }

        .count-actions .button,
        .count-actions form {
            width: 100%;
        }
    }
}

* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    display: grid;
    grid-template-columns: 280px 1fr;
}

a { color: inherit; text-decoration: none; }
.sidebar {
    background: #0b1220;
    color: white;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    background: var(--primary);
    display: grid;
    place-items: center;
    font-weight: 800;
}
.brand small, .sidebar-footer, .operator span, .eyebrow, .hint, small { color: var(--muted); }
.sidebar nav {
    display: grid;
    gap: 5px;
    overflow-y: auto;
    padding-right: 2px;
}
.sidebar nav a {
    color: #cbd5e1;
    padding: 9px 10px;
    border-radius: var(--radius);
    font-size: 14px;
}
.sidebar nav a.active, .sidebar nav a:hover { background: #1e293b; color: #ffffff; }
.sidebar-footer { margin-top: auto; display: flex; align-items: center; gap: 8px; color: #cbd5e1; }
.pulse, .device-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--good);
    display: inline-block;
}

.main { padding: 28px; min-width: 0; }
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}
.eyebrow { margin: 0 0 4px; text-transform: uppercase; letter-spacing: 0; font-size: 12px; font-weight: 700; }
h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 30px; }
h2 { font-size: 18px; }
.operator {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 12px;
    display: grid;
    gap: 2px;
    min-width: 150px;
}

.company-badge {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 999px;
    padding: 6px 14px 6px 7px;
    background: rgba(255, 255, 255, 0.6);
    box-shadow: inset 0 0 0 1px rgba(8, 10, 20, 0.06);
    font-weight: 850;
}

.company-badge img,
.company-badge span,
.user-menu summary img,
.user-menu summary span {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    object-fit: cover;
    display: grid;
    place-items: center;
    background: #ffffff;
    color: var(--primary);
    font-weight: 950;
}

.user-menu {
    position: relative;
}

.user-menu summary {
    list-style: none;
    cursor: pointer;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.62);
    box-shadow: inset 0 0 0 1px rgba(8, 10, 20, 0.06);
}

.user-menu summary::-webkit-details-marker {
    display: none;
}

.user-menu > div {
    position: absolute;
    right: 0;
    top: 58px;
    z-index: 30;
    width: 250px;
    display: grid;
    gap: 8px;
    padding: 14px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 24px 60px rgba(57, 72, 95, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.78);
}

.user-menu a,
.user-menu button {
    min-height: 38px;
    border: 0;
    border-radius: 999px;
    padding: 9px 12px;
    background: rgba(238, 244, 251, 0.88);
    color: var(--text);
    text-align: left;
    font: inherit;
    font-weight: 780;
    cursor: pointer;
}

.user-menu form {
    margin: 0;
}

.user-menu button {
    width: 100%;
    background: rgba(255, 19, 55, 0.10);
    color: var(--primary-strong);
}

.admin-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.settings-preview {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.settings-preview article {
    min-height: 124px;
    display: grid;
    place-items: center;
    gap: 8px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.62);
    box-shadow: inset 0 0 0 1px rgba(8, 10, 20, 0.06);
}

.settings-preview img,
.settings-preview strong {
    width: 76px;
    height: 76px;
    display: grid;
    place-items: center;
    border-radius: 24px;
    object-fit: contain;
    background: #ffffff;
    color: var(--primary);
    font-size: 34px;
    box-shadow: 0 14px 28px rgba(84, 103, 130, 0.12);
}

.settings-legal-card {
    display: grid;
    gap: 16px;
    padding: 18px;
    border: 1px solid rgba(205, 216, 232, 0.86);
    border-radius: var(--radius);
    background: rgba(247, 250, 253, 0.76);
}

.settings-legal-card .panel-header {
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.settings-readonly-grid input:disabled {
    color: #61708a;
    background: #eef3f9;
    border-color: rgba(201, 213, 229, 0.84);
    cursor: not-allowed;
}

.settings-form-section {
    padding-top: 4px;
}

.settings-form-section h2 {
    margin: 0;
    font-size: 19px;
}

.auth-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    grid-template-columns: 1fr;
    padding: 22px;
}

.auth-card {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 18px;
    padding: 18px;
    border-radius: 34px;
    background: rgba(255, 255, 255, 0.62);
    box-shadow: 0 28px 80px rgba(84, 103, 130, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.74);
}

.compact-auth {
    grid-template-columns: 1fr 1fr;
    max-width: 820px;
}

.auth-intro,
.auth-form {
    border-radius: 28px;
    padding: clamp(24px, 4vw, 46px);
}

.auth-intro {
    background: linear-gradient(135deg, #ffffff, #e8f5ff);
}

.auth-intro h1 {
    margin: 18px 0 12px;
    font-size: clamp(34px, 5vw, 58px);
    line-height: 0.98;
}

.auth-intro p {
    color: var(--muted);
    max-width: 520px;
}

.auth-form {
    display: grid;
    align-content: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.72);
}

.auth-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
}

.auth-chips span,
.auth-link {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    padding: 8px 12px;
    font-weight: 820;
    color: var(--text);
}

.auth-link {
    text-align: center;
}

.auth-legal-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 12px;
    padding-top: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.auth-legal-links a {
    color: var(--muted);
    text-decoration: none;
}

.auth-legal-links a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.metric, .panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
}
.metric { padding: 18px; display: grid; gap: 8px; }
.metric span { color: var(--muted); font-size: 13px; }
.metric strong { font-size: 26px; }
.metric.warning strong { color: var(--warn); }
.split { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 18px; }
.panel { padding: 18px; }
.panel-header, .toolbar, .scan-form {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
}
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0; }
.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #ffe4e9;
    color: var(--primary-strong);
    font-size: 12px;
    font-weight: 700;
}
.button {
    border: 0;
    border-radius: var(--radius);
    background: var(--primary);
    color: white;
    padding: 10px 14px;
    font-weight: 800;
    cursor: pointer;
}
.button.secondary { background: #e2e8f0; color: var(--text); }
.button.danger { background: #991b1b; }
.actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.actions form { margin: 0; }
.subtle {
    color: var(--muted);
    margin: 6px 0 0;
    max-width: 850px;
}
.form-panel { max-width: 980px; }
.form-panel.wide-form { max-width: 1180px; }
.entity-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.entity-form .wide, .form-actions { grid-column: 1 / -1; }
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.check-line {
    grid-template-columns: 20px 1fr;
    align-items: center;
    min-height: 42px;
    color: var(--text);
}
.check-line input {
    min-height: auto;
    width: 18px;
    height: 18px;
}
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; width: 100%; }
input, select, textarea {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    min-height: 42px;
    padding: 9px 11px;
    font: inherit;
    color: var(--text);
    background: white;
}
.device-list { display: grid; gap: 12px; }
.device-row { display: flex; gap: 10px; align-items: center; }
.device-row div { display: grid; gap: 2px; }
.device-dot.offline { background: var(--accent); }

.pos-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.scan-form .qty { max-width: 130px; }
.cart { display: grid; gap: 10px; min-height: 360px; align-content: start; }
.cart-row {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.cart-row button {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: var(--radius);
    background: #fee2e2;
    color: #991b1b;
    font-size: 18px;
    cursor: pointer;
}
.empty { color: var(--muted); text-align: center; padding: 80px 0; }
.checkout { position: sticky; top: 24px; display: grid; gap: 16px; }
.grand-total { font-size: 34px; }
.segmented {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.segmented button {
    border: 0;
    min-height: 42px;
    background: #ffffff;
    cursor: pointer;
    font-weight: 700;
}
.segmented button.active { background: var(--surface-strong); color: white; }
.charge { min-height: 52px; font-size: 16px; }
.docs-panel { margin-top: 18px; display: grid; gap: 10px; }
.docs-panel code {
    display: block;
    background: #111827;
    color: #e5e7eb;
    border-radius: var(--radius);
    padding: 10px 12px;
    overflow-x: auto;
}
.blueprint-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 18px;
    align-items: stretch;
    margin-bottom: 18px;
}
.blueprint-hero > div {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
}
.blueprint-hero h2 { font-size: 24px; margin-bottom: 10px; }
.blueprint-hero p { color: var(--muted); max-width: 850px; }
.blueprint-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
.blueprint-stats span {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
    color: var(--muted);
}
.blueprint-stats span:last-child { border-bottom: 0; padding-bottom: 0; }
.blueprint-stats strong { color: var(--text); font-size: 30px; }
.blueprint-section { margin-bottom: 18px; }
.module-hero {
    margin-bottom: 18px;
}
.module-hero p {
    color: var(--muted);
    margin-bottom: 0;
}
.action-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}
.principles-grid, .inspiration-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.principle-card, .inspiration-grid article {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    background: #fbfcfe;
}
.inspiration-grid p, .module-purpose, .roadmap p { color: var(--muted); }
.blueprint-modules {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}
.module-card {
    display: grid;
    gap: 12px;
    align-content: start;
}
.module-card-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: start;
}
.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 800;
    background: #e2e8f0;
    color: #334155;
    white-space: nowrap;
}

.windows-agent-settings-box {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid rgba(215, 225, 236, 0.86);
    border-radius: var(--radius-inner);
    background: rgba(248, 251, 254, 0.72);
}

.windows-agent-settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.windows-agent-settings-actions select {
    flex: 1 1 320px;
    min-width: 220px;
}

.settings-bank-panel {
    margin-top: 18px;
}

.settings-bank-table {
    margin-bottom: 16px;
}

.settings-bank-table .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.settings-bank-table .actions form {
    margin: 0;
}

.settings-bank-form {
    padding-top: 14px;
    border-top: 1px solid rgba(215, 225, 236, 0.78);
    align-items: end;
}

.pill-button {
    border-radius: 999px;
}

.brand-mark-image {
    overflow: hidden;
    background: #ffffff;
}

.brand-mark-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.settings-domain-card,
.settings-domain-panel {
    display: grid;
    gap: 16px;
}

.settings-domain-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.settings-domain-summary article,
.settings-domain-row {
    border: 1px solid rgba(211, 222, 237, 0.86);
    border-radius: var(--radius);
    background: rgba(248, 251, 255, 0.82);
}

.settings-domain-summary article {
    padding: 14px;
}

.settings-domain-summary span,
.settings-domain-dns span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.settings-domain-summary strong {
    display: block;
    margin-top: 4px;
    color: var(--text);
    font-size: 22px;
}

.settings-domain-list {
    display: grid;
    gap: 14px;
}

.settings-domain-row {
    display: grid;
    gap: 14px;
    padding: 16px;
}

.settings-domain-main,
.settings-domain-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.settings-domain-main h3 {
    margin: 0 0 4px;
    font-size: 22px;
}

.settings-domain-dns {
    display: grid;
    gap: 10px;
}

.settings-domain-dns div {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
}

.settings-domain-dns code {
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(203, 215, 230, 0.86);
    background: #ffffff;
    color: #1f2a44;
    word-break: break-all;
}

.settings-domain-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
}

.settings-domain-actions form {
    margin: 0;
}

[data-windows-agent-status][data-state="ok"],
.einvoice-windows-agent-status[data-state="ok"] {
    color: #0f8f70;
    font-weight: 800;
}

[data-windows-agent-status][data-state="error"],
.einvoice-windows-agent-status[data-state="error"] {
    color: #d12f5c;
    font-weight: 800;
}

[data-windows-agent-status][data-state="pending"],
.einvoice-windows-agent-status[data-state="pending"] {
    color: var(--primary-strong);
    font-weight: 800;
}
.status-pill.started, .status-pill.in_progress { background: #ffe4e9; color: var(--primary-strong); }
.module-card details {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 12px;
}
.module-card summary {
    cursor: pointer;
    font-weight: 800;
}
.feature-list {
    margin: 12px 0 0;
    padding-left: 18px;
    color: var(--text);
}
.feature-list li { margin-bottom: 8px; }
.entity-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.entity-row code {
    background: #eef2f7;
    border-radius: 999px;
    padding: 4px 8px;
    color: #334155;
}
.roadmap {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
}
.roadmap article {
    border-left: 3px solid var(--primary);
    background: #fbfcfe;
    padding: 12px;
    border-radius: var(--radius);
}
.roadmap strong {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: var(--primary);
    color: white;
}
.roadmap h3 {
    margin: 10px 0 6px;
    font-size: 15px;
}
.backlog-list {
    display: grid;
    gap: 10px;
}
.backlog-list article {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    background: #fbfcfe;
}
.backlog-list small {
    display: block;
    margin-top: 3px;
}
.backlog-list p {
    margin: 6px 0 0;
    color: var(--muted);
}
.documents-split { grid-template-columns: minmax(0, 1fr); margin-bottom: 18px; }
.document-table-link {
    display: inline-flex;
    flex-direction: column;
    gap: 3px;
    color: var(--text);
    text-decoration: none;
}
.document-table-link strong {
    font-weight: 900;
    transition: color 0.16s ease;
}
.document-table-link small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 760;
}
.document-table-link:hover strong,
.document-table-link:focus-visible strong {
    color: var(--primary);
}
.preview-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 14px;
}
.document-preview-sheet {
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
    width: min(210mm, 100%);
    min-height: 297mm;
    margin: 0 auto;
    padding: 18mm;
}
.doc-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 28px;
    align-items: start;
    border-bottom: 3px solid var(--primary);
    padding-bottom: 20px;
}
.doc-brand {
    display: inline-grid;
    place-items: center;
    min-width: 74px;
    min-height: 42px;
    border-radius: var(--radius);
    background: var(--primary);
    color: white;
    font-weight: 900;
    margin-bottom: 12px;
    padding: 8px 12px;
}

.doc-brand img {
    max-width: 160px;
    max-height: 52px;
    object-fit: contain;
}
.doc-header p, .doc-meta-grid p { margin: 4px 0; color: var(--muted); }
.doc-title-box {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    display: grid;
    gap: 8px;
    text-align: right;
}
.doc-title-box span { color: var(--muted); text-transform: uppercase; font-weight: 800; }
.doc-title-box strong { font-size: 24px; color: var(--primary-strong); }
.doc-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin: 22px 0;
}
.doc-meta-grid article {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
}
.doc-meta-grid h3 { margin: 0 0 8px; }
.doc-lines th, .doc-lines td {
    white-space: normal;
    vertical-align: top;
}
.doc-total-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    margin-top: 22px;
}
.doc-note {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    color: var(--muted);
}
.doc-note p { margin: 0 0 8px; }
.doc-note p:last-child { margin-bottom: 0; }
.doc-totals {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
}
.doc-totals p {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 10px;
}
.doc-totals .grand {
    border-top: 1px solid var(--line);
    padding-top: 12px;
    font-size: 20px;
    color: var(--primary-strong);
}
.doc-tax-summary {
    margin-top: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
}
.doc-tax-summary h3 {
    margin: 0 0 8px;
    font-size: 15px;
}
.doc-tax-summary th, .doc-tax-summary td {
    padding: 8px 6px;
}
.doc-footer {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 44px;
}
.doc-footer div {
    border-top: 1px solid var(--text);
    padding-top: 8px;
    display: grid;
    gap: 6px;
}
.doc-footer span { color: var(--muted); font-size: 12px; }
.product-preview-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 22px;
}
.product-preview-grid article {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
}
.product-preview-grid h3 { margin: 0 0 12px; }
.product-preview-grid p {
    display: grid;
    gap: 3px;
    margin: 0 0 12px;
}
.product-preview-grid span {
    color: var(--muted);
    font-size: 12px;
}
.barcode-field {
    align-content: start;
}
.barcode-live-preview,
.barcode-preview-block {
    min-height: 58px;
    display: grid;
    gap: 5px;
    align-content: center;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f8fbff;
}
.barcode-live-preview > span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}
.barcode-preview-block {
    margin-top: 8px;
}
.barcode-svg {
    width: 100%;
    height: 34px;
    display: block;
}
.barcode-live-preview small,
.barcode-preview-block small,
.doc-code-cell small {
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0;
}
.doc-code-cell {
    display: grid;
    gap: 3px;
    min-width: 112px;
}
.doc-line-barcode {
    width: 104px;
    display: block;
}
.doc-line-barcode .barcode-svg {
    height: 22px;
}
.document-lines {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
}
.document-line {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 120px 140px 120px 90px;
    gap: 10px;
    align-items: end;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
    margin-bottom: 12px;
}
.document-line:last-child {
    border-bottom: 0;
    margin-bottom: 0;
    padding-bottom: 0;
}
.sequence-list {
    display: grid;
    gap: 10px;
}
.sequence-list div {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    display: grid;
    gap: 4px;
    background: #fbfcfe;
}
.sequence-list span {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    color: var(--primary-strong);
    font-weight: 800;
}
.install-wrap {
    min-height: 60vh;
    display: grid;
    place-items: center;
}
.install-panel {
    width: min(720px, 100%);
    display: grid;
    gap: 18px;
}
.install-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.install-form .charge { grid-column: 1 / -1; }
.error-box, .success-box {
    margin: 0;
    border-radius: var(--radius);
    padding: 12px 14px;
    font-weight: 700;
}
.error-box { background: #fee2e2; color: #991b1b; }
.success-box { background: #dcfce7; color: #166534; }

@media (max-width: 980px) {
    body { grid-template-columns: 1fr; }
    .sidebar { position: static; padding: 16px; }
    .sidebar nav { grid-template-columns: repeat(4, 1fr); }
    .metric-grid, .split, .pos-grid, .blueprint-hero, .blueprint-modules, .principles-grid, .inspiration-grid, .roadmap, .action-grid { grid-template-columns: 1fr; }
    .checkout { position: static; }
}

@media (max-width: 640px) {
    .main { padding: 16px; }
    .topbar, .panel-header, .toolbar, .scan-form { align-items: stretch; flex-direction: column; }
    .sidebar nav { grid-template-columns: 1fr 1fr; }
    .operator { display: none; }
    h1 { font-size: 24px; }
    .metric strong, .grand-total { font-size: 24px; }
    .install-form, .entity-form { grid-template-columns: 1fr; }
    .backlog-list article { grid-template-columns: 1fr; }
    .document-line, .doc-header, .doc-meta-grid, .doc-total-grid, .doc-footer, .product-preview-grid { grid-template-columns: 1fr; }
}

@media print {
    @page { size: A4; margin: 12mm; }
    body { display: block; background: white; }
    .sidebar, .topbar, .preview-toolbar { display: none; }
    .main { padding: 0; }
    .document-preview-sheet {
        border: 0;
        box-shadow: none;
        max-width: none;
        width: auto;
        min-height: auto;
        padding: 0;
    }
    .doc-header { padding-bottom: 14px; }
    th, td { padding: 7px 5px; }
}

/* Modern Gendox UI refresh */
:root {
    --bg: #eef4fb;
    --app-bg: #e6edf5;
    --surface: rgba(255, 255, 255, 0.86);
    --surface-solid: #ffffff;
    --surface-soft: rgba(248, 251, 255, 0.78);
    --surface-strong: #080a14;
    --text: #171923;
    --muted: #6d7482;
    --line: rgba(139, 153, 173, 0.22);
    --primary: #2563eb;
    --primary-strong: #1d4ed8;
    --accent: #2563eb;
    --blue: #92c8ed;
    --blue-soft: #dff0ff;
    --mint: #dff7f5;
    --lavender: #eaf4ff;
    --cream: #fff1f4;
    --good: #2ec866;
    --warn: #f3a527;
    --radius: 26px;
}

html {
    background: linear-gradient(135deg, #f8fbff 0%, #eef5fb 46%, #e8f1fa 100%);
}

body {
    grid-template-columns: 308px minmax(0, 1fr);
    gap: 0;
    padding: 30px;
    background:
        radial-gradient(circle at 82% 12%, rgba(146, 200, 237, 0.28), transparent 30%),
        radial-gradient(circle at 72% 92%, rgba(255, 19, 55, 0.08), transparent 32%),
        linear-gradient(135deg, #f8fbff 0%, #eef5fb 48%, #e7f0f8 100%);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.mobile-bar { display: none; }

.sidebar {
    position: sticky;
    top: 30px;
    height: calc(100vh - 60px);
    background: rgba(255, 255, 255, 0.44);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.74);
    border-right: 0;
    border-radius: 34px 0 0 34px;
    box-shadow: 24px 30px 70px rgba(93, 113, 139, 0.16);
    backdrop-filter: blur(22px);
    padding: 30px 20px;
    gap: 28px;
}

.main {
    min-height: calc(100vh - 60px);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.46), rgba(237, 246, 255, 0.62)),
        var(--app-bg);
    border: 1px solid rgba(255, 255, 255, 0.74);
    border-left: 0;
    border-radius: 0 34px 34px 0;
    box-shadow: 24px 30px 70px rgba(93, 113, 139, 0.16);
    padding: 30px 34px 42px;
    overflow: hidden;
}

.brand {
    color: var(--text);
    gap: 14px;
    padding: 0 6px;
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    background: #ffffff;
    color: var(--surface-strong);
    box-shadow: inset 0 0 0 1px rgba(8, 10, 20, 0.06), 0 12px 26px rgba(113, 130, 154, 0.16);
    font-size: 20px;
}

.brand small,
.sidebar-footer,
.operator span,
.eyebrow,
.hint,
small {
    color: var(--muted);
}

.sidebar nav {
    gap: 9px;
    padding-right: 0;
}

.sidebar nav a {
    min-height: 54px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 999px;
    padding: 9px 13px;
    color: #414753;
    background: rgba(255, 255, 255, 0.44);
    box-shadow: inset 0 0 0 1px rgba(8, 10, 20, 0.04);
    font-size: 15px;
    font-weight: 760;
}

.sidebar nav a:hover {
    background: rgba(255, 255, 255, 0.76);
    color: var(--text);
    transform: translateX(2px);
}

.sidebar nav a.active {
    background: linear-gradient(135deg, #ffffff, #edf7ff);
    color: var(--text);
    box-shadow: inset 0 0 0 1px rgba(255, 19, 55, 0.16), 0 12px 26px rgba(255, 19, 55, 0.10);
}

.sidebar nav a.active .nav-icon {
    background: var(--primary);
    color: #ffffff;
}

.nav-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: #ffffff;
    color: #4c5563;
    font-size: 11px;
    font-weight: 900;
    box-shadow: inset 0 0 0 1px rgba(8, 10, 20, 0.07);
}

.sidebar-footer {
    min-height: 48px;
    border-radius: 999px;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.55);
    color: #424956;
}

.topbar {
    margin-bottom: 26px;
    align-items: start;
}

.topbar h1 {
    font-size: clamp(28px, 3vw, 42px);
    line-height: 1.05;
    font-weight: 820;
}

.eyebrow {
    text-transform: none;
    font-size: 13px;
    font-weight: 760;
}

.top-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-width: 0;
}

.search-pill {
    width: min(340px, 32vw);
    position: relative;
}

.search-pill span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.search-pill input {
    min-height: 48px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.52);
    padding-left: 44px;
    box-shadow: inset 0 0 0 1px rgba(8, 10, 20, 0.06);
}

.search-pill::before {
    content: "";
    position: absolute;
    left: 18px;
    top: 50%;
    width: 13px;
    height: 13px;
    border: 3px solid #090b16;
    border-radius: 999px;
    transform: translateY(-50%);
    z-index: 1;
}

.search-pill::after {
    content: "";
    position: absolute;
    left: 31px;
    top: 30px;
    width: 10px;
    height: 3px;
    background: #090b16;
    border-radius: 999px;
    transform: rotate(42deg);
}

.icon-button,
.mobile-action {
    min-width: 48px;
    height: 48px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.6);
    color: var(--text);
    font-weight: 900;
    box-shadow: inset 0 0 0 1px rgba(8, 10, 20, 0.06);
}

.icon-button:first-of-type {
    background: #090b16;
    color: #ffffff;
}

.operator {
    min-width: 178px;
    min-height: 50px;
    border-radius: 999px;
    border: 0;
    background: rgba(255, 255, 255, 0.62);
    box-shadow: inset 0 0 0 1px rgba(8, 10, 20, 0.05);
    padding: 9px 18px;
}

.panel,
.metric,
.blueprint-hero > div,
.principle-card,
.inspiration-grid article,
.module-card details,
.roadmap article,
.backlog-list article,
.sequence-list div,
.document-lines,
.product-preview-grid article,
.doc-meta-grid article,
.doc-note,
.doc-totals,
.doc-tax-summary {
    border: 1px solid rgba(255, 255, 255, 0.74);
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 18px 46px rgba(84, 103, 130, 0.10);
    backdrop-filter: blur(18px);
}

.panel {
    padding: 24px;
}

.metric-grid {
    gap: 16px;
}

.metric {
    min-height: 142px;
    padding: 22px;
    position: relative;
    overflow: hidden;
}

.metric::after {
    content: "";
    position: absolute;
    inset: auto 18px 18px auto;
    width: 58px;
    height: 58px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.54);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.metric strong {
    font-size: clamp(26px, 2.5vw, 40px);
    line-height: 1.02;
    color: #333944;
}

.metric span {
    color: #596170;
    font-weight: 780;
}

.metric small {
    font-size: 13px;
    font-weight: 650;
}

.tint-warm { background: linear-gradient(135deg, #ffffff 0%, #fff1f4 100%); }
.tint-cool { background: linear-gradient(135deg, #ffffff 0%, #edf7ff 100%); }
.tint-blue { background: linear-gradient(135deg, #ffffff 0%, #e4f8fb 100%); }
.tint-white { background: linear-gradient(135deg, #ffffff 0%, #f6f8fb 100%); }

.button {
    border-radius: 999px;
    min-height: 42px;
    padding: 10px 18px;
    background: var(--primary);
    box-shadow: 0 14px 28px rgba(255, 19, 55, 0.16);
}

.button.secondary {
    background: rgba(255, 255, 255, 0.72);
    color: var(--text);
    box-shadow: inset 0 0 0 1px rgba(8, 10, 20, 0.07);
}

.button.danger {
    background: #090b16;
    color: #ffffff;
    box-shadow: none;
}

.dark-button {
    background: #090b16;
    color: #ffffff;
    box-shadow: 0 16px 34px rgba(8, 10, 20, 0.18);
}

input,
select,
textarea {
    border: 0;
    border-radius: 999px;
    min-height: 48px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: inset 0 0 0 1px rgba(8, 10, 20, 0.07);
}

textarea {
    border-radius: 22px;
}

label {
    color: #697180;
    font-weight: 720;
}

.panel-header {
    align-items: center;
}

.subtle {
    color: var(--muted);
}

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(440px, 0.95fr);
    gap: 18px;
    align-items: end;
    margin-bottom: 18px;
}

.hero-copy h2 {
    margin: 0;
    font-size: clamp(30px, 4vw, 50px);
    line-height: 1;
}

.hero-copy p {
    max-width: 680px;
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 16px;
}

.tenant-logo-card {
    min-width: 156px;
    min-height: 112px;
    display: grid;
    place-items: center;
    gap: 8px;
    border-radius: 30px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.58);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.74), 0 18px 46px rgba(84, 103, 130, 0.10);
}

.tenant-logo-card img,
.tenant-logo-card span {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    object-fit: contain;
    border-radius: 18px;
    background: #ffffff;
    color: var(--primary);
    font-size: 28px;
    font-weight: 950;
}

.tenant-logo-card strong {
    max-width: 180px;
    text-align: center;
}

.hero-filterbar {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    padding: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.42);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.66);
}

.hero-filterbar label {
    gap: 4px;
}

.hero-filterbar label span {
    padding-left: 16px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
    gap: 18px;
}

.dashboard-grid > .panel:nth-last-child(2) {
    grid-column: span 1;
}

.revenue-panel {
    min-height: 360px;
}

.chart-panel {
    overflow: hidden;
}

.line-chart {
    position: relative;
    min-height: 220px;
    margin-top: 20px;
    border-radius: 24px;
    overflow: hidden;
    background:
        linear-gradient(to bottom, rgba(255, 255, 255, 0.5), rgba(238, 244, 250, 0.82)),
        repeating-linear-gradient(to right, transparent 0 13%, rgba(100, 116, 139, 0.11) 13.2% 13.45%, transparent 13.65% 16%);
}

.line-chart i {
    position: absolute;
    inset: 58% 0 0;
    background: linear-gradient(180deg, rgba(146, 200, 237, 0.24), rgba(146, 200, 237, 0));
    clip-path: polygon(0 72%, 15% 44%, 31% 62%, 46% 32%, 61% 45%, 75% 20%, 100% 30%, 100% 100%, 0 100%);
}

.line-chart span {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--primary);
    box-shadow: 0 0 0 8px rgba(255, 19, 55, 0.11);
    z-index: 2;
}

.chart-months {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    color: var(--muted);
    font-weight: 720;
    padding: 10px 8px 0;
}

.donut-wrap {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 20px;
    align-items: center;
}

.donut-chart {
    width: 190px;
    aspect-ratio: 1;
    border-radius: 999px;
    display: grid;
    place-items: center;
    align-content: center;
    background:
        radial-gradient(circle at center, #ffffff 0 43%, transparent 44%),
        conic-gradient(var(--primary) 0 28%, #92c8ed 28% 62%, #dff0ff 62% 82%, #f3f7fb 82% 100%);
    box-shadow: inset 0 0 22px rgba(255, 255, 255, 0.72), 0 18px 34px rgba(110, 120, 140, 0.12);
}

.donut-chart strong {
    font-size: 32px;
}

.donut-chart span {
    color: var(--muted);
}

.legend-list,
.soft-list,
.bar-list {
    display: grid;
    gap: 12px;
}

.legend-list span {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-weight: 720;
}

.legend-list i {
    width: 12px;
    height: 12px;
    border-radius: 999px;
}

.legend-red { background: var(--primary); }
.legend-blue { background: var(--blue); }
.legend-yellow { background: #dff0ff; }
.legend-muted { background: #d8dce5; }

.soft-list div {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    min-height: 62px;
    padding: 9px 12px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.62);
}

.product-avatar {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: var(--blue-soft);
    color: #1f5f89;
    font-weight: 900;
}

.soft-list strong {
    display: grid;
    gap: 2px;
}

.soft-list em,
.bar-list em {
    font-style: normal;
    color: #3d4451;
    font-weight: 800;
}

.bar-list div {
    display: grid;
    grid-template-columns: 120px minmax(120px, 1fr) 54px;
    gap: 12px;
    align-items: center;
}

.bar-list span {
    color: #4a5260;
    font-weight: 740;
}

.bar-list b {
    height: 34px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.58);
    overflow: hidden;
}

.bar-list i {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--blue), #edf7ff);
}

table {
    border-collapse: separate;
    border-spacing: 0 8px;
}

thead th {
    background: rgba(8, 10, 20, 0.05);
    border: 0;
    color: #5b6370;
    font-size: 12px;
    font-weight: 850;
}

thead th:first-child {
    border-radius: 999px 0 0 999px;
}

thead th:last-child {
    border-radius: 0 999px 999px 0;
}

tbody td {
    background: rgba(255, 255, 255, 0.54);
    border-bottom: 1px solid rgba(8, 10, 20, 0.04);
}

tbody tr td:first-child {
    border-radius: 18px 0 0 18px;
}

tbody tr td:last-child {
    border-radius: 0 18px 18px 0;
}

.badge {
    border-radius: 999px;
    background: rgba(255, 19, 55, 0.10);
    color: var(--primary-strong);
}

.success-box {
    background: rgba(46, 200, 102, 0.13);
    color: #16713a;
}

.error-box {
    background: rgba(255, 19, 55, 0.11);
    color: var(--primary-strong);
}

.documents-split,
.split {
    gap: 18px;
}

.document-preview-sheet {
    background: #ffffff;
    backdrop-filter: none;
}

@media (max-width: 1180px) {
    body {
        grid-template-columns: 96px minmax(0, 1fr);
        padding: 18px;
    }

    .sidebar {
        top: 18px;
        height: calc(100vh - 36px);
        padding: 24px 12px;
        border-radius: 28px 0 0 28px;
    }

    .brand span:last-child,
    .sidebar-footer span:last-child,
    .sidebar nav a span:last-child {
        display: none;
    }

    .brand,
    .sidebar nav a,
    .sidebar-footer {
        justify-content: center;
    }

    .main {
        min-height: calc(100vh - 36px);
        border-radius: 0 28px 28px 0;
        padding: 24px;
    }

    .dashboard-hero,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .hero-filterbar {
        grid-template-columns: 1fr 1fr;
        border-radius: 28px;
    }
}

@media (max-width: 760px) {
    body {
        display: block;
        padding: 0;
        background: #eef4fb;
    }

    .mobile-bar {
        position: sticky;
        top: 0;
        z-index: 50;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 12px 14px;
        background: rgba(238, 244, 251, 0.86);
        backdrop-filter: blur(18px);
        border-bottom: 1px solid rgba(8, 10, 20, 0.06);
    }

    .compact-brand span:last-child {
        font-weight: 900;
    }

    .mobile-action {
        width: auto;
        padding: 0 16px;
        background: var(--primary);
        color: #ffffff;
    }

    .sidebar {
        position: fixed;
        inset: auto 10px 10px;
        z-index: 45;
        height: 68px;
        border-radius: 999px;
        border: 1px solid rgba(255, 255, 255, 0.78);
        padding: 8px;
        display: block;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
    }

    .sidebar > .brand,
    .sidebar-footer {
        display: none;
    }

    .sidebar nav {
        display: flex;
        gap: 8px;
        overflow: visible;
        padding: 0;
    }

    .sidebar nav a {
        width: 52px;
        height: 52px;
        min-height: 52px;
        padding: 0;
        flex: 0 0 52px;
    }

    .main {
        min-height: auto;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        padding: 20px 14px 96px;
        background: transparent;
    }

    .topbar {
        align-items: stretch;
        flex-direction: column;
        gap: 14px;
    }

    .top-actions {
        justify-content: stretch;
        display: grid;
        grid-template-columns: minmax(0, 1fr) 48px 48px 48px;
    }

    .search-pill {
        width: 100%;
    }

    .operator,
    .company-badge {
        display: none;
    }

    .hero-filterbar,
    .metric-grid,
    .dashboard-metrics,
    .donut-wrap,
    .settings-preview,
    .document-line,
    .entity-form,
    .doc-header,
    .doc-meta-grid,
    .doc-total-grid,
    .doc-footer,
    .product-preview-grid,
    .install-form {
        grid-template-columns: 1fr;
    }

    .hero-filterbar {
        border-radius: 24px;
    }

    .panel {
        padding: 18px;
    }

    .panel-header,
    .toolbar,
    .scan-form {
        align-items: stretch;
        flex-direction: column;
    }

    .metric {
        min-height: 124px;
    }

    .line-chart {
        min-height: 180px;
    }

    .donut-chart {
        width: min(190px, 70vw);
        margin: 0 auto;
    }

    .bar-list div {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .actions {
        flex-wrap: wrap;
    }

    th,
    td {
        padding: 10px 9px;
    }

    .document-preview-sheet {
        width: 100%;
        min-height: auto;
        padding: 18px;
    }

    .user-menu > div {
        right: 0;
        width: min(270px, calc(100vw - 28px));
    }

    .auth-card,
    .compact-auth {
        grid-template-columns: 1fr;
    }
}

/* Final alignment pass: full-width work surfaces and unified controls. */
.documents-workspace,
.documents-hero,
.doc-action-strip,
.panel,
.table-wrap,
.sequence-list,
.soft-list,
.bar-list,
.device-list,
.backlog-list,
.document-lines,
.document-registry,
.blueprint-section,
.form-panel {
    width: 100%;
    max-width: none;
}

.documents-workspace {
    display: grid;
    gap: 18px;
}

.documents-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.documents-hero h2 {
    margin: 0;
    font-size: clamp(28px, 3vw, 44px);
    line-height: 1.04;
}

.doc-action-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.doc-action-card {
    min-height: 112px;
    display: grid;
    align-content: center;
    gap: 8px;
    padding: 18px;
    border-radius: 28px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.62);
    box-shadow: inset 0 0 0 1px rgba(8, 10, 20, 0.05), 0 16px 34px rgba(84, 103, 130, 0.08);
}

.doc-action-card:hover {
    transform: translateY(-1px);
    box-shadow: inset 0 0 0 1px rgba(255, 19, 55, 0.20), 0 18px 38px rgba(255, 19, 55, 0.10);
}

.doc-action-card strong {
    font-size: 18px;
}

.doc-action-card span {
    color: var(--muted);
    line-height: 1.35;
}

.button,
button.button,
a.button,
.dark-button,
.icon-button,
.mobile-action {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 18px;
    border-radius: 999px;
    line-height: 1;
    white-space: nowrap;
    text-align: center;
    flex: 0 0 auto;
}

.button,
button.button,
a.button {
    min-width: max-content;
}

.button:hover,
.doc-action-card:hover,
.icon-button:hover,
.mobile-action:hover {
    filter: brightness(0.99);
}

.actions,
.form-actions,
.admin-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: nowrap;
}

.actions form,
.form-actions form,
.admin-actions form {
    display: contents;
    margin: 0;
}

.panel-header,
.toolbar,
.scan-form {
    align-items: center;
}

.toolbar {
    flex-wrap: wrap;
}

.toolbar label {
    min-width: min(360px, 100%);
    flex: 1 1 360px;
}

.table-wrap {
    display: block;
    overflow-x: auto;
}

.table-wrap table {
    width: 100%;
    min-width: 760px;
}

.compact-table table {
    min-width: 680px;
}

.sequence-list > div,
.soft-list > div,
.bar-list > div,
.device-row,
.backlog-list article {
    width: 100%;
    box-sizing: border-box;
}

.panel > :last-child,
.table-wrap > :last-child,
.sequence-list > :last-child,
.document-lines > :last-child {
    margin-bottom: 0;
}

.document-line {
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.document-registry details {
    width: 100%;
}

.document-registry summary {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    font-weight: 850;
    list-style: none;
}

.document-registry summary::-webkit-details-marker {
    display: none;
}

.document-registry summary::after {
    content: "+";
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--primary);
    box-shadow: inset 0 0 0 1px rgba(8, 10, 20, 0.07);
}

.document-registry details[open] summary::after {
    content: "-";
}

/* Invoice/document preview: the paper itself stays clean, with lines instead of app shadows. */
.document-preview-sheet {
    box-sizing: border-box;
    width: min(210mm, 100%);
    min-height: 297mm;
    border-radius: 0;
    box-shadow: none !important;
    backdrop-filter: none !important;
}

.document-preview-sheet .doc-title-box,
.document-preview-sheet .doc-meta-grid article,
.document-preview-sheet .doc-note,
.document-preview-sheet .doc-totals,
.document-preview-sheet .doc-tax-summary {
    background: #ffffff !important;
    border: 1px solid #d8dee8;
    box-shadow: none !important;
    backdrop-filter: none !important;
}

.document-preview-sheet .doc-brand {
    background: #ffffff;
    color: var(--text);
    border: 1px solid #d8dee8;
    border-radius: 0;
}

.document-preview-sheet .doc-brand img {
    display: block;
}

.document-preview-sheet .doc-lines {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
}

.document-preview-sheet .doc-lines th,
.document-preview-sheet .doc-lines td,
.document-preview-sheet .doc-tax-summary th,
.document-preview-sheet .doc-tax-summary td {
    border-bottom: 1px solid #d8dee8;
}

@media (max-width: 1180px) {
    .doc-action-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .documents-hero {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 760px) {
    .doc-action-strip,
    .documents-split {
        grid-template-columns: 1fr;
    }

    .actions,
    .form-actions,
    .admin-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .panel-header,
    .toolbar,
    .scan-form {
        align-items: stretch;
    }

    .button,
    button.button,
    a.button,
    .mobile-action {
        width: auto;
        max-width: 100%;
    }
}

@media print {
    @page {
        size: A4 portrait;
        margin: 12mm;
    }

    html,
    body {
        width: auto !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0;
        background: white !important;
        color: #111827;
        display: block !important;
    }

    .mobile-bar,
    .sidebar,
    .topbar,
    .preview-toolbar {
        display: none !important;
    }

    .main {
        width: auto !important;
        min-height: auto !important;
        display: block !important;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        background: white !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .document-preview-sheet {
        width: 100% !important;
        max-width: none !important;
        min-height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        background: #ffffff !important;
    }

    .document-preview-sheet * {
        box-shadow: none !important;
        text-shadow: none !important;
        backdrop-filter: none !important;
    }

    .doc-header {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) 62mm !important;
        gap: 10mm !important;
        align-items: start !important;
        border-bottom: 2px solid #111827 !important;
        padding-bottom: 8mm !important;
        break-inside: avoid;
    }

    .doc-brand {
        min-width: 0 !important;
        min-height: 0 !important;
        border: 1px solid #c8d0dc !important;
        border-radius: 0 !important;
        background: #ffffff !important;
        color: #111827 !important;
        padding: 5px 8px !important;
    }

    .doc-brand img {
        max-width: 42mm !important;
        max-height: 18mm !important;
    }

    .doc-header h2 {
        margin: 4mm 0 2mm !important;
        font-size: 15pt !important;
        line-height: 1.15 !important;
    }

    .doc-header p,
    .doc-meta-grid p {
        color: #374151 !important;
        font-size: 9.5pt !important;
        line-height: 1.35 !important;
    }

    .doc-title-box {
        text-align: right !important;
        border: 1px solid #c8d0dc !important;
        border-radius: 0 !important;
        padding: 6mm !important;
        background: #ffffff !important;
    }

    .doc-title-box strong {
        font-size: 17pt !important;
        color: #111827 !important;
    }

    .doc-meta-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8mm !important;
        margin: 8mm 0 !important;
    }

    .doc-meta-grid article,
    .doc-note,
    .doc-totals,
    .doc-tax-summary {
        border: 1px solid #c8d0dc !important;
        border-radius: 0 !important;
        background: #ffffff !important;
        padding: 5mm !important;
    }

    .doc-lines {
        width: 100% !important;
        min-width: 0 !important;
        table-layout: auto !important;
        border-collapse: collapse !important;
        font-size: 8.8pt !important;
        page-break-inside: auto;
    }

    .doc-lines thead {
        display: table-header-group;
    }

    .doc-lines tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .doc-lines th,
    .doc-lines td {
        padding: 3.2mm 2mm !important;
        border-bottom: 1px solid #c8d0dc !important;
        white-space: normal !important;
        vertical-align: top !important;
    }

    .doc-lines th {
        color: #111827 !important;
        text-transform: none !important;
        font-size: 8.2pt !important;
        font-weight: 800 !important;
    }

    .doc-total-grid {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) 62mm !important;
        gap: 8mm !important;
        margin-top: 8mm !important;
        break-inside: avoid;
    }

    .doc-totals p {
        margin-bottom: 3mm !important;
    }

    .doc-totals .grand {
        color: #111827 !important;
        font-size: 13pt !important;
        border-top: 1px solid #111827 !important;
    }

    .doc-tax-summary {
        margin-top: 7mm !important;
        break-inside: avoid;
    }

    .doc-tax-summary table {
        width: 100% !important;
        min-width: 0 !important;
        border-collapse: collapse !important;
    }

    .doc-tax-summary th,
    .doc-tax-summary td {
        padding: 2.4mm 2mm !important;
        border-bottom: 1px solid #c8d0dc !important;
        white-space: normal !important;
    }

    .doc-footer {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8mm !important;
        margin-top: 16mm !important;
        break-inside: avoid;
    }

    .doc-footer div {
        border-top: 1px solid #111827 !important;
        padding-top: 3mm !important;
    }
}

@media screen {
    /*
     * Gendox accounting UI rule:
     * one visual container may have a shadow; nested blocks inside it use lines,
     * flat fills and strict spacing. This keeps the app modern without looking
     * like stacked marketing cards.
     */
    :root {
        --bg: #eef4fa;
        --surface: rgba(255, 255, 255, 0.88);
        --line: #d7e1ec;
        --text: #172033;
        --muted: #647084;
        --radius: 14px;
        --radius-inner: 10px;
        --shadow-shell: 0 18px 46px rgba(55, 74, 99, 0.12);
        --shadow-panel: 0 10px 28px rgba(55, 74, 99, 0.08);
    }

    body {
        background:
            linear-gradient(145deg, #f7fbff 0%, #eaf2fb 46%, #e8f0f7 100%);
    }

    .sidebar {
        border-radius: 18px 0 0 18px;
        background: rgba(231, 239, 247, 0.78);
        border: 1px solid rgba(255, 255, 255, 0.78);
        box-shadow: var(--shadow-shell);
    }

    .main {
        border-radius: 0 18px 18px 0;
        box-shadow: var(--shadow-shell);
        background:
            linear-gradient(135deg, rgba(255, 255, 255, 0.60), rgba(241, 247, 252, 0.72)),
            #f4f8fc;
    }

    .topbar {
        align-items: center;
        margin-bottom: 20px;
    }

    .page-heading {
        display: grid;
        gap: 6px;
        min-width: 0;
    }

    .page-heading h1 {
        margin: 0;
        font-size: clamp(28px, 2.6vw, 38px);
        line-height: 1.08;
        font-weight: 850;
        color: #172033;
    }

    .page-heading p {
        margin: 0;
        max-width: 860px;
        color: var(--muted);
        font-size: 15px;
        line-height: 1.45;
        font-weight: 620;
    }

    .page-tools-row {
        display: flex;
        align-items: flex-end;
        justify-content: space-between;
        gap: 16px;
        margin-bottom: 18px;
    }

    .page-tools-row.dashboard-hero {
        grid-template-columns: none;
    }

    .page-tools-row .hero-filterbar {
        flex: 1 1 auto;
        max-width: 880px;
        margin-left: auto;
    }

    .documents-hero {
        justify-content: flex-end;
    }

    .blueprint-hero {
        display: block;
        margin-bottom: 18px;
    }

    .blueprint-stats {
        max-width: none;
    }

    .brand-mark,
    .sidebar nav a,
    .sidebar-footer,
    .company-badge,
    .search-pill input,
    .operator,
    input,
    select,
    textarea,
    .button,
    button.button,
    a.button,
    .dark-button,
    .mobile-action,
    .auth-link,
    .auth-chips span {
        border-radius: var(--radius-inner) !important;
    }

    .user-menu summary,
    .user-menu summary img,
    .user-menu summary span,
    .company-badge img,
    .company-badge span,
    .badge,
    .pulse,
    .device-dot {
        border-radius: 999px !important;
    }

    .panel,
    .metric,
    .auth-card,
    .document-preview-sheet,
    .product-preview-grid article {
        border-radius: var(--radius) !important;
        box-shadow: var(--shadow-panel) !important;
    }

    .panel {
        padding: 22px;
    }

    .panel-header,
    .toolbar,
    .scan-form {
        gap: 12px;
        padding-bottom: 12px;
        border-bottom: 1px solid rgba(215, 225, 236, 0.72);
        margin-bottom: 16px;
    }

    .panel-header h2,
    .toolbar h2,
    .scan-form h2 {
        font-size: 18px;
        font-weight: 820;
    }

    .panel-header .subtle,
    .toolbar .subtle {
        margin-top: 4px;
    }

    .button,
    button.button,
    a.button,
    .dark-button,
    .mobile-action {
        min-height: 40px;
        padding: 0 16px;
        font-size: 14px;
        font-weight: 780;
        box-shadow: none !important;
        border: 1px solid transparent;
    }

    .button {
        border-color: rgba(255, 19, 55, 0.16);
    }

    .button.secondary {
        background: #f8fbfe;
        border-color: #ccd7e5;
        color: #243044;
    }

    .button.secondary:hover {
        border-color: rgba(255, 19, 55, 0.38);
        background: #ffffff;
    }

    .dark-button,
    .button.danger {
        background: #151c2b;
        border-color: #151c2b;
        color: #ffffff;
    }

    .sidebar nav a {
        min-height: 46px;
        background: rgba(255, 255, 255, 0.46);
        box-shadow: none !important;
        border: 1px solid rgba(215, 225, 236, 0.74);
    }

    .sidebar nav a.active,
    .sidebar nav a:hover {
        background: #ffffff;
        border-color: rgba(255, 19, 55, 0.26);
        box-shadow: none !important;
        transform: none;
    }

    .nav-icon {
        border-radius: 8px;
        box-shadow: none !important;
        border: 1px solid rgba(215, 225, 236, 0.86);
    }

    .nav-icon svg,
    .icon-button svg {
        width: 19px;
        height: 19px;
        display: block;
    }

    .nav-fallback {
        display: none;
    }

    .sidebar nav a.active .nav-icon {
        background: rgba(255, 19, 55, 0.10);
        border-color: rgba(255, 19, 55, 0.28);
        color: var(--primary);
    }

    .hero-filterbar,
    .tenant-logo-card,
    .doc-action-card,
    .sequence-list > div,
    .soft-list > div,
    .bar-list > div,
    .backlog-list article,
    .module-card details,
    .principle-card,
    .inspiration-grid article,
    .document-lines,
    .doc-title-box,
    .doc-meta-grid article,
    .doc-note,
    .doc-totals,
    .doc-tax-summary,
    .product-preview-grid article,
    .user-menu > div,
    .auth-form {
        border-radius: var(--radius-inner) !important;
        box-shadow: none !important;
        background: rgba(255, 255, 255, 0.66);
        border: 1px solid rgba(215, 225, 236, 0.86);
    }

    .panel .panel,
    .panel .metric,
    .panel .doc-action-card,
    .panel .sequence-list > div,
    .panel .soft-list > div,
    .panel .bar-list > div,
    .panel .backlog-list article,
    .panel .module-card details,
    .panel .principle-card,
    .panel .inspiration-grid article,
    .panel .document-lines,
    .panel .doc-title-box,
    .panel .doc-meta-grid article,
    .panel .doc-note,
    .panel .doc-totals,
    .panel .doc-tax-summary,
    .panel .product-preview-grid article,
    .metric .tenant-logo-card,
    .metric .doc-action-card,
    .metric .sequence-list > div {
        box-shadow: none !important;
    }

    .doc-action-card {
        min-height: 96px;
        align-content: start;
        padding: 16px;
    }

    .doc-action-card:hover {
        transform: none;
        border-color: rgba(255, 19, 55, 0.34);
        background: #ffffff;
        box-shadow: none !important;
    }

    .metric {
        min-height: 124px;
        padding: 18px;
    }

    .metric::after {
        border-radius: var(--radius-inner);
        box-shadow: none !important;
        background: rgba(255, 255, 255, 0.50);
    }

    .metric strong {
        font-size: clamp(24px, 2.1vw, 34px);
    }

    .line-chart,
    .donut-chart,
    .bar-list div span:last-child,
    .progress,
    .activity-icon {
        border-radius: var(--radius-inner) !important;
        box-shadow: none !important;
    }

    .donut-chart {
        border: 1px solid rgba(215, 225, 236, 0.86);
    }

    table {
        border-spacing: 0;
    }

    th {
        color: #5b6678;
        font-weight: 820;
        background: rgba(244, 248, 252, 0.92);
    }

    tbody tr:hover {
        background: rgba(255, 19, 55, 0.035);
    }

    tbody tr td:first-child,
    tbody tr td:last-child {
        border-radius: 0 !important;
    }

    .table-wrap {
        border-radius: var(--radius-inner);
        border: 1px solid rgba(215, 225, 236, 0.78);
        background: rgba(255, 255, 255, 0.50);
    }

    .table-wrap table {
        min-width: 760px;
    }

    .user-menu > div {
        box-shadow: var(--shadow-panel) !important;
    }

    .document-preview-sheet,
    .document-preview-sheet * {
        box-shadow: none !important;
    }

    .document-preview-sheet {
        border-radius: 0 !important;
    }

    .donut-chart,
    .legend-list i,
    .line-chart span,
    .bar-list b,
    .bar-list i,
    .progress,
    .progress > *,
    .activity-icon,
    .pulse,
    .device-dot {
        border-radius: 999px !important;
    }

    .donut-chart {
        overflow: hidden;
        aspect-ratio: 1;
        background:
            radial-gradient(circle at center, #ffffff 0 43%, transparent 44%),
            conic-gradient(var(--primary) 0 28%, #92c8ed 28% 62%, #dff0ff 62% 82%, #f3f7fb 82% 100%);
    }

    .line-chart span {
        box-shadow: 0 0 0 8px rgba(255, 19, 55, 0.10) !important;
    }

    @media (max-width: 1180px) {
        .sidebar {
            border-radius: 16px 0 0 16px;
        }

        .main {
            border-radius: 0 16px 16px 0;
        }
    }

    @media (max-width: 760px) {
        .sidebar,
        .main {
            border-radius: 0;
            box-shadow: none;
        }

        .panel {
            padding: 18px;
        }

        .panel-header,
        .toolbar,
        .scan-form {
            padding-bottom: 10px;
        }

        .topbar {
            align-items: stretch;
        }

        .page-tools-row {
            align-items: stretch;
            flex-direction: column;
        }

        .page-tools-row .hero-filterbar {
            max-width: none;
            margin-left: 0;
        }
    }
}

@media screen {
    .warehouse-toolbar label:first-child {
        flex: 999 1 460px;
    }

    .warehouse-table-wrap table {
        min-width: 1320px;
    }

    .warehouse-form textarea {
        min-height: 112px;
    }

    .store-layout {
        grid-template-columns: minmax(0, 1fr) 360px;
        align-items: start;
    }

    .permission-table-wrap table {
        min-width: 1180px;
    }

    .permission-table th {
        vertical-align: top;
    }

    .permission-table th small,
    .permission-table td small {
        display: block;
        margin-top: 4px;
        text-transform: none;
        white-space: normal;
    }

    .permission-table td {
        vertical-align: top;
        white-space: normal;
    }

    .permission-enabled {
        min-height: 34px;
        display: grid;
        grid-template-columns: 18px 1fr;
        align-items: center;
        gap: 7px;
        margin-bottom: 8px;
        color: #243044;
        font-size: 12px;
        font-weight: 820;
    }

    .permission-enabled input,
    .permission-toggle-grid input {
        width: 16px;
        height: 16px;
        min-height: 0;
        box-shadow: none;
    }

    .permission-toggle-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(110px, 1fr));
        gap: 5px 8px;
    }

    .permission-toggle-grid label {
        min-height: 26px;
        display: grid;
        grid-template-columns: 16px 1fr;
        align-items: center;
        gap: 6px;
        color: #526074;
        font-size: 11px;
        font-weight: 720;
    }

    .permission-actions {
        margin-top: 16px;
    }

    .pos-context-panel {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        margin-bottom: 18px;
    }

    .pos-context-panel div {
        display: grid;
        gap: 4px;
    }

    .pos-context-panel span {
        color: var(--muted);
        font-size: 12px;
        font-weight: 820;
        text-transform: uppercase;
    }

    .pos-context-panel strong {
        font-size: 18px;
    }

    button[disabled],
    .button[disabled] {
        cursor: not-allowed;
        opacity: 0.58;
    }

    @media (max-width: 1180px) {
        .store-layout {
            grid-template-columns: 1fr;
        }
    }

    @media (max-width: 760px) {
        .pos-context-panel {
            align-items: stretch;
            flex-direction: column;
        }

        .permission-toggle-grid {
            grid-template-columns: 1fr;
        }
    }
}

@media screen {
    .material-subnav {
        align-items: center;
        scrollbar-width: thin;
    }

    .material-action-grid {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 12px;
        margin-bottom: 18px;
    }

    .material-action-grid .doc-action-card {
        min-height: 112px;
        align-content: center;
    }

    .material-metrics .metric {
        min-height: 118px;
    }

    .material-toolbar {
        width: 100%;
        align-items: end;
        gap: 12px;
    }

    .material-toolbar label {
        flex: 1 1 190px;
        min-width: 170px;
    }

    .material-toolbar label:last-of-type {
        flex: 2 1 320px;
    }

    .material-table-wrap table {
        min-width: 1320px;
    }

    .material-table-wrap.compact-table table,
    .compact-table.material-table-wrap table {
        min-width: 760px;
    }

    .material-form-panel {
        max-width: none;
    }

    .material-form {
        align-items: end;
    }

    .material-cost-grid {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 10px;
        padding: 12px;
        border: 1px solid rgba(215, 225, 236, 0.82);
        border-radius: var(--radius-inner);
        background: rgba(248, 251, 254, 0.62);
        box-shadow: none !important;
    }

    .material-production-box {
        display: grid;
        grid-template-columns: minmax(260px, 1fr) minmax(180px, 0.4fr) auto;
        gap: 10px;
        align-items: end;
        padding: 12px;
        border: 1px solid rgba(215, 225, 236, 0.82);
        border-radius: var(--radius-inner);
        background: rgba(248, 251, 254, 0.62);
        box-shadow: none !important;
    }

    .material-lines {
        box-shadow: none !important;
    }

    .material-line {
        grid-template-columns: minmax(260px, 1.5fr) repeat(3, minmax(130px, 0.7fr)) minmax(120px, 0.6fr) auto;
        align-items: end;
        box-shadow: none !important;
    }

    .material-line .button {
        align-self: end;
    }

    .material-preview .panel-header {
        border-bottom: 1px solid rgba(215, 225, 236, 0.78);
        padding-bottom: 14px;
    }

    .material-preview-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
        justify-content: flex-end;
    }

    .material-preview-actions form {
        margin: 0;
    }

    .material-doc-meta {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 10px;
        margin: 0 0 14px;
    }

    .material-doc-meta article {
        display: grid;
        gap: 4px;
        min-height: 86px;
        padding: 13px;
        border: 1px solid rgba(215, 225, 236, 0.86);
        border-radius: var(--radius-inner);
        background: rgba(255, 255, 255, 0.62);
        box-shadow: none !important;
    }

    .material-doc-meta span,
    .material-totals span {
        color: var(--muted);
        font-size: 12px;
        font-weight: 820;
        text-transform: uppercase;
    }

    .material-doc-meta strong {
        color: var(--text);
        font-size: 16px;
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .material-totals {
        display: flex;
        justify-content: flex-end;
        gap: 10px;
        flex-wrap: wrap;
        margin-top: 14px;
        padding-top: 14px;
        border-top: 1px solid rgba(215, 225, 236, 0.78);
    }

    .material-totals span {
        min-height: 42px;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        border: 1px solid rgba(215, 225, 236, 0.86);
        border-radius: var(--radius-inner);
        padding: 0 12px;
        background: rgba(248, 251, 254, 0.72);
        box-shadow: none !important;
    }

    .material-totals strong {
        color: var(--text);
        font-size: 15px;
        white-space: nowrap;
    }

    .material-import-history-panel {
        margin-top: 18px;
    }

    .material-import-attachment-form {
        display: grid;
        grid-template-columns: minmax(150px, 0.75fr) minmax(220px, 1.2fr) minmax(140px, 0.7fr) minmax(150px, 0.7fr);
        gap: 10px;
        align-items: end;
        margin-top: 14px;
        padding-top: 14px;
        border-top: 1px solid rgba(215, 225, 236, 0.78);
    }

    .material-import-attachment-form label {
        margin: 0;
    }

    .material-import-attachment-form label > span {
        display: block;
        margin: 0 0 6px;
        color: var(--muted);
        font-size: 12px;
        font-weight: 820;
        text-transform: uppercase;
    }

    .material-import-attachment-form input,
    .material-import-attachment-form select,
    .material-import-attachment-form textarea {
        width: 100%;
    }

    .material-import-file-field,
    .material-import-notes-field {
        grid-column: span 2;
    }

    .material-import-attachment-form .button {
        min-height: 46px;
        justify-self: end;
        grid-column: span 2;
    }

    .material-import-attachments-wrap {
        margin-top: 16px;
    }

    .material-import-attachments-wrap .actions {
        display: flex;
        gap: 8px;
        align-items: center;
        justify-content: flex-end;
        white-space: nowrap;
    }

    .material-import-attachments-wrap .actions form {
        margin: 0;
    }

    .material-norm-layout {
        grid-template-columns: minmax(0, 1fr) 380px;
        align-items: start;
    }

    .material-norm-layout aside {
        display: grid;
        gap: 16px;
    }

    .material-add-component-form {
        padding-top: 16px;
        border-top: 1px solid rgba(215, 225, 236, 0.78);
    }

    .material-norm-lines-head {
        margin-top: 18px;
        padding-top: 14px;
        border-top: 1px solid rgba(215, 225, 236, 0.78);
    }

    .panel .material-cost-grid,
    .panel .material-production-box,
    .panel .material-line,
    .panel .material-doc-meta article,
    .panel .material-totals span {
        box-shadow: none !important;
    }

    @media (max-width: 1180px) {
        .material-action-grid {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .material-cost-grid,
        .material-doc-meta {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .material-production-box,
        .material-norm-layout,
        .material-import-attachment-form {
            grid-template-columns: 1fr;
        }

        .material-import-file-field,
        .material-import-notes-field,
        .material-import-attachment-form .button {
            grid-column: 1 / -1;
        }

        .material-line {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .material-line .button {
            grid-column: 1 / -1;
        }
    }

    @media (max-width: 760px) {
        .material-action-grid,
        .material-cost-grid,
        .material-doc-meta,
        .material-line {
            grid-template-columns: 1fr;
        }

        .material-toolbar {
            align-items: stretch;
        }

        .material-toolbar label,
        .material-toolbar label:last-of-type,
        .material-toolbar .button {
            flex: 1 1 100%;
            min-width: 0;
        }

        .material-preview-actions,
        .material-totals {
            justify-content: stretch;
        }

        .material-preview-actions .button,
        .material-preview-actions form,
        .material-preview-actions button,
        .material-totals span {
            width: 100%;
        }

        .material-import-attachments-wrap .actions,
        .material-import-attachments-wrap .actions .button,
        .material-import-attachments-wrap .actions form {
            width: 100%;
            justify-content: stretch;
        }
    }
}

@media screen {
    .accounting-action-grid .doc-action-card {
        border-radius: var(--radius);
        box-shadow: inset 0 0 0 1px rgba(215, 225, 236, 0.82), 0 10px 24px rgba(84, 103, 130, 0.06);
    }

    .accounting-line {
        grid-template-columns: minmax(220px, 1.2fr) minmax(180px, 0.9fr) minmax(180px, 1fr) repeat(2, minmax(120px, 0.55fr)) minmax(140px, 0.7fr) auto auto;
        align-items: end;
        box-shadow: none !important;
    }

    .accounting-split > .panel .panel-header,
    .accounting-side-stack .panel-header {
        border-bottom: 1px solid rgba(215, 225, 236, 0.72);
        padding-bottom: 12px;
    }

    @media (max-width: 1280px) {
        .accounting-line {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }
    }

    @media (max-width: 760px) {
        .accounting-line {
            grid-template-columns: 1fr;
        }
    }
}

/* True final design guard. Keep this block last. */
@media screen {
    :root {
        --primary: #2563eb;
        --primary-strong: #1d4ed8;
        --accent: #2563eb;
        --primary-soft: #dbeafe;
        --blue: #60a5fa;
        --blue-soft: #eff6ff;
        --app-bg: #eef4fb;
        --bg: #f6f9fd;
        --surface: rgba(255, 255, 255, 0.9);
        --surface-strong: #ffffff;
        --line: #d8e2ef;
        --line-strong: #c8d6e6;
        --text: #172033;
        --muted: #64748b;
        --radius: 12px;
        --radius-inner: 8px;
        --shadow-shell: 0 18px 48px rgba(30, 41, 59, 0.08);
        --shadow-card: 0 10px 26px rgba(30, 41, 59, 0.07);
    }

    body {
        background:
            radial-gradient(circle at 86% 12%, rgba(96, 165, 250, 0.14), transparent 28%),
            linear-gradient(135deg, #f8fbff 0%, #eef4fb 46%, #f6f9fd 100%);
    }

    a {
        color: var(--primary-strong);
    }

    .main {
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(246, 249, 253, 0.96));
    }

    .panel,
    .doc-action-card,
    .stat-card,
    .modern-card,
    .glass-card,
    .document-preview-shell,
    .accounting-action-grid .doc-action-card {
        border-color: rgba(216, 226, 239, 0.88) !important;
        box-shadow: var(--shadow-card) !important;
    }

    .panel .panel,
    .panel .doc-action-card,
    .panel .modern-card,
    .panel .glass-card,
    .document-preview-shell .panel,
    .document-paper .panel,
    .table-shell .panel {
        box-shadow: none !important;
    }

    .button,
    button.button,
    .mobile-action {
        min-height: 40px;
        border-radius: var(--radius-inner);
        border-color: var(--primary);
        background: var(--primary);
        color: #ffffff;
        box-shadow: none;
        white-space: nowrap;
    }

    .button:hover,
    button.button:hover,
    .mobile-action:hover {
        border-color: var(--primary-strong);
        background: var(--primary-strong);
        color: #ffffff;
    }

    .button.secondary,
    .button.ghost,
    a.button.secondary,
    a.button.ghost {
        border-color: var(--line);
        background: #ffffff;
        color: var(--text);
    }

    .button.secondary:hover,
    .button.ghost:hover,
    a.button.secondary:hover,
    a.button.ghost:hover {
        border-color: rgba(37, 99, 235, 0.38);
        background: #f8fbff;
        color: var(--primary-strong);
    }

    .button.danger,
    button.danger,
    .danger {
        border-color: #dc2626;
        background: #dc2626;
        color: #ffffff;
    }

    .sidebar {
        background: rgba(255, 255, 255, 0.72);
        border-color: rgba(216, 226, 239, 0.9);
        box-shadow: none;
    }

    .sidebar nav,
    .main-nav {
        gap: 4px;
    }

    .sidebar nav a,
    .main-nav a {
        min-height: 44px;
        border: 1px solid transparent !important;
        border-radius: 10px !important;
        background: transparent !important;
        box-shadow: none !important;
        color: #334155;
        font-weight: 760;
        letter-spacing: 0;
    }

    .sidebar nav a:hover,
    .main-nav a:hover {
        border-color: rgba(37, 99, 235, 0.14) !important;
        background: rgba(239, 246, 255, 0.72) !important;
        color: var(--primary-strong) !important;
    }

    .sidebar nav a.active,
    .main-nav a.active {
        border-color: var(--primary) !important;
        background: var(--primary) !important;
        color: #ffffff !important;
    }

    .nav-icon,
    .sidebar nav a.active .nav-icon,
    .main-nav a.active .nav-icon,
    .sidebar nav a:hover .nav-icon,
    .main-nav a:hover .nav-icon {
        width: 24px !important;
        height: 24px !important;
        min-width: 24px !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        color: currentColor !important;
    }

    .nav-icon svg {
        width: 20px !important;
        height: 20px !important;
        stroke-width: 1.85;
    }

    .subnav,
    .employees-subnav,
    .accounting-subnav,
    .stock-subnav,
    .material-subnav,
    .payroll-subnav {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 6px;
        max-width: 100%;
        margin: 0 0 18px;
        padding: 0 0 8px;
        overflow-x: auto;
        overflow-y: hidden;
        border-bottom: 1px solid rgba(216, 226, 239, 0.92);
        background: transparent;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    .subnav a,
    .employees-subnav a,
    .accounting-subnav a,
    .stock-subnav a,
    .material-subnav a,
    .payroll-subnav a {
        flex: 0 0 auto;
        min-height: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0 12px;
        border: 1px solid #e2e8f0 !important;
        border-bottom: 2px solid transparent !important;
        border-radius: var(--radius-inner) !important;
        background: #f1f5f9 !important;
        box-shadow: none !important;
        color: #475569;
        font-weight: 760;
        line-height: 1;
        white-space: nowrap;
    }

    .subnav a:hover,
    .employees-subnav a:hover,
    .accounting-subnav a:hover,
    .stock-subnav a:hover,
    .material-subnav a:hover,
    .payroll-subnav a:hover {
        border-color: #dbe6f3 !important;
        border-bottom-color: var(--primary) !important;
        background: #f8fbff !important;
        color: var(--primary-strong) !important;
    }

    .subnav a.active,
    .employees-subnav a.active,
    .accounting-subnav a.active,
    .stock-subnav a.active,
    .material-subnav a.active,
    .payroll-subnav a.active {
        border-color: var(--primary) !important;
        border-bottom-color: var(--primary) !important;
        background: var(--primary) !important;
        color: #ffffff !important;
    }

    .doc-action-card:hover,
    .stat-card:hover,
    tbody tr:hover {
        border-color: rgba(37, 99, 235, 0.22) !important;
    }

    tbody tr:hover {
        background: rgba(37, 99, 235, 0.035) !important;
    }

    .line-chart span {
        background: linear-gradient(180deg, var(--primary), var(--blue));
        box-shadow: 0 10px 20px rgba(37, 99, 235, 0.16);
    }

    .donut,
    .status-donut,
    .sales-donut {
        border-radius: 999px !important;
        background:
            radial-gradient(circle at center, #ffffff 0 34%, transparent 35%),
            conic-gradient(var(--primary) 0 28%, #8fc6f1 28% 62%, #d9efff 62% 82%, #edf3fa 82% 100%) !important;
    }

    .legend-red {
        background: var(--primary) !important;
    }

    .mobile-menu-toggle,
    .mobile-drawer-backdrop {
        display: none;
    }
}

@media screen and (max-width: 760px) {
    body {
        display: block;
        padding: 0;
        overflow-x: hidden;
    }

    .mobile-bar {
        position: sticky;
        top: 0;
        z-index: 65;
        display: grid !important;
        grid-template-columns: 42px minmax(0, 1fr) auto;
        align-items: center;
        gap: 10px;
        width: 100%;
        min-height: 64px;
        padding: 10px 14px;
        border-bottom: 1px solid rgba(216, 226, 239, 0.9);
        background: rgba(248, 251, 255, 0.94);
        backdrop-filter: blur(18px);
        box-shadow: 0 10px 24px rgba(30, 41, 59, 0.06);
    }

    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border: 1px solid rgba(216, 226, 239, 0.95);
        border-radius: 10px;
        background: #ffffff;
        color: var(--text);
        box-shadow: none;
    }

    .mobile-menu-toggle svg {
        width: 21px;
        height: 21px;
    }

    .compact-brand {
        min-width: 0;
        gap: 8px;
    }

    .compact-brand span:last-child {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-action {
        min-height: 40px;
        padding: 0 12px;
        border-radius: 10px;
        font-size: 13px;
    }

    .sidebar {
        position: fixed !important;
        inset: 0 auto 0 0 !important;
        z-index: 80 !important;
        width: min(84vw, 330px) !important;
        height: 100dvh !important;
        min-height: 100dvh !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
        padding: 18px 14px !important;
        border-radius: 0 18px 18px 0 !important;
        border: 0 !important;
        border-right: 1px solid rgba(216, 226, 239, 0.94) !important;
        background: rgba(255, 255, 255, 0.96) !important;
        box-shadow: 24px 0 54px rgba(15, 23, 42, 0.16) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        transform: translateX(-105%);
        transition: transform 0.22s ease;
    }

    body.mobile-menu-open .sidebar {
        transform: translateX(0);
    }

    .sidebar > .brand,
    .sidebar-footer {
        display: flex !important;
    }

    .sidebar nav,
    .main-nav {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 4px !important;
        overflow: visible !important;
        padding: 0 !important;
    }

    .sidebar nav a,
    .main-nav a {
        width: auto !important;
        min-width: 0 !important;
        height: auto !important;
        min-height: 44px !important;
        flex: initial !important;
        justify-content: flex-start !important;
        padding: 0 12px !important;
    }

    .sidebar nav a span:last-child,
    .main-nav a span:last-child {
        display: inline !important;
    }

    .mobile-drawer-backdrop {
        position: fixed;
        inset: 0;
        z-index: 70;
        display: block;
        background: rgba(15, 23, 42, 0.34);
        opacity: 0;
        pointer-events: none;
        backdrop-filter: blur(2px);
        transition: opacity 0.18s ease;
    }

    body.mobile-menu-open .mobile-drawer-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .main {
        width: 100%;
        min-width: 0;
        padding: 16px 12px 28px !important;
    }

    .topbar {
        gap: 12px;
        margin-top: 0;
    }

    .top-actions {
        width: 100%;
        display: grid;
        grid-template-columns: minmax(0, 1fr) 40px 40px 44px;
        gap: 8px;
        align-items: center;
    }

    .company-badge {
        min-width: 0;
    }

    .search-pill {
        grid-column: 1 / -1;
        order: 2;
        width: 100%;
    }

    .subnav,
    .employees-subnav,
    .accounting-subnav,
    .stock-subnav,
    .material-subnav,
    .payroll-subnav {
        margin-left: -12px;
        margin-right: -12px;
        padding: 0 12px 8px;
    }
}
