/* ── LARABE design system ──────────────────────────────────────────────────
   Direction: broadcast booth. Signal amber on ink, the way an ON AIR lamp and
   a VU meter read. Arabic is first-class type here, not an afterthought.     */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,700;12..96,800&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  /* light */
  --bg:#f7f6f3;         --surface:#ffffff;     --surface-2:#f0eeea;
  --ink:#14171c;        --muted:#6a6f78;       --line:#e4e1da;
  --accent:#b26a10;     --accent-ink:#ffffff;  --accent-soft:#fdf1de;
  --ok:#0f7a52;         --ok-soft:#e3f3ec;
  --warn:#a35a12;       --warn-soft:#fbeedb;
  --danger:#b3341f;     --danger-soft:#fbe8e4;
  --shadow:0 1px 2px rgba(20,23,28,.05), 0 6px 20px rgba(20,23,28,.06);
  --radius:10px;
  --f-disp:"Bricolage Grotesque", system-ui, sans-serif;
  --f-body:"IBM Plex Sans", system-ui, sans-serif;
  --f-ar:"IBM Plex Sans Arabic", "Segoe UI", sans-serif;
  --f-mono:"IBM Plex Mono", ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#0e1116;       --surface:#161b22;     --surface-2:#1d232c;
    --ink:#e8e6e1;      --muted:#98a0ac;       --line:#262d37;
    --accent:#f2a03d;   --accent-ink:#1a1206;  --accent-soft:#2a1f0e;
    --ok:#3fbe8b;       --ok-soft:#12291f;
    --warn:#e0a05a;     --warn-soft:#2a1f10;
    --danger:#f0705a;   --danger-soft:#2c1512;
    --shadow:0 1px 2px rgba(0,0,0,.4), 0 6px 22px rgba(0,0,0,.32);
  }
}
:root[data-theme="dark"] {
  --bg:#0e1116;         --surface:#161b22;     --surface-2:#1d232c;
  --ink:#e8e6e1;        --muted:#98a0ac;       --line:#262d37;
  --accent:#f2a03d;     --accent-ink:#1a1206;  --accent-soft:#2a1f0e;
  --ok:#3fbe8b;         --ok-soft:#12291f;
  --warn:#e0a05a;       --warn-soft:#2a1f10;
  --danger:#f0705a;     --danger-soft:#2c1512;
  --shadow:0 1px 2px rgba(0,0,0,.4), 0 6px 22px rgba(0,0,0,.32);
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin:0; background:var(--bg); color:var(--ink);
  font-family:var(--f-body); font-size:15px; line-height:1.55;
  -webkit-font-smoothing:antialiased;
}
:lang(ar), [dir="rtl"], .ar { font-family:var(--f-ar); }
a { color:var(--accent); text-decoration:none; }
a:hover { text-decoration:underline; }
h1,h2,h3 { font-family:var(--f-disp); margin:0; letter-spacing:-.02em; text-wrap:balance; }
h1 { font-weight:800; font-size:clamp(30px,5.2vw,52px); line-height:1.05; }
h2 { font-weight:700; font-size:clamp(20px,2.6vw,27px); line-height:1.15; }
h3 { font-weight:600; font-size:17px; }
p  { margin:0; }

.wrap { width:100%; max-width:1180px; margin:0 auto; padding:0 20px; }
.narrow { max-width:760px; }
.stack { display:flex; flex-direction:column; }
.row { display:flex; align-items:center; }
.gap-xs{gap:6px}.gap-sm{gap:10px}.gap-md{gap:16px}.gap-lg{gap:24px}.gap-xl{gap:40px}
.wrapf { flex-wrap:wrap; }
.grow { flex:1; min-width:0; }
.right { margin-left:auto; }
.center { text-align:center; }
.muted { color:var(--muted); }
.small { font-size:13.5px; }
.tiny  { font-size:12px; }
.mono  { font-family:var(--f-mono); font-variant-numeric:tabular-nums; }
.nowrap{ white-space:nowrap; }
.hidden{ display:none !important; }

/* ── brand mark ──────────────────────────────────────────────── */
.brand { display:inline-flex; align-items:center; gap:10px; font-family:var(--f-disp);
  font-weight:800; font-size:20px; letter-spacing:-.035em; color:var(--ink); line-height:1; }
.brand:hover { text-decoration:none; }
.brand .mark { width:30px; height:26px; flex:none; overflow:visible; }
footer .brand .mark { width:21px; height:18px; }

/* ── buttons ─────────────────────────────────────────────────── */
.btn {
  font-family:var(--f-body); font-size:14.5px; font-weight:500; line-height:1;
  padding:11px 17px; min-height:42px; border-radius:var(--radius); border:1px solid var(--line);
  background:var(--surface); color:var(--ink); cursor:pointer;
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  transition:background .15s, border-color .15s, color .15s, opacity .15s;
}
.btn:hover:not(:disabled) { border-color:var(--accent); color:var(--accent); }
.btn:disabled { opacity:.5; cursor:not-allowed; }
.btn-primary { background:var(--accent); border-color:var(--accent); color:var(--accent-ink); font-weight:600; }
.btn-primary:hover:not(:disabled) { filter:brightness(1.08); color:var(--accent-ink); border-color:var(--accent); }
.btn-danger { color:var(--danger); border-color:var(--line); }
.btn-danger:hover:not(:disabled) { border-color:var(--danger); color:var(--danger); }
.btn-ghost { background:transparent; border-color:transparent; color:var(--muted); }
.btn-ghost:hover:not(:disabled) { color:var(--accent); border-color:transparent; }
.btn-sm { padding:7px 11px; min-height:36px; font-size:13px; border-radius:8px; }

/* Touch pointers get the full 44px target. */
@media (pointer: coarse) {
  .btn { min-height:46px; }
  .btn-sm { min-height:44px; }
  .tab { min-height:44px; }
  input, select, textarea { min-height:46px; }
}
.btn-block { width:100%; }

/* ── forms ───────────────────────────────────────────────────── */
label.field { display:flex; flex-direction:column; gap:6px; }
label.field > span { font-size:12.5px; font-weight:500; color:var(--muted); }
input[type=text], input[type=password], input[type=email], input[type=tel],
input[type=number], select, textarea {
  font-family:var(--f-body); font-size:15px; color:var(--ink);
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  padding:10px 12px; width:100%; transition:border-color .15s;
}
textarea { resize:vertical; line-height:1.6; }
textarea.ar { font-family:var(--f-ar); font-size:17px; line-height:2; }
input:focus, select:focus, textarea:focus { outline:none; border-color:var(--accent);
  box-shadow:0 0 0 3px var(--accent-soft); }
:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
select { appearance:none; background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),
  linear-gradient(135deg,var(--muted) 50%,transparent 50%);
  background-position:calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size:5px 5px, 5px 5px; background-repeat:no-repeat; padding-right:34px; }

/* ── surfaces ────────────────────────────────────────────────── */
.card { background:var(--surface); border:1px solid var(--line); border-radius:14px;
  padding:20px; box-shadow:var(--shadow); }
.panel { background:var(--surface); border:1px solid var(--line); border-radius:14px; overflow:hidden; }
.panel-h { padding:14px 18px; border-bottom:1px solid var(--line); display:flex;
  align-items:center; gap:12px; flex-wrap:wrap; }
.panel-b { padding:18px; }
.eyebrow { font-family:var(--f-mono); font-size:11px; letter-spacing:.14em;
  text-transform:uppercase; color:var(--accent); }

/* ── pills & badges ──────────────────────────────────────────── */
.pill { display:inline-flex; align-items:center; gap:5px; font-family:var(--f-mono);
  font-size:11px; letter-spacing:.06em; text-transform:uppercase; padding:4px 9px;
  border-radius:100px; font-weight:500; white-space:nowrap; }
.pill-ok{background:var(--ok-soft);color:var(--ok)}
.pill-warn{background:var(--warn-soft);color:var(--warn)}
.pill-danger{background:var(--danger-soft);color:var(--danger)}
.pill-mute{background:var(--surface-2);color:var(--muted)}
.pill-accent{background:var(--accent-soft);color:var(--accent)}

/* ── tables ──────────────────────────────────────────────────── */
.table-scroll { overflow-x:auto; -webkit-overflow-scrolling:touch; }
table { width:100%; border-collapse:collapse; font-size:14px; }
th { text-align:left; font-family:var(--f-mono); font-size:11px; letter-spacing:.09em;
  text-transform:uppercase; color:var(--muted); font-weight:500;
  padding:9px 12px; border-bottom:1px solid var(--line); white-space:nowrap; }
td { padding:11px 12px; border-bottom:1px solid var(--line); vertical-align:middle; }
tbody tr:last-child td { border-bottom:none; }
tbody tr:hover { background:var(--surface-2); }
td.num, th.num { text-align:right; font-family:var(--f-mono); font-variant-numeric:tabular-nums; }

/* ── stat tiles ──────────────────────────────────────────────── */
.stats { display:grid; gap:12px; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); }
.stat { background:var(--surface); border:1px solid var(--line); border-radius:12px; padding:15px 16px; }
.stat .k { font-family:var(--f-mono); font-size:10.5px; letter-spacing:.11em;
  text-transform:uppercase; color:var(--muted); }
.stat .v { font-family:var(--f-disp); font-weight:700; font-size:26px; line-height:1.15;
  margin-top:5px; font-variant-numeric:tabular-nums; }
.stat .s { font-size:12.5px; color:var(--muted); margin-top:2px; }

/* ── meters ──────────────────────────────────────────────────── */
.meter { height:5px; background:var(--surface-2); border-radius:3px; overflow:hidden; }
.meter > i { display:block; height:100%; background:var(--accent); border-radius:3px;
  transition:width .3s ease; }
.meter.over > i { background:var(--danger); }

/* ── toast ───────────────────────────────────────────────────── */
.toast { position:fixed; left:50%; bottom:20px; transform:translateX(-50%) translateY(12px);
  background:var(--ink); color:var(--bg); font-size:14px; padding:11px 18px;
  border-radius:100px; opacity:0; pointer-events:none; transition:opacity .22s, transform .22s;
  z-index:200; max-width:calc(100vw - 40px); text-align:center; }
.toast.show { opacity:1; transform:translateX(-50%) translateY(0); }
.toast.err { background:var(--danger); color:#fff; }

/* ── notices ─────────────────────────────────────────────────── */
.notice { padding:11px 14px; border-radius:var(--radius); font-size:14px;
  border:1px solid var(--line); background:var(--surface-2); }
.notice-err { background:var(--danger-soft); border-color:transparent; color:var(--danger); }
.notice-ok  { background:var(--ok-soft); border-color:transparent; color:var(--ok); }
.notice-warn{ background:var(--warn-soft); border-color:transparent; color:var(--warn); }

/* ── top bar ─────────────────────────────────────────────────── */
.topbar { position:sticky; top:0; z-index:50; background:var(--bg);
  border-bottom:1px solid var(--line); }
.topbar .inner { display:flex; align-items:center; gap:16px; height:60px; }
.navlink { font-size:14px; color:var(--muted); padding:9px 11px; border-radius:8px;
  display:inline-flex; align-items:center; min-height:40px; }
.navlink:hover { color:var(--ink); text-decoration:none; background:var(--surface-2); }
.navlink.on { color:var(--accent); background:var(--accent-soft); }

.spinner { width:15px; height:15px; border:2px solid currentColor; border-right-color:transparent;
  border-radius:50%; display:inline-block; animation:spin .7s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after {
  animation-duration:.01ms !important; transition-duration:.01ms !important; } }

/* ══ Studio console ══════════════════════════════════════════════════════════
   The studio is a working surface, not a stack of cards. One deep desk panel
   holds the whole take: settings rail, script, transport, waveform.          */

.desk { background:var(--surface); border:1px solid var(--line); border-radius:18px;
  overflow:hidden; box-shadow:var(--shadow); min-width:0; }

/* settings rails — horizontal, scannable, no card grid */
.rail { display:flex; align-items:center; gap:12px; padding:13px 18px;
  border-bottom:1px solid var(--line); min-width:0; }
.rail-k { font-family:var(--f-mono); font-size:10.5px; letter-spacing:.14em;
  text-transform:uppercase; color:var(--muted); width:52px; flex:none; }
.rail-scroll { display:flex; gap:7px; overflow-x:auto; scrollbar-width:none;
  padding:2px 0; flex:1; min-width:0; scroll-behavior:smooth;
  -webkit-mask-image:linear-gradient(90deg,#000 calc(100% - 34px),transparent);
  mask-image:linear-gradient(90deg,#000 calc(100% - 34px),transparent); }
.rail-scroll.at-end { -webkit-mask-image:none; mask-image:none; }
.rail-scroll::-webkit-scrollbar { display:none; }
.chip { flex:none; display:flex; flex-direction:column; gap:1px; padding:8px 14px;
  border:1px solid var(--line); border-radius:9px; background:transparent;
  cursor:pointer; font-family:var(--f-body); color:var(--ink); text-align:left;
  transition:border-color .15s, background .15s; }
.chip b { font-weight:600; font-size:14px; line-height:1.25; white-space:nowrap; }
.chip i { font-style:normal; font-size:11.5px; color:var(--muted); white-space:nowrap; }
.chip:hover { border-color:var(--accent); }
.chip[aria-pressed="true"] { background:var(--accent); border-color:var(--accent); }
.chip[aria-pressed="true"] b { color:var(--accent-ink); }
.chip[aria-pressed="true"] i { color:var(--accent-ink); opacity:.75; }

/* script — the hero surface, where the Arabic lives */
.script { position:relative; background:var(--bg); }
.script textarea { width:100%; border:none; background:transparent; border-radius:0;
  padding:24px 24px 14px; font-family:var(--f-ar); font-size:21px; line-height:2.1;
  color:var(--ink); resize:none; min-height:112px; max-height:46vh; overflow-y:auto; }
.script textarea:focus { outline:none; box-shadow:none; }
.script textarea::placeholder { color:var(--muted); opacity:.6; }

/* what will be spoken — a quiet annotation, not another card */
.spoken-strip { padding:0 24px 16px; }
.spoken-strip .k { font-family:var(--f-mono); font-size:10px; letter-spacing:.14em;
  text-transform:uppercase; color:var(--accent); display:block; margin-bottom:7px; }
.spoken-strip p { font-family:var(--f-ar); font-size:16px; line-height:1.95;
  color:var(--muted); direction:rtl; text-align:right;
  border-right:2px solid var(--accent); padding-right:13px; margin:0; }

/* transport — the record bar */
.transport { display:flex; align-items:center; gap:14px; padding:14px 18px;
  border-top:1px solid var(--line); background:var(--surface-2); flex-wrap:wrap; }
.rec { display:inline-flex; align-items:center; gap:10px; padding:0 22px 0 16px;
  height:46px; border-radius:100px; border:none; cursor:pointer;
  background:var(--accent); color:var(--accent-ink);
  font-family:var(--f-body); font-weight:600; font-size:15px; }
.rec:disabled { opacity:.45; cursor:not-allowed; }
.rec .dot { width:11px; height:11px; border-radius:50%; background:currentColor; flex:none; }
.rec.live .dot { animation:rec 1.1s ease-in-out infinite; }
@keyframes rec { 0%,100%{opacity:1} 50%{opacity:.25} }

.gauge { flex:1; min-width:120px; display:flex; flex-direction:column; gap:5px; }
.gauge-row { display:flex; justify-content:space-between; font-family:var(--f-mono);
  font-size:11.5px; color:var(--muted); font-variant-numeric:tabular-nums; }
.gauge-row .over { color:var(--danger); }
.gauge .meter { height:3px; }

/* take — a finished recording, with its real waveform */
.take { border-top:1px solid var(--line); padding:16px 18px;
  display:flex; align-items:center; gap:15px; flex-wrap:wrap; }
.take-play { width:46px; height:46px; flex:none; border-radius:50%;
  border:1px solid var(--accent); background:var(--accent-soft); color:var(--accent);
  cursor:pointer; display:grid; place-items:center; font-size:13px; padding-left:2px; }
.take-play.on { background:var(--accent); color:var(--accent-ink); }
.wave { flex:1; min-width:160px; height:46px; display:block; }
.take-meta { display:flex; flex-direction:column; gap:2px; min-width:104px; margin-right:4px; }
.take-meta b { font-family:var(--f-mono); font-size:14px; font-variant-numeric:tabular-nums; }
.take-meta span { font-size:11.5px; color:var(--muted); }

/* library rows reuse the take language at a smaller scale */
.takes { display:flex; flex-direction:column; }
.take-row { display:flex; align-items:center; gap:13px; padding:13px 0;
  border-bottom:1px solid var(--line); }
.take-row:last-child { border-bottom:none; }
.take-row .wave { height:32px; min-width:70px; }
.take-row-text { flex:2; min-width:150px; font-family:var(--f-ar); font-size:14.5px;
  direction:rtl; text-align:right; line-height:1.75; color:var(--muted);
  max-height:3.4em; overflow:hidden; }
.mini-play { width:34px; height:34px; flex:none; border-radius:50%;
  border:1px solid var(--line); background:var(--surface); color:var(--ink);
  cursor:pointer; display:grid; place-items:center; font-size:10px; padding-left:2px; }
.mini-play:hover { border-color:var(--accent); color:var(--accent); }

/* side rail */
.side-card { background:var(--surface); border:1px solid var(--line);
  border-radius:14px; padding:17px 18px; }
.side-k { font-family:var(--f-mono); font-size:10.5px; letter-spacing:.14em;
  text-transform:uppercase; color:var(--muted); display:block; margin-bottom:13px; }

@media (max-width:700px) {
  .rail { flex-direction:column; align-items:stretch; gap:8px; padding:12px 14px; }
  .rail-scroll { width:100%; }
  .rail-k { width:auto; }
  .script textarea { padding:20px 16px 10px; font-size:19px; }
  .spoken-strip { padding:0 16px 14px; }
  .transport { padding:12px 14px; }
  .rec { flex:1; justify-content:center; }
}

/* ── theme toggle ────────────────────────────────────────────── */
.theme-btn { width:38px; height:38px; flex:none; border-radius:50%;
  border:1px solid var(--line); background:var(--surface); color:var(--muted);
  cursor:pointer; display:grid; place-items:center; padding:0; }
.theme-btn:hover { border-color:var(--accent); color:var(--accent); }
.theme-btn svg { width:19px; height:19px; display:block; }
@media (pointer: coarse) { .theme-btn { width:44px; height:44px; } }
.lib-side { flex:none; flex-wrap:wrap; }
@media (max-width:640px) {
  .take-row { flex-wrap:wrap; }
  .take-row-text { flex:1 1 100%; order:3; }
  .lib-side { order:4; flex:1 1 100%; }
}

/* ══ Control room ════════════════════════════════════════════════════════════ */
.tabs-wrap { border-bottom:1px solid var(--line); }
.hero-stat { display:grid; gap:18px; align-items:end; padding:22px 0 24px; }
@media (min-width:820px) { .hero-stat { grid-template-columns:230px 1fr; } }
.hero-stat .big { font-family:var(--f-disp); font-weight:800; font-size:clamp(34px,5vw,50px);
  line-height:1; letter-spacing:-.03em; font-variant-numeric:tabular-nums; }
.hero-stat .cap { font-family:var(--f-mono); font-size:10.5px; letter-spacing:.14em;
  text-transform:uppercase; color:var(--muted); margin-bottom:9px; display:block; }
.hero-stat .sub { color:var(--muted); font-size:13.5px; margin-top:7px; }
.spark { width:100%; height:78px; display:block; }

.tiles { display:grid; gap:1px; background:var(--line); border:1px solid var(--line);
  border-radius:14px; overflow:hidden; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); }
.tile { background:var(--surface); padding:15px 17px; }
.tile .k { font-family:var(--f-mono); font-size:10px; letter-spacing:.13em;
  text-transform:uppercase; color:var(--muted); }
.tile .v { font-family:var(--f-disp); font-weight:700; font-size:23px; line-height:1.2;
  margin-top:5px; font-variant-numeric:tabular-nums; }
.tile .s { font-size:12px; color:var(--muted); margin-top:2px; }

/* tables sit on the page, not inside another box */
.sheet { border:1px solid var(--line); border-radius:14px; overflow:hidden; background:var(--surface); }
.sheet-h { display:flex; align-items:center; gap:12px; padding:13px 17px;
  border-bottom:1px solid var(--line); flex-wrap:wrap; }
.sheet-h h2 { font-size:16px; font-weight:600; }
.sheet thead th { background:var(--surface-2); }
