/* ============================================================
   Lightswitch POS — theme
   From the Lightswitch brand (brand/logo-concepts.html): Ink sidebar,
   green for systems and actions, orange as the "switched on" accent,
   Sora for headings and figures, DM Sans for text. The brand greens are
   stepped darker where they carry white text (5.1:1) or sit as text.
   ============================================================ */
:root {
    --bg: #F5F8F6;
    --surface: #FFFFFF;
    --surface-2: #F9FBFA;

    --sidebar: #0B2E1C;      /* brand Ink */
    --sidebar-2: #0E3A24;
    --sidebar-text: #B5CCBE;
    --sidebar-muted: #8AAB97;

    --brand-green: #119447;  /* logo green: marks, icons, large fills */
    --brand-orange: #FF7A1A; /* logo orange: indicators, never text on light */
    --brand-orange-ink: #B84A00;

    --primary: #0E7F3B;      /* brand green stepped for white text */
    --primary-rgb: 14, 127, 59;
    --primary-600: #0C7235;
    --primary-700: #0A6530;  /* brand Deep Green */
    --accent: #0E7F3B;       /* positive money */
    --success: #15803D;
    --danger: #E5484D;
    --warning: #F5A524;

    --ink: #13251B;
    --ink-2: #33463A;
    --muted: #56685D;        /* 5.6:1 on --bg, 5.9:1 on cards */
    --line: #E0E8E3;
    --link: #0A6530;
    --line-soft: #EEF3F0;
    --line-strong: #CCD8D0;
    --hover: #F2F7F4;

    /* tinted backgrounds and the text that sits on them */
    --tint-primary: #E6F4EC;
    --tint-danger: #FDECEC;
    --tint-success: #E3F5EA;
    --tint-warning: #FEF3E2;
    --danger-ink: #B4272C;
    --success-ink: #17703F;
    --warning-ink: #B5740F;

    --skel-a: #ECF1EE;
    --skel-b: #F5F8F6;
    --toast-bg: #0B2E1C;

    --font-display: 'Sora', 'Segoe UI', system-ui, sans-serif;
    --font-body: 'DM Sans', 'Segoe UI', system-ui, sans-serif;

    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow: 0 1px 3px rgba(16, 24, 40, .04), 0 10px 26px rgba(16, 24, 40, .07);

    --bs-primary: #0E7F3B;
    --bs-primary-rgb: 14, 127, 59;
    --bs-link-color: #0A6530;
    --bs-link-color-rgb: 10, 101, 48;
    --bs-link-hover-color: #07552A;
    --bs-body-color: #13251B;
    --bs-border-color: #E0E8E3;
    --bs-body-font-family: var(--font-body);
}

/* ---------- Dark theme ----------
   Set by the inline script in App.razor (data-theme + data-bs-theme on <html>)
   from the saved choice, or the OS setting when the choice is "auto". Its own
   steps, not an inversion: surfaces stay distinguishable and text keeps contrast. */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0B1510;
    --surface: #12211A;
    --surface-2: #172A21;

    --sidebar: #07110C;
    --sidebar-2: #0B1A13;

    --brand-orange-ink: #FF9A52;

    --primary: #0E7F3B;       /* white button text stays at 5.1:1 */
    --primary-600: #0C7235;   /* hover fill under white text */
    --primary-700: #7FDCA3;   /* used as text on tints: needs to be light here */
    --accent: #4CD082;
    --success: #15803D;

    --ink: #E6EFE9;
    --ink-2: #C3D3C9;
    --muted: #9DB1A5;
    --line: #24382D;
    --link: #4CD082;
    --line-soft: #1B2C23;
    --line-strong: #34503F;
    --hover: #193026;

    --tint-primary: #153D27;
    --tint-danger: #3A1D24;
    --tint-success: #14382A;
    --tint-warning: #3A2C12;
    --danger-ink: #FF9EA2;
    --success-ink: #7BE0A6;
    --warning-ink: #F5C46B;

    --skel-a: #1A2B22;
    --skel-b: #22372B;
    --toast-bg: #1E3A2B;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 10px 26px rgba(0, 0, 0, .35);

    --bs-primary: #0E7F3B;
    --bs-primary-rgb: 14, 127, 59;
    --bs-link-color: #4CD082;
    --bs-link-color-rgb: 76, 208, 130;
    --bs-link-hover-color: #7FDCA3;
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--surface);      /* Bootstrap paints form fields with this */
    --bs-border-color: var(--line);
    --bs-secondary-color: var(--muted);
    --bs-tertiary-bg: var(--surface-2);

    /* charts: the validated dark steps of the same categorical palette */
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
    --series-other: #6E8577;
    /* sequential: near-zero recedes into the dark surface, high values are brightest */
    --seq-1: #133524; --seq-2: #175A35; --seq-3: #1B7442; --seq-4: #249A57; --seq-5: #4CC27C; --seq-6: #93E2B0;
    --hm-empty: #1A2B22;
    --flow-charged: #9DB1A5;
    --chart-grid: #21352A;
}
:root[data-theme="dark"] .text-muted { color: var(--muted) !important; }
:root[data-theme="dark"] .table-light, :root[data-theme="dark"] .table-light th { color: var(--ink-2); }
:root[data-theme="dark"] .btn-close { filter: invert(1) grayscale(1) brightness(1.6); }

html, body {
    font-family: var(--font-body);
    background-color: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
h1:focus, h1:focus-visible { outline: none; }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--primary-700); }

/* tabular figures for anything money-like */
.num, td.text-end, .fw-bold, .fs-3, .fs-5 { font-variant-numeric: tabular-nums; }
/* DM Sans has no tabular figures, so money and counts are set in Sora, which does. */
.num, td.text-end, .fs-3, .fs-5, .kpi-value, .change-due, .cart-total-row .num { font-family: var(--font-display); }
td.text-end .btn, td.text-end .badge { font-family: var(--font-body); }

/* ---------- Buttons ---------- */
.btn { border-radius: var(--radius-sm); font-weight: 600; padding: .5rem .9rem; }
.btn-lg { padding: .7rem 1.2rem; }
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 6px 16px rgba(var(--primary-rgb), .25);
}
/* Hover darkens in both themes (--primary-700 is a light text colour in dark mode). */
.btn-primary:hover, .btn-primary:focus, .btn-primary:active { background-color: var(--primary-600); border-color: var(--primary-600); }
.btn-success { background-color: var(--success); border-color: var(--success); }
.btn-outline-secondary { color: var(--ink-2); border-color: var(--line); }
.btn-outline-secondary:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line-strong); }
.btn:focus, .btn:active:focus, .form-control:focus, .form-select:focus, .form-check-input:focus {
    box-shadow: 0 0 0 .2rem rgba(var(--primary-rgb), .18);
    border-color: var(--primary);
}

/* Bootstrap parts whose blue is compiled in rather than read from --bs-primary. */
.btn-outline-primary {
    --bs-btn-color: var(--link); --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary); --bs-btn-hover-border-color: var(--primary); --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--primary-600); --bs-btn-active-border-color: var(--primary-600); --bs-btn-active-color: #fff;
}
.btn-link { --bs-btn-color: var(--link); --bs-btn-hover-color: var(--primary-700); --bs-btn-active-color: var(--primary-700); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-switch .form-check-input:focus:not(:checked) {
    --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%230E7F3B'/%3e%3c/svg%3e");
}
.nav-pills { --bs-nav-pills-link-active-bg: var(--primary); --bs-nav-link-color: var(--link); --bs-nav-link-hover-color: var(--primary-700); }
.list-group { --bs-list-group-active-bg: var(--primary); --bs-list-group-active-border-color: var(--primary); }
:root { --bs-focus-ring-color: rgba(var(--primary-rgb), .25); }

/* ---------- Cards ---------- */
.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: var(--surface);
}
.card.shadow-sm { box-shadow: var(--shadow) !important; }
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
    padding: .9rem 1.1rem;
}
.card-footer { background: var(--surface-2); border-top: 1px solid var(--line); }

/* ---------- Forms ---------- */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--line);
    padding: .55rem .8rem;
    background-color: var(--surface);
}
.form-label { font-weight: 600; font-size: .82rem; color: var(--ink-2); margin-bottom: .3rem; }
.input-group-text { background: var(--surface-2); border-color: var(--line); color: var(--muted); border-radius: var(--radius-sm); }

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; color: var(--ink); }
.table > thead th {
    text-transform: uppercase;
    font-size: .72rem;
    letter-spacing: .04em;
    color: var(--muted);
    font-weight: 600;
    border-bottom: 1px solid var(--line);
}
.table > tbody td { border-color: var(--line-soft); padding-top: .7rem; padding-bottom: .7rem; }
.table-hover > tbody > tr:hover > * { background-color: var(--hover); }
.table-light, .table-light th { background-color: var(--surface-2) !important; }

/* code chips (item numbers) */
code { color: var(--primary-700); background: var(--tint-primary); padding: .1rem .4rem; border-radius: 6px; font-size: .82em; }

.alert-light { border: 1px solid var(--line); }

/* page heading helper */
.page-title { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; letter-spacing: -.02em; }

/* ============================================================
   App shell
   ============================================================ */
.page { display: flex; flex-direction: column; min-height: 100vh; }

.sidebar {
    background: var(--sidebar);
    background-image: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
}

.app-topbar {
    height: 64px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
}

.content { padding: 1.5rem; }

@media (min-width: 768px) {
    .page { flex-direction: row; }
    .sidebar { width: 256px; height: 100vh; position: sticky; top: 0; flex-shrink: 0; }
    main { flex: 1; min-width: 0; }
    .app-topbar { position: sticky; top: 0; z-index: 5; }
    .content { padding: 1.75rem 2rem; }
}

/* ---------- Sidebar brand + nav ---------- */
.brand {
    display: flex; align-items: center;
    padding: 1.1rem 1.35rem; text-decoration: none;
}
.brand img { display: block; height: 42px; width: auto; max-width: 100%; }

.nav-section { color: var(--sidebar-muted); font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding: 1rem 1.6rem .35rem; }

.nav-scrollable { overflow-y: auto; height: calc(100vh - 70px); padding-bottom: 1rem; }

.sidebar .nav-link {
    color: var(--sidebar-text);
    display: flex; align-items: center; gap: .8rem;
    padding: .6rem .85rem; margin: .12rem .75rem; border-radius: var(--radius-sm);
    font-weight: 500; font-size: .92rem; white-space: nowrap;
}
.sidebar .nav-link .bi { font-size: 1.15rem; opacity: .9; }
.sidebar .nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar .nav-link.active {
    background: var(--primary);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--brand-orange), 0 8px 18px rgba(0, 0, 0, .25); /* orange = switched on */
}
.sidebar .nav-link.active .bi { opacity: 1; }

.sidebar-user { border-top: 1px solid rgba(255, 255, 255, .07); margin-top: .5rem; padding: .85rem 1rem; }
.sidebar-user .nav-link { margin: 0; }
.sidebar form button.nav-link { width: 100%; background: none; border: 0; text-align: left; }

/* topbar user chip */
.user-chip { display: flex; align-items: center; gap: .6rem; color: var(--ink); font-weight: 600; }
.user-chip .avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--brand-green));
    color: #fff; display: grid; place-items: center; font-size: .85rem; font-weight: 700;
}

/* ============================================================
   Sale / register — the signature screen
   ============================================================ */
.pos-layout { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
@media (min-width: 992px) { .pos-layout { grid-template-columns: minmax(0, 1fr) 390px; } }

.cat-pills { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .25rem; }
.cat-pill {
    border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
    border-radius: 999px; padding: .45rem .95rem; font-weight: 600; font-size: .85rem;
    white-space: nowrap; cursor: pointer;
}
.cat-pill:hover { border-color: var(--line-strong); }
.cat-pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .9rem; }
.product-card {
    border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
    padding: .85rem; cursor: pointer; text-align: left;
    transition: transform .08s ease, box-shadow .15s ease, border-color .15s ease;
    display: flex; flex-direction: column; gap: .5rem;
}
.product-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-2px); }
.product-thumb {
    aspect-ratio: 1 / 1; border-radius: var(--radius-sm); display: grid; place-items: center;
    font-size: 1.6rem; font-weight: 700; color: #fff;
}
.product-name { font-weight: 600; font-size: .9rem; line-height: 1.2; }
.product-meta { color: var(--muted); font-size: .76rem; }
.product-price { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.stock-pill {
    font-size: .72rem; font-weight: 700; padding: .1rem .45rem; border-radius: 999px;
    background: var(--tint-success); color: var(--success); font-variant-numeric: tabular-nums;
}
.stock-pill.low { background: var(--tint-warning); color: var(--warning-ink); }
.stock-pill.out { background: var(--tint-danger); color: var(--danger); }

/* cart rail: scrolls within the viewport so the checkout bar is always reachable */
.cart-rail { position: sticky; top: 84px; }
@media (min-width: 992px) {
    .cart-rail { max-height: calc(100vh - 100px); overflow-y: auto; overscroll-behavior: contain; }
}
.cart-scroll { max-height: 34vh; overflow-y: auto; }
.cart-line { display: flex; align-items: center; gap: .5rem; padding: .5rem 0; border-bottom: 1px solid var(--line-soft); border-radius: 8px; }
.cart-line:last-child { border-bottom: 0; }
.cart-line .min-w-0 { min-width: 0; }
.cart-qty { width: 4.5rem; }
.line-total { width: 5rem; text-align: right; }
.line-discount { display: inline-block; width: 2.6rem; border: 0; border-bottom: 1px dashed var(--line); padding: 0; background: transparent; color: var(--muted); }

/* scan feedback: the changed line glows briefly (two names so re-adding restarts it) */
.cart-line.flash-a { animation: line-flash-a 1.1s ease-out; }
.cart-line.flash-b { animation: line-flash-b 1.1s ease-out; }
@keyframes line-flash-a { from { background: var(--tint-success); } to { background: transparent; } }
@keyframes line-flash-b { from { background: var(--tint-success); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) {
    .cart-line.flash-a, .cart-line.flash-b { animation: none; background: var(--tint-success); }
}

/* touch targets: 44px minimum for anything tapped mid-sale */
.pos-touch { min-height: 44px; min-width: 44px; }
.qty-stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.qty-btn { width: 40px; height: 44px; border: 0; background: var(--surface-2); color: var(--ink-2); }
.qty-btn:hover { background: var(--tint-primary); color: var(--primary-700); }
.qty-input { width: 3rem; height: 44px; border: 0; text-align: center; font-weight: 700; -moz-appearance: textfield; }
.qty-input::-webkit-outer-spin-button, .qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.line-remove { width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); border-radius: var(--radius-sm); flex: none; }
.line-remove:hover { background: var(--tint-danger); color: var(--danger); }
.line-remove.sm { width: 36px; height: 36px; }
.qty-btn:focus-visible, .line-remove:focus-visible, .keypad-key:focus-visible, .quick-cash-btn:focus-visible,
.pay-tab:focus-visible, .product-card:focus-visible, .cat-pill:focus-visible, .held-item:focus-visible, .customer-option:focus-visible {
    outline: 2px solid var(--primary); outline-offset: 2px;
}

/* scan bar + shortcut hints */
.scan-bar { max-width: 36rem; }
.shortcut-hints { display: flex; flex-wrap: wrap; gap: .25rem .9rem; margin-top: .4rem; font-size: .74rem; color: var(--muted); }
kbd { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: .05rem .35rem; font-size: .72em; font-family: inherit; font-weight: 700; }
.btn-checkout kbd { background: rgba(255,255,255,.18); color: #fff; border-color: rgba(255,255,255,.35); }
@media (pointer: coarse) { .shortcut-hints, .btn-checkout kbd, label kbd { display: none; } }

/* held orders menu (no Bootstrap JS on the page) */
.held-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 16rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .35rem; }
.held-item { display: flex; justify-content: space-between; gap: 1rem; width: 100%; min-height: 44px; padding: .5rem .7rem; border: 0; background: transparent; border-radius: 8px; text-align: left; }
.held-item:hover { background: var(--surface-2); }

/* customer type-ahead */
.customer-list { position: absolute; left: 0; right: 0; z-index: 20; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-top: 4px; padding: .3rem; max-height: 18rem; overflow-y: auto; }
.customer-option { display: flex; flex-direction: column; align-items: flex-start; width: 100%; min-height: 44px; padding: .45rem .7rem; border: 0; background: transparent; border-radius: 8px; text-align: left; }
.customer-option:hover, .customer-option.active { background: var(--tint-primary); }
.customer-chip { display: flex; align-items: center; gap: .5rem; min-height: 44px; padding: .4rem .75rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }

/* tender */
.quick-cash { display: grid; grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr)); gap: .4rem; }
.quick-cash-btn { min-height: 44px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm); font-weight: 700; color: var(--ink); }
.quick-cash-btn:hover { border-color: var(--primary); color: var(--primary-700); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.keypad-key { min-height: 48px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm); font-size: 1.15rem; font-weight: 700; color: var(--ink); }
.keypad-key:active { background: var(--tint-primary); }
.keypad-key.fn { background: var(--surface-2); color: var(--ink-2); }
.payment-lines { list-style: none; margin: 0; padding: 0; }
.payment-lines li { display: flex; align-items: center; gap: .5rem; padding: .15rem 0; }

/* checkout bar pinned to the bottom of the rail */
.checkout-bar { position: sticky; bottom: 0; background: var(--surface-2); padding: .5rem 0 .25rem; margin-top: .75rem; }

/* phones/tablets: total + jump-to-checkout bar */
.pos-mobile-bar { display: none; }
@media (max-width: 991.98px) {
    .pos-mobile-bar {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-between; align-items: center;
        gap: 1rem; padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line);
        box-shadow: 0 -6px 18px rgba(16, 24, 40, .08); font-size: 1.1rem;
    }
    .pos-layout { padding-bottom: 4.5rem; }
}
.cart-total-row { display: flex; justify-content: space-between; padding: .25rem 0; color: var(--ink-2); }
.cart-total-row.grand { font-size: 1.35rem; font-weight: 800; color: var(--ink); padding-top: .5rem; border-top: 1px dashed var(--line); margin-top: .25rem; font-variant-numeric: tabular-nums; }
.change-due { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }

.btn-checkout {
    width: 100%; border: 0; color: #fff; font-weight: 700; font-size: 1.05rem;
    padding: .85rem; border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary) 0%, var(--brand-green) 100%);
    box-shadow: 0 10px 22px rgba(var(--primary-rgb), .35);
}
.btn-checkout:disabled { opacity: .55; box-shadow: none; }

.pay-tabs { display: flex; gap: .4rem; }
.pay-tab {
    flex: 1; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm);
    padding: .55rem; font-weight: 600; font-size: .85rem; cursor: pointer; text-align: center; color: var(--ink-2);
    min-height: 44px; min-width: 5.5rem;
}
.pay-tab.active { background: var(--tint-primary); border-color: var(--primary); color: var(--primary-700); }

/* empty states */
.empty-state { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.empty-state .bi { font-size: 2rem; opacity: .4; display: block; margin-bottom: .5rem; }

/* ============================================================
   Auth pages (login, forgot/reset password, register…)
   Standalone split-screen layout — NO app sidebar/menu.
   ============================================================ */
.auth-shell { display: flex; min-height: 100vh; background: var(--bg); }

/* left branded hero */
.auth-hero {
    display: none;
    width: 44%;
    max-width: 560px;
    padding: 2.5rem 3rem;
    color: #fff;
    background: radial-gradient(120% 120% at 0% 0%, #14512F 0%, var(--sidebar-2) 38%, var(--sidebar) 100%);
    flex-direction: column;
    position: relative;
    overflow: hidden;
}
.auth-hero::after {
    content: "";
    position: absolute;
    width: 360px; height: 360px;
    right: -120px; bottom: -120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--primary-rgb), .55) 0%, rgba(var(--primary-rgb), 0) 70%);
}
.auth-hero-top { flex: 0 0 auto; }
.auth-hero-body { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; position: relative; z-index: 1; }
.auth-hero-foot { flex: 0 0 auto; color: var(--sidebar-muted); font-size: .8rem; }

.auth-brand { display: block; height: 50px; width: auto; max-width: 100%; }

.auth-hero-body h2 { color: #fff; font-size: 2rem; line-height: 1.15; font-weight: 800; margin-bottom: .9rem; max-width: 18ch; }
.auth-hero-body > p { color: var(--sidebar-text); font-size: 1rem; line-height: 1.6; max-width: 36ch; margin-bottom: 2rem; }

.auth-hero-points { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .9rem; }
.auth-hero-points li { display: flex; align-items: center; gap: .75rem; color: var(--line-strong); font-weight: 500; font-size: .95rem; }
.auth-hero-points .bi {
    flex-shrink: 0; width: 34px; height: 34px; border-radius: 9px;
    display: grid; place-items: center; font-size: 1rem;
    background: rgba(255,255,255,.08); color: var(--brand-orange);
}

/* right form column */
.auth-main { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.auth-card {
    width: 100%;
    max-width: 410px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.25rem 2.1rem;
}

.auth-head { margin-bottom: 1.5rem; }
.auth-head h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: .35rem; }
.auth-sub { color: var(--muted); font-size: .92rem; margin: 0; }

/* input with leading icon */
.auth-input { position: relative; }
.auth-input > .bi { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1rem; pointer-events: none; }
.auth-input .form-control { padding-left: 2.5rem; }

.auth-row { display: flex; align-items: center; justify-content: space-between; }
.auth-remember { display: inline-flex; align-items: center; gap: .45rem; font-size: .88rem; color: var(--ink-2); font-weight: 500; cursor: pointer; }
.auth-row a { font-size: .88rem; font-weight: 600; }

.auth-alt { text-align: center; color: var(--muted); font-size: .9rem; margin-top: 1.5rem; }
.auth-alt a { font-weight: 600; }
.auth-dot { margin: 0 .4rem; color: var(--line); }

@media (min-width: 992px) {
    .auth-hero { display: flex; }
}

/* ---------- Blazor framework bits (kept) ---------- */
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--success); }
.invalid { outline: 1px solid var(--danger); }
.validation-message { color: var(--danger); font-size: .82rem; }

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.blazor-error-boundary {
    background: #b32121; padding: 1rem; color: white; border-radius: var(--radius-sm);
}
.blazor-error-boundary::after { content: "An error has occurred." }

/* ---------- Shared page furniture ---------- */
.min-w-0 { min-width: 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.back-link { display: inline-flex; align-items: center; font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: .2rem; }
.back-link:hover { color: var(--primary-700); }
.skeleton-label { height: .8rem; width: 30%; margin-bottom: .4rem; }
.loading-state .skeleton-row:last-child { margin-bottom: 0; }

/* Whole-row links: the first cell holds a real <a> (keyboard, screen reader,
   open in new tab) whose hit area stretches across the row. */
.table-rowlinks > tbody > tr { position: relative; }
.table-rowlinks a.row-link { color: inherit; font-weight: 600; }
.table-rowlinks a.row-link::after { content: ""; position: absolute; inset: 0; }
.table-rowlinks a.row-link:focus-visible { outline: none; }
.table-rowlinks > tbody > tr:has(a.row-link:focus-visible) { outline: 2px solid var(--primary); outline-offset: -2px; }
.table-rowlinks > tbody > tr:hover a.row-link { color: var(--primary-700); }

/* ---------- Confirmation dialog ---------- */
.confirm-backdrop { position: fixed; inset: 0; background: rgba(11, 46, 28, .45); z-index: 1050; }
.confirm-dialog {
    position: fixed; z-index: 1055; left: 50%; top: 18vh; transform: translateX(-50%);
    width: min(28rem, calc(100vw - 2rem)); background: var(--surface); border-radius: var(--radius);
    box-shadow: 0 24px 60px rgba(16, 24, 40, .25); padding: 1.4rem;
}
.confirm-icon { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--tint-primary); color: var(--primary-700); font-size: 1.2rem; }
.confirm-icon.danger { background: var(--tint-danger); color: var(--danger); }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; right: 1rem; bottom: 1rem; z-index: 1060; display: grid; gap: .5rem; width: min(24rem, calc(100vw - 2rem)); }
.app-toast {
    display: flex; align-items: center; gap: .6rem; padding: .75rem .9rem; border-radius: var(--radius-sm);
    background: var(--toast-bg); color: #fff; box-shadow: var(--shadow); font-weight: 600; font-size: .9rem;
    animation: toast-in .18s ease-out;
}
.app-toast .bi { color: #7BE0A6; }
.app-toast.error { background: #7A1F23; }
.app-toast.error .bi { color: #FFB4B6; }
.app-toast .btn-close { filter: invert(1) grayscale(1) brightness(2); opacity: .7; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .app-toast { animation: none; } }
@media (max-width: 991.98px) { .toast-stack { bottom: 5rem; } } /* clear the register's mobile total bar */

/* ---------- Print: receipt only ---------- */
@media print {
    .sidebar, .app-topbar, .d-print-none { display: none !important; }
    .content { padding: 0 !important; }
    .page { display: block !important; }
    body { background: #fff; }
    .card { box-shadow: none !important; border: none !important; }
    .alert { display: none !important; }
}

/* ============================================================
   Reports & charts
   Categorical slots = validated reference palette (fixed order;
   identity follows payment-method order). Sequential = one blue
   ramp. Text never wears a series color.
   ============================================================ */
:root {
    --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
    --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
    --series-other: #A3B3A9;
    --seq-1: #C2E6CF; --seq-2: #8FD1A7; --seq-3: #5BB97F; --seq-4: #2A9C58; --seq-5: #127A3E; --seq-6: #0A5A2C;
    --hm-empty: var(--line-soft);
    --flow-charged: #6E8075;          /* new debt: neutral ink */
    --flow-collected: var(--accent);  /* money in: the positive-money green */
    --chart-grid: #E8EFEA;
}

/* page header + section tabs */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: .9rem; }
.section-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.1rem; overflow-x: auto; }
.section-tab {
    display: inline-flex; align-items: center; gap: .45rem; padding: .6rem .9rem; color: var(--muted);
    font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.section-tab:hover { color: var(--ink); }
.section-tab.active { color: var(--primary-700); border-bottom-color: var(--primary); }

/* keyboard-reachable row selection */
.row-select:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* filters */
.filter-row { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: flex-end; }
.filter-field { min-width: 9rem; }
.filter-field.grow { flex: 1 1 14rem; }
.chip-group { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.chip-label { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-right: .2rem; }
.chip {
    display: inline-flex; align-items: center; gap: .35rem; min-height: 32px; padding: .2rem .7rem;
    border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2);
    font-size: .82rem; font-weight: 600;
}
.chip:hover { border-color: var(--line-strong); }
.chip.on { background: var(--tint-primary); border-color: var(--primary); color: var(--primary-700); }
.chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; }
.chip .swatch { margin-right: 0; }

/* headline + KPI tiles */
.report-headline { font-size: 1.02rem; color: var(--ink-2); margin-bottom: .9rem; max-width: 70rem; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .9rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; }
.kpi-label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 1.55rem; font-weight: 700; letter-spacing: -.01em; margin-top: .15rem; font-variant-numeric: tabular-nums; }
.kpi-hint, .kpi-delta { font-size: .78rem; color: var(--muted); margin-top: .1rem; }
.kpi-delta.good { color: var(--success); }
.kpi-delta.bad { color: var(--danger); }
.hero-figure { font-size: 2.6rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }

/* skeletons (respect reduced motion) */
.skeleton { background: linear-gradient(90deg, var(--skel-a) 25%, var(--skel-b) 37%, var(--skel-a) 63%); background-size: 400% 100%; border-radius: 8px; animation: skeleton 1.4s ease infinite; }
.skeleton-row { height: 2.2rem; margin-bottom: .5rem; }
.kpi-skel { height: 2rem; margin-top: .4rem; }
.chart-skel { height: 240px; }
.chart-skel.short { height: 160px; }
@keyframes skeleton { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* report layout */
.report-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
@media (min-width: 992px) {
    .report-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .report-grid .span-2 { grid-column: span 2; }
}
.report-table { font-size: .9rem; }

/* charts */
.chart { margin: 0; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .35rem 1rem; margin-bottom: .5rem; font-size: .8rem; color: var(--ink-2); }
.chart-legend .key { display: inline-flex; align-items: center; gap: .4rem; }
.chart-legend .key i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-legend .key.line i { width: 14px; height: 2px; border-radius: 1px; }
.plot { width: 100%; height: auto; display: block; overflow: visible; }
.plot .tick { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.plot .grid { stroke: var(--chart-grid); stroke-width: 1; }
.plot .axis { stroke: var(--line-strong); stroke-width: 1; }
.plot .hit { fill: transparent; }
.plot .col { transition: opacity .12s; }
.plot.stacked:hover .col { opacity: .55; }
.plot.stacked .col:hover { opacity: 1; }
.plot .crosshair { stroke: var(--line-strong); stroke-width: 1; opacity: 0; }
.plot .col:hover .crosshair { opacity: 1; }
.plot .series-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.plot .end-dot { stroke: var(--surface); stroke-width: 2; }

/* horizontal bar list */
.bar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; }
.bar-list li { display: grid; grid-template-columns: minmax(6rem, 9rem) minmax(0, 1fr) auto; align-items: center; gap: .75rem; }
.bar-label { font-size: .86rem; color: var(--ink-2); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 14px; }
.bar-fill { display: block; height: 100%; max-width: 100%; border-radius: 0 4px 4px 0; }
.bar-value { font-size: .86rem; font-weight: 600; text-align: right; white-space: nowrap; }

/* weekday x hour heatmap */
.heatmap { overflow-x: auto; }
.hm-grid { display: grid; grid-template-columns: 2.6rem repeat(24, minmax(14px, 1fr)); gap: 2px; min-width: 460px; }
.hm-cell { aspect-ratio: 1.6; border-radius: 3px; }
.hm-day, .hm-hour { font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.hm-day { align-self: center; }
.hm-legend { display: flex; align-items: center; gap: 2px; justify-content: flex-end; margin-top: .6rem; font-size: .72rem; color: var(--muted); }
.hm-legend i { width: 14px; height: 10px; border-radius: 2px; display: inline-block; }
.hm-legend span { margin: 0 .35rem; }

/* statement */
.statement-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.entry-badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; background: var(--line-soft); color: var(--ink-2); }
.entry-badge.charge { background: var(--tint-danger); color: var(--danger-ink); }
.entry-badge.payment { background: var(--tint-success); color: var(--success-ink); }
.entry-badge.reversal { background: var(--line-soft); color: var(--muted); }

/* print: just the report */
.print-only { display: none; }
@media print {
    .no-print, .section-tabs, #blazor-error-ui { display: none !important; }
    .print-only { display: block; }
    .card, .kpi { break-inside: avoid; }
}
