/* إيراد — design system v3 "Convergence"
   Scattered quotes resolve into one decision. Deep navy (ink) carries the brand, signal blue marks
   action and the recommended choice, amber marks corrections, coral marks errors. No green, no beige. */
:root {
  --ink: #0B1B3F;
  --ink-2: #22304F;
  --ink-soft: #46536E;
  --muted: #657186;
  --faint: #8A94A6;

  --blue: #2E50F0;
  --blue-700: #1D38C4;
  --blue-050: #EEF2FF;
  --blue-100: #DCE4FF;

  --amber: #A85A00;
  --amber-500: #F0A020;
  --amber-050: #FFF5E6;
  --amber-200: #F6D9A8;

  --red: #D23B3F;
  --red-050: #FEF0EE;
  --red-200: #F7C9C3;

  --slate: #33558F;
  --slate-050: #EEF2F8;

  --bg: #F4F6FB;
  --surface: #FFFFFF;
  --line: #E1E6EF;
  --line-2: #EEF1F7;
  --line-strong: #C7CFDB;

  /* legacy aliases (scripts reference some of these) */
  --indigo: var(--blue); --indigo-600: var(--blue-700); --indigo-050: var(--blue-050); --indigo-100: var(--blue-100);
  --violet: var(--blue); --violet-050: var(--blue-050);
  --saffron: var(--amber-500); --saffron-600: var(--amber); --saffron-050: var(--amber-050);
  --coral: var(--red); --coral-600: var(--red); --coral-050: var(--red-050);
  --sky: var(--slate); --sky-700: var(--slate); --sky-050: var(--slate-050);
  --grad: var(--blue); --grad-deep: var(--ink);

  --r-sm: 6px; --r: 8px; --r-lg: 12px; --r-xl: 16px;
  --sh-1: 0 1px 2px rgba(11,27,63,.05);
  --sh-2: 0 1px 2px rgba(11,27,63,.04), 0 8px 24px -10px rgba(11,27,63,.16);
  --sh-3: 0 2px 4px rgba(11,27,63,.04), 0 28px 60px -20px rgba(11,27,63,.32);
  --ring: 0 0 0 3px rgba(46,80,240,.22);
  --navy-2: #13275A; --navy-3: #1C3470; --sky: #8FA4FF;
  --f-body: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-head: "IBM Plex Sans Arabic", system-ui, sans-serif;
  --f-display: "Noto Kufi Arabic", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --side-w: 248px;
  --ease: cubic-bezier(.2,.7,.2,1);
}
/* English documents: IBM Plex Sans is the Latin sibling of the Arabic body face; Archivo is the display face
   (wide, flat-shouldered grotesque that echoes the horizontal emphasis of Noto Kufi). */
:root:lang(en) {
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-head: "IBM Plex Sans", system-ui, sans-serif;
  --f-display: "Archivo", "IBM Plex Sans", system-ui, sans-serif;
}
:root:lang(en) h1, :root:lang(en) h2, :root:lang(en) h3, :root:lang(en) h4 { letter-spacing: -.01em; }
:root:lang(en) body { line-height: 1.55; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; overflow-x: hidden; background: var(--bg); color: var(--ink-2);
  font-family: var(--f-body); font-size: 14.5px; line-height: 1.65;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5 { font-family: var(--f-head); color: var(--ink); line-height: 1.35; margin: 0 0 .5em; font-weight: 600; letter-spacing: 0; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
h4 { font-size: .95rem; }
p { margin: 0 0 1em; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img, svg { vertical-align: middle; }
svg.ic { width: 1.05em; height: 1.05em; vertical-align: -0.18em; flex: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--blue-100); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 3px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; top: -100px; inset-inline-start: 12px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: var(--r); z-index: 999; }
.skip-link:focus { top: 12px; }
[hidden] { display: none !important; }

/* numbers */
.num, .money, td.n, .tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.xs { font-size: .78rem; }
.strong { font-weight: 600; color: var(--ink); }
.nowrap { white-space: nowrap; }
.t-center { text-align: center; }
.t-end { text-align: end; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* layout utils */
.container { width: min(1180px, 100% - 40px); margin-inline: auto; }
.stack > * + * { margin-top: var(--gap, 16px); }
.row { display: flex; align-items: center; gap: var(--gap, 12px); flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.spacer { flex: 1; }
.grid { display: grid; gap: var(--gap, 16px); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }
.g-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 1080px) { .g-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g-side { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .g-2, .g-3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 420px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); --gap: 10px; } }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 36px; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.w-100 { width: 100%; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* ---------- Buttons ---------- */
.btn {
  --bh: 38px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--bh); padding: 0 16px; border-radius: var(--r); border: 1px solid transparent;
  font-family: var(--f-body); font-weight: 500; font-size: .93rem; line-height: 1;
  cursor: pointer; text-decoration: none !important; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
  user-select: none;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 6px 16px -8px rgba(46,80,240,.7); }
.btn-primary:hover { background: var(--blue-700); }
.btn-accent { background: var(--ink); color: #fff; }
.btn-accent:hover { background: var(--navy-2); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-outline:hover { border-color: var(--ink-soft); }
.btn-soft { background: var(--blue-050); color: var(--blue-700); }
.btn-soft:hover { background: var(--blue-100); }
.btn-danger { background: var(--surface); color: var(--red); border-color: var(--red-200); }
.btn-danger:hover { background: var(--red-050); }
.btn-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.btn-light:hover { background: rgba(255,255,255,.08); }
.btn-sm { --bh: 32px; padding: 0 11px; font-size: .86rem; }
.btn-lg { --bh: 46px; padding: 0 22px; font-size: 1rem; }
.btn-icon { padding: 0; width: var(--bh); }
.btn-block { width: 100%; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.9); border-top-color: transparent;
  animation: spin .7s linear infinite;
}
.btn-outline.is-loading::after, .btn-soft.is-loading::after, .btn-ghost.is-loading::after, .btn-danger.is-loading::after { border-color: var(--blue); border-top-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Panels ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.card-b { padding: 18px 20px; }
.card-h { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-h h2, .card-h h3 { margin: 0; font-size: 1rem; }
.card-h .sub { color: var(--muted); font-size: .84rem; }
.card-f { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; background: #FAFBFC; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card.flat { box-shadow: none; }
.card.tint { background: #FAFBFD; }
@media (max-width: 600px) { .card-b { padding: 16px; } .card-h { padding: 12px 16px; } .card-f { padding: 12px 16px; } }

/* ---------- Status labels ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: var(--r-sm);
  font-size: .78rem; font-weight: 500; white-space: nowrap; line-height: 1; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-soft);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.no-dot::before { display: none; }
.pill.indigo, .pill.violet { color: var(--blue-700); border-color: var(--blue-100); background: var(--blue-050); }
.pill.sky { color: var(--slate); border-color: #D3DCEA; background: var(--slate-050); }
.pill.saffron { color: var(--amber); border-color: var(--amber-200); background: var(--amber-050); }
.pill.coral { color: var(--red); border-color: var(--red-200); background: var(--red-050); }
.pill.ink { background: var(--ink); color: #fff; border-color: var(--ink); }
.pill.muted { color: var(--muted); }
.pill.lg { height: 28px; padding: 0 10px; font-size: .84rem; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: var(--r-sm); font-size: .77rem; line-height: 1.55;
  background: var(--line-2); color: var(--ink-soft); border: 1px solid transparent;
}
.chip svg { width: 13px; height: 13px; }
.chip.warn { background: var(--amber-050); color: var(--amber); border-color: var(--amber-200); }
.chip.err { background: var(--red-050); color: var(--red); border-color: var(--red-200); }
.chip.info { background: var(--slate-050); color: var(--slate); }
.chip.ok { background: var(--blue-050); color: var(--blue-700); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.verified { display: inline-flex; align-items: center; gap: 4px; color: var(--blue-700); font-size: .78rem; font-weight: 500; }
.verified svg { width: 14px; height: 14px; }

/* AI engine status */
.ai-badge { display: inline-flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--ink-soft); }
.ai-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }
.ai-badge.sim .dot { background: var(--amber-500); }
.ai-badge.on-light { color: var(--ink-soft); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: .86rem; font-weight: 500; color: var(--ink); }
.field .hint { font-size: .79rem; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: #AEB8C8; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--blue); box-shadow: var(--ring); }
.input.sm, .select.sm { min-height: 34px; padding: 5px 9px; font-size: .9rem; }
.textarea { min-height: 120px; resize: vertical; line-height: 1.75; }
.textarea.xl { min-height: 220px; font-size: 1rem; }
.select { appearance: none; padding-inline-end: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23657186' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 10px center; }
[dir="ltr"] .select { background-position: right 10px center; }
.input[type="number"] { direction: ltr; text-align: right; }
.input.ltr-in { direction: ltr; text-align: left; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-start-end-radius: 0; border-end-end-radius: 0; }
.input-group .addon { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--line-strong); border-inline-start: 0; border-start-end-radius: var(--r); border-end-end-radius: var(--r); background: #F7F8FA; color: var(--muted); font-size: .85rem; }
.field.invalid .input, .field.invalid .textarea { border-color: var(--red); }
.form-error { color: var(--red); font-size: .84rem; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--blue); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 38px; height: 22px; border-radius: 999px; background: #C9D0DC; position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.switch input:checked + .track { background: var(--blue); }
.switch input:checked + .track::after { transform: translateX(-16px); }
[dir="ltr"] .switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }
.switch input:disabled + .track { opacity: .55; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--line-2); border-radius: var(--r); flex-wrap: wrap; }
.seg button, .seg a { border: 0; background: transparent; padding: 6px 13px; border-radius: var(--r-sm); cursor: pointer; font-size: .88rem; color: var(--ink-soft); white-space: nowrap; text-decoration: none; }
.seg button[aria-selected="true"], .seg a[aria-current="page"], .seg button.active { background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: 0 1px 2px rgba(15,27,51,.1); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; padding: 9px 12px; font-size: .92rem; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--blue); font-weight: 500; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  padding: 24px 18px; border: 1px dashed var(--line-strong); border-radius: var(--r-lg); background: #FAFBFC; cursor: pointer;
}
.dropzone:hover, .dropzone.over { background: var(--blue-050); border-color: var(--blue); }
.dropzone svg { width: 26px; height: 26px; color: var(--ink-soft); }
.dropzone input { position: absolute; opacity: 0; pointer-events: none; width: 1px; }
.dropzone .file-name { font-weight: 600; color: var(--blue-700); }

/* ---------- Tables ---------- */
.table-wrap { position: relative; overflow: auto; -webkit-overflow-scrolling: touch; max-width: 100%; border-radius: inherit; }
.table-wrap.tall { max-height: 560px; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .91rem; }
.tbl th, .tbl td { padding: 10px 14px; text-align: start; vertical-align: middle; border-bottom: 1px solid var(--line-2); }
.tbl thead th { position: sticky; top: 0; z-index: 2; background: #F7F8FA; color: var(--muted); font-weight: 500; font-size: .8rem; white-space: nowrap; border-bottom: 1px solid var(--line); }
.tbl tbody tr:hover { background: #FAFBFD; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl td.n, .tbl th.n { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl tr.clickable { cursor: pointer; }
.tbl .cell-title { font-weight: 500; color: var(--ink); }
.tbl .cell-sub { font-size: .79rem; color: var(--muted); }
.tbl.compact th, .tbl.compact td { padding: 7px 10px; }
.tbl.edit td { padding: 5px 6px; }
.tbl.edit .input, .tbl.edit .select { min-height: 34px; padding: 5px 9px; font-size: .9rem; }
.tbl tfoot td { background: #F7F8FA; font-weight: 600; color: var(--ink); border-top: 1px solid var(--line); border-bottom: 0; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 1000; bottom: 20px; inset-inline-end: 20px; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--r);
  background: var(--ink); color: #fff; box-shadow: var(--sh-3); font-size: .9rem; animation: toastIn .2s var(--ease);
  border-inline-start: 3px solid var(--blue-100);
}
.toast.error { border-inline-start-color: #F08A80; }
.toast.warn { border-inline-start-color: var(--amber-500); }
.toast.success { border-inline-start-color: #8FA6FF; }
.toast.out { animation: toastOut .2s var(--ease) forwards; }
.toast button { margin-inline-start: auto; background: none; border: 0; color: #fff; opacity: .6; cursor: pointer; padding: 0 2px; font-size: 1.1rem; line-height: 1; }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } }
@keyframes toastOut { to { opacity: 0; } }
@media (max-width: 760px) { .toasts { inset-inline: 16px; bottom: 84px; max-width: none; } }

/* ---------- Modal / drawer ---------- */
.backdrop { position: fixed; inset: 0; z-index: 900; background: rgba(15,27,51,.42); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-3); }
.modal.wide { width: min(820px, 100%); }
.modal-h { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-h h3 { margin: 0; font-size: 1.04rem; }
.modal-b { padding: 18px 20px; }
.modal-f { padding: 12px 20px 18px; display: flex; gap: 10px; justify-content: flex-start; flex-wrap: wrap; }
.x-btn { margin-inline-start: auto; width: 32px; height: 32px; border-radius: var(--r); border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.x-btn:hover { background: var(--line-2); color: var(--ink); }
.x-btn svg { width: 17px; height: 17px; }
.backdrop.drawer-bd { justify-content: flex-start; padding: 0; }
.drawer { width: min(480px, 100%); height: 100%; background: var(--surface); overflow: auto; box-shadow: var(--sh-3); margin-inline-start: auto; }
@media (max-width: 600px) {
  .backdrop:not(.drawer-bd) { align-items: flex-end; padding: 0; }
  .modal { border-radius: 12px 12px 0 0; max-height: 92vh; }
}

/* ---------- Stepper (request lifecycle) ---------- */
.stepper { display: flex; list-style: none; margin: 0; padding: 0; overflow-x: auto; scrollbar-width: none; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.stepper::-webkit-scrollbar { display: none; }
.stepper li { flex: 1 0 auto; min-width: 104px; position: relative; display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--faint); padding: 10px 12px; border-inline-start: 1px solid var(--line-2); }
.stepper li:first-child { border-inline-start: 0; }
.stepper li::before { display: none; }
.stepper .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line-strong); font-size: .74rem; color: var(--muted); font-weight: 600; flex: none; font-variant-numeric: tabular-nums; }
.stepper .dot svg { width: 12px; height: 12px; }
.stepper li.done { color: var(--ink-soft); }
.stepper li.done .dot { background: var(--ink); border-color: var(--ink); color: #fff; }
.stepper li.current { color: var(--ink); font-weight: 600; background: var(--blue-050); box-shadow: inset 0 -2px 0 var(--blue); }
.stepper li.current .dot { border-color: var(--blue); background: var(--blue); color: #fff; }
.stepper li.cancelled .dot { border-color: var(--red); color: var(--red); }

/* ---------- Empty / skeleton / error ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .ill { display: none; }
.empty h3 { color: var(--ink); margin-bottom: 6px; font-size: 1rem; }
.empty p { max-width: 440px; margin: 0 auto 16px; }
.error-box { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--red-050); color: var(--red); border: 1px solid var(--red-200); }
.skel { background: #ECEFF4; border-radius: var(--r-sm); animation: skel 1.2s ease-in-out infinite alternate; }
@keyframes skel { to { background: #F4F6F9; } }
.skel.line { height: 11px; margin: 10px 0; }
.skel.line.w60 { width: 60%; } .skel.line.w40 { width: 40%; } .skel.line.w80 { width: 80%; }
.skel.block { height: 104px; border-radius: var(--r-lg); }
.skel.title { height: 20px; width: 40%; margin-bottom: 14px; }

.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line); border-inline-start-width: 3px; font-size: .91rem; background: var(--surface); color: var(--ink-2); }
.banner svg { width: 18px; height: 18px; flex: none; margin-top: 3px; }
.banner.warn { background: var(--amber-050); border-color: var(--amber-200); border-inline-start-color: var(--amber-500); }
.banner.warn svg { color: var(--amber); }
.banner.info { background: var(--slate-050); border-color: #D3DCEA; border-inline-start-color: var(--slate); }
.banner.indigo { background: var(--blue-050); border-color: var(--blue-100); border-inline-start-color: var(--blue); }
.banner.indigo svg { color: var(--blue); }
.banner.err { background: var(--red-050); border-color: var(--red-200); border-inline-start-color: var(--red); color: var(--red); }
.banner b { font-weight: 600; color: var(--ink); }

/* ---------- Key figures ---------- */
.kpi { padding: 16px 18px; position: relative; }
.kpi .k-label { color: var(--muted); font-size: .84rem; display: flex; align-items: center; gap: 8px; }
.kpi .k-label .ic { display: none; }
.kpi .k-val { font-size: 1.6rem; font-weight: 600; color: var(--ink); margin-top: 6px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi .k-val small { font-size: .82rem; font-weight: 400; color: var(--muted); margin-inline-start: 4px; }
.kpi .k-sub { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.kpi.feature { background: var(--ink); border-color: var(--ink); background-image: radial-gradient(80% 120% at 0% 0%, rgba(46,80,240,.45), transparent 60%); }
.kpi.feature .k-label, .kpi.feature .k-sub { color: #B4BFDA; }
.kpi.feature .k-val { color: #fff; }
@media (max-width: 420px) { .kpi { padding: 13px; } .kpi .k-val { font-size: 1.3rem; } }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; background: var(--ink); color: #C9D2EA; display: flex; flex-direction: column;
  padding: 18px 12px; gap: 4px; overflow-y: auto;
  background-image: radial-gradient(120% 40% at 100% 0%, rgba(46,80,240,.28), transparent 70%);
}
.side .brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; color: #fff; text-decoration: none !important; }
.side .brand img, .side .brand svg { width: 26px; height: 26px; }
.brand .word { font-family: var(--f-display); font-weight: 700; font-size: 1.3rem; line-height: 1; color: var(--ink); }
.brand .tag { display: none; }
.side .brand .word { color: #fff; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r); color: var(--ink-soft);
  font-size: .92rem; text-decoration: none !important;
}
.nav a { color: #B4BFDA; position: relative; }
.nav a svg { width: 18px; height: 18px; flex: none; color: #7F8CB0; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a[aria-current="page"] { background: rgba(255,255,255,.1); color: #fff; font-weight: 500; }
.nav a[aria-current="page"]::before { content: ""; position: absolute; inset-inline-start: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--blue); }
.nav a[aria-current="page"] svg { color: var(--sky); }
.nav a .count { margin-inline-start: auto; background: var(--blue); color: #fff; border-radius: 999px; font-size: .7rem; padding: 0 7px; line-height: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.nav-label { font-size: .74rem; color: #7F8CB0; padding: 14px 10px 6px; }
.side .side-cta { margin: 4px 2px 12px; }
.side .side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.1); }
.side .side-cta { background: var(--blue) !important; color: #fff !important; }
.side .side-cta:hover { background: var(--blue-700) !important; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.user-chip .btn { color: #9AA6C6 !important; }
.side .user-chip .btn:hover { background: rgba(255,255,255,.08); color: #fff !important; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--line-2); display: grid; place-items: center; font-weight: 600; color: var(--ink-soft); flex: none; font-size: .82rem; }
.avatar.sm { width: 26px; height: 26px; font-size: .72rem; }
.user-chip .u-name { font-size: .87rem; color: #fff; line-height: 1.3; }
.user-chip .u-org { font-size: .75rem; color: #9AA6C6; line-height: 1.3; }
.side .ai-badge { margin: 6px 6px 0; font-size: .74rem; color: #9AA6C6; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: rgba(244,246,249,.92); backdrop-filter: blur(8px); border-bottom: 1px solid transparent; min-height: 56px; }
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .crumbs { font-size: .85rem; color: var(--muted); display: flex; gap: 6px; align-items: center; min-width: 0; }
.topbar .crumbs a { color: var(--muted); }
.topbar .mobile-brand { display: none; }
.view { padding: 6px 28px 48px; flex: 1; max-width: 1320px; width: 100%; }
.view:focus { outline: none; }
.page-h { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 4px 0 20px; }
.page-h h1 { margin: 0; font-size: 1.45rem; }
.page-h .sub { color: var(--muted); margin: 2px 0 0; font-size: .9rem; }
.page-h .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.bottom-nav { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .topbar { padding: 10px 16px; background: var(--surface); border-bottom-color: var(--line); }
  .topbar .mobile-brand { display: flex; align-items: center; gap: 8px; color: var(--ink); font-family: var(--f-display); font-weight: 700; font-size: 1.15rem; text-decoration: none; }
  .topbar .mobile-brand img { width: 24px; height: 24px; }
  .topbar .crumbs { display: none; }
  .view { padding: 14px 16px 100px; }
  .page-h h1 { font-size: 1.25rem; }
  .page-h .actions { margin-inline-start: 0; width: 100%; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; inset-inline: 0; z-index: 60; background: var(--surface);
    border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; font-size: .68rem; color: var(--muted); text-decoration: none !important; }
  .bottom-nav a svg { width: 21px; height: 21px; }
  .bottom-nav a[aria-current="page"] { color: var(--blue); }
  .bottom-nav a.fab { color: var(--ink); }
  .bottom-nav a.fab span.fab-ic { width: 40px; height: 32px; border-radius: var(--r); background: var(--blue); color: #fff; display: grid; place-items: center; }
  .bottom-nav a.fab span.lbl { color: var(--blue-700); }
}

/* list items */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 11px 20px; border-bottom: 1px solid var(--line-2); }
.list > li:last-child { border-bottom: 0; }
.list > li a.cover { color: inherit; text-decoration: none; flex: 1; min-width: 0; }
.list .li-title { font-weight: 500; color: var(--ink); }
.list .li-sub { font-size: .8rem; color: var(--muted); }
@media (max-width: 600px) { .list > li { padding: 11px 16px; } }
.ic-box { width: 30px; height: 30px; border-radius: var(--r); display: grid; place-items: center; background: var(--line-2); color: var(--ink-soft); flex: none; }
.ic-box svg { width: 16px; height: 16px; }
.ic-box.sky, .ic-box.violet { color: var(--slate); }
.ic-box.saffron { background: var(--amber-050); color: var(--amber); }
.ic-box.coral { background: var(--red-050); color: var(--red); }

/* decision trail */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 16px; padding-inline-start: 26px; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: 7px; top: 18px; bottom: 0; width: 1px; background: var(--line-strong); }
.timeline li:last-child::before { display: none; }
.timeline .t-dot { position: absolute; inset-inline-start: 3px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--ink); }
.timeline .t-dot.agent { background: var(--blue); }
.timeline .t-dot.supplier { background: var(--slate); }
.timeline .t-dot.system { background: var(--faint); }
.timeline .t-head { font-size: .91rem; font-weight: 500; color: var(--ink); }
.timeline .t-meta { font-size: .77rem; color: var(--muted); }
.timeline .t-detail { font-size: .83rem; color: var(--ink-soft); margin-top: 2px; }

/* ---------- Comparison ---------- */
.q-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); }
.q-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.q-card.reco { border: 1.5px solid var(--blue); }
.q-card .reco-tag { position: absolute; top: -11px; inset-inline-start: 14px; background: var(--blue); color: #fff; font-size: .74rem; padding: 2px 8px; border-radius: var(--r-sm); display: inline-flex; gap: 5px; align-items: center; font-weight: 500; }
.q-card .reco-tag svg { width: 12px; height: 12px; }
.q-card .q-top { display: flex; align-items: center; gap: 10px; }
.q-card .rank { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: .82rem; border: 1px solid var(--line-strong); color: var(--ink-soft); flex: none; font-variant-numeric: tabular-nums; }
.q-card.reco .rank { background: var(--blue); border-color: var(--blue); color: #fff; }
.q-card .q-name { font-weight: 600; font-size: .98rem; line-height: 1.35; color: var(--ink); }
.q-card .q-total { font-size: 1.4rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.2; }
.q-card .q-total small { font-size: .8rem; color: var(--muted); font-weight: 400; }
.q-card dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; font-size: .85rem; }
.q-card dt { color: var(--muted); }
.q-card dd { margin: 0; text-align: end; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.score { display: flex; align-items: center; gap: 10px; }
.score .bar { flex: 1; height: 4px; border-radius: 2px; background: var(--line-2); overflow: hidden; }
.score .bar span { display: block; height: 100%; background: var(--ink-soft); }
.q-card.reco .score .bar span { background: var(--blue); }
.score .val { font-weight: 600; font-size: .86rem; min-width: 30px; text-align: end; font-variant-numeric: tabular-nums; }
.matrix th.qcol { min-width: 150px; text-align: center; }
.matrix th.qcol.reco { color: var(--blue-700); box-shadow: inset 0 -2px 0 var(--blue); }
.matrix td.cell { text-align: center; white-space: nowrap; }
.matrix td.cell .p { font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink); }
.matrix td.cell .lt { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.matrix td.cell.best { background: var(--blue-050); }
.matrix td.cell.best .p { color: var(--blue-700); font-weight: 600; }
.matrix td.cell.missing { background: repeating-linear-gradient(-45deg, #F7F8FA, #F7F8FA 5px, #FFFFFF 5px, #FFFFFF 10px); color: var(--muted); }
.matrix td.cell .chips { justify-content: center; margin-top: 4px; }
.matrix th.item { min-width: 190px; position: sticky; inset-inline-start: 0; background: #F7F8FA; z-index: 3; }
.matrix td.item { position: sticky; inset-inline-start: 0; background: var(--surface); z-index: 1; box-shadow: -1px 0 0 var(--line-2); }
[dir="ltr"] .matrix td.item { box-shadow: 1px 0 0 var(--line-2); }
.matrix tbody tr:hover td.item { background: #FAFBFD; }
.matrix tfoot td { text-align: center; }
.matrix tfoot td.item { text-align: start; position: sticky; inset-inline-start: 0; background: #F7F8FA; }

/* Wide tables (quotes received, supplier directory): the table keeps its natural width and scrolls inside the card;
   the first column (.item) stays in view like the matrix. With .stack-sm the table turns into cards under 600px instead. */
.tbl.scrollx { width: max-content; min-width: 100%; }
.tbl.scrollx th, .tbl.scrollx td { white-space: nowrap; }
.tbl.scrollx th.item, .tbl.scrollx td.item { position: sticky; inset-inline-start: 0; z-index: 1; white-space: normal; min-width: 170px; max-width: 320px; background: var(--surface); box-shadow: -1px 0 0 var(--line-2); }
.tbl.scrollx thead th.item { z-index: 3; background: #F7F8FA; }
[dir="ltr"] .tbl.scrollx th.item, [dir="ltr"] .tbl.scrollx td.item { box-shadow: 1px 0 0 var(--line-2); }
.tbl.scrollx tbody tr:hover td.item { background: #FAFBFD; }
.tbl.scrollx td.wrap { white-space: normal; min-width: 180px; max-width: 320px; }
.tbl.scrollx td.src .chip { display: flex; width: fit-content; margin-top: 4px; }
@media (max-width: 600px) {
  .tbl.scrollx th.item, .tbl.scrollx td.item { min-width: 140px; max-width: 190px; }
  .tbl.scrollx.stack-sm { width: 100%; }
  .tbl.scrollx.stack-sm th.item, .tbl.scrollx.stack-sm td.item { position: static; box-shadow: none; min-width: 0; max-width: none; }
}
.best-key { display: inline-block; width: 11px; height: 11px; border-radius: 2px; background: var(--blue-050); border: 1px solid var(--blue-100); vertical-align: -1px; }
.savings { display: flex; gap: 28px; align-items: center; padding: 14px 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); flex-wrap: wrap; }
.savings .s-val { font-size: 1.3rem; font-weight: 600; color: var(--blue-700); font-variant-numeric: tabular-nums; }
.savings .s-lbl { font-size: .8rem; color: var(--muted); }
.savings .s-item { min-width: 140px; }
.rationale { background: var(--surface); border: 1px solid var(--line); border-inline-start: 3px solid var(--blue); border-radius: var(--r); padding: 14px 16px; }
.rationale .r-h { display: flex; gap: 8px; align-items: center; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.rationale .r-h svg { width: 16px; height: 16px; color: var(--blue); }
.rationale p { margin: 0; white-space: pre-line; color: var(--ink-2); }

/* price index range */
.range { position: relative; height: 24px; min-width: 180px; }
.range .rail { position: absolute; top: 11px; inset-inline: 0; height: 2px; background: var(--line-2); }
.range .whisk { position: absolute; top: 11px; height: 2px; background: var(--line-strong); }
.range .iqr { position: absolute; top: 6px; height: 12px; border-radius: 2px; background: var(--blue-100); border: 1px solid #B6C4F7; }
.range .med { position: absolute; top: 2px; width: 2px; height: 20px; background: var(--blue-700); }
.range .cap { position: absolute; top: 7px; width: 1px; height: 10px; background: var(--faint); }

.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: 150px 1fr 120px; gap: 12px; align-items: center; font-size: .88rem; }
.hbar .track { height: 10px; background: var(--line-2); border-radius: 2px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--blue); transform-origin: right; }
[dir="ltr"] .hbar .fill { transform-origin: left; }
.hbar .v { text-align: end; font-variant-numeric: tabular-nums; color: var(--ink-2); }
@media (max-width: 600px) { .hbar { grid-template-columns: 1fr auto; } .hbar .track { grid-column: 1 / -1; grid-row: 2; } }

.stars { display: inline-flex; gap: 1px; direction: ltr; }
.stars svg { width: 14px; height: 14px; }
.stars .on { color: var(--ink-soft); }
.stars .off { color: var(--line-strong); }
.star-input { display: inline-flex; gap: 4px; flex-direction: row-reverse; }
.star-input button { border: 0; background: none; cursor: pointer; padding: 2px; color: var(--line-strong); }
.star-input button svg { width: 26px; height: 26px; }
.star-input button.on { color: var(--blue); }

/* misc */
.kbd { font-size: .8rem; background: var(--line-2); padding: 1px 6px; border-radius: var(--r-sm); border: 1px solid var(--line); }
.mono { font-variant-numeric: tabular-nums; font-size: .88rem; }
.ref { font-size: .82rem; color: var(--muted); direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: .91rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; color: var(--ink-2); min-width: 0; overflow-wrap: anywhere; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 6px 20px; font-size: .94rem; max-width: 360px; margin-inline-start: auto; }
.totals .grand { font-weight: 600; font-size: 1.1rem; color: var(--ink); padding-top: 8px; border-top: 1px solid var(--line); }
.totals > :nth-child(even) { text-align: end; font-variant-numeric: tabular-nums; }
.notice-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); display: inline-block; }
.examples { display: flex; flex-wrap: wrap; gap: 6px; }
.examples button { border: 1px solid var(--line); background: var(--surface); padding: 5px 11px; border-radius: var(--r); font-size: .83rem; cursor: pointer; color: var(--ink-soft); }
.examples button:hover { border-color: var(--blue); color: var(--blue-700); }
.section-title { display: flex; align-items: center; gap: 10px; margin: 28px 0 12px; }
.section-title h2 { margin: 0; font-size: 1.05rem; }
.section-title .line { flex: 1; height: 1px; background: var(--line); }
.loading-center { display: grid; place-items: center; padding: 60px 0; }
.spinner { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--blue); animation: spin .8s linear infinite; }
.ai-working { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); }
.ai-working .pulse { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--blue); animation: spin .8s linear infinite; }

/* ---------- Supplier portal ---------- */
.portal-top { background: var(--ink); color: #C9D2EA; padding: 16px 0 24px; background-image: radial-gradient(70% 140% at 100% 0%, rgba(46,80,240,.35), transparent 70%); }
.portal-top h1, .portal-top h2, .portal-top .strong, .portal-top b { color: #fff; }
.portal-top .muted, .portal-top .small { color: #B4BFDA; }
.portal-top .countdown { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: #fff; }
.portal-top .countdown svg { color: #B4BFDA; }
.portal-top .container { width: min(860px, 100% - 32px); margin-inline: auto; }
.pt-brand { display: inline-flex; align-items: center; gap: 10px; }
.pt-brand img { border-radius: 8px; box-shadow: 0 0 0 1px rgba(255,255,255,.18); }
.pt-brand .w { font-family: var(--f-display); font-weight: 700; font-size: 1.2rem; color: #fff; }
.pt-brand .t { font-size: .78rem; color: #9AA6C6; padding-inline-start: 10px; border-inline-start: 1px solid rgba(255,255,255,.18); }
.pt-k { font-size: .8rem; color: #9AA6C6; }
.pt-org { font-family: var(--f-display); font-size: 1.45rem; font-weight: 700; color: #fff; line-height: 1.5; }
.pt-city { font-family: var(--f-body); font-size: .9rem; font-weight: 400; color: #B4BFDA; }
.pt-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: .88rem; color: #C9D2EA; }
.pt-meta .ref { color: #9AA6C6; font-variant-numeric: tabular-nums; }
.portal-body { width: min(860px, 100% - 32px); margin: 20px auto 0; padding-bottom: 120px; }
.countdown { display: inline-flex; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); padding: 4px 10px; font-size: .86rem; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.countdown svg { width: 15px; height: 15px; color: var(--ink-soft); }
.countdown.urgent { border-color: var(--red-200); background: var(--red-050); color: var(--red); }
.p-item { padding: 14px 18px; border-bottom: 1px solid var(--line-2); display: grid; grid-template-columns: 1fr 150px 130px 120px; gap: 12px; align-items: center; }
.p-item:last-child { border-bottom: 0; }
.p-item .nm { font-weight: 500; color: var(--ink); }
.p-item .sp { font-size: .8rem; color: var(--muted); }
.p-item .qty { font-size: .85rem; color: var(--ink-soft); }
.p-item .lt { text-align: end; font-variant-numeric: tabular-nums; font-weight: 500; }
.p-item .lbl-m { display: none; font-size: .74rem; color: var(--muted); }
@media (max-width: 680px) {
  .p-item { grid-template-columns: 1fr 1fr; }
  .p-item .info { grid-column: 1 / -1; }
  .p-item .lt { grid-column: 1 / -1; text-align: start; display: flex; justify-content: space-between; padding-top: 4px; border-top: 1px dashed var(--line); }
  .p-item .lbl-m { display: block; }
}
.sticky-total { position: fixed; bottom: 0; inset-inline: 0; z-index: 70; background: var(--surface); border-top: 1px solid var(--line); padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); }
.sticky-total .inner { width: min(860px, 100% - 32px); margin: 0 auto; display: flex; align-items: center; gap: 14px; }
.sticky-total .st-val { font-weight: 700; font-size: 1.2rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.success-ill { width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 16px; display: grid; place-items: center; background: var(--blue-050); color: var(--blue); }
.success-ill svg { width: 28px; height: 28px; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--surface); }
.auth .a-side { background: var(--bg); border-inline-start: 1px solid var(--line); padding: 40px 48px; display: flex; flex-direction: column; justify-content: center; }
.auth .a-main { display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth .a-box { width: min(420px, 100%); }
.auth .a-box h1 { font-size: 1.45rem; }
.demo-box { margin-top: 20px; padding: 14px 16px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--bg); }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth .a-side { display: none; } }

/* language switcher: "العربية | English", current language emphasised */
.lang-switch { display: inline-flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--muted); }
.lang-switch a, .lang-switch button { color: inherit; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; text-decoration: none; }
.lang-switch a:hover, .lang-switch button:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.lang-switch .current { color: var(--ink); font-weight: 600; }
.lang-switch .sep { color: var(--line-strong); }
.side .side-lang { margin: 10px 6px 0; }
.side .lang-switch, .portal-top .lang-switch { color: #9AA6C6; }
.side .lang-switch .current, .portal-top .lang-switch .current { color: #fff; }
.side .lang-switch a:hover, .side .lang-switch button:hover, .portal-top .lang-switch a:hover, .portal-top .lang-switch button:hover { color: #fff; }
.side .lang-switch .sep, .portal-top .lang-switch .sep { color: rgba(255,255,255,.25); }

/* 404 */
.nf { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; background: var(--bg); }
.nf .big { font-family: var(--f-display); font-size: 4.5rem; font-weight: 700; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
@media print {
  .side, .bottom-nav, .topbar, .toasts, .site-h { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
}

/* ---------- Coverage, review, stacked tables ---------- */
.chip.cov { background: var(--amber-050); color: var(--amber); border-color: var(--amber-200); font-weight: 600; }
.q-card.partial { border-style: dashed; border-color: var(--line-strong); }
.q-card.partial .q-total { color: var(--ink-soft); }
.req-list { margin: 6px 0 0; padding-inline-start: 18px; }
.req-list li { margin: 2px 0; }
.kv-review { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.kv-review > div { background: #FAFBFC; border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; }
.kv-review .k { font-size: .77rem; color: var(--muted); }
.kv-review .v { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.inline-err { color: var(--red); background: var(--red-050); border: 1px solid var(--red-200); border-radius: var(--r); padding: 8px 12px; font-size: .88rem; }
.otp-input { letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; direction: ltr; max-width: 200px; }

.m-items { display: none; }
.m-item { border-top: 1px solid var(--line-2); padding: 12px 16px; }
.m-item:first-child { border-top: 0; }
.m-item-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.m-items ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.m-items li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; padding: 8px 10px; border-radius: var(--r); background: #FAFBFC; border: 1px solid var(--line-2); font-size: .9rem; }
.m-items li.best { background: var(--blue-050); border-color: var(--blue-100); }
.m-items li.best .p { color: var(--blue-700); font-weight: 600; }
.m-items li.missing { background: repeating-linear-gradient(-45deg, #F7F8FA, #F7F8FA 5px, #FFFFFF 5px, #FFFFFF 10px); }
.m-items li .sup { font-weight: 500; min-width: 0; }
.m-items li .val { display: inline-flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.m-items li .lt { font-size: .74rem; color: var(--muted); }
.m-items li .chips { flex-basis: 100%; }
.m-items .best-tag { font-size: .7rem; color: var(--blue-700); background: #fff; border: 1px solid var(--blue-100); border-radius: var(--r-sm); padding: 0 6px; }
.m-total { padding: 12px 16px; border-top: 1px solid var(--line); background: #FAFBFC; display: grid; gap: 6px; }
.m-total li { background: #fff; }

.scroll-cue { display: none; align-items: center; gap: 6px; font-size: .77rem; color: var(--muted); padding: 6px 16px; background: #FAFBFC; border-bottom: 1px solid var(--line-2); }
.scroll-cue svg { width: 14px; height: 14px; }
.scroll-cue.done { opacity: .45; }
.table-wrap.has-overflow:not(.at-end) { box-shadow: inset 12px 0 10px -10px rgba(15,27,51,.18); }
[dir="ltr"] .table-wrap.has-overflow:not(.at-end) { box-shadow: inset -12px 0 10px -10px rgba(15,27,51,.18); }

.show-sm-inline { display: none; }
@media (max-width: 600px) {
  .scroll-cue:not([hidden]) { display: flex; }
  .matrix-wrap { display: none; }
  .matrix-wrap + .m-items { display: block; }
  .tbl.stack-sm, .tbl.stack-sm tbody, .tbl.stack-sm tr, .tbl.stack-sm td { display: block; width: 100%; }
  .tbl.stack-sm thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tbl.stack-sm tbody tr { padding: 12px 16px; border-bottom: 1px solid var(--line-2); display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
  .tbl.stack-sm tbody tr:last-child { border-bottom: 0; }
  .tbl.stack-sm td { padding: 0; border: 0; text-align: start; white-space: normal; }
  .tbl.stack-sm td.n { text-align: start; }
  .tbl.stack-sm td[data-label]::before { content: attr(data-label); display: block; font-size: .72rem; color: var(--muted); font-weight: 400; }
  .tbl.stack-sm td.full { grid-column: 1 / -1; }
  .tbl.stack-sm td.lead { grid-column: 1 / -1; font-size: 1rem; }
  .tbl.stack-sm td.lead::before { display: none; }
  .tbl.stack-sm td.end { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
  .tbl.edit.stack-sm tbody tr { grid-template-columns: 1fr 1fr; background: #FCFCFD; }
  .tbl.edit.stack-sm td.idx { display: none; }
  .show-sm-inline { display: inline; }
  .tbl.stack-sm td.hide-sm-cell, .tbl.stack-sm td.idx { display: none; }
  .banner.banner-action { flex-wrap: wrap; }
  .banner.banner-action > div { flex: 1 1 calc(100% - 40px); }
  .banner.banner-action > .btn { width: 100%; justify-content: center; }
}
