/* ==========================================================================
   Kasir POS — Design System
   Hand-authored CSS with no build step, so the app deploys to shared
   hosting by unzipping. Everything below is token-driven; change the
   values in :root and the whole product follows.
   ========================================================================== */

/* --- Tokens -------------------------------------------------------------- */

:root {
    /* Neutral ramp — a cool slate that keeps large surfaces calm. */
    --n-0:   #ffffff;
    --n-25:  #fcfcfd;
    --n-50:  #f8fafc;
    --n-100: #f1f5f9;
    --n-150: #e9eef5;
    --n-200: #e2e8f0;
    --n-300: #cbd5e1;
    --n-400: #94a3b8;
    --n-500: #64748b;
    --n-600: #475569;
    --n-700: #334155;
    --n-800: #1e293b;
    --n-900: #0f172a;
    --n-950: #080f1f;

    /* Brand — indigo with a violet lean, used sparingly for emphasis. */
    --brand-50:  #eef2ff;
    --brand-100: #e0e7ff;
    --brand-200: #c7d2fe;
    --brand-400: #818cf8;
    --brand-500: #6366f1;
    --brand-600: #4f46e5;
    --brand-700: #4338ca;
    --brand-800: #3730a3;

    /* Semantic */
    --ok-50:  #ecfdf5;  --ok-200: #a7f3d0;  --ok-500: #10b981;  --ok-600: #059669;  --ok-700: #047857;
    --warn-50:#fffbeb;  --warn-200:#fde68a; --warn-500:#f59e0b; --warn-600:#d97706;  --warn-700:#b45309;
    --bad-50: #fef2f2;  --bad-200:#fecaca;  --bad-500:#ef4444;  --bad-600:#dc2626;   --bad-700:#b91c1c;
    --info-50:#eff6ff;  --info-200:#bfdbfe; --info-500:#3b82f6; --info-600:#2563eb;  --info-700:#1d4ed8;

    /* Surfaces */
    --bg:            var(--n-50);
    --bg-elevated:   var(--n-0);
    --bg-sunken:     var(--n-100);
    --surface:       var(--n-0);
    --surface-hover: var(--n-50);
    --border:        var(--n-200);
    --border-strong: var(--n-300);

    /* Text */
    --text:        var(--n-900);
    --text-muted:  var(--n-500);
    --text-subtle: var(--n-400);
    --text-invert: var(--n-0);

    /* Shape */
    --r-xs: 6px;
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 20px;
    --r-2xl: 28px;
    --r-full: 999px;

    /* Depth — layered, low-opacity shadows read as "premium" far better
       than a single heavy drop shadow. */
    --sh-xs: 0 1px 2px rgba(15, 23, 42, .04);
    --sh-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
    --sh-md: 0 4px 12px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
    --sh-lg: 0 12px 28px rgba(15, 23, 42, .10), 0 2px 6px rgba(15, 23, 42, .05);
    --sh-xl: 0 24px 56px rgba(15, 23, 42, .16), 0 4px 12px rgba(15, 23, 42, .06);
    --sh-brand: 0 6px 20px rgba(79, 70, 229, .28);

    --ring: 0 0 0 3px rgba(99, 102, 241, .28);

    /* Type */
    --font: "Segoe UI Variable Display", -apple-system, BlinkMacSystemFont,
            "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --font-mono: "Cascadia Mono", ui-monospace, SFMono-Regular, "SF Mono",
                 Menlo, Consolas, "Liberation Mono", monospace;

    --sidebar-w: 264px;
    --topbar-h: 68px;
}

/* Dark mode. Surfaces lift with lightness rather than borders, which keeps
   the interface from looking like a wireframe at night. */
[data-theme="dark"] {
    --bg:            #0b1220;
    --bg-elevated:   #111a2b;
    --bg-sunken:     #080e19;
    --surface:       #111a2b;
    --surface-hover: #17223a;
    --border:        #1f2c45;
    --border-strong: #2c3b58;

    --text:        #e8eefc;
    --text-muted:  #94a3b8;
    --text-subtle: #64748b;

    --brand-50:  #1a1f3d;
    --brand-100: #232a52;

    --ok-50:   #0d2a22;
    --warn-50: #2b2110;
    --bad-50:  #2c1416;
    --info-50: #0f2038;

    --sh-xs: 0 1px 2px rgba(0, 0, 0, .3);
    --sh-sm: 0 1px 3px rgba(0, 0, 0, .4);
    --sh-md: 0 4px 14px rgba(0, 0, 0, .45);
    --sh-lg: 0 14px 32px rgba(0, 0, 0, .55);
    --sh-xl: 0 28px 60px rgba(0, 0, 0, .65);
}

/* --- Reset --------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5 { margin: 0; font-weight: 650; letter-spacing: -.015em; line-height: 1.25; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
p  { margin: 0; }

a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); }

img, svg { max-width: 100%; vertical-align: middle; }

button, input, select, textarea { font: inherit; color: inherit; }

hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-full); border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--n-400); background-clip: content-box; }

/* Money and quantities line up in columns. */
.num, td.num, .money { font-variant-numeric: tabular-nums; }

/* --- Utilities ----------------------------------------------------------- */

.stack   { display: flex; flex-direction: column; }
.row     { display: flex; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.wrap    { flex-wrap: wrap; }
.grow    { flex: 1 1 auto; min-width: 0; }
.center  { display: flex; align-items: center; justify-content: center; }

.g-4  { gap: 4px; }  .g-6  { gap: 6px; }   .g-8  { gap: 8px; }
.g-10 { gap: 10px; } .g-12 { gap: 12px; }  .g-16 { gap: 16px; }
.g-20 { gap: 20px; } .g-24 { gap: 24px; }

.mt-4 { margin-top: 4px; }   .mt-8 { margin-top: 8px; }
.mt-10{ margin-top: 10px; }  .mt-12{ margin-top: 12px; }
.mt-16{ margin-top: 16px; }  .mt-20{ margin-top: 20px; }
.mt-24{ margin-top: 24px; }
.mb-4 { margin-bottom: 4px; }.mb-6 { margin-bottom: 6px; }
.mb-8 { margin-bottom: 8px; }.mb-10{ margin-bottom: 10px; }
.mb-12{ margin-bottom: 12px; }.mb-16{ margin-bottom: 16px; }
.mb-20{ margin-bottom: 20px; }.mb-24{ margin-bottom: 24px; }

.t-right  { text-align: right; }
.t-center { text-align: center; }

.muted   { color: var(--text-muted); }
.subtle  { color: var(--text-subtle); }
.tiny    { font-size: 11px; }
.small   { font-size: 12px; }
.big     { font-size: 18px; }
.bold    { font-weight: 650; }
.semi    { font-weight: 550; }
.mono    { font-family: var(--font-mono); }
.upper   { text-transform: uppercase; letter-spacing: .06em; }
.nowrap  { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ok   { color: var(--ok-600); }
.bad  { color: var(--bad-600); }
.warn { color: var(--warn-600); }

.hide { display: none !important; }

/* Screen-reader only, for icon-only controls. */
.sr {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* --- Layout -------------------------------------------------------------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 40;
}

.sidebar__brand {
    display: flex; align-items: center; gap: 11px;
    padding: 20px 20px 18px;
    border-bottom: 1px solid var(--border);
}

.brand-mark {
    width: 38px; height: 38px; flex: 0 0 38px;
    border-radius: var(--r-md);
    background: linear-gradient(140deg, var(--brand-500), var(--brand-700));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px;
    box-shadow: var(--sh-brand);
}

.brand-name { font-weight: 680; font-size: 15px; letter-spacing: -.01em; }
.brand-sub  { font-size: 11px; color: var(--text-subtle); }

/* --- Aldef Tech brand ---------------------------------------------------
   The logo is a saturated neon render on a transparent field. Sitting it
   on a near-black plaque keeps the colour readable on light and dark
   surfaces alike, and stops it competing with the interface around it. */

.aldef-chip {
    position: relative;
    display: flex; align-items: center; justify-content: center;
    flex: 0 0 auto;
    width: 40px; height: 40px;
    border-radius: var(--r-md);
    background:
        radial-gradient(120% 120% at 30% 0%, #241b45 0%, #0d1024 55%, #07080f 100%);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, .09),
        0 4px 14px rgba(10, 8, 30, .35);
    overflow: hidden;
}

.aldef-chip img {
    width: 78%; height: 78%;
    object-fit: contain;
    /* A faint bloom so the mark reads as lit rather than pasted on. */
    filter: drop-shadow(0 0 5px rgba(129, 140, 248, .45));
}

.aldef-chip--lg { width: 54px; height: 54px; border-radius: var(--r-lg); }
.aldef-chip--sm { width: 32px; height: 32px; border-radius: var(--r-sm); }

/* Full lockup, used on the sign-in panels. */
.aldef-lockup {
    display: block;
    width: 100%;
    max-width: 190px;
    height: auto;
    filter: drop-shadow(0 6px 20px rgba(0, 0, 0, .45));
}

.aldef-lockup--sm { max-width: 132px; }

/* Small "powered by" line. */
.aldef-credit {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 10.5px; font-weight: 600;
    letter-spacing: .09em; text-transform: uppercase;
    color: var(--text-subtle);
}
.aldef-credit img { width: 16px; height: 16px; object-fit: contain; }

/* --- Outlet switcher ----------------------------------------------------
   Which branch the dashboard is reading. Kept visually distinct from the
   ordinary buttons because acting on the wrong outlet is costly. */

.outlet-chip {
    display: inline-flex; align-items: center; gap: 7px;
    max-width: 210px;
    padding: 7px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-full);
    background: var(--surface);
    color: var(--text);
    font-size: 12.5px; font-weight: 600;
    cursor: pointer;
    transition: border-color .13s ease, background .13s ease;
}
.outlet-chip:hover { border-color: var(--brand-400); background: var(--brand-50); }

/* An assigned operator cannot switch, so it reads as a label, not a control. */
.outlet-chip--fixed {
    cursor: default;
    background: var(--bg-sunken);
    border-style: dashed;
}
.outlet-chip--fixed:hover { border-color: var(--border-strong); background: var(--bg-sunken); }

@media (max-width: 720px) {
    .outlet-chip { max-width: 130px; padding: 6px 10px; font-size: 12px; }
}

.sidebar__nav { flex: 1; overflow-y: auto; padding: 14px 12px 20px; }

.nav-group { margin-bottom: 18px; }
.nav-group__label {
    font-size: 10.5px; font-weight: 650; text-transform: uppercase;
    letter-spacing: .09em; color: var(--text-subtle);
    padding: 0 10px 7px;
}

.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 11px; margin-bottom: 2px;
    border-radius: var(--r-sm);
    color: var(--n-600);
    font-weight: 520; font-size: 13.5px;
    transition: background .13s ease, color .13s ease;
}
[data-theme="dark"] .nav-item { color: var(--n-400); }

.nav-item:hover { background: var(--surface-hover); color: var(--text); }

.nav-item.is-active {
    background: var(--brand-600);
    color: #fff;
    box-shadow: var(--sh-brand);
}
.nav-item.is-active .nav-item__icon { opacity: 1; }

.nav-item__icon { width: 18px; height: 18px; flex: 0 0 18px; opacity: .7; }
.nav-item__badge {
    margin-left: auto;
    background: var(--bad-500); color: #fff;
    font-size: 10.5px; font-weight: 650;
    padding: 1px 7px; border-radius: var(--r-full);
}
.nav-item.is-active .nav-item__badge { background: rgba(255,255,255,.25); }

.sidebar__foot { padding: 12px; border-top: 1px solid var(--border); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 14px;
    padding: 0 24px;
    background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 30;
}

.topbar__title { font-size: 17px; font-weight: 650; letter-spacing: -.015em; }
.topbar__sub { font-size: 12px; color: var(--text-muted); }

.content { padding: 24px; max-width: 1560px; width: 100%; margin: 0 auto; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }

/* --- Cards --------------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-sm);
}

.card--flat { box-shadow: none; }
.card--pad { padding: 20px; }

.card__head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.card__title { font-size: 14.5px; font-weight: 650; }
.card__sub { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.card__body { padding: 20px; }
.card__body--tight { padding: 12px; }
.card__foot { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--bg-sunken); border-radius: 0 0 var(--r-lg) var(--r-lg); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-2-1 { grid-template-columns: 2fr 1fr; }
.grid-1-2 { grid-template-columns: 1fr 2fr; }

/* --- Stat tiles ---------------------------------------------------------- */

.stat {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 18px 20px;
    box-shadow: var(--sh-sm);
    overflow: hidden;
}

/* A hairline of brand colour along the top edge — enough to feel designed
   without shouting. */
.stat::after {
    content: "";
    position: absolute; inset: 0 0 auto 0; height: 3px;
    background: linear-gradient(90deg, var(--brand-500), var(--brand-700));
    opacity: 0;
    transition: opacity .18s ease;
}
.stat--accent::after { opacity: 1; }

.stat__label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--text-subtle); }
.stat__value { font-size: 25px; font-weight: 690; letter-spacing: -.028em; margin-top: 7px; font-variant-numeric: tabular-nums; }
.stat__meta  { font-size: 12px; color: var(--text-muted); margin-top: 5px; }

.stat__icon {
    position: absolute; top: 16px; right: 18px;
    width: 34px; height: 34px; border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center;
    background: var(--brand-50); color: var(--brand-600);
}

.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 620; }
.delta--up   { color: var(--ok-600); }
.delta--down { color: var(--bad-600); }
.delta--flat { color: var(--text-subtle); }

/* --- Buttons ------------------------------------------------------------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 15px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    background: var(--surface);
    color: var(--text);
    font-size: 13.5px; font-weight: 570;
    cursor: pointer;
    white-space: nowrap;
    transition: background .14s ease, border-color .14s ease, box-shadow .14s ease, transform .06s ease;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled, .btn.is-disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn--primary { background: var(--brand-600); color: #fff; box-shadow: var(--sh-brand); }
.btn--primary:hover:not(:disabled) { background: var(--brand-700); }

.btn--outline { border-color: var(--border-strong); background: var(--surface); }
.btn--outline:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--n-400); }

.btn--ghost { background: transparent; color: var(--text-muted); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }

.btn--soft { background: var(--brand-50); color: var(--brand-700); }
.btn--soft:hover:not(:disabled) { background: var(--brand-100); }

.btn--danger { background: var(--bad-600); color: #fff; }
.btn--danger:hover:not(:disabled) { background: var(--bad-700); }

.btn--danger-soft { background: var(--bad-50); color: var(--bad-600); }
.btn--danger-soft:hover:not(:disabled) { background: var(--bad-200); color: var(--bad-700); }

.btn--success { background: var(--ok-600); color: #fff; }
.btn--success:hover:not(:disabled) { background: var(--ok-700); }

.btn--sm { padding: 6px 11px; font-size: 12.5px; border-radius: var(--r-xs); }
.btn--lg { padding: 12px 22px; font-size: 15px; border-radius: var(--r-md); }
.btn--xl { padding: 16px 26px; font-size: 16px; font-weight: 640; border-radius: var(--r-md); }
.btn--block { width: 100%; }
.btn--icon { padding: 8px; width: 34px; height: 34px; }

.btn-group { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.btn-group .btn { border-radius: 0; border: 0; border-right: 1px solid var(--border); box-shadow: none; }
.btn-group .btn:last-child { border-right: 0; }
.btn-group .btn.is-active { background: var(--brand-600); color: #fff; }

/* --- Forms --------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field__label { font-size: 12.5px; font-weight: 600; color: var(--n-700); }
[data-theme="dark"] .field__label { color: var(--n-300); }
.field__hint { font-size: 11.5px; color: var(--text-subtle); }
.field__error { font-size: 11.5px; color: var(--bad-600); font-weight: 550; }
.field__req { color: var(--bad-500); }

.input, .select, .textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 13.5px;
    transition: border-color .14s ease, box-shadow .14s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--text-subtle); }

.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: var(--ring);
}
.input.is-error, .select.is-error { border-color: var(--bad-500); }
.input:disabled, .select:disabled { background: var(--bg-sunken); color: var(--text-muted); cursor: not-allowed; }

.textarea { min-height: 84px; resize: vertical; }

.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 34px;
}

/* Prefixed inputs, used for currency fields. */
.input-group { display: flex; align-items: stretch; }
.input-group__addon {
    display: flex; align-items: center;
    padding: 0 11px;
    background: var(--bg-sunken);
    border: 1px solid var(--border-strong);
    border-right: 0;
    border-radius: var(--r-sm) 0 0 var(--r-sm);
    font-size: 12.5px; font-weight: 600; color: var(--text-muted);
}
.input-group .input { border-radius: 0 var(--r-sm) var(--r-sm) 0; }

.check { display: inline-flex; align-items: flex-start; gap: 9px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--brand-600); cursor: pointer; }
.check__text { font-size: 13px; }
.check__hint { font-size: 11.5px; color: var(--text-subtle); }

/* Toggle switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
    width: 40px; height: 22px; flex: 0 0 40px;
    background: var(--n-300);
    border-radius: var(--r-full);
    position: relative;
    transition: background .18s ease;
}
.switch__track::after {
    content: ""; position: absolute; top: 2px; left: 2px;
    width: 18px; height: 18px; border-radius: 50%;
    background: #fff; box-shadow: var(--sh-sm);
    transition: transform .18s cubic-bezier(.4, 0, .2, 1);
}
.switch input:checked + .switch__track { background: var(--brand-600); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { box-shadow: var(--ring); }

/* Search box with a leading icon. */
.search { position: relative; }
.search .input { padding-left: 36px; }
.search__icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-subtle); pointer-events: none; }

/* --- Tables -------------------------------------------------------------- */

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

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.table thead th {
    text-align: left;
    font-size: 11px; font-weight: 650;
    text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-subtle);
    padding: 11px 16px;
    background: var(--bg-sunken);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table thead th:first-child { border-top-left-radius: var(--r-lg); }
.table thead th:last-child  { border-top-right-radius: var(--r-lg); }

.table tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s ease; }
.table tbody tr:hover { background: var(--surface-hover); }

.table--compact tbody td { padding: 8px 12px; }
.table--compact thead th { padding: 8px 12px; }

.table tfoot td { padding: 12px 16px; font-weight: 650; border-top: 2px solid var(--border-strong); background: var(--bg-sunken); }

/* --- Badges & pills ------------------------------------------------------ */

.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2.5px 9px;
    border-radius: var(--r-full);
    font-size: 11.5px; font-weight: 620;
    line-height: 1.5;
    white-space: nowrap;
}
.badge--neutral { background: var(--n-100); color: var(--n-600); }
[data-theme="dark"] .badge--neutral { background: var(--n-800); color: var(--n-300); }
.badge--brand   { background: var(--brand-50);  color: var(--brand-700); }
.badge--ok      { background: var(--ok-50);     color: var(--ok-700); }
.badge--warn    { background: var(--warn-50);   color: var(--warn-700); }
.badge--bad     { background: var(--bad-50);    color: var(--bad-700); }
.badge--info    { background: var(--info-50);   color: var(--info-700); }
.badge--violet  { background: #f5f3ff; color: #6d28d9; }
[data-theme="dark"] .badge--violet { background: #241b40; color: #c4b5fd; }
.badge--emerald { background: var(--ok-50); color: var(--ok-700); }
.badge--blue    { background: var(--info-50); color: var(--info-700); }

.dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }
.dot--ok { background: var(--ok-500); }
.dot--warn { background: var(--warn-500); }
.dot--bad { background: var(--bad-500); }

/* Live indicator for an open drawer. */
.pulse { position: relative; }
.pulse::before {
    content: ""; position: absolute; inset: -4px;
    border-radius: 50%; background: var(--ok-500);
    opacity: .35; animation: pulse 1.9s ease-out infinite;
}
@keyframes pulse {
    0%   { transform: scale(.6); opacity: .45; }
    70%  { transform: scale(1.5); opacity: 0; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* --- Avatars ------------------------------------------------------------- */

.avatar {
    width: 34px; height: 34px; flex: 0 0 34px;
    border-radius: var(--r-full);
    background: linear-gradient(140deg, var(--brand-400), var(--brand-700));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12.5px; font-weight: 650;
    overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 26px; height: 26px; flex-basis: 26px; font-size: 10.5px; }
.avatar--lg { width: 46px; height: 46px; flex-basis: 46px; font-size: 16px; }
.avatar--xl { width: 68px; height: 68px; flex-basis: 68px; font-size: 24px; }

/* --- Profile photo ------------------------------------------------------
   Larger sibling of .avatar, used on the profile page itself. */

.profile-photo {
    position: relative;
    width: 116px; height: 116px;
    margin: 0 auto;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(140deg, var(--brand-400), var(--brand-700));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--border), var(--sh-md);
}

.profile-photo img { width: 100%; height: 100%; object-fit: cover; }
.profile-photo__initials { font-size: 38px; font-weight: 700; letter-spacing: -.02em; }

/* --- Alerts -------------------------------------------------------------- */

.alert {
    display: flex; align-items: flex-start; gap: 11px;
    padding: 13px 16px;
    border-radius: var(--r-md);
    border: 1px solid transparent;
    font-size: 13px;
    margin-bottom: 16px;
}
.alert__icon { flex: 0 0 18px; margin-top: 1px; }
.alert--ok   { background: var(--ok-50);   border-color: var(--ok-200);   color: var(--ok-700); }
.alert--bad  { background: var(--bad-50);  border-color: var(--bad-200);  color: var(--bad-700); }
.alert--warn { background: var(--warn-50); border-color: var(--warn-200); color: var(--warn-700); }
.alert--info { background: var(--info-50); border-color: var(--info-200); color: var(--info-700); }

/* --- Dropdowns ----------------------------------------------------------- */

.dropdown { position: relative; }

.dropdown__menu {
    position: absolute; top: calc(100% + 6px); right: 0;
    min-width: 210px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--sh-lg);
    padding: 6px;
    z-index: 60;
    opacity: 0; visibility: hidden; transform: translateY(-4px);
    transition: opacity .14s ease, transform .14s ease, visibility .14s;
}
.dropdown.is-open .dropdown__menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown__menu--left { right: auto; left: 0; }

.dropdown__item {
    display: flex; align-items: center; gap: 9px;
    width: 100%;
    padding: 8px 10px;
    border: 0; background: transparent;
    border-radius: var(--r-xs);
    font-size: 13px; color: var(--text);
    text-align: left; cursor: pointer;
}
.dropdown__item:hover { background: var(--surface-hover); }
.dropdown__item--danger { color: var(--bad-600); }
.dropdown__item--danger:hover { background: var(--bad-50); }
.dropdown__sep { height: 1px; background: var(--border); margin: 5px 0; }
.dropdown__label { padding: 7px 10px 4px; font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--text-subtle); }

/* --- Modals -------------------------------------------------------------- */

.modal {
    position: fixed; inset: 0; z-index: 100;
    display: none;
    align-items: center; justify-content: center;
    padding: 20px;
}
.modal.is-open { display: flex; }

.modal__backdrop {
    position: absolute; inset: 0;
    background: rgba(8, 15, 31, .55);
    backdrop-filter: blur(3px);
    animation: fade .16s ease;
}

.modal__panel {
    position: relative;
    width: 100%; max-width: 520px;
    max-height: calc(100vh - 40px);
    display: flex; flex-direction: column;
    background: var(--surface);
    border-radius: var(--r-xl);
    box-shadow: var(--sh-xl);
    animation: pop .2s cubic-bezier(.16, 1, .3, 1);
    overflow: hidden;
}
.modal__panel--wide { max-width: 780px; }
.modal__panel--narrow { max-width: 400px; }

.modal__head { padding: 20px 22px 14px; border-bottom: 1px solid var(--border); }
.modal__title { font-size: 16.5px; font-weight: 660; }
.modal__sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.modal__body { padding: 20px 22px; overflow-y: auto; }
.modal__foot { padding: 15px 22px; border-top: 1px solid var(--border); display: flex; gap: 9px; justify-content: flex-end; background: var(--bg-sunken); }
.modal__close { position: absolute; top: 16px; right: 16px; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop  { from { opacity: 0; transform: translateY(12px) scale(.97); } }

/* --- Toasts -------------------------------------------------------------- */

.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }

.toast {
    display: flex; align-items: flex-start; gap: 11px;
    min-width: 290px; max-width: 400px;
    padding: 13px 15px;
    background: var(--n-900);
    color: #fff;
    border-radius: var(--r-md);
    box-shadow: var(--sh-xl);
    font-size: 13px;
    animation: slide-in .22s cubic-bezier(.16, 1, .3, 1);
}
.toast--ok  { background: var(--ok-600); }
.toast--bad { background: var(--bad-600); }
.toast.is-leaving { animation: slide-out .18s ease forwards; }

@keyframes slide-in  { from { opacity: 0; transform: translateX(24px); } }
@keyframes slide-out { to   { opacity: 0; transform: translateX(24px); } }

/* --- Tabs ---------------------------------------------------------------- */

.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }

.tab {
    padding: 10px 15px;
    border: 0; background: transparent;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 13.5px; font-weight: 570;
    cursor: pointer;
    white-space: nowrap;
    margin-bottom: -1px;
    transition: color .14s ease, border-color .14s ease;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--brand-600); border-bottom-color: var(--brand-600); }

.tab-panel { display: none; }
.tab-panel.is-active { display: block; animation: fade .18s ease; }

/* --- Empty state --------------------------------------------------------- */

.empty { padding: 52px 24px; text-align: center; }
.empty__icon {
    width: 56px; height: 56px; margin: 0 auto 14px;
    border-radius: var(--r-lg);
    background: var(--bg-sunken); color: var(--text-subtle);
    display: flex; align-items: center; justify-content: center;
}
.empty__title { font-size: 15px; font-weight: 630; }
.empty__text { font-size: 13px; color: var(--text-muted); margin-top: 5px; max-width: 380px; margin-inline: auto; }

/* --- Pagination ---------------------------------------------------------- */

.pagination { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pagination__link {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 33px; height: 33px; padding: 0 9px;
    border: 1px solid var(--border);
    border-radius: var(--r-xs);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 13px; font-weight: 560;
}
.pagination__link:hover { background: var(--surface-hover); color: var(--text); }
.pagination__link.is-active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.pagination__link.is-disabled { opacity: .45; pointer-events: none; }

/* --- Charts (hand-drawn SVG / CSS, no library) --------------------------- */

.chart { width: 100%; }
.chart__grid line { stroke: var(--border); stroke-width: 1; }
.chart__area { fill: url(#chartFill); }
.chart__line { fill: none; stroke: var(--brand-600); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart__dot { fill: var(--surface); stroke: var(--brand-600); stroke-width: 2.5; }
.chart__label { font-size: 10px; fill: var(--text-subtle); }

.bars { display: flex; align-items: flex-end; gap: 5px; height: 130px; }
.bars__col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; min-width: 0; }
.bars__bar {
    width: 100%;
    background: linear-gradient(180deg, var(--brand-500), var(--brand-700));
    border-radius: var(--r-xs) var(--r-xs) 2px 2px;
    min-height: 3px;
    transition: opacity .14s ease;
}
.bars__col:hover .bars__bar { opacity: .78; }
.bars__label { font-size: 10px; color: var(--text-subtle); white-space: nowrap; }

/* Horizontal progress / share meter. */
.meter { height: 7px; border-radius: var(--r-full); background: var(--bg-sunken); overflow: hidden; }
.meter__fill { height: 100%; border-radius: var(--r-full); background: var(--brand-600); transition: width .3s ease; }
.meter__fill--ok { background: var(--ok-500); }
.meter__fill--warn { background: var(--warn-500); }
.meter__fill--bad { background: var(--bad-500); }

/* --- Misc ---------------------------------------------------------------- */

.kbd {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; padding: 1px 6px;
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: var(--r-xs);
    background: var(--bg-sunken);
    font-family: var(--font-mono); font-size: 11px; font-weight: 600;
    color: var(--text-muted);
}

.divider { height: 1px; background: var(--border); margin: 16px 0; }
.divider--v { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }

.code-chip {
    display: inline-flex; align-items: center;
    padding: 2px 8px;
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: var(--r-xs);
    font-family: var(--font-mono); font-size: 12px; font-weight: 600;
    letter-spacing: .01em;
}

/* Thin top progress bar used while the terminal posts a sale. */
.progress-top {
    position: fixed; top: 0; left: 0; height: 3px; width: 0;
    background: linear-gradient(90deg, var(--brand-500), var(--brand-400));
    z-index: 300;
    transition: width .25s ease;
}

/* --- Responsive ---------------------------------------------------------- */

@media (max-width: 1200px) {
    .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
    .sidebar {
        position: fixed; left: 0; top: 0;
        transform: translateX(-100%);
        transition: transform .24s cubic-bezier(.4, 0, .2, 1);
        box-shadow: var(--sh-xl);
    }
    .sidebar.is-open { transform: translateX(0); }

    .sidebar-scrim {
        position: fixed; inset: 0; z-index: 39;
        background: rgba(8, 15, 31, .5);
        display: none;
    }
    .sidebar-scrim.is-open { display: block; }

    .grid-2-1, .grid-1-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .grid-2, .grid-4, .grid-5 { grid-template-columns: 1fr; }
    .card__head, .card__body { padding: 14px 16px; }
    h1 { font-size: 21px; }
    .stat__value { font-size: 22px; }
    .page-head { flex-direction: column; align-items: stretch; }
    .toasts { left: 14px; right: 14px; bottom: 14px; }
    .toast { min-width: 0; max-width: none; }
}

/* Anything marked print-only stays hidden on screen. */
.print-only { display: none; }

@media print {
    .no-print, .sidebar, .topbar, .toasts { display: none !important; }
    .print-only { display: block; }
    body { background: #fff; }
    .content { padding: 0; max-width: none; }
    .card { box-shadow: none; border-color: #ddd; }
}
