/* Safqa employee portal — design system (third pass, 2026-11-02: full redesign).

   Direction: a calm, dense B2B operations tool. One primary colour (indigo) for action and selection, a dark navy
   navigation rail, neutral slate surfaces, and five state colours that only ever mean one thing:
     success (done, paid, verified) · warning (needs attention, waiting) · danger (failed, destructive, paid) ·
     info (in review, in progress) · blocked (cannot proceed until something else happens).

   Tokens, in this order: type scale, spacing scale (4-8-12-16-24-32-48), radii, elevation, colours (light, then dark
   under prefers-color-scheme). Components below use tokens only, so a change to the scale is a change everywhere.
   Every text/background pair meets WCAG 2.2 AA (4.5:1 body text, 3:1 large text and UI boundaries); the dark palette
   was chosen to keep the same ratios. Layout uses logical properties (inline-start/end, padding-inline, inset-inline)
   so Arabic (RTL) needs no overrides beyond the two shadows that point at an edge.
   Type: Inter for Latin script and IBM Plex Sans Arabic for Arabic, both self-hosted from the repository's
   OFL-licensed copies (`/fonts/...`); no CDN, nothing assumed installed. The CSP allows 'self' only.

   Type system (round 4, 2026-11-02). One scale, two scripts: the Latin scale is the default; `html[lang="ar"]`
   redefines the same tokens one optical step larger (Arabic at the same pixel size reads smaller) and gives body text
   and headings more leading (Arabic ascenders, descenders and marks need it). Components only use the tokens, so an
   Arabic page needs no per-component size overrides beyond the uppercase Latin micro-labels, which Arabic does not
   have. Weights: 400 body, 500 controls and labels, 600 titles, 700 page titles in Arabic (Plex Arabic has no 650).
   Latin runs inside Arabic text (ids, e-mails, SKUs, URLs, amounts, phone numbers) are isolated (`<bdi>`, `dir="ltr"`
   or `.num`) so they keep their own order, and numbers use Latin digits with tabular figures in both languages. */

@font-face { font-family: "Inter"; src: url("/fonts/inter.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Plex Arabic"; src: url("/fonts/plex-arabic-400.ttf") format("truetype"); font-weight: 400; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+0660-0669; }
@font-face { font-family: "Plex Arabic"; src: url("/fonts/plex-arabic-500.ttf") format("truetype"); font-weight: 500; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+0660-0669; }
@font-face { font-family: "Plex Arabic"; src: url("/fonts/plex-arabic-600.ttf") format("truetype"); font-weight: 600; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+0660-0669; }
@font-face { font-family: "Plex Arabic"; src: url("/fonts/plex-arabic-700.ttf") format("truetype"); font-weight: 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+0660-0669; }

:root {
  /* type */
  --font: "Inter", "Plex Arabic", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-ar: "Plex Arabic", "Inter", "Segoe UI", Tahoma, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", monospace;
  --text-xs: .75rem; --text-sm: .8125rem; --text-md: .875rem; --text-lg: 1rem; --text-xl: 1.125rem;
  --text-2xl: 1.375rem; --text-3xl: 1.75rem;
  --lh-body: 1.55; --lh-tight: 1.3; --lh-title: 1.2; --lh-control: 1.25;
  --weight-title: 650;
  /* spacing */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px; --space-7: 48px;
  /* shape and elevation */
  --radius: 10px; --radius-sm: 6px; --radius-lg: 14px; --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --sidebar: 248px; --content-max: 1360px; --control-h: 38px;
  /* neutrals */
  --bg: #f4f5f8; --surface: #ffffff; --surface-2: #f8f9fb; --surface-3: #eef0f4;
  --fg: #111827; --fg-2: #344054; --muted: #5d6677; --line: #e2e5ea; --line-strong: #cdd2da;
  /* primary */
  --primary: #3346c9; --primary-hover: #2a3bb0; --primary-fg: #ffffff; --primary-soft: #eef0fd; --primary-line: #c7cdf5;
  --focus: #3346c9;
  /* states */
  --success: #127a3e; --success-soft: #e8f6ee; --success-line: #b6e2c6;
  --warning: #8a4d00; --warning-soft: #fff4e0; --warning-line: #f6d39a;
  --danger: #b42318; --danger-soft: #fdeceb; --danger-line: #f3bdb7;
  --info: #1859b8; --info-soft: #e9f1fc; --info-line: #bcd4f4;
  --blocked: #5c4698; --blocked-soft: #f1eefa; --blocked-line: #d4ccef;
  --neutral-soft: #eef0f4;
  /* navigation rail */
  --rail: #101828; --rail-fg: #cfd5e0; --rail-fg-strong: #ffffff; --rail-muted: #98a2b3; --rail-hover: #1d2939;
  --rail-active: #26324a; --rail-line: #263043;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c111b; --surface: #141a26; --surface-2: #19202e; --surface-3: #212a3a;
    --fg: #eef1f6; --fg-2: #d0d6e1; --muted: #a2acbd; --line: #283244; --line-strong: #3a4558;
    --primary: #8f9dff; --primary-hover: #a5b1ff; --primary-fg: #0d1440; --primary-soft: #1c2350; --primary-line: #34408a; --focus: #a5b1ff;
    --success: #6fd394; --success-soft: #11291b; --success-line: #1f5133;
    --warning: #f4c46a; --warning-soft: #2d220e; --warning-line: #5a4316;
    --danger: #ff9a8f; --danger-soft: #34171a; --danger-line: #6a2b2b;
    --info: #8fb9ff; --info-soft: #14233a; --info-line: #27466f;
    --blocked: #c3b5f5; --blocked-soft: #221d38; --blocked-line: #433a6d;
    --neutral-soft: #212a3a;
    --rail: #090d15; --rail-hover: #151c2a; --rail-active: #1e2738; --rail-line: #1b2230; --rail-muted: #8b95a7;
    --shadow-sm: none; --shadow: 0 1px 2px rgba(0, 0, 0, .45); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .6);
  }
}

/* ---- base ---- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 var(--text-md)/var(--lh-body) var(--font); background: var(--bg); color: var(--fg);
       font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
/* Arabic: the same scale one optical step up, more leading, no Latin-only stylistic sets (Inter's cv11/ss01 have no
   meaning for Plex Arabic, and a stylistic set must never change an Arabic letter form by accident). */
html[lang="ar"] {
  --text-xs: .8125rem; --text-sm: .875rem; --text-md: .9375rem; --text-lg: 1.0625rem; --text-xl: 1.1875rem;
  --text-2xl: 1.4375rem; --text-3xl: 1.8125rem;
  --lh-body: 1.75; --lh-tight: 1.5; --lh-title: 1.45; --lh-control: 1.45;
  --weight-title: 700;
}
html[lang="ar"] body { font-family: var(--font-ar); font-size: var(--text-md); line-height: var(--lh-body); font-feature-settings: normal; }
h1, h2, h3, h4 { line-height: var(--lh-tight); margin: 0; color: var(--fg); font-weight: 600; letter-spacing: -.005em; }
html[lang="ar"] :is(h1, h2, h3, h4) { letter-spacing: 0; }
/* Numbers: Latin digits, tabular figures, their own direction inside Arabic sentences (amounts, counts, sizes). */
.num, bdi[dir="ltr"], .table td, .facts dd, .stat-value, .count { font-variant-numeric: tabular-nums; }
.num { unicode-bidi: isolate; white-space: nowrap; }
/* A left-to-right field (e-mail, password, URL, SKU) in a right-to-left form: typed text runs left to right, but the
   empty field's placeholder lines up with its Arabic label. */
[dir="rtl"] input[dir="ltr"]:placeholder-shown { text-align: right; }
/* Free-text fields (search, names, labels, notes) keep the page's direction for their box -- padding, icon, placeholder
   -- while what is typed takes the direction of its first letter, per line: an id typed into the Arabic search reads
   "SS-DEMO00007 (lamp)", an Arabic note in the English page reads right to left. (`dir="auto"` on an empty field made
   it left-to-right, so the Arabic placeholder ran under the search icon on phones.) Overlong placeholders end in "…". */
input:not([dir]):not([type="checkbox"]):not([type="file"]), textarea:not([dir]) { unicode-bidi: plaintext; }
input { text-overflow: ellipsis; }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-hover); }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: var(--text-sm); }
.mono, code { font-family: var(--mono); font-size: .86em; letter-spacing: 0; }
bdi.mono { white-space: nowrap; }   /* an id never breaks at its hyphen ("SS-" / "UX0000002") */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.flip { display: inline-block; }
[dir="rtl"] .flip { transform: scaleX(-1); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: absolute; inset-inline-start: var(--space-2); top: -48px; z-index: 50; background: var(--surface);
             padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.skip-link:focus { top: var(--space-2); }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---- buttons ---- */
.btn { font-family: inherit; font-size: var(--text-md); font-weight: 500; line-height: var(--lh-control); display: inline-flex; align-items: center; justify-content: center;
       gap: var(--space-2); min-height: var(--control-h); padding: var(--space-2) 14px; border: 1px solid var(--line-strong);
       border-radius: var(--radius-sm); background: var(--surface); color: var(--fg-2); cursor: pointer; text-decoration: none;
       white-space: nowrap; box-shadow: var(--shadow-sm); transition: background-color .12s, border-color .12s, color .12s; }
.btn:hover { background: var(--surface-2); border-color: var(--muted); color: var(--fg); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-fg); }
.btn-danger { color: var(--danger); border-color: var(--danger-line); background: var(--surface); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { filter: brightness(1.07); background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-block { width: 100%; }
.btn-sm { min-height: 30px; padding: var(--space-1) 10px; font-size: var(--text-sm); }
.btn-lg { min-height: 44px; padding: 10px 18px; font-size: var(--text-lg); }
.icon-btn { min-width: var(--control-h); padding: 6px; }
.paid-chip { display: inline-flex; align-items: center; gap: var(--space-1); padding: 0 6px; border-radius: var(--radius-pill);
             font-size: var(--text-xs); font-weight: 600; background: var(--warning-soft); color: var(--warning); border: 1px solid var(--warning-line); }

/* ---- forms ---- */
input, select, textarea { font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line-strong);
                          border-radius: var(--radius-sm); padding: var(--space-2) 10px; min-height: var(--control-h); max-width: 100%;
                          transition: border-color .12s, box-shadow .12s; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
textarea { width: 100%; resize: vertical; line-height: var(--lh-body); }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: var(--text-sm); font-weight: 500; color: var(--fg-2); min-width: 0; }
.field > input, .field > select, .field > textarea { font-size: var(--text-md); font-weight: 400; width: 100%; }
.field .muted.small { font-weight: 400; }
.check { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--fg-2); font-size: var(--text-md); cursor: pointer; }
.check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); }
.check-strong { font-weight: 500; color: var(--fg); }
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: flex-end; }
.grow { flex: 1 1 220px; }
progress { width: 100%; accent-color: var(--primary); }
.form-box { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px dashed var(--line); }
.form-box-top { margin: 0 0 var(--space-4); padding: 0 0 var(--space-4); border-top: 0; border-bottom: 1px dashed var(--line); }
.form-box h4 { font-size: var(--text-md); }

/* ---- badges ---- */
.badge { display: inline-flex; align-items: center; gap: var(--space-1); padding: 2px var(--space-2); border-radius: var(--radius-pill);
         font-size: var(--text-xs); font-weight: 600; line-height: 1.6; white-space: nowrap; border: 1px solid transparent;
         background: var(--neutral-soft); color: var(--fg-2); max-width: 100%; }
html[lang="ar"] .badge { font-weight: 500; }
.badge-neutral { background: var(--neutral-soft); color: var(--fg-2); border-color: var(--line); }
.badge-info { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }
.badge-accent { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-line); }
.badge-warn { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-line); }
.badge-ok { background: var(--success-soft); color: var(--success); border-color: var(--success-line); }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.badge-blocked { background: var(--blocked-soft); color: var(--blocked); border-color: var(--blocked-line); }
.badge.priority span { font-size: .65em; }
.count { margin-inline-start: auto; min-width: 22px; padding: 0 7px; border-radius: var(--radius-pill); background: var(--primary);
         color: #fff; font-size: var(--text-xs); font-weight: 600; line-height: 20px; text-align: center; }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.work-state { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.work-reason { color: var(--fg-2); font-size: var(--text-sm); }

/* ---- shell: navigation rail, top bar, page header ---- */
.shell { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; width: var(--sidebar); flex: none; display: flex; flex-direction: column;
           gap: var(--space-4); padding: var(--space-4) var(--space-3); background: var(--rail); color: var(--rail-fg);
           border-inline-end: 1px solid var(--rail-line); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: var(--text-lg); padding: 2px var(--space-2); color: var(--rail-fg-strong); }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--space-2); background: var(--primary);
              color: #fff; font-weight: 700; font-size: var(--text-md); }
.brand-large { font-size: var(--text-xl); justify-content: center; color: var(--fg); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { margin: var(--space-3) 10px var(--space-1); font-size: var(--text-xs); font-weight: 600; text-transform: uppercase;
             letter-spacing: .07em; color: var(--rail-muted); }
.nav-group:first-child { margin-top: 0; }
html[lang="ar"] .nav-group { text-transform: none; letter-spacing: 0; font-size: var(--text-sm); }
.nav-item { font: inherit; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: var(--space-2) 10px;
            border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--rail-fg); cursor: pointer;
            text-align: start; font-weight: 500; }
.nav-item:hover { background: var(--rail-hover); color: var(--rail-fg-strong); }
.nav-item[aria-current="page"] { background: var(--rail-active); color: var(--rail-fg-strong); box-shadow: inset 3px 0 0 var(--primary); }
[dir="rtl"] .nav-item[aria-current="page"] { box-shadow: inset -3px 0 0 var(--primary); }
.nav-item:focus-visible { outline-color: #a5b1ff; }
.nav-icon { display: inline-flex; width: 20px; justify-content: center; color: inherit; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--rail-line); }
.identity { display: flex; align-items: center; gap: 10px; padding: 0 var(--space-2); min-width: 0; }
.identity-text { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.avatar { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--rail-active);
          color: var(--rail-fg-strong); font-weight: 700; text-transform: uppercase; border: 1px solid var(--rail-line); }
.who { font-size: var(--text-sm); color: var(--rail-fg-strong); overflow-wrap: anywhere; text-align: start; }
.identity .badge { align-self: flex-start; background: var(--rail-active); color: var(--rail-fg-strong); border-color: var(--rail-line); }
.sidebar .lang-switch select { width: 100%; background: var(--rail-hover); color: var(--rail-fg-strong); border-color: var(--rail-line); }
.sidebar .btn-ghost { color: var(--rail-fg); justify-content: flex-start; }
.sidebar .btn-ghost:hover { background: var(--rail-hover); color: var(--rail-fg-strong); }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: var(--space-3); min-height: 60px;
          padding: var(--space-2) var(--space-6); background: color-mix(in srgb, var(--surface) 94%, transparent);
          backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
#menu { display: none; }
.quick-search { position: relative; flex: 1; max-width: 520px; }
.quick-search input { width: 100%; padding-inline-start: 36px; background: var(--surface-2); }
.quick-search-icon { position: absolute; inset-inline-start: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); display: inline-flex; }
.topbar .notif-wrap { margin-inline-start: auto; }
main#main { padding: var(--space-5) var(--space-6) var(--space-7); max-width: var(--content-max); width: 100%; outline: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-3) var(--space-5);
             margin-bottom: var(--space-5); }
.page-head-text { min-width: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.page-title { font-size: var(--text-3xl); font-weight: var(--weight-title); line-height: var(--lh-title); overflow-wrap: anywhere; }
.page-subtitle { color: var(--muted); max-width: 72ch; }
.page-subtitle:empty { display: none; }
.page-actions, .page-actions-slot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.page-actions-slot:empty { display: none; }
.backdrop { position: fixed; inset: 0; background: rgba(8, 12, 22, .45); z-index: 19; }
.view-error { justify-content: flex-start; }
.view-error .btn { margin-inline-start: auto; }
.alert-icon { display: inline-flex; }

/* ---- cards, grids, sections ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
        padding: 18px var(--space-5); margin-bottom: var(--space-4); min-width: 0; }
.card-flush { padding: 0; overflow-x: auto; }
.card-title { font-size: var(--text-lg); font-weight: 600; margin-bottom: var(--space-3); }
.card-title-pad { padding: var(--space-4) var(--space-5) 0; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-2); margin-bottom: 14px; }
.card-head .card-title { margin: 0; }
.section-title { font-size: var(--text-sm); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin: var(--space-2) 0 var(--space-3); }
html[lang="ar"] .section-title { text-transform: none; letter-spacing: 0; font-size: var(--text-md); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: var(--space-4); }
.grid-2 > .card, .stack-cards > .card { margin-bottom: 0; }
.grid-2 + .card, .grid-2 + .grid-2 { margin-top: var(--space-4); }
.stack-cards { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.empty-state { color: var(--muted); padding: 10px 0; }
.tech-detail { margin-top: var(--space-4); border-top: 1px solid var(--line); padding-top: 10px; }
.tech-detail > summary { cursor: pointer; color: var(--muted); font-size: var(--text-sm); min-height: 24px; }
.tech-detail > .facts { margin-top: 10px; }

/* ---- dashboard ---- */
.next-task { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding: var(--space-5);
             border-color: var(--primary-line); box-shadow: inset 4px 0 0 var(--primary), var(--shadow-sm); }
[dir="rtl"] .next-task { box-shadow: inset -4px 0 0 var(--primary), var(--shadow-sm); }
.next-task-idle { border-color: var(--success-line); box-shadow: inset 4px 0 0 var(--success), var(--shadow-sm); }
[dir="rtl"] .next-task-idle { box-shadow: inset -4px 0 0 var(--success), var(--shadow-sm); }
.next-task-head { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.eyebrow { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--primary); }
html[lang="ar"] .eyebrow { text-transform: none; letter-spacing: 0; font-size: var(--text-sm); }
.next-task-title { font-size: var(--text-2xl); font-weight: 600; }
.next-task-why { font-size: var(--text-lg); color: var(--fg-2); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-5); }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 14px var(--space-4); margin: 0; text-align: start; cursor: pointer;
        color: inherit; text-decoration: none; transition: border-color .12s, box-shadow .12s; }
.stat:hover { border-color: var(--primary-line); box-shadow: var(--shadow); color: inherit; }
.stat-value { font-size: var(--text-2xl); font-weight: 600; line-height: var(--lh-title); font-variant-numeric: tabular-nums; color: var(--fg); }
.stat-label { color: var(--muted); font-size: var(--text-sm); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-5); }
.work-panel { display: flex; flex-direction: column; gap: var(--space-3); margin: 0; }
.work-panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.work-panel-head .card-title { margin: 0; display: flex; align-items: center; gap: var(--space-2); }
.work-panel-hint { margin-top: calc(-1 * var(--space-2)); }
.tone-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.tone-dot.tone-accent { background: var(--primary); } .tone-dot.tone-warn { background: var(--warning); }
.tone-dot.tone-blocked { background: var(--blocked); } .tone-dot.tone-danger { background: var(--danger); }
.tone-dot.tone-info { background: var(--info); } .tone-dot.tone-ok { background: var(--success); }
.work-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.work-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-1) var(--space-3); align-items: center;
             padding: 10px var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
             color: inherit; text-decoration: none; }
.work-item:hover { border-color: var(--primary-line); background: var(--primary-soft); color: inherit; }
.work-item-title { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.work-item-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px var(--space-2); align-items: center; color: var(--muted); font-size: var(--text-sm); }
.work-item-reason { color: var(--fg-2); }
.link-more { font-size: var(--text-sm); font-weight: 500; white-space: nowrap; }
.queue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-5); }
.queue { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; }
.queue-info { background: var(--surface-2); box-shadow: none; }
.queue-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.queue-head .card-title { margin: 0; font-size: var(--text-md); }
.queue-count { min-width: 30px; padding: 0 9px; border-radius: var(--radius-pill); background: var(--surface-3); color: var(--fg-2);
               text-align: center; font-weight: 600; font-size: var(--text-sm); line-height: 24px; font-variant-numeric: tabular-nums; }
.queue-count-hot { background: var(--primary); color: #fff; }
.queue-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.queue-item { display: flex; justify-content: space-between; gap: var(--space-2); align-items: center; padding: var(--space-2) 10px;
              border-radius: var(--radius-sm); color: inherit; text-decoration: none; border: 1px solid var(--line); background: var(--surface); }
.queue-item:hover { border-color: var(--primary-line); background: var(--primary-soft); color: inherit; }
.queue-item-name { min-width: 0; overflow-wrap: anywhere; }
.queue .btn { align-self: flex-start; margin-top: var(--space-1); }
.status-bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(130px, 34%) 1fr 36px; align-items: center; gap: var(--space-3); padding: var(--space-1) 6px;
           color: inherit; text-decoration: none; border-radius: var(--radius-sm); }
.bar-row:hover, .bar-row:focus-visible { background: var(--primary-soft); color: inherit; }
.bar-track { height: 8px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: var(--radius-pill); min-width: 2px; }
.bar-count { text-align: end; font-variant-numeric: tabular-nums; color: var(--fg-2); }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.feed li { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }

/* ---- filters and tables ---- */
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--space-3); align-items: end;
           margin-bottom: var(--space-4); padding: var(--space-4); background: var(--surface); border: 1px solid var(--line);
           border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.filters .field-search { grid-column: 1 / -1; }
.filters-compact { grid-template-columns: minmax(0, 3fr) minmax(160px, 1fr); }
.filters-compact .field-search { grid-column: auto; }
.filters input:not([type="checkbox"]), .filters select { width: 100%; height: var(--control-h); padding-block: 6px; }
.filters-foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.filters-foot .btn { margin-inline-start: auto; }
.cell-stack { display: flex; flex-direction: column; gap: 2px; }
.cell-stack .badge { align-self: flex-start; }
.row-link { text-decoration: none; font-weight: 600; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: start; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2);
            font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
html[lang="ar"] .table th { text-transform: none; letter-spacing: 0; font-size: var(--text-sm); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; transition: background-color .1s; }
.table tr.clickable:hover, .table tr.clickable:focus-within { background: var(--primary-soft); }
.table td.empty { text-align: center; color: var(--muted); padding: var(--space-7) var(--space-4); }
.table td bdi.mono, .table td:last-child { white-space: nowrap; }
.table td { overflow-wrap: anywhere; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: var(--space-3); }
.pager-buttons { display: flex; align-items: center; gap: var(--space-2); }

/* ---- request page ---- */
.back-link { display: inline-flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); text-decoration: none; font-weight: 500; }
.detail-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.detail-head-main { min-width: 0; }
.detail-title { font-size: var(--text-2xl); font-weight: 600; line-height: var(--lh-title); overflow-wrap: anywhere; }
.detail-head .muted { margin-top: var(--space-1); }
.action-card { border-color: var(--primary-line); }
.action-card .card-head { margin-bottom: var(--space-3); align-items: baseline; }
.action-bar { display: flex; flex-wrap: wrap; gap: 10px; }
.blocked-list { list-style: none; margin: var(--space-3) 0 0; padding: var(--space-3) 0 0; display: flex; flex-direction: column; gap: var(--space-2); border-top: 1px dashed var(--line); }
.blocked-list:empty { display: none; }
.blocked { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.blocked .muted { color: var(--blocked); }
.danger-zone { margin-top: var(--space-4); padding: var(--space-3) var(--space-4); border: 1px solid var(--danger-line); border-radius: var(--radius-sm);
               background: color-mix(in srgb, var(--danger-soft) 55%, var(--surface)); display: flex; flex-direction: column; gap: 10px; }
.danger-title { font-weight: 600; color: var(--danger); }
.tabs { display: flex; gap: 2px; overflow-x: auto; overflow-y: hidden; box-shadow: inset 0 -1px 0 var(--line); margin-bottom: var(--space-5); scrollbar-width: thin; }
/* The underline is an inset shadow and the tabs sit inside the box: with Arabic leading a negative margin made the
   strip one pixel taller than its box, and a vertical scrollbar appeared beside the tabs (round 4, seen in RTL). */
.tab { font: inherit; font-weight: 500; border: 0; background: transparent; color: var(--muted); padding: 10px 14px; min-height: 44px;
       cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--fg); }
.tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-panel:focus-visible { outline-offset: 4px; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px var(--space-5); margin: 0; }
.facts dt { color: var(--muted); font-size: var(--text-sm); }
.facts dd { margin: 0; overflow-wrap: anywhere; color: var(--fg); }
.facts-wide dd { white-space: pre-wrap; }
.item-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.item { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: var(--space-3) 14px; border: 1px solid var(--line);
        border-radius: var(--radius-sm); background: var(--surface-2); }
.item-main { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 3px; overflow-wrap: anywhere; }
.item-title { font-weight: 600; color: var(--fg); }
.item-meta { color: var(--muted); font-size: var(--text-sm); }
.item-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.item.blocker { border-color: var(--warning-line); background: var(--warning-soft); }
.bridge-state { white-space: normal; text-align: start; }
.tech { margin-top: var(--space-1); font-size: var(--text-sm); color: var(--muted); }
.tech summary { cursor: pointer; }
.tech summary:hover { color: var(--fg); }
.controls { display: flex; flex-direction: column; gap: var(--space-3); }
.control-group { display: flex; flex-direction: column; gap: var(--space-2); }
.control-group-label { font-size: var(--text-sm); font-weight: 600; color: var(--fg-2); display: flex; gap: var(--space-2); align-items: center; }
.control-group-danger { padding-top: var(--space-3); border-top: 1px dashed var(--danger-line); }
.control-group-danger .control-group-label { color: var(--danger); }
.confirm-box { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0; }
.confirm-box p { flex-basis: 100%; }

/* stage stepper */
.stages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.stage { display: flex; gap: var(--space-3); position: relative; padding-bottom: 10px; }
.stage::before { content: ""; position: absolute; inset-inline-start: 13px; top: 28px; bottom: 0; width: 2px; background: var(--line); }
.stage:last-child::before { display: none; }
.stage-done::before { background: var(--success-line); }
.stage-icon { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: var(--text-sm);
              background: var(--surface-3); color: var(--muted); z-index: 1; border: 1px solid var(--line); }
.stage-icon.badge-ok { background: var(--success-soft); color: var(--success); border-color: var(--success-line); }
.stage-icon.badge-accent { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-line); }
.stage-icon.badge-warn { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-line); }
.stage-icon.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.stage-main { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; min-width: 0; padding-top: 3px; }
.stage-name { font-weight: 600; }
.stage-pending .stage-name { color: var(--muted); font-weight: 400; }
.stage-detail { flex-basis: 100%; color: var(--danger); overflow-wrap: anywhere; }

/* questions */
.question-card { border-color: var(--warning-line); box-shadow: inset 4px 0 0 var(--warning), var(--shadow-sm); }
[dir="rtl"] .question-card { box-shadow: inset -4px 0 0 var(--warning), var(--shadow-sm); }
.question { display: flex; flex-direction: column; gap: var(--space-2); padding: 14px var(--space-4); border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.question-title { font-size: var(--text-lg); }
.question-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented label { min-width: 44px; min-height: 44px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
                   background: var(--surface); cursor: pointer; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--fg-2); }
.segmented label:hover { border-color: var(--primary); color: var(--primary); }
.segmented input:checked + label { background: var(--primary); color: #fff; border-color: var(--primary); }
.segmented input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* media review */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-3); }
.media-grid > .empty-state { grid-column: 1 / -1; }
.media-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; min-width: 0; box-shadow: var(--shadow-sm); }
.media-preview { background: var(--surface-3); display: grid; place-items: center; min-height: 150px; border-bottom: 1px solid var(--line); }
.media-open { border: 0; padding: 0; background: transparent; cursor: zoom-in; display: block; width: 100%; }
.media-thumb { display: block; width: 100%; height: 170px; object-fit: contain; background: var(--surface-3); }
.media-none { padding: var(--space-5) var(--space-3); text-align: center; color: var(--muted); }
.media-body { display: flex; flex-direction: column; gap: 6px; padding: var(--space-3); min-width: 0; overflow-wrap: anywhere; }
.media-view { display: grid; place-items: center; }
.media-large { max-width: 100%; max-height: 72vh; border-radius: var(--radius-sm); }
.review-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.review-tile { margin: 0; border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); transition: border-color .12s; }
.review-tile:hover { border-color: var(--line-strong); }
.review-tile.marked { border-color: var(--danger); }
.review-tile .media-thumb { height: 150px; }
.review-tile figcaption { padding: var(--space-2) 10px; color: var(--fg); font-size: var(--text-sm); }
.review-tile figcaption label { cursor: pointer; }

/* delivery checklist */
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.checklist li { display: flex; gap: 10px; align-items: center; }
.check-mark { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; flex: none; font-size: var(--text-sm);
              background: var(--surface-3); color: var(--muted); border: 1px solid var(--line); }
.checklist li.ok .check-mark { background: var(--success-soft); color: var(--success); border-color: var(--success-line); }
.checklist li.todo { color: var(--muted); }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding-inline-start: var(--space-5); padding-bottom: var(--space-4); }
.timeline li::before { content: ""; position: absolute; inset-inline-start: 5px; top: 10px; bottom: -6px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; inset-inline-start: 0; top: 6px; width: 12px; height: 12px; border-radius: 50%;
                      background: var(--surface); border: 2px solid var(--primary); }
.timeline li.t-note::after { border-color: var(--muted); }
.timeline li.t-blocker::after { border-color: var(--warning); background: var(--warning); }
.timeline li.t-job::after { border-color: var(--info); }
.timeline .when { color: var(--muted); font-size: var(--text-xs); }

/* ---- alerts, toasts, dialogs, skeletons ---- */
.alert { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding: 10px 14px; border-radius: var(--radius-sm); margin: 0 0 var(--space-4);
         border: 1px solid transparent; font-size: var(--text-md); }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.payment-alert { margin: var(--space-4) 0 0; }
.alert-warn { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-line); }
.alert-info { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }
.alert-success { background: var(--success-soft); color: var(--success); border-color: var(--success-line); }
.alert .btn { margin-inline-start: auto; }
.toasts { position: fixed; inset-inline-end: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: var(--space-2); max-width: min(420px, calc(100vw - 32px)); }
.toast { padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); background: var(--fg); color: var(--surface); box-shadow: var(--shadow-lg);
         border-inline-start: 4px solid var(--success); font-size: var(--text-md); }
.toast.error { background: var(--danger); color: #fff; border-inline-start-color: #fff; }
.dialog { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px var(--space-5); width: min(520px, calc(100vw - 32px)); background: var(--surface);
          color: var(--fg); box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: rgba(8, 12, 22, .5); }
.dialog-title { font-size: var(--text-xl); }
.dialog-wide { width: min(980px, calc(100vw - 32px)); }
#dialog-body { white-space: pre-line; color: var(--fg-2); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: var(--space-3); border-top: 1px solid var(--line); margin-top: var(--space-1); }
.skeleton { display: block; height: 14px; border-radius: 6px; margin: var(--space-2) 0;
            background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%;
            animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } * { transition: none !important; } }

/* ---- notifications: bell, unread count, panel ---- */
.notif-wrap { position: relative; display: inline-flex; }
.notif-button { position: relative; }
.notif-count { position: absolute; top: 2px; inset-inline-end: 0; min-width: 18px; padding: 0 5px; border-radius: var(--radius-pill);
               background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
               font-variant-numeric: tabular-nums; pointer-events: none; }
.notif-panel { position: absolute; top: calc(100% + var(--space-2)); inset-inline-end: 0; z-index: 30;
               width: min(420px, calc(100vw - 24px)); max-height: min(70vh, 640px); overflow-y: auto;
               display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3) var(--space-4);
               background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: var(--radius);
               box-shadow: var(--shadow-lg); }
.notif-head, .notif-tools { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; }
.notif-title { font-size: var(--text-lg); }
.notif-state:empty { display: none; }
.notif-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.notif-item { display: flex; gap: var(--space-2); align-items: flex-start; width: 100%; padding: var(--space-2) var(--space-3);
              border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: inherit;
              font: inherit; text-align: start; cursor: pointer; }
.notif-item:hover { border-color: var(--primary-line); background: var(--primary-soft); }
.notif-item.unread { background: var(--surface-2); border-inline-start: 3px solid var(--primary); }
.notif-dot { flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--primary); }
.notif-item:not(.unread) .notif-dot { background: transparent; }
.notif-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.notif-text { color: var(--fg); }
.notif-item.unread .notif-text { font-weight: 600; }
.notif-when { color: var(--muted); font-size: var(--text-xs); }
.notif-foot { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); padding-top: var(--space-2);
              border-top: 1px solid var(--line); }

/* ---- sign in ---- */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--space-4);
         background: radial-gradient(1200px 600px at 50% -200px, var(--primary-soft), var(--bg)); }
.login-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
              box-shadow: var(--shadow-lg); padding: var(--space-6) 28px; display: flex; flex-direction: column; gap: var(--space-4); }
.login-card h1 { font-size: var(--text-2xl); text-align: center; }
.login-card > .muted { text-align: center; }
.login-foot { display: flex; justify-content: center; }

/* ---- responsive ---- */
/* Below 1100px the tables' columns no longer fit beside the sidebar: each row becomes a labelled card. */
@media (max-width: 1100px) {
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); }
  .table.responsive td { border: 0; padding: var(--space-1) 0; display: flex; gap: var(--space-3); justify-content: space-between; align-items: center; }
  .table.responsive td::before { content: attr(data-label); color: var(--muted); font-size: var(--text-sm); flex: none; }
  .table.responsive td.empty { justify-content: center; }
  .table.responsive td.empty::before { content: none; }
}
/* Below 900px the navigation rail becomes a drawer behind the menu button. */
@media (max-width: 900px) {
  #menu { display: inline-flex; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 20; transform: translateX(-105%); transition: transform .2s ease; }
  [dir="rtl"] .sidebar { transform: translateX(105%); }
  .sidebar.open { transform: none; }
  .topbar { padding: var(--space-2) var(--space-4); }
  main#main { padding: var(--space-4) var(--space-4) var(--space-7); }
  .page-title { font-size: var(--text-2xl); }
}
@media (max-width: 680px) {
  .tabs { flex-wrap: wrap; overflow-x: visible; }
  .bar-row { grid-template-columns: minmax(100px, 40%) 1fr 32px; }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .facts dd { margin-bottom: 10px; }
  .filters, .filters-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: var(--space-3); }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .next-task { padding: var(--space-4); }
  .next-task .btn-lg { width: 100%; }
  .action-bar .btn { flex: 1 1 100%; }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .detail-head { flex-direction: column; align-items: flex-start; }
  .card { padding: var(--space-4); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .page-head { align-items: flex-start; flex-direction: column; }
  .notif-panel { position: fixed; top: 60px; inset-inline: var(--space-3); width: auto; max-height: calc(100vh - 80px); }
  .quick-search input { font-size: 16px; }   /* no zoom-on-focus on phones */
  .table.responsive td .badge { white-space: normal; text-align: start; }
  .table.responsive td > * { min-width: 0; }
}
@media print {
  .sidebar, .topbar, .page-actions, .action-card, .tabs, .toasts { display: none !important; }
  .tab-panel[hidden] { display: block !important; }
}

/* Support-led services (contract v1): the structured brief, one readable section per field group. */
.brief-sections { display: grid; gap: var(--space-3); }
.brief-section { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); min-width: 0; }
.brief-section-title { margin: 0 0 var(--space-2); font-size: var(--text-md); font-weight: 600; }
.brief-section dd { overflow-wrap: anywhere; white-space: pre-wrap; }
.command-reply { margin-top: var(--space-2, 8px); }
.command-reply > summary { cursor: pointer; color: var(--muted); font-size: var(--text-sm); min-height: 24px; }
.command-reply > pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 24rem; overflow: auto; font: inherit; font-size: var(--text-sm); background: var(--surface-2, transparent); padding: 8px; border: 1px solid var(--line); border-radius: 6px; }
