/* Mudrek Quality — calm blue-grey screens; colour appears only when it means something:
   green for approved, red for out of range, amber for a warning. */
:root {
  --page: #f4f8fa; --card: #ffffff; --sunken: #eef5f8; --line: #d5e2e9; --line2: #b9cbd6;
  --ink: #10293a; --ink2: #23485c; --mute: #4b6879; --quiet: #6b8398;
  --brand: #006da3; --brand-ink: #004b76; --brand-soft: #eaf4fa;
  --ok: #1f7a68; --ok-soft: #e4f5f0; --check: #34ba96;
  --warn: #a8630b; --warn-soft: #fdf2e2;
  --bad: #b3261e; --bad-soft: #fdeceb;
  --focus: #2d8bbd;
  --r-sm: 8px; --r-md: 12px; --r-lg: 18px;
  --shadow: 0 6px 18px rgba(16, 41, 58, .08);
  --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, system-ui, sans-serif;
  --display: 'Cairo', 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #07161f; --card: #0e2430; --sunken: #0a1c26; --line: #1d3d4f; --line2: #2a5367;
    --ink: #e6f1f6; --ink2: #c7dce6; --mute: #9fb6c4; --quiet: #7f98a8;
    --brand: #63aed4; --brand-ink: #9ccde6; --brand-soft: #0f3346;
    --ok: #5cc3aa; --ok-soft: #10372e; --check: #34ba96;
    --warn: #e0a14a; --warn-soft: #3a2a10;
    --bad: #f28b82; --bad-soft: #3b1715;
    --shadow: 0 6px 18px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.6; -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.3; margin: 0; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; }
.mute { color: var(--mute); }
.small { font-size: .86rem; }
.hide { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-rows: auto 1fr auto; min-height: 100dvh; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.top .mark { width: 30px; height: 30px; flex: none; }
.top .who { display: grid; line-height: 1.25; min-width: 0; }
.top .who b { font-family: var(--display); font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .who span { font-size: .8rem; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .spacer { flex: 1; }
.top select { max-width: 42vw; border: 1px solid var(--line); background: var(--sunken); border-radius: var(--r-sm); padding: 6px 8px; }
.bell { position: relative; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; cursor: pointer; }
.bell svg { width: 20px; height: 20px; }
.bell .dot { position: absolute; top: 4px; inset-inline-end: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: .72rem; display: grid; place-items: center; font-weight: 700; }
main { grid-row: 2; padding: 16px; max-width: 1180px; width: 100%; margin: 0 auto; }
.nav { grid-row: 3; position: sticky; bottom: 0; z-index: 20; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav a { display: grid; justify-items: center; gap: 2px; padding: 8px 4px 9px; text-decoration: none; color: var(--mute); font-size: .76rem; font-weight: 600; position: relative; }
.nav a svg { width: 22px; height: 22px; }
.nav a.on { color: var(--brand); }
.nav a.on::before { content: ''; position: absolute; top: 0; inset-inline: 22%; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
.nav .badge { position: absolute; top: 4px; inset-inline-start: calc(50% + 6px); background: var(--bad); color: #fff; border-radius: 9px; font-size: .68rem; min-width: 17px; height: 17px; display: grid; place-items: center; padding: 0 4px; }
@media (min-width: 960px) {
  .shell { grid-template-columns: 230px 1fr; grid-template-rows: auto 1fr; }
  .top { grid-column: 1 / -1; }
  .nav { grid-auto-flow: row; grid-auto-rows: max-content; grid-row: 2; border-top: 0; border-inline-end: 1px solid var(--line); align-content: start; padding: 12px 10px; gap: 2px; height: calc(100dvh - 65px); position: sticky; top: 65px; }
  .nav a { grid-template-columns: 24px 1fr; justify-items: start; align-items: center; gap: 10px; font-size: .92rem; padding: 10px 12px; border-radius: var(--r-sm); }
  .nav a.on { background: var(--brand-soft); }
  .nav a.on::before { display: none; }
  .nav .badge { position: static; justify-self: end; grid-column: 3; }
  main { grid-row: 2; padding: 24px; }
}

/* ---------- building blocks ---------- */
.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid2 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid3 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; }
.card.flat { box-shadow: none; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 18px 2px 8px; }
.section-title h2 { font-size: 1.1rem; }
.empty { text-align: center; padding: 28px 16px; color: var(--mute); border: 1px dashed var(--line2); border-radius: var(--r-md); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px; border-radius: var(--r-md); border: 1px solid transparent; background: var(--brand); color: #fff; font-weight: 700; font-family: var(--display); font-size: 1rem; cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ok { background: var(--ok); }
.btn.bad { background: var(--bad); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line2); }
.btn.soft { background: var(--brand-soft); color: var(--brand-ink); }
.btn.sm { min-height: 38px; padding: 6px 12px; font-size: .9rem; border-radius: var(--r-sm); }
.btn.block { width: 100%; }
.btn svg { width: 20px; height: 20px; }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--sunken); color: var(--ink2); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.brand { background: var(--brand-soft); color: var(--brand-ink); }

.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: .92rem; }
.field small { color: var(--mute); }
input[type=text], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=time], input:not([type]), select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line2); border-radius: var(--r-sm); background: var(--card);
}
textarea { min-height: 90px; resize: vertical; }
input[dir=ltr] { text-align: right; }
.check { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; background: var(--card); }
.check input { width: 24px; height: 24px; accent-color: var(--ok); }
.check:has(input:checked) { border-color: var(--ok); background: var(--ok-soft); }

.notice { padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--sunken); }
.notice.bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.notice.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.notice.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.notice b { font-family: var(--display); }

.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th, .tbl td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th { font-weight: 700; color: var(--mute); background: var(--sunken); font-size: .82rem; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.wrap { white-space: normal; min-width: 180px; }

/* ---------- the ticket: one task ---------- */
.ticket { display: grid; gap: 6px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-inline-start: 5px solid var(--line2); border-radius: var(--r-md); text-decoration: none; color: inherit; cursor: pointer; }
.ticket.URGENT { border-inline-start-color: var(--bad); }
.ticket.MEDIUM { border-inline-start-color: var(--brand); }
.ticket.LOW { border-inline-start-color: var(--line2); }
.ticket.done { opacity: .62; border-inline-start-color: var(--ok); }
.ticket .t-title { font-family: var(--display); font-weight: 700; font-size: 1.05rem; }
.ticket .t-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: .82rem; color: var(--mute); }
.sla { height: 4px; border-radius: 2px; background: var(--sunken); overflow: hidden; }
.sla > i { display: block; height: 100%; background: var(--brand); }
.sla.late > i { background: var(--bad); }
.sla.near > i { background: var(--warn); }

/* ---------- the seal: readiness gate (the logo's ring, filling as critical tasks are approved) ---------- */
.gate { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.seal { width: 148px; height: 148px; }
.seal .track { stroke: var(--sunken); }
.seal .fill { stroke: var(--brand); transition: stroke-dashoffset .6s ease; }
.seal .tick { stroke: var(--check); stroke-dasharray: 160; stroke-dashoffset: 160; }
.seal.open .fill { stroke: var(--brand); }
.seal.open .tick { animation: tick .7s .15s ease-out forwards; }
@keyframes tick { to { stroke-dashoffset: 0; } }
.seal text { font-family: var(--display); font-weight: 800; fill: var(--ink); }
.seats { display: flex; gap: 6px; flex-wrap: wrap; }
.seat { width: 34px; height: 34px; border-radius: 50%; border: 2px dashed var(--line2); display: grid; place-items: center; font-size: .72rem; font-weight: 700; color: var(--mute); }
.seat.on { border: 2px solid var(--ok); background: var(--ok-soft); color: var(--ok); }
@media (max-width: 520px) { .gate { grid-template-columns: 1fr; justify-items: center; text-align: center; } .gate .seats { justify-content: center; } }

/* ---------- task execution ---------- */
.reading { display: grid; gap: 6px; }
.reading input { font-family: var(--display); font-size: 2.6rem; font-weight: 800; text-align: center; min-height: 84px; font-variant-numeric: tabular-nums; direction: ltr; }
.reading .range { text-align: center; color: var(--mute); font-size: .9rem; }
.reading.bad input { border-color: var(--bad); color: var(--bad); background: var(--bad-soft); }
.reading.ok input { border-color: var(--ok); }
.steps { counter-reset: s; display: grid; gap: 10px; }
.step { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; }
.step::before { counter-increment: s; content: counter(s); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--sunken); font-weight: 800; font-family: var(--display); }
.step.done::before { content: '✓'; background: var(--ok); color: #fff; }
.photo-thumb { width: 100%; border-radius: var(--r-sm); border: 1px solid var(--line); display: block; background: var(--sunken); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.photos img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line); cursor: zoom-in; }

/* ---------- sheet (camera, scanner, dialogs) ---------- */
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(4, 16, 24, .6); display: grid; align-items: end; justify-items: center; }
.sheet { width: min(640px, 100%); max-height: 94dvh; overflow: auto; background: var(--card); border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: var(--r-lg); } }
.cam { position: relative; background: #000; border-radius: var(--r-md); overflow: hidden; aspect-ratio: 3/4; }
.cam video, .cam canvas, .cam img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam .aim { position: absolute; inset: 18%; border: 3px solid rgba(255,255,255,.85); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.25); }
.cam .live { position: absolute; top: 10px; inset-inline-start: 10px; background: var(--bad); color: #fff; font-size: .75rem; font-weight: 800; padding: 2px 8px; border-radius: 6px; }
.shutter { width: 76px; height: 76px; border-radius: 50%; border: 5px solid var(--card); outline: 3px solid var(--brand); background: var(--brand); cursor: pointer; }
.toast { position: fixed; z-index: 60; inset-inline: 16px; bottom: 84px; margin: 0 auto; max-width: 520px; padding: 12px 16px; border-radius: var(--r-md); background: var(--ink); color: var(--page); font-weight: 600; box-shadow: var(--shadow); }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login .box { width: min(420px, 100%); display: grid; gap: 18px; }
.login .logo { width: 220px; height: auto; margin: 0 auto 6px; }
.login .logo-dark { display: none; }
@media (prefers-color-scheme: dark) { .login .logo-light { display: none; } .login .logo-dark { display: block; } }

/* ---------- board (quality) ---------- */
.bcard { display: grid; gap: 10px; }
.bcard .units { display: flex; gap: 6px; flex-wrap: wrap; }
.uchip { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: var(--r-sm); background: var(--sunken); font-size: .8rem; border: 1px solid transparent; cursor: pointer; }
.uchip b { font-family: var(--display); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.uchip.bad { background: var(--bad-soft); color: var(--bad); }
.uchip.warn { background: var(--warn-soft); color: var(--warn); }
.uchip.ok b { color: var(--ok); }
.uchip.off { opacity: .55; }
.feed { display: grid; gap: 8px; }
.fitem { display: grid; grid-template-columns: 54px 1fr; gap: 10px; padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); }
.fitem.bad { border-color: var(--bad); }
.fitem img { width: 54px; height: 54px; object-fit: cover; border-radius: 6px; cursor: zoom-in; }
.fitem .ph { width: 54px; height: 54px; border-radius: 6px; background: var(--sunken); display: grid; place-items: center; color: var(--mute); }
.fitem .ph svg { width: 22px; height: 22px; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--check); display: inline-block; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- roster grid ---------- */
.roster td select { min-height: 38px; padding: 4px 6px; font-size: .85rem; min-width: 96px; }
.roster td.gap { background: var(--bad-soft); }

/* ---------- print ---------- */
.qrs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.qr { border: 1px dashed var(--line2); border-radius: var(--r-sm); padding: 12px; text-align: center; background: #fff; color: #10293a; }
.qr svg { width: 150px; height: 150px; }
@media print {
  .top, .nav, .noprint { display: none !important; }
  .shell { display: block; }
  main { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .card, .tbl-wrap { border-color: #ccc; }
}

/* Inline icons take the size of the text around them; buttons, the bell and the nav set their own. */
main svg[aria-hidden="true"] { width: 1.25em; height: 1.25em; vertical-align: -0.25em; flex: none; }

/* ---------- لوحة البيانات ---------- */
/* Chart series: the validated reference palette, in its fixed order; dark steps chosen for the dark surface. */
:root { --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948; --dim: #c3ccd2; --text-3: #6b8398;
  --h1: #cde2fb; --h2: #9ec5f4; --h3: #6da7ec; --h4: #3987e5; --h5: #256abf; --h6: #184f95; }
@media (prefers-color-scheme: dark) {
  :root { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --dim: #3a5566; --text-3: #7f98a8;
    --h1: #13304a; --h2: #184f95; --h3: #1c5cab; --h4: #256abf; --h5: #2a78d6; --h6: #5598e7; }
}
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: var(--r-sm); overflow: hidden; background: var(--card); }
.seg button { border: 0; background: transparent; padding: 8px 14px; font-weight: 600; cursor: pointer; min-height: 40px; color: var(--ink2); }
.seg button + button { border-inline-start: 1px solid var(--line); }
.seg button.on { background: var(--brand); color: #fff; }
.hero-row { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
@media (max-width: 760px) { .hero-row { grid-template-columns: 1fr; } }
.hero { display: grid; gap: 6px; align-content: start; }
.hero-v { font-size: 4.2rem; font-weight: 800; line-height: 1; color: var(--ink); }
.spark { width: 100%; height: 44px; margin-top: 6px; }
.kpi-l { color: var(--mute); font-size: .86rem; font-weight: 600; }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); }
.kpi { display: grid; gap: 4px; align-content: start; }
.kpi-v { font-size: 1.9rem; font-weight: 800; line-height: 1.2; }
.delta { font-size: .8rem; font-weight: 700; white-space: nowrap; }
.delta.good { color: var(--ok); }
.delta.bad { color: var(--bad); }
.delta.flat { color: var(--mute); }
.part { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(80px, 2fr) 56px minmax(96px, auto); gap: 10px; align-items: center; }
@media (max-width: 560px) { .part { grid-template-columns: 1fr 1fr; } }
.meter { display: inline-block; flex: 1; min-width: 60px; height: 8px; border-radius: 4px; background: var(--sunken); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 4px; background: var(--brand); }
.meter.ok > i { background: var(--ok); }
.meter.bad > i { background: var(--bad); }
.viz { position: relative; }
.viz svg { width: 100%; height: auto; display: block; touch-action: pan-y; }
.viz .grid { stroke: var(--line); stroke-width: 1; }
.viz .axis { fill: var(--mute); font-size: 11px; font-family: var(--font); }
.viz .lbl { fill: var(--ink); font-size: 12px; font-weight: 700; font-family: var(--font); }
.viz .dot { stroke: var(--card); stroke-width: 2; }
.viz .cross { stroke: var(--line2); stroke-width: 1; stroke-dasharray: 3 3; }
.tip { position: absolute; top: 8px; min-width: 170px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--card); border: 1px solid var(--line2); box-shadow: var(--shadow); font-size: .84rem; display: grid; gap: 3px; pointer-events: none; z-index: 2; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.sw.h1 { background: var(--h1); } .sw.h2 { background: var(--h2); } .sw.h3 { background: var(--h3); } .sw.h4 { background: var(--h4); } .sw.h5 { background: var(--h5); } .sw.h6 { background: var(--h6); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .84rem; color: var(--ink2); }
.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 1fr) minmax(120px, 2.4fr) minmax(120px, auto); gap: 10px; align-items: center; }
.bar-row.dim { opacity: .45; }
.bar-name { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.bar-track { position: relative; height: 14px; border-radius: 4px; background: var(--sunken); }
.bar-fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 4px; background: var(--s1); }
.bar-prev { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 1px; }
.bar-val { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.rank { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 50%; background: var(--sunken); font-weight: 800; font-family: var(--display); font-size: .85rem; }
.rank.top { background: var(--brand); color: #fff; }
table.heat td { text-align: center; font-variant-numeric: tabular-nums; min-width: 38px; padding: 8px 6px; }
table.heat td.h1 { background: var(--h1); } table.heat td.h2 { background: var(--h2); }
table.heat td.h3 { background: var(--h3); color: #fff; } table.heat td.h4 { background: var(--h4); color: #fff; }
table.heat td.h5 { background: var(--h5); color: #fff; } table.heat td.h6 { background: var(--h6); color: #fff; }
@media (prefers-color-scheme: dark) { table.heat td.h1, table.heat td.h2 { color: #fff; } }
table.lb tr.mute td { color: var(--mute); }

.tip[hidden] { display: none; }
.rank { width: 26px; flex: none; }
.hero .spark { width: 100%; height: 48px; justify-self: stretch; }
/* Nothing on the dashboard may push the page wider than the phone. */
.seg { flex-wrap: wrap; max-width: 100%; }
.grid2 > *, .grid3 > *, .hero-row > *, .kpis > *, .card { min-width: 0; }
@media (max-width: 560px) {
  .bar-row { grid-template-columns: 1fr auto; }
  .bar-row .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .hero-v { font-size: 3.4rem; }
}
/* A wide table scrolls inside its frame; it never widens the page. */
.shell { grid-template-columns: minmax(0, 1fr); }
main, .stack, .card, .tbl-wrap { min-width: 0; }
@media (min-width: 960px) { .shell { grid-template-columns: 230px minmax(0, 1fr); } }

/* ---------- languages ---------- */
.langs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 14px; }
.langs button { border: 1px solid var(--line2); background: var(--card); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-weight: 600; color: var(--ink2); }
.langs button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.ut-orig { margin-inline-start: 6px; border: 0; background: none; color: var(--brand); font-size: .78rem; font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline; }
/* Scripts the Arabic faces do not carry: the phone's own fonts first, Noto as the fallback. */
[data-lang="bn"] { --font: 'Noto Sans Bengali', 'Vrinda', 'Shonar Bangla', system-ui, sans-serif; --display: 'Noto Sans Bengali', 'Vrinda', system-ui, sans-serif; }
[data-lang="hi"] { --font: 'Noto Sans Devanagari', 'Mangal', 'Nirmala UI', system-ui, sans-serif; --display: 'Noto Sans Devanagari', 'Nirmala UI', system-ui, sans-serif; }
[data-lang="ur"] { --font: 'Noto Naskh Arabic', 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif; }
[data-lang="en"], [data-lang="fil"], [data-lang="tr"] { --font: 'IBM Plex Sans Arabic', 'Segoe UI', system-ui, sans-serif; }
/* Left-to-right languages: arrows point the other way, chart end labels read left to right. */
[dir="ltr"] .ticket { border-inline-start-width: 5px; }
[dir="ltr"] a > svg:first-child[aria-hidden], [dir="ltr"] .btn svg.flip { transform: scaleX(-1); }
[dir="ltr"] .viz .lbl { direction: ltr; text-anchor: start; }
[dir="ltr"] .step::before { content: counter(s); }
