:root {
    --color-bg: #f4f6f3;
    --color-text: #182a2b;
    --color-muted: #526365;
    --color-border: #dde5df;
    --color-success: #19724f;
    --color-danger: #b62935;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px #182a2b0b, 0 4px 14px #182a2b06;
    --shadow-md: 0 12px 34px #182a2b1a;
    --workspace-ink: #162c2d;
    --mobile-nav-height: 62px;
}

body { font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif; }
.workspace a, .pos-body a { text-underline-offset: .17em; }
.workspace h1 { font-size: clamp(1.55rem, 2.4vw, 2.12rem); line-height: 1.16; font-weight: 750; letter-spacing: -.036em; }
.workspace .section-title { font-size: 1.18rem; line-height: 1.25; letter-spacing: -.015em; }
.workspace :is(.stat-value, .table, .cash-line) { font-variant-numeric: tabular-nums; }
.workspace .page-head { gap: 14px; margin-bottom: 20px; }
.workspace .page-head h1 { margin-bottom: 4px; }
.workspace :is(.page-head, .filters, .form-actions) > :is(button, .btn) { min-height: 44px; }
.workspace .form-actions { flex-wrap: wrap; }
.workspace .form { max-width: min(100%, 36rem); }
.workspace .form-hint { margin: 6px 0 0; font-size: .88rem; }
.workspace .settings-form .form-section { margin-bottom: 10px; }
.workspace .settings-form .form-section:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.workspace :is(input, select, textarea) { min-width: 0; }
.workspace .content { margin-inline: auto; max-width: 1460px; padding: clamp(20px, 3.2vw, 42px); }
.workspace .content:focus { outline: none; }
.workspace .main { min-width: 0; }
.workspace .shell { grid-template-columns: 246px minmax(0, 1fr); }

.workspace-skip { position: fixed; top: 10px; left: 12px; z-index: 65; transform: translateY(-160%); }
.workspace-skip:focus { transform: none; padding: 10px 14px; border-radius: 8px; background: #fff; }

.topbar { min-height: 65px; padding: 10px clamp(20px, 3.2vw, 42px); background: #fbfcfa; }
.topbar .user, .pos-top .user { min-width: 0; }
.topbar .who { max-width: 190px; font-size: .9rem; }
.topbar .who :is(strong, span) { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.topbar .btn-ghost, .pos-top .btn-ghost, .menu-btn { min-width: 44px; min-height: 44px; padding: 8px 10px; }
.workspace-section { min-width: 0; overflow: hidden; color: var(--color-muted); font-weight: 650; white-space: nowrap; text-overflow: ellipsis; font-size: .9rem; }
.workspace-mobile-context { display: none; }
.topbar-print { min-height: 42px; padding-inline: 11px; color: var(--color-primary-ink); border-color: var(--color-primary-soft); }
.topbar-print .icon { flex-shrink: 0; }
.avatar { flex: none; font-weight: 750; }

#site-sidebar {
    padding: 17px 12px 24px;
    color: #eaf2ed;
    background: var(--workspace-ink);
    border-right-color: #203b3b;
    overscroll-behavior: contain;
    scrollbar-color: #586d68 var(--workspace-ink);
}
.sidebar-heading { display: flex; align-items: center; gap: 5px; margin: 0 1px 16px; }
#site-sidebar .brand { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 3px; text-decoration: none; color: #fff; line-height: 1.25; letter-spacing: -.02em; overflow-wrap: anywhere; }
#site-sidebar .brand::before { display: none; }
.brand-mark { display: grid; flex: none; width: 37px; height: 37px; place-items: center; border-radius: 11px; color: var(--color-primary-ink); background: var(--color-primary-soft); }
.brand-mark .icon { width: 20px; height: 20px; }
.sidebar-close { display: none; margin: 0 0 0 auto; min-width: 42px; min-height: 42px; padding: 9px; border: 0; background: transparent; color: #edf4f0; }
.sidebar-close:hover { background: #ffffff15; }
.sidebar-search { position: relative; margin: 0 0 14px; }
.sidebar-search > .icon { position: absolute; top: 12px; left: 11px; width: 17px; height: 17px; color: #c1d1cd; pointer-events: none; }
.sidebar-search input { min-height: 42px; padding: 8px 10px 8px 36px; border-color: #ffffff27; background: #ffffff11; color: #fff; }
.sidebar-search input::placeholder { color: #c2d0cb; }
.sidebar-search input::-webkit-search-cancel-button { filter: brightness(0) invert(1); }
#site-sidebar :focus-visible { outline-color: #f4fbf6; outline-offset: 2px; }
.nav-primary { margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid #ffffff22; }
#site-sidebar .nav a { min-height: 42px; padding: 8px 10px; margin: 2px 0; gap: 10px; color: #d5e3dc; font-size: .9rem; }
#site-sidebar .nav a .icon { width: 18px; height: 18px; }
#site-sidebar .nav a:hover, .nav-group summary:hover { color: #fff; background: #ffffff13; }
#site-sidebar .nav a.active { color: #fff; background: #ffffff20; font-weight: 700; box-shadow: inset 3px 0 0 color-mix(in srgb, var(--color-primary) 49%, #d4e8dc); }
.nav-group { margin: 2px 0; }
.nav-group summary { display: flex; justify-content: space-between; align-items: center; gap: 9px; min-height: 40px; padding: 6px 9px; border-radius: 8px; list-style: none; cursor: pointer; font-size: .82rem; font-weight: 650; color: #c0d1c9; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary .icon { width: 15px; height: 15px; transition: transform .16s; }
.nav-group[open] summary .icon { transform: rotate(180deg); }
#site-sidebar .nav-group a { padding-left: 17px; }
.sidebar-empty { padding: 0 9px; color: #d5e3dc; font-size: .875rem; }
#site-sidebar [hidden], .report-directory [hidden] { display: none; }
.workspace .mobile-nav { display: none; }
.pos-shell .sidebar-close { display: inline-flex; }
.pos-shell #site-sidebar { width: min(298px, 88vw); }
.pos-body.nav-open, .workspace.nav-open { overflow: hidden; }
body.nav-open :is(.shell, .pos-shell) > .overlay { z-index: 40; background: #0d202299; }
body.nav-open :is(.shell, .pos-shell) > #site-sidebar { z-index: 45; }

.workspace .stat { box-shadow: var(--shadow-sm); }
.workspace .stat-value { letter-spacing: -.036em; }
.workspace .table th { background: #f0f4f0; color: #3c5152; }
.workspace .table tbody tr:nth-child(even) { background: #fafcf9; }
.workspace .table tbody tr:hover { background: #f2f7f2; }
.workspace .table td .cell { overflow-wrap: break-word; }
.workspace .filters { padding: 12px; border: 1px solid var(--color-border); border-radius: var(--radius); background: #fbfcfa; }
.workspace .filters :is(input, select, button) { min-height: 44px; }
.workspace .filters > :is(input[type="search"], input[type="text"]) { flex-basis: 13rem; min-width: min(100%, 13rem); }
.workspace .filters > input[type="date"] { flex: 1 1 10rem; min-width: min(100%, 10rem); }
.workspace .filters > select { min-width: min(100%, 10rem); max-width: 100%; }
.workspace .tabs a { min-height: 42px; display: inline-flex; align-items: center; }
.workspace .icon-btn { min-width: 38px; min-height: 38px; }

.auth-page {
    background: radial-gradient(ellipse at 10% 5%, #e8eeea, transparent 47%), radial-gradient(ellipse at 92% 92%, #e0eae3, transparent 45%), var(--color-bg);
}
.auth-card { max-width: 450px; padding: clamp(24px, 6vw, 42px); border-radius: 22px; box-shadow: 0 24px 68px #19333418; }
.auth-identity { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; color: var(--color-muted); overflow-wrap: anywhere; }
.auth-card h1 { margin-bottom: 20px; font-size: 2rem; font-weight: 750; letter-spacing: -.04em; }
.auth-card form button { min-height: 46px; margin-top: 24px; }

.report-directory > .page-head { gap: 18px; align-items: end; }
.report-lookup { position: relative; display: block; width: min(100%, 320px); margin: 0; }
.report-lookup > .icon { position: absolute; top: 13px; left: 12px; width: 17px; height: 17px; color: var(--color-muted); pointer-events: none; }
.report-lookup input { min-height: 44px; padding-left: 38px; }
.report-section { margin: 0 0 24px; }
.report-section h2 { margin: 0 0 10px; font-size: 1.1rem; font-weight: 750; letter-spacing: -.02em; }
.report-directory .report-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 12px; margin-bottom: 0; }
.report-directory .report-card { display: grid; grid-template-columns: 36px minmax(0, 1fr) 17px; align-items: start; gap: 11px; border-radius: 13px; padding: 15px; }
.report-directory .report-card[hidden] { display: none; }
.report-directory .report-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 10px; background: var(--color-primary-soft); }
.report-directory .report-icon .icon, .report-card-arrow .icon { width: 17px; height: 17px; }
.workspace .report-filters { align-items: end; }
:is(.report-filter-field, .sales-filter-field) {
    display: grid; gap: 4px; flex: 1 1 152px; min-width: min(100%, 152px); margin: 0; font-weight: 400;
}
:is(.report-filter-field, .sales-filter-field) > label { margin: 0; color: var(--color-muted); font-size: .82rem; font-weight: 650; }
.workspace .filters :is(.report-filter-field, .sales-filter-field) > :is(input[type="date"], input[type="search"], select) { width: 100%; min-width: 0; }
.report-filter-search { flex-basis: 220px; }
.workspace .sales-filters { display: grid; }
.sales-filter-row { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; min-width: 0; }
.sales-filter-search { flex-basis: 14rem; min-width: min(100%, 14rem); }
.sales-filter-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sales-filter-actions > :is(button, a) { min-height: 44px; margin: 0; }

@media (min-width: 641px) {
    .workspace-report .table td .cell { overflow-wrap: normal; }
    .workspace #return-form .table select { width: auto; }
}

@media (min-width: 641px) and (max-width: 800px) {
    .workspace #return-form .table :is(th, td) { padding-inline: 8px; }
}

@media (max-width: 640px) {
    .workspace .filters > :is(input[type="search"], input[type="text"]) { flex-basis: 100%; }
    .workspace .filters > input[type="date"] { flex: 1 1 calc(50% - 5px); min-width: min(100%, 152px); }
    .workspace .table td .cell { overflow-wrap: anywhere; }
    .report-filter-field { flex-basis: calc(50% - 5px); }
    .report-filter-search { flex-basis: 100%; }
    .sales-filter-search { flex-basis: 100%; }
    .sales-filter-actions { flex: 1 1 100%; }
}
@media (max-width: 350px) {
    .workspace-report .topbar .user { display: none; }
}
.report-card-copy { display: grid; gap: 3px; }
.report-card-copy strong { line-height: 1.3; }
.report-card-copy .muted { font-size: .82rem; line-height: 1.42; }
.report-card-arrow { color: var(--color-muted); margin-top: 3px; }

.register-day-denominations { padding: 0 12px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
.register-day-denominations > summary { min-height: 44px; padding-block: 11px; cursor: pointer; }
.register-day-denominations .setup { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.register-day-denominations .setup label { margin-top: 0; }

@media (max-width: 1024px) {
    .workspace .shell { grid-template-columns: minmax(0, 1fr); }
    .workspace-mobile-context { display: block; }
    #site-sidebar { width: min(298px, 88vw); }
    .sidebar-close { display: inline-flex; }
}

@media (max-width: 800px) {
    .workspace .content { padding: 22px 16px calc(24px + var(--mobile-nav-height) + env(safe-area-inset-bottom, 0px)); }
    .workspace .topbar { min-height: 58px; padding: 7px 12px; gap: 8px; }
    .workspace .mobile-nav {
        display: flex; position: fixed; inset: auto 0 0; z-index: 12;
        align-items: stretch; justify-content: space-around; min-height: var(--mobile-nav-height);
        padding: 3px 5px env(safe-area-inset-bottom, 0px); gap: 1px;
        background: #fbfcfa; border-top: 1px solid var(--color-border);
        box-shadow: 0 -3px 15px #182a2b10;
    }
    .mobile-nav :is(a, button) {
        display: flex; flex: 1 1 0; flex-direction: column; align-items: center; justify-content: center; min-width: 0; min-height: 56px;
        gap: 3px; margin: 0; padding: 4px 2px; border: 0; border-radius: 9px; background: transparent; color: var(--color-muted);
        font-size: .71rem; font-weight: 650; text-decoration: none;
    }
    .mobile-nav :is(a, button):hover { background: #edf3ed; color: var(--color-text); }
    .mobile-nav [aria-current="page"] { color: var(--color-primary-ink); background: var(--color-primary-soft); font-weight: 750; }
    .mobile-nav .icon { width: 19px; height: 19px; }
    .workspace .icon-btn { min-width: 44px; min-height: 44px; }
    .workspace .form-actions { gap: 6px 12px; }
    .workspace .form-actions > a:not(.btn) { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 8px; }
    .workspace .table td[data-label]::before { flex: 0 1 44%; overflow-wrap: anywhere; }
}

@media (max-width: 560px) {
    .workspace-report .workspace-section { display: none; }
    .workspace .card:not(.table-wrap):not(.dashboard-metric) { padding: 16px; }
    .workspace .photo-current { flex-wrap: wrap; }
    #return-form .seg { max-width: 100%; }
    #return-form .seg-btn { white-space: normal; }
    .report-directory > .page-head { align-items: stretch; }
    .report-lookup { width: 100%; }
    .report-section { margin-bottom: 20px; }
    .report-directory .report-card { padding: 13px; }
    .pos-top .pos-branch { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
    #site-sidebar, .nav-group summary .icon { transition: none; }
}
