/* ==========================================================================
   Digitaly design system
   --------------------------------------------------------------------------
   One stylesheet for every surface. Before this, each template carried its own
   <style> block, so a button looked different on every page and there was no
   way to change the brand without editing 30 files.

   Written with CSS logical properties (inline-start/end) rather than left/right
   so the whole system mirrors correctly in the RTL Arabic layout.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
    /* Brand. Teal is kept because the existing logo asset is teal-green;
       switching hue would have orphaned static/images/logo-green.png. */
    --brand: #0d9488;
    --brand-strong: #0f766e;
    --brand-ink: #ffffff;
    --brand-tint: #f0fdfa;
    --brand-line: #99f6e4;

    /* Buy actions get their own green so "pay" never looks like "cancel". */
    --buy: #16a34a;
    --buy-strong: #15803d;

    /* Surfaces */
    --bg: #f6f8fa;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --line: #e4e8ec;
    --line-strong: #cbd5e1;

    /* Ink. Every value below clears 4.5:1 on --surface. */
    --ink: #0f172a;
    --ink-2: #475569;
    --ink-3: #64748b;
    --ink-on-brand: #ffffff;

    /* Semantic */
    --ok: #15803d;
    --ok-bg: #dcfce7;
    --ok-line: #86efac;
    --warn: #b45309;
    --warn-bg: #fef3c7;
    --warn-line: #fcd34d;
    --danger: #b91c1c;
    --danger-bg: #fee2e2;
    --danger-line: #fca5a5;
    --info: #1d4ed8;
    --info-bg: #dbeafe;
    --info-line: #93c5fd;

    /* Type */
    --font: 'Cairo', 'Segoe UI', system-ui, -apple-system, sans-serif;
    /* Nudged up one step from the usual 12/14/16 ladder. On a wide desktop the
       dashboard read as "zoomed out" at the smaller scale — labels, hints and
       table cells all live at --text-sm, so that step carries most of the UI. */
    --text-xs: 0.8125rem;
    --text-sm: 0.9375rem;
    --text-base: 1.0625rem;
    --text-lg: 1.1875rem;
    --text-xl: 1.5rem;
    --text-2xl: 1.875rem;
    --text-3xl: 2.375rem;

    /* Space — a 4px scale. */
    --s1: 4px;
    --s2: 8px;
    --s3: 12px;
    --s4: 16px;
    --s5: 20px;
    --s6: 24px;
    --s8: 32px;
    --s10: 40px;
    --s12: 48px;

    /* Radius */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-full: 999px;

    /* Elevation */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, .08);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, .12);

    /* z-index — a fixed scale, so nothing is ever "z-index: 99999". */
    --z-sticky: 10;
    --z-drawer: 30;
    --z-overlay: 20;
    --z-toast: 50;

    --sidebar-w: 280px;
    /* Content stops widening here and centres. Without a cap, tables and forms
       stretch the full width of a 27" monitor and become unreadable; without
       centring, everything hugs one edge and the other half of the screen is
       dead space. */
    --content-max: 1240px;
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; padding: 0; }

/* Author `display` rules below (.field, .row, .btn…) outrank the UA stylesheet's
   [hidden] rule, so scripts that toggle `el.hidden` would silently do nothing.
   This restores the attribute's meaning for every element in the system. */
[hidden] { display: none !important; }

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

body {
    font-family: var(--font);
    /* 16px minimum on mobile — anything smaller triggers iOS zoom-on-focus. */
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--ink);
    background: var(--bg);
    min-height: 100vh;
    /* Wide content scrolls inside its own wrapper, never the page. */
    overflow-x: hidden;
}

img, svg, video { max-width: 100%; }
img, video { height: auto; }

h1, h2, h3, h4 { line-height: 1.3; font-weight: 700; color: var(--ink); }
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }

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

/* Body copy stays readable: 65-75 characters per line. */
.prose { max-width: 68ch; }

/* One focus treatment for the whole app. :focus-visible keeps it off mouse
   clicks but guarantees it for keyboard users. */
:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}

::selection { background: var(--brand-line); color: var(--ink); }

/* Respect the OS setting. Motion is decoration here, never information. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* --------------------------------------------------------------------------
   3. Accessibility helpers
   -------------------------------------------------------------------------- */
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Keyboard users shouldn't tab through 11 nav links to reach the page. */
.skip-link {
    position: absolute;
    inset-inline-start: var(--s4);
    top: -100px;
    z-index: var(--z-toast);
    background: var(--ink);
    color: #fff;
    padding: var(--s3) var(--s5);
    border-radius: var(--r-sm);
    text-decoration: none;
    font-weight: 600;
    transition: top .15s ease;
}
.skip-link:focus { top: var(--s4); }

/* --------------------------------------------------------------------------
   4. Icons
   -------------------------------------------------------------------------- */
.icon {
    width: 20px; height: 20px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }

/* --------------------------------------------------------------------------
   5. Buttons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s2);
    /* 44px min height — the WCAG touch target floor. */
    min-height: 44px;
    padding: var(--s3) var(--s5);
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1;
    color: var(--brand-ink);
    background: var(--brand);
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    /* Colour/shadow only — never transform, which nudges neighbours around. */
    transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease;
}
.btn:hover { background: var(--brand-strong); }
.btn:active { background: var(--brand-strong); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .12); }

.btn[disabled], .btn.is-loading {
    opacity: .6;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-secondary {
    background: var(--surface);
    color: var(--ink-2);
    border-color: var(--line-strong);
}
.btn-secondary:hover { background: var(--surface-2); color: var(--ink); border-color: var(--ink-3); }

.btn-ghost {
    background: transparent;
    color: var(--ink-2);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

.btn-buy { background: var(--buy); }
.btn-buy:hover, .btn-buy:active { background: var(--buy-strong); }

.btn-danger { background: var(--danger); }
.btn-danger:hover, .btn-danger:active { background: #991b1b; }

.btn-sm { min-height: 36px; padding: var(--s2) var(--s3); font-size: var(--text-xs); }
.btn-lg { min-height: 52px; padding: var(--s4) var(--s8); font-size: var(--text-base); }
.btn-block { display: flex; width: 100%; }

/* Icon-only buttons still need the 44px target even though the glyph is 20px. */
.btn-icon {
    min-width: 44px;
    padding: var(--s2);
}

/* Spinner for async submits, toggled by adding .is-loading. */
.btn.is-loading::before {
    content: '';
    width: 15px; height: 15px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   6. Cards & surfaces
   -------------------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-sm);
}
.card-pad { padding: var(--s6); }

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s4);
    padding: var(--s4) var(--s5);
    border-bottom: 1px solid var(--line);
}
.card-head h2, .card-head h3 { font-size: var(--text-base); }
.card-body { padding: var(--s5); }

/* --------------------------------------------------------------------------
   7. Layout primitives
   -------------------------------------------------------------------------- */
.stack > * + * { margin-top: var(--s4); }
.stack-lg > * + * { margin-top: var(--s8); }

.row {
    display: flex;
    align-items: center;
    gap: var(--s3);
    flex-wrap: wrap;
}
.row-between { justify-content: space-between; }
.spacer { flex: 1; }

.grid { display: grid; gap: var(--s4); }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--s4);
    flex-wrap: wrap;
    margin-bottom: var(--s6);
}
.page-head h1 { font-size: var(--text-2xl); }
.page-head .sub {
    color: var(--ink-2);
    font-size: var(--text-sm);
    margin-top: var(--s1);
    max-width: 62ch;
}

/* --------------------------------------------------------------------------
   8. Stats
   -------------------------------------------------------------------------- */
.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: var(--s5);
    box-shadow: var(--shadow-sm);
}
.stat-label {
    display: flex;
    align-items: center;
    gap: var(--s2);
    font-size: var(--text-sm);
    color: var(--ink-2);
    font-weight: 600;
}
.stat-value {
    font-size: var(--text-2xl);
    font-weight: 800;
    color: var(--ink);
    margin-top: var(--s2);
    line-height: 1.2;
    /* Latin numerals stay left-to-right inside the RTL page. */
    direction: ltr;
    text-align: start;
}
.stat-value .unit { font-size: var(--text-sm); font-weight: 600; color: var(--ink-3); }
.stat-foot { font-size: var(--text-xs); color: var(--ink-3); margin-top: var(--s2); }

.meter {
    height: 6px;
    background: var(--line);
    border-radius: var(--r-full);
    overflow: hidden;
    margin-top: var(--s3);
}
.meter > span {
    display: block;
    height: 100%;
    background: var(--brand);
    border-radius: inherit;
    transition: width .3s ease;
}
.meter.is-warn > span { background: #f59e0b; }
.meter.is-full > span { background: var(--danger); }

/* --------------------------------------------------------------------------
   9. Tables
   -------------------------------------------------------------------------- */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-sm);
    /* The table scrolls in here so the page body never scrolls sideways. */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
    min-width: 640px;
}
table.data th,
table.data td {
    padding: var(--s3) var(--s4);
    text-align: start;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
table.data th {
    background: var(--surface-2);
    color: var(--ink-2);
    font-size: var(--text-xs);
    font-weight: 700;
    white-space: nowrap;
    position: sticky;
    top: 0;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data .num { direction: ltr; text-align: start; font-variant-numeric: tabular-nums; }
table.data .muted { color: var(--ink-3); }

/* --------------------------------------------------------------------------
   10. Badges & chips
   -------------------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--s1);
    padding: 3px var(--s3);
    border-radius: var(--r-full);
    font-size: var(--text-xs);
    font-weight: 700;
    white-space: nowrap;
    background: var(--surface-2);
    color: var(--ink-2);
    border: 1px solid var(--line);
}
/* Each state carries an icon or word as well as colour — colour is never the
   only signal, so it still reads for colour-blind users. */
.badge-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.badge-info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.badge-brand { background: var(--brand-tint); color: var(--brand-strong); border-color: var(--brand-line); }
.badge-lead { background: #ede9fe; color: #5b21b6; border-color: #ddd6fe; }

/* Legacy status classes, still referenced by the payment-proof templates. */
.status-badge { display: inline-flex; align-items: center; gap: var(--s1); padding: 3px var(--s3); border-radius: var(--r-full); font-size: var(--text-xs); font-weight: 700; }
.status-pending { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); }
.status-approved, .status-paid { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-line); }
.status-rejected, .status-failed { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-line); }
.status-refunded { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }

.chip {
    display: inline-flex;
    align-items: center;
    gap: var(--s2);
    padding: var(--s2) var(--s3);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    font-size: var(--text-xs);
    color: var(--ink-2);
    text-decoration: none;
    direction: ltr;
}

/* --------------------------------------------------------------------------
   11. Forms
   -------------------------------------------------------------------------- */
.field { display: block; margin-bottom: var(--s5); }
.field > label,
.label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--ink);
    margin-bottom: var(--s2);
}
.label .req { color: var(--danger); margin-inline-start: 2px; }

.input,
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field input[type="number"], .field input[type="tel"], .field input[type="url"],
.field input[type="date"], .field input[type="search"],
.field select, .field textarea {
    display: block;
    width: 100%;
    /* 16px keeps iOS from zooming the viewport when a field is focused. */
    font-size: var(--text-base);
    font-family: inherit;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    padding: var(--s3) var(--s4);
    min-height: 44px;
    transition: border-color .18s ease, box-shadow .18s ease;
}
.field textarea { min-height: 110px; resize: vertical; line-height: 1.6; }

.input:focus,
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, .15);
}
.field input::placeholder, .field textarea::placeholder { color: var(--ink-3); }

.hint { font-size: var(--text-xs); color: var(--ink-3); margin-top: var(--s2); line-height: 1.5; }

/* Errors sit directly under the field they belong to, not in a page banner. */
.field-error {
    display: flex;
    align-items: flex-start;
    gap: var(--s2);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--danger);
    margin-top: var(--s2);
}
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }

.field input[type="file"] {
    width: 100%;
    font-size: var(--text-sm);
    padding: var(--s3);
    background: var(--surface-2);
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-sm);
    cursor: pointer;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: var(--s3);
    cursor: pointer;
    font-size: var(--text-sm);
}
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--brand); flex: none; cursor: pointer; }

/* Prefix shown inside the field, e.g. the "@" on a store handle.

   The group is forced to LTR even on an RTL page. A URL is a single left-to-
   right string: in RTL flow the prefix lands to the *right* of the value, so
   "digitaly.dz/@" + "yasmine" reads back as "yasmine digitaly.dz/@". Setting
   the direction here also makes the logical borders and radii below resolve
   against the left edge, which is where the prefix now sits. */
.input-group { display: flex; align-items: stretch; direction: ltr; }
.input-group .affix {
    display: flex;
    align-items: center;
    padding: 0 var(--s3);
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    border-inline-end: 0;
    border-start-start-radius: var(--r-sm);
    border-end-start-radius: var(--r-sm);
    color: var(--ink-3);
    font-size: var(--text-sm);
    white-space: nowrap;
}
.input-group input {
    border-start-start-radius: 0 !important;
    border-end-start-radius: 0 !important;
}

.form-actions {
    display: flex;
    gap: var(--s3);
    flex-wrap: wrap;
    padding-top: var(--s5);
    margin-top: var(--s5);
    border-top: 1px solid var(--line);
}

/* Filter bars above tables. */
.filters {
    display: flex;
    gap: var(--s3);
    flex-wrap: wrap;
    align-items: flex-end;
    padding: var(--s4);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    margin-bottom: var(--s5);
}
.filters .field { flex: 1; min-width: 160px; margin-bottom: 0; }

/* --------------------------------------------------------------------------
   12. Empty states
   -------------------------------------------------------------------------- */
/* A blank screen tells a new user nothing. Every empty list says what the
   thing is and offers the one action that fills it. */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--s12) var(--s6);
    color: var(--ink-2);
}
.empty .icon-wrap {
    display: grid;
    place-items: center;
    width: 56px; height: 56px;
    border-radius: var(--r-full);
    background: var(--brand-tint);
    color: var(--brand-strong);
    margin-bottom: var(--s4);
}
.empty h3 { font-size: var(--text-lg); margin-bottom: var(--s2); }
.empty p { font-size: var(--text-sm); max-width: 42ch; margin-bottom: var(--s5); }

/* --------------------------------------------------------------------------
   13. Alerts & toasts
   -------------------------------------------------------------------------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--s3);
    padding: var(--s4);
    border-radius: var(--r-md);
    border: 1px solid var(--info-line);
    background: var(--info-bg);
    color: var(--info);
    font-size: var(--text-sm);
    line-height: 1.6;
}
.alert .icon { margin-top: 2px; }
.alert-success { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.alert-error { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.alert-warning { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.alert strong { display: block; margin-bottom: 2px; }
.alert .alert-body { flex: 1; }
.alert .btn { margin-inline-start: auto; }

.messages { display: grid; gap: var(--s3); margin-bottom: var(--s6); }

/* --------------------------------------------------------------------------
   14. Onboarding checklist
   -------------------------------------------------------------------------- */
.onboard {
    background: var(--surface);
    border: 1px solid var(--brand-line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
.onboard-head {
    padding: var(--s5) var(--s6);
    background: linear-gradient(135deg, var(--brand) 0%, #10b981 100%);
    color: #fff;
}
.onboard-head h2 { color: #fff; font-size: var(--text-xl); }
.onboard-head p { font-size: var(--text-sm); opacity: .92; margin-top: var(--s1); }

.onboard-progress {
    height: 8px;
    background: rgba(255, 255, 255, .28);
    border-radius: var(--r-full);
    overflow: hidden;
    margin-top: var(--s4);
}
.onboard-progress > span {
    display: block;
    height: 100%;
    background: #fff;
    border-radius: inherit;
    transition: width .4s ease;
}

.steps { list-style: none; }
.step {
    display: flex;
    align-items: flex-start;
    gap: var(--s4);
    padding: var(--s4) var(--s6);
    border-bottom: 1px solid var(--line);
}
.step:last-child { border-bottom: 0; }

.step-mark {
    display: grid;
    place-items: center;
    width: 30px; height: 30px;
    flex: none;
    border-radius: var(--r-full);
    border: 2px solid var(--line-strong);
    color: var(--ink-3);
    font-size: var(--text-xs);
    font-weight: 700;
    background: var(--surface);
}
.step.is-done .step-mark {
    background: var(--ok);
    border-color: var(--ok);
    color: #fff;
}
.step.is-next .step-mark { border-color: var(--brand); color: var(--brand-strong); }

.step-body { flex: 1; min-width: 0; }
.step-title { font-weight: 700; font-size: var(--text-sm); color: var(--ink); }
.step.is-done .step-title { color: var(--ink-3); text-decoration: line-through; }
.step-text { font-size: var(--text-xs); color: var(--ink-2); margin-top: 2px; line-height: 1.6; }

/* --------------------------------------------------------------------------
   15. Dashboard shell
   -------------------------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }

/* The sidebar pins to the *start* of the inline axis, which in Arabic (RTL) is
   the right edge and in a Latin locale the left. `inline-end` would put it on
   the left in Arabic — the wrong side for an RTL reader. */
.sidebar {
    width: var(--sidebar-w);
    flex: none;
    background: var(--surface);
    border-inline-end: 1px solid var(--line);
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    overflow-y: auto;
    z-index: var(--z-drawer);
    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--s3);
    padding: var(--s5) var(--s5);
    border-bottom: 1px solid var(--line);
    text-decoration: none;
    color: var(--ink);
}
.brand img { width: 34px; height: auto; }
.brand-name { font-weight: 800; font-size: var(--text-lg); color: var(--brand-strong); }

/* The store link is the product. It sits above the nav, always visible,
   one tap to copy — because it is the thing a creator shares all day. */
.store-link { padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); }
.store-link .k { font-size: var(--text-xs); color: var(--ink-3); font-weight: 600; }
.store-link-row {
    display: flex;
    align-items: center;
    gap: var(--s2);
    margin-top: var(--s2);
}
.store-link-url {
    flex: 1;
    min-width: 0;
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--brand-strong);
    direction: ltr;
    text-align: start;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
}
.store-link-url:hover { text-decoration: underline; }

.nav { padding: var(--s3) 0; flex: 1; }
.nav-group-label {
    padding: var(--s4) var(--s5) var(--s2);
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--ink-3);
    letter-spacing: .02em;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: var(--s3);
    padding: var(--s3) var(--s5);
    color: var(--ink-2);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: 600;
    min-height: 44px;
    border-inline-start: 3px solid transparent;
    transition: background-color .18s ease, color .18s ease;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
/* Active state is colour + a bar + aria-current, not colour alone. */
.nav-item.active {
    background: var(--brand-tint);
    color: var(--brand-strong);
    border-inline-start-color: var(--brand);
}
.nav-item .icon { opacity: .85; }
.nav-count {
    margin-inline-start: auto;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: var(--r-full);
}

.nav-foot { border-top: 1px solid var(--line); padding: var(--s3) 0; }

.main {
    flex: 1;
    min-width: 0;
    margin-inline-start: var(--sidebar-w);
    padding: var(--s8) var(--s8) var(--s12);
}

/* Everything inside .main lives in this band, so pages fill the screen on a
   wide monitor instead of clinging to one edge. */
.main-inner {
    max-width: var(--content-max);
    margin-inline: auto;
    width: 100%;
}

.topbar {
    display: none;
    align-items: center;
    gap: var(--s3);
    padding: var(--s3) var(--s4);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    margin-bottom: var(--s5);
    position: sticky;
    top: var(--s2);
    z-index: var(--z-sticky);
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    z-index: var(--z-overlay);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}
.overlay.open { opacity: 1; visibility: visible; }

/* --------------------------------------------------------------------------
   16. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    /* Off-canvas: the drawer parks outside the edge it is pinned to. In RTL
       that edge is the right, so it slides out to +100%; in LTR, to -100%. */
    .sidebar {
        transform: translateX(100%);
        transition: transform .25s ease;
        box-shadow: var(--shadow-lg);
    }
    [dir="ltr"] .sidebar { transform: translateX(-100%); }
    .sidebar.open,
    [dir="ltr"] .sidebar.open { transform: translateX(0); }

    .main { margin-inline-start: 0; padding: var(--s5) var(--s4) var(--s8); }
    .topbar { display: flex; }
}

@media (max-width: 640px) {
    :root { --text-2xl: 1.5rem; --text-3xl: 1.875rem; }
    .main { padding: var(--s3); }
    .page-head { margin-bottom: var(--s5); }
    .card-pad, .card-body { padding: var(--s4); }
    .step { padding: var(--s4); }
    .onboard-head { padding: var(--s5) var(--s4); }
    .form-actions .btn { flex: 1; }
}

/* --------------------------------------------------------------------------
   17. Utilities
   -------------------------------------------------------------------------- */

/* Single-column pages (a settings form, one product) read badly at the full
   content width. They cap earlier and centre inside the band. */
.narrow { max-width: 860px; margin-inline: auto; width: 100%; }

.muted { color: var(--ink-3); }
.soft { color: var(--ink-2); }
.tiny { font-size: var(--text-xs); }
.small { font-size: var(--text-sm); }
.strong { font-weight: 700; }
.ltr { direction: ltr; text-align: start; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-4 { margin-top: var(--s4); }
.mt-6 { margin-top: var(--s6); }
.mt-8 { margin-top: var(--s8); }
.mb-4 { margin-bottom: var(--s4); }
.mb-6 { margin-bottom: var(--s6); }
.hide { display: none !important; }

@media print {
    .sidebar, .topbar, .overlay, .skip-link, .form-actions { display: none !important; }
    .main { margin: 0; padding: 0; }
}
