/* صوتك كلام v4.0 — نظام التصميم
   «فخامة أندلسية × تقنية علمية»: كحلي عميق + تيل + لمسات ذهبي، زخرفة نجمية خفيفة جدًا.
   الوضوح قبل المؤثرات — كل الألوان متراجعة لتباين WCAG AA. */
@font-face { font-family: 'Cairo'; src: url('../assets/fonts/Cairo.woff2') format('woff2'); font-weight: 200 1000; font-display: swap; }

:root, [data-theme="dark"] {
  --bg: #08131F; --bg2: #0B1A2E; --surface: #10233B; --surface2: #163052; --surface3: #1D3D66;
  --line: rgba(160, 190, 230, .16); --line2: rgba(160, 190, 230, .28);
  --text: #EEF3F9; --muted: #A9B8CB; --faint: #7F93AC;
  --teal: #2FB8A6; --teal2: #1E8F82; --gold: #D9B25F; --gold2: #B8903C; --goldText: #1C1405;
  --red: #E5675F; --amber: #E9A23B; --green: #3CCB8B; --blue: #6FA8F5; --wa: #25D366; --waText: #062b14;
  --glass: rgba(16, 35, 59, .78); --shadow: 0 14px 40px rgba(0, 0, 0, .38);
  --pattern-op: .05;
}
[data-theme="light"] {
  --bg: #F3F6FA; --bg2: #E9EFF6; --surface: #FFFFFF; --surface2: #F2F6FB; --surface3: #E3EBF5;
  --line: rgba(11, 37, 69, .12); --line2: rgba(11, 37, 69, .24);
  --text: #0B2545; --muted: #4A5D74; --faint: #6A7C91;
  --teal: #0F7C70; --teal2: #0B6158; --gold: #9A7224; --gold2: #7E5C17; --goldText: #FFFFFF;
  --red: #B3261E; --amber: #9A5B00; --green: #0F7A4B; --blue: #1D5FB8; --wa: #128C4A; --waText: #FFFFFF;
  --glass: rgba(255, 255, 255, .9); --shadow: 0 10px 28px rgba(11, 37, 69, .10); --pattern-op: .035;
}
[data-theme="midnight"] {
  --bg: #000000; --bg2: #05070B; --surface: #0C1016; --surface2: #131A24; --surface3: #1B2533;
  --line: rgba(200, 215, 235, .14); --line2: rgba(200, 215, 235, .26);
  --text: #F2F5F9; --muted: #A3AFBF; --faint: #7D8A9C;
  --teal: #3CC9B6; --teal2: #2A9E8F; --gold: #E0BD6B; --gold2: #C29C45; --goldText: #130D02;
  --glass: rgba(12, 16, 22, .9); --shadow: 0 12px 34px rgba(0, 0, 0, .7); --pattern-op: .03;
}
[data-theme="contrast"] {
  --bg: #000; --bg2: #000; --surface: #000; --surface2: #111; --surface3: #222;
  --line: #FFF; --line2: #FFF; --text: #FFF; --muted: #FFF; --faint: #E6E6E6;
  --teal: #00FFE1; --teal2: #00D6BD; --gold: #FFD600; --gold2: #FFC400; --goldText: #000;
  --red: #FF6B6B; --amber: #FFB000; --green: #4DFF9E; --blue: #7DB7FF; --wa: #4DFF9E; --waText: #000;
  --glass: #000; --shadow: none; --pattern-op: 0;
}
:root { --fs: 1; --r: 18px; --r-sm: 12px; --pad: 18px; --gap: 16px;
  --font: 'Cairo', 'Segoe UI', Tahoma, 'Noto Sans Arabic', Arial, sans-serif;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); }
[data-density="compact"] { --pad: 12px; --gap: 10px; }
[data-density="comfy"] { --pad: 24px; --gap: 20px; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; font-size: calc(16px * var(--fs)); }
body { min-height: 100dvh; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.75; -webkit-tap-highlight-color: transparent; overflow-x: hidden; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: var(--pattern-op);
  background-image: url('../assets/pattern.svg'); background-size: 120px 120px; }
body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(60% 40% at 85% 0%, color-mix(in srgb, var(--teal) 14%, transparent), transparent 70%),
              radial-gradient(50% 40% at 0% 100%, color-mix(in srgb, var(--gold) 10%, transparent), transparent 70%); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; inset-inline-start: -999px; top: 8px; z-index: 200; background: var(--gold); color: var(--goldText); padding: 8px 14px; border-radius: 10px; }
.skip:focus { inset-inline-start: 8px; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
[data-motion="reduce"] * { animation: none !important; transition: none !important; }

/* ─── Layout ─── */
.shell { position: relative; z-index: 1; display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 14px; padding: calc(18px + var(--sat)) 14px 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg2) 92%, transparent), var(--bg)); border-inline-end: 1px solid var(--line); overflow-y: auto; z-index: 40; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 12px; border-bottom: 1px solid var(--line); }
.brand-mark { width: 44px; height: 44px; border-radius: 12px; box-shadow: 0 6px 16px rgba(0,0,0,.3); }
.brand-name { font-weight: 900; font-size: 1.25rem; line-height: 1.2; color: var(--gold); }
.brand-en { font-size: .68rem; letter-spacing: .14em; color: var(--muted); direction: ltr; text-align: end; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-btn { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 8px 12px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-weight: 700; font-size: .92rem; cursor: pointer; text-align: start; }
.nav-btn .ic { width: 26px; text-align: center; font-size: 1rem; }
.nav-btn:hover { background: var(--surface); color: var(--text); }
.nav-btn[aria-current="page"] { background: linear-gradient(90deg, color-mix(in srgb, var(--teal) 22%, transparent), transparent); color: var(--text); box-shadow: inset -3px 0 0 var(--gold); }
.author { margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.author img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold); }
.author-name { font-weight: 800; font-size: .86rem; color: var(--gold); }
.author-title { font-size: .72rem; color: var(--muted); }
.content { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: calc(10px + var(--sat)) 22px 10px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.page-title { font-size: 1.15rem; font-weight: 900; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-inline-start: auto; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: .72rem; font-weight: 800; border: 1px solid var(--line2); color: var(--muted); background: var(--surface); white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.ok { color: var(--green); } .chip.warn { color: var(--amber); } .chip.bad { color: var(--red); } .chip.info { color: var(--blue); } .chip.gold { color: var(--gold); }
.top-actions { display: flex; gap: 6px; }
main { padding: 22px; display: flex; flex-direction: column; gap: var(--gap); outline: 0; flex: 1; }
.view { display: flex; flex-direction: column; gap: var(--gap); animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.foot { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 18px 0 6px; font-size: .74rem; color: var(--faint); text-align: center; }

/* ─── Cards ─── */
.card { background: var(--glass); border: 1px solid var(--line); border-radius: var(--r); padding: var(--pad); box-shadow: var(--shadow); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h3 { font-size: 1rem; font-weight: 900; }
.hint { font-size: .8rem; color: var(--muted); line-height: 1.8; }
.eyebrow { color: var(--teal); font-weight: 800; font-size: .85rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: .85rem; }
.kv dt, .kv .k { color: var(--muted); } .kv .v { font-weight: 700; overflow-wrap: anywhere; }

/* ─── Buttons ─── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 10px 18px; border-radius: var(--r-sm); border: 1px solid transparent; font-weight: 800; font-size: .9rem; cursor: pointer; touch-action: manipulation; user-select: none; transition: transform .12s, filter .15s, background .15s; }
.btn:active { transform: scale(.97); }
.btn:disabled, .tb:disabled { opacity: .45; cursor: not-allowed; }
.btn-gold, .btn-primary { background: linear-gradient(135deg, var(--gold), var(--gold2)); color: var(--goldText); }
.btn-gold:hover, .btn-primary:hover { filter: brightness(1.08); }
.btn-teal { background: var(--teal); color: #031916; }
.btn-ghost { background: var(--surface); border-color: var(--line2); color: var(--text); }
.btn-ghost:hover { background: var(--surface2); }
.btn-danger { background: var(--red); color: #fff; }
.btn-wa { background: var(--wa); color: var(--waText); }
.btn-sm { min-height: 40px; padding: 7px 12px; font-size: .8rem; }
.btn-lg { min-height: 54px; padding: 12px 22px; font-size: 1rem; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.icon-btn { min-width: 42px; min-height: 42px; border-radius: 12px; border: 1px solid var(--line2); background: var(--surface); cursor: pointer; font-weight: 900; display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--surface2); }
.link-btn { background: none; border: 0; color: var(--teal); font-weight: 800; cursor: pointer; font-size: .85rem; min-height: 36px; }
.only-mobile { display: none; }

/* ─── Forms ─── */
.field { width: 100%; min-height: 44px; padding: 9px 12px; border-radius: var(--r-sm); border: 1px solid var(--line2); background: var(--surface2); color: var(--text); outline: 0; }
.field:focus { border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 25%, transparent); }
select.field { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 10px; margin: 8px 0; }
.form-row label { font-size: .85rem; color: var(--muted); font-weight: 700; }
.toggle-row { display: flex; align-items: center; gap: 12px; margin: 8px 0; font-size: .86rem; line-height: 1.6; }
.switch { position: relative; width: 52px; min-width: 52px; height: 30px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--surface3); border: 1px solid var(--line2); transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 22px; height: 22px; top: 3px; right: 3px; border-radius: 50%; background: var(--muted); transition: .2s; }
.switch input:checked + span { background: color-mix(in srgb, var(--teal) 40%, var(--surface3)); border-color: var(--teal); }
.switch input:checked + span::before { transform: translateX(-22px); background: var(--teal); }
.switch input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
input[type=range] { width: 100%; accent-color: var(--gold); min-height: 32px; }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface2); border: 1px solid var(--line); flex-wrap: wrap; }
.seg button { flex: 1; min-height: 44px; padding: 6px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 800; font-size: .84rem; cursor: pointer; white-space: nowrap; }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 4px 12px rgba(0,0,0,.18), inset 0 -2px 0 var(--gold); }
.seg-sm button { min-height: 40px; font-size: .78rem; }
.disclosure { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 8px; }
.disclosure summary { cursor: pointer; font-weight: 800; color: var(--muted); font-size: .88rem; min-height: 40px; display: flex; align-items: center; }

/* ─── Home ─── */
.hero { display: flex; align-items: center; gap: 22px; overflow: hidden; position: relative;
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface2) 95%, transparent), color-mix(in srgb, var(--teal) 12%, var(--surface))); }
.hero::after { content: ""; position: absolute; inset-inline-end: -40px; top: -40px; width: 220px; height: 220px; background: url('../assets/pattern.svg') center/110px; opacity: .1; border-radius: 50%; pointer-events: none; }
.hero-text { flex: 1; position: relative; z-index: 1; }
.hero-title { font-size: 2rem; font-weight: 900; line-height: 1.3; }
.hero-title .ver { font-size: .9rem; color: var(--goldText); background: var(--gold); border-radius: 8px; padding: 2px 8px; vertical-align: middle; }
.hero-sub { color: var(--muted); margin: 6px 0 14px; max-width: 62ch; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-photo { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 3px solid var(--gold); box-shadow: 0 10px 30px rgba(0,0,0,.35); position: relative; z-index: 1; }
.health { display: flex; flex-direction: column; gap: 4px; }
.health .h-top { display: flex; align-items: center; gap: 8px; font-weight: 900; }
.health .h-ic { font-size: 1.3rem; }
.health .h-val { font-size: 1.05rem; font-weight: 900; }
.health.ok .h-val { color: var(--green); } .health.warn .h-val { color: var(--amber); } .health.bad .h-val { color: var(--red); }
.mini-list { display: flex; flex-direction: column; }
.mini-item { display: flex; gap: 10px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 8px; background: none; border-inline: 0; border-top: 0; text-align: start; width: 100%; min-height: 52px; }
.mini-item:hover { background: var(--surface2); }
.mini-item .t { font-weight: 800; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-item .m { font-size: .74rem; color: var(--muted); white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: 18px; font-size: .88rem; line-height: 2; }

/* ─── Studio ─── */
.studio-grid { display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.rec-col { display: flex; flex-direction: column; gap: var(--gap); position: sticky; top: 76px; }
.ed-col { min-width: 0; }
.rec-card { display: flex; flex-direction: column; gap: 10px; }
.mic-zone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0; }
.mic-ring { position: relative; display: grid; place-items: center; width: 150px; height: 150px; }
.mic-ring::before, .mic-ring::after { content: ""; position: absolute; inset: 14px; border-radius: 50%; border: 2px solid var(--gold); opacity: 0; pointer-events: none; }
.mic-ring.on::before { animation: ring 1.8s ease-out infinite; } .mic-ring.on::after { animation: ring 1.8s ease-out .6s infinite; }
@keyframes ring { 0% { transform: scale(.85); opacity: .6; } 100% { transform: scale(1.25); opacity: 0; } }
.mic-btn { width: 112px; height: 112px; border-radius: 50%; border: 2px solid var(--line2); cursor: pointer; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, var(--surface3), var(--surface)); box-shadow: 0 12px 30px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.08); touch-action: none; }
.mic-btn svg { width: 42px; height: 42px; fill: var(--text); }
.mic-btn.on { background: radial-gradient(circle at 35% 30%, var(--gold), var(--gold2)); border-color: var(--gold); }
.mic-btn.on svg { fill: var(--goldText); }
.mic-btn.paused { background: radial-gradient(circle at 35% 30%, var(--amber), var(--gold2)); }
.mic-btn:disabled { opacity: .5; cursor: progress; }
.rec-timer { font-size: 1.6rem; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--gold); direction: ltr; }
.rec-limit { font-size: .74rem; color: var(--faint); }
.rec-ctrls { display: flex; gap: 8px; }
.rec-state { font-size: .88rem; font-weight: 700; color: var(--muted); text-align: center; min-height: 1.8em; }
.rec-state.ok { color: var(--green); } .rec-state.err { color: var(--red); } .rec-state.busy { color: var(--teal); } .rec-state.rec { color: var(--gold); }
.wave { width: 100%; height: 80px; border-radius: 12px; background: color-mix(in srgb, var(--bg) 70%, transparent); border: 1px solid var(--line); display: block; }
.level { display: flex; align-items: center; gap: 10px; font-size: .76rem; color: var(--muted); }
.level-lbl { min-width: 92px; } .level-val { min-width: 38px; text-align: end; font-variant-numeric: tabular-nums; }
.level-track { flex: 1; height: 10px; border-radius: 99px; background: var(--surface3); overflow: hidden; }
.level-fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--teal), var(--gold) 70%, var(--red)); transition: width .08s linear; }
.warn-line { font-size: .82rem; font-weight: 800; color: var(--amber); background: color-mix(in srgb, var(--amber) 12%, transparent); border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent); padding: 6px 10px; border-radius: 10px; }
.drop { text-align: center; border: 2px dashed var(--line2); cursor: pointer; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.drop:hover, .drop.over { border-color: var(--teal); background: color-mix(in srgb, var(--teal) 8%, var(--glass)); }
.drop-ic { font-size: 1.8rem; }
.progress { height: 10px; border-radius: 99px; background: var(--surface3); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), var(--gold)); transition: width .3s; }
.job-meta { font-size: .8rem; color: var(--muted); margin-top: 6px; display: flex; gap: 12px; flex-wrap: wrap; }
.job-segs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.seg-pill { font-size: .72rem; padding: 3px 9px; border-radius: 99px; border: 1px solid var(--line2); }
.seg-pill.done { color: var(--green); border-color: var(--green); } .seg-pill.fail { color: var(--red); border-color: var(--red); cursor: pointer; } .seg-pill.run { color: var(--gold); border-color: var(--gold); }

.editor-card { display: flex; flex-direction: column; gap: 10px; min-height: 70vh; }
.doc-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.doc-title { flex: 1; min-width: 180px; font-weight: 900; font-size: 1.05rem; }
.save-state { font-size: .76rem; font-weight: 800; color: var(--muted); white-space: nowrap; }
.save-state.ok { color: var(--green); } .save-state.dirty { color: var(--amber); } .save-state.err { color: var(--red); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 10px 14px; min-height: 44px; color: var(--muted); font-weight: 800; cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; font-size: .86rem; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--gold); }
.toolbar { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.tb { min-height: 38px; padding: 5px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: .78rem; font-weight: 800; white-space: nowrap; }
.tb:hover { background: var(--surface2); }
.tb-wa { background: var(--wa); color: var(--waText); border-color: transparent; }
.tb-sep { width: 1px; height: 24px; background: var(--line2); margin: 0 4px; }
.find-bar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 8px; border-radius: 12px; background: var(--surface2); }
.find-bar .field { flex: 1; min-width: 140px; min-height: 38px; }
.pane { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.editor { flex: 1; width: 100%; min-height: 48vh; resize: vertical; border-radius: 14px; border: 1px solid var(--line2); background: var(--surface2); color: var(--text); padding: 16px 18px; font-size: 1.08rem; line-height: 2.1; outline: 0; text-align: start; }
.editor:focus { border-color: var(--teal); }
.editor[dir="ltr"] { text-align: left; }
.ro-text { white-space: pre-wrap; min-height: 40vh; padding: 16px 18px; border-radius: 14px; background: var(--surface2); border: 1px solid var(--line); font-size: 1.05rem; line-height: 2.1; overflow-wrap: anywhere; }
.ro-text bdi { unicode-bidi: isolate; }
mark.corr { background: color-mix(in srgb, var(--teal) 28%, transparent); color: inherit; border-radius: 4px; padding: 0 2px; cursor: pointer; border-bottom: 2px solid var(--teal); }
mark.corr.off { background: color-mix(in srgb, var(--amber) 20%, transparent); border-bottom-color: var(--amber); text-decoration: line-through dotted; }
mark.corr.sug { background: color-mix(in srgb, var(--blue) 22%, transparent); border-bottom: 2px dashed var(--blue); }
.seg-line { display: block; padding: 2px 4px; border-radius: 6px; cursor: pointer; }
.seg-line:hover { background: var(--surface3); }
.seg-line .ts { color: var(--teal); font-size: .78rem; font-weight: 800; direction: ltr; display: inline-block; margin-inline-end: 8px; }
.corr-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: auto; }
.corr-item { display: flex; align-items: center; gap: 10px; font-size: .82rem; padding: 6px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.corr-item .ft { flex: 1; } .corr-item .ft b { color: var(--teal); }
.compare { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.compare h4 { font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.compare .ro-text { min-height: 30vh; font-size: .95rem; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tool { text-align: start; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; min-height: 86px; display: flex; flex-direction: column; gap: 4px; }
.tool:hover { border-color: var(--teal); }
.tool b { font-size: .92rem; } .tool span { font-size: .75rem; color: var(--muted); line-height: 1.6; }
.tool-out { margin-top: 12px; }
.stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: .76rem; color: var(--muted); }
.stats b { color: var(--text); }
.live-box { border: 1px dashed var(--gold); border-radius: 12px; padding: 10px 14px; background: color-mix(in srgb, var(--gold) 7%, transparent); color: var(--text); line-height: 2; }
.live-box .live-tag { display: block; font-size: .7rem; color: var(--gold); font-weight: 900; }
.live-box .interim { color: var(--muted); }
.doc-audio { width: 100%; }

/* ─── Library ─── */
.lib-filters { display: flex; flex-direction: column; gap: 10px; }
.lib-search { font-size: 1rem; }
.lib-row { display: flex; gap: 8px; flex-wrap: wrap; }
.lib-row .field { width: auto; flex: 1; min-width: 150px; }
.tag-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: .74rem; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line2); background: var(--surface); cursor: pointer; min-height: 30px; }
.tag[aria-pressed="true"] { background: var(--teal); color: #031916; border-color: var(--teal); }
.vlist { position: relative; height: 66vh; overflow-y: auto; border-radius: var(--r); border: 1px solid var(--line); background: var(--glass); }
.vlist-inner { position: relative; }
.doc-row { position: absolute; inset-inline: 0; height: 84px; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.doc-row:hover { background: var(--surface2); }
.doc-row .open { flex: 1; min-width: 0; background: none; border: 0; text-align: start; cursor: pointer; padding: 0; min-height: 60px; }
.doc-row .t { font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-row .s { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-row .m { font-size: .72rem; color: var(--faint); }
.doc-row .acts { display: flex; gap: 4px; }
.flag { color: var(--gold); }
.menu { position: fixed; z-index: 90; min-width: 220px; background: var(--surface); border: 1px solid var(--line2); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; }
.menu button { text-align: start; min-height: 42px; padding: 6px 12px; border: 0; border-radius: 10px; background: none; cursor: pointer; font-weight: 700; font-size: .86rem; }
.menu button:hover, .menu button:focus-visible { background: var(--surface2); }
.menu button.danger { color: var(--red); }

/* ─── Dictionary ─── */
.packs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.pack { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; border: 1px solid var(--line2); background: var(--surface); }
.dict-form { display: grid; grid-template-columns: 1fr 1.5fr .8fr auto; gap: 8px; }
.dict-search { max-width: 260px; }
.dict-list { display: flex; flex-direction: column; max-height: 60vh; overflow: auto; }
.dict-row { display: grid; grid-template-columns: auto minmax(110px, .6fr) 1.6fr auto auto; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: .86rem; }
.dict-row .term { font-weight: 900; direction: ltr; text-align: start; }
.dict-row .al { color: var(--muted); overflow-wrap: anywhere; }
.badge { font-size: .68rem; padding: 2px 8px; border-radius: 99px; background: var(--surface3); color: var(--muted); white-space: nowrap; }
.issues { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.issue { font-size: .8rem; padding: 4px 10px; border-radius: 8px; }
.issue.error { color: var(--red); background: color-mix(in srgb, var(--red) 10%, transparent); }
.issue.warn { color: var(--amber); background: color-mix(in srgb, var(--amber) 10%, transparent); }

/* ─── Models ─── */
.model-card { display: flex; flex-direction: column; gap: 8px; }
.model-card.reco { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), var(--shadow); }
.model-card.selected { border-color: var(--teal); }
.model-card h3 { font-size: 1.1rem; }
.model-size { font-size: 1.4rem; font-weight: 900; color: var(--gold); direction: ltr; text-align: start; }
.rec-reco { border-inline-start: 4px solid var(--gold); }

/* ─── Banners / dialogs / toasts ─── */
.update-bar, .banner { position: fixed; top: 0; inset-inline: 0; z-index: 120; display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: calc(10px + var(--sat)) 16px 10px; background: linear-gradient(135deg, var(--teal2), #0B4A44); color: #fff; font-weight: 800; font-size: .86rem; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.banner { top: auto; bottom: 0; background: linear-gradient(135deg, #6A2B1F, #4A1C14); }
.banner.banner-info { background: linear-gradient(135deg, #12406B, #0B2A4A); }
.update-actions { display: flex; gap: 8px; }
.dlg { border: 1px solid var(--line2); border-radius: 20px; padding: 0; background: var(--surface); color: var(--text); width: min(560px, calc(100vw - 24px)); max-height: 86vh; box-shadow: 0 30px 80px rgba(0,0,0,.5); margin: auto; }
.dlg-wide { width: min(860px, calc(100vw - 24px)); }
.dlg::backdrop { background: rgba(3, 8, 15, .66); backdrop-filter: blur(3px); }
.dlg-title { font-size: 1.1rem; font-weight: 900; padding: 18px 20px 8px; }
.dlg-danger .dlg-title { color: var(--red); }
.dlg-body { padding: 4px 20px 10px; overflow: auto; max-height: 62vh; font-size: .92rem; display: flex; flex-direction: column; gap: 8px; }
.dlg-label { font-size: .82rem; color: var(--muted); font-weight: 700; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px 18px; flex-wrap: wrap; }
.tech { font-size: .75rem; color: var(--faint); } .tech code { display: block; direction: ltr; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; }
.toasts { position: fixed; z-index: 150; bottom: calc(24px + var(--sab)); inset-inline-start: 50%; transform: translateX(50%); display: flex; flex-direction: column; gap: 8px; width: min(520px, calc(100vw - 24px)); pointer-events: none; }
.toast { pointer-events: auto; padding: 12px 16px; border-radius: 14px; background: var(--surface3); border: 1px solid var(--line2); color: var(--text); font-weight: 700; font-size: .88rem; box-shadow: var(--shadow); animation: fade .2s ease; }
.toast.out { opacity: 0; transition: opacity .35s; }
.toast-ok { border-color: var(--green); } .toast-err { border-color: var(--red); } .toast-warn { border-color: var(--amber); }
.preview-doc { background: #fff; color: #0B2545; border-radius: 12px; padding: 22px; max-height: 48vh; overflow: auto; line-height: 2; font-size: .95rem; }
.preview-doc h1 { font-size: 1.2rem; } .preview-doc .print-meta { color: #5A6B7B; font-size: .8rem; }
.preview-doc .print-foot { margin-top: 14px; font-size: .7rem; color: #8A97A6; }
.print-area { display: none; }
.help h2 { font-size: 1.15rem; margin: 18px 0 6px; color: var(--gold); } .help h2:first-child { margin-top: 0; }
.help p, .help li { font-size: .92rem; line-height: 2; } .help ol, .help ul { padding-inline-start: 22px; }
.help table { width: 100%; border-collapse: collapse; font-size: .84rem; margin: 6px 0; }
.help th, .help td { border: 1px solid var(--line2); padding: 6px 8px; text-align: start; vertical-align: top; }
.help kbd { background: var(--surface3); border: 1px solid var(--line2); border-radius: 6px; padding: 0 6px; font-family: inherit; direction: ltr; display: inline-block; }
.noscript { padding: 20px; text-align: center; }

/* ─── Mobile ─── */
.bottomnav, .fab, .scrim { display: none; }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .compare { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 280px; transform: translateX(110%); transition: transform .25s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .scrim:not([hidden]) { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 35; }
  .only-mobile { display: inline-grid; }
  .topbar { padding-inline: 12px; } .chips { display: none; }
  main { padding: 14px 12px calc(96px + var(--sab)); }
  .grid-2, .grid-3, .studio-grid { grid-template-columns: 1fr; }
  .rec-col { position: static; }
  .hero { flex-direction: column-reverse; text-align: center; } .hero-actions { justify-content: center; } .hero-title { font-size: 1.6rem; }
  .bottomnav { display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; position: fixed; bottom: 0; inset-inline: 0; z-index: 45; padding: 6px 8px calc(6px + var(--sab)); background: color-mix(in srgb, var(--bg2) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .bottomnav button { display: flex; flex-direction: column; align-items: center; gap: 0; background: none; border: 0; color: var(--muted); font-size: .68rem; font-weight: 800; min-height: 52px; cursor: pointer; }
  .bottomnav button span { font-size: 1.1rem; }
  .bottomnav button[aria-current="page"] { color: var(--gold); }
  .fab { display: grid !important; place-items: center; width: 66px; height: 66px; margin: -26px auto 0; border-radius: 50%; border: 3px solid var(--bg); background: linear-gradient(135deg, var(--gold), var(--gold2)) !important; box-shadow: 0 10px 26px rgba(0,0,0,.45); }
  .fab svg { width: 30px; height: 30px; fill: var(--goldText); }
  .fab.on { background: linear-gradient(135deg, var(--red), #a3392f) !important; }
  .form-row { grid-template-columns: 1fr; gap: 4px; }
  .dict-form { grid-template-columns: 1fr; }
  .dict-row { grid-template-columns: auto 1fr auto; } .dict-row .al { grid-column: 2 / -1; }
  .doc-row .acts .hide-sm { display: none; }
  .editor { min-height: 42vh; font-size: 1.05rem; }
  .vlist { height: 62vh; }
  .toasts { bottom: calc(90px + var(--sab)); }
}
@media (max-width: 420px) { .seg button { font-size: .74rem; padding: 6px 6px; } .tb { padding: 5px 8px; } .hero-photo { width: 90px; height: 90px; } }
.notfound { min-height: 100dvh; display: grid; place-items: center; padding: 20px; position: relative; z-index: 1; text-align: center; }
.notfound h1 { font-size: 1.4rem; margin-bottom: 8px; }
.notfound a { text-decoration: none; margin-top: 12px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.mini-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.pre { white-space: pre-wrap; font-family: inherit; font-size: .85rem; overflow-wrap: anywhere; }
