/* KataLeap ELV Studio — design system */
:root {
  --bg: #0B1220; --panel: #111A2E; --panel2: #0E1628; --sunken: #0A1322; --line: #1C2741; --line2: #2A3757;
  --text: #E6ECF5; --soft: #C5D0E2; --muted: #8D9BB4; --strong: #F2F6FC;
  --accent: #22D3EE; --accent-ink: #06202A; --accent-bg: #11304A; --accent-text: #67E8F9;
  --ok: #7EE7D2; --ok-bg: #0F2A26; --warn: #F5C76A; --warn-bg: #2A2412; --danger: #FFB4B4; --danger-bg: #2A1A1D;
  --gold: #F5B544; --gold-ink: #2A1A00;
  --plan-bg: #0A1322; --plan-grid: #14203A; --plan-wall: #5B6B88; --plan-text: #8D9BB4; --plan-room: #0F1A2E;
  --radius: 12px; --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, 'Noto Sans Arabic', system-ui, sans-serif; --mono: 'IBM Plex Mono', 'IBM Plex Sans Arabic', Consolas, 'Segoe UI', Tahoma, monospace;
}
[data-theme="light"] {
  --bg: #F3F5F9; --panel: #FFFFFF; --panel2: #F8FAFC; --sunken: #F1F5F9; --line: #E2E8F0; --line2: #CBD5E1;
  --text: #0F172A; --soft: #334155; --muted: #5B6578; --strong: #020617;
  --accent: #0E7490; --accent-ink: #FFFFFF; --accent-bg: #E0F2FE; --accent-text: #0E7490;
  --ok: #047857; --ok-bg: #ECFDF5; --warn: #92400E; --warn-bg: #FFFBEB; --danger: #B91C1C; --danger-bg: #FEF2F2;
  --plan-bg: #FFFFFF; --plan-grid: #EEF2F7; --plan-wall: #475569; --plan-text: #475569; --plan-room: #F8FAFC;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.6; -webkit-text-size-adjust: 100%; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.3; }
button, input, select, textarea { font-family: inherit; font-size: 14px; color: inherit; }
.mono { font-family: var(--mono); }
.ltr { direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); } .soft { color: var(--soft); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg { flex: none; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line2); background: transparent; color: var(--text); cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { background: var(--panel2); border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); font-weight: 600; }
.btn.soft { background: var(--accent-bg); border-color: var(--accent); color: var(--accent-text); }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 40px; padding: 0; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=number], input[type=search], select, textarea { background: var(--sunken); border: 1px solid var(--line2); border-radius: 10px; padding: 8px 10px; min-height: 40px; color: var(--text); width: 100%; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--soft); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); color: var(--soft); font-size: 12px; white-space: nowrap; }
.chip.accent { background: var(--accent-bg); color: var(--accent-text); border-color: transparent; }
.chip.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.chip.danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex: none; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; color: var(--soft); border-radius: 8px; padding: 0 12px; min-height: 32px; cursor: pointer; }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line2); border-radius: 99px; transition: .15s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { inset-inline-start: 19px; }

/* ---------- cards & layout ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card h2 { font-size: 16px; } .card h3 { font-size: 14px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.row.top { align-items: flex-start; } .row.between { justify-content: space-between; } .row.nowrap { flex-wrap: nowrap; }
.col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.flex1 { flex: 1 1 0; min-width: 0; }
.split { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.split > .main { flex: 999 1 560px; min-width: 0; }
.split > .side { flex: 1 1 280px; min-width: 0; max-width: 100%; }
.kpi { padding: 14px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.kpi small { display: block; color: var(--muted); font-size: 12px; }
.kpi b { display: block; font-family: var(--mono); font-weight: 500; font-size: 26px; color: var(--strong); margin: 4px 0 2px; }
.kpi span { font-size: 12px; color: var(--muted); }
.bar { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 6px; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.note { padding: 10px 12px; border-radius: 10px; font-size: 13px; }
.note.ok { background: var(--ok-bg); color: var(--ok); } .note.warn { background: var(--warn-bg); color: var(--warn); } .note.danger { background: var(--danger-bg); color: var(--danger); } .note.info { background: var(--accent-bg); color: var(--accent-text); }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; border-radius: 12px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 8px 10px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 500; font-size: 12px; background: var(--panel2); position: sticky; top: 0; }
.tbl td.num, .tbl th.num { text-align: end; font-family: var(--mono); white-space: nowrap; }
.tbl tr.group td { background: var(--panel2); font-weight: 600; color: var(--strong); }
.tbl tr.total td { font-weight: 600; color: var(--strong); background: var(--sunken); }
.tbl input { min-height: 30px; padding: 4px 8px; font-size: 13px; }

/* ---------- formula block ---------- */
.formula { direction: ltr; text-align: left; font-family: var(--mono); font-size: 13px; background: var(--sunken); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; line-height: 1.9; overflow-x: auto; }
.formula .lbl { font-family: var(--font); color: var(--muted); font-size: 12px; display: block; direction: rtl; text-align: right; margin-top: 6px; }
[dir=ltr] .formula .lbl { direction: ltr; text-align: left; }
.formula .lbl:first-child { margin-top: 0; }
.formula .eq { color: var(--soft); } .formula .res { color: var(--strong); font-weight: 500; }
.result { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; padding: 14px 16px; border-radius: 12px; background: var(--accent-bg); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.result small { display: block; font-size: 12px; color: var(--muted); }
.result b { display: block; font-family: var(--mono); font-weight: 500; font-size: 28px; color: var(--strong); }
.result .sep { width: 1px; align-self: stretch; background: color-mix(in srgb, var(--accent) 35%, transparent); }

/* ---------- studio shell ---------- */
.shell { display: flex; min-height: 100vh; }
.side-nav { width: 252px; flex: none; background: var(--panel2); border-inline-end: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 3px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 18px; text-decoration: none !important; color: var(--text); }
.logo { width: 38px; height: 38px; border-radius: 11px; background: var(--gold); color: var(--gold-ink); display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-weight: 600; flex: none; }
.brand b { display: block; font-size: 15px; } .brand b span { color: var(--gold); } .brand small { color: var(--muted); font-size: 11.5px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--soft); text-decoration: none !important; font-size: 14px; }
.nav-item:hover { background: var(--panel); }
.nav-item.on { background: var(--accent-bg); color: var(--accent-text); font-weight: 500; }
.nav-sep { font-size: 11.5px; color: var(--muted); padding: 14px 12px 4px; }
.side-foot { margin-top: auto; padding: 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 26px 10px; }
.topbar h1 { font-size: 22px; }
.crumb { font-size: 12px; color: var(--muted); }
.content { padding: 8px 26px 40px; display: flex; flex-direction: column; gap: 14px; }
.search-btn { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line2); background: var(--panel); color: var(--muted); min-width: 220px; cursor: pointer; }
.kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line2); border-radius: 6px; padding: 0 6px; margin-inline-start: auto; }
.bottom-nav { display: none; }
.proj-hero { display: flex; gap: 16px; align-items: center; }
.proj-thumb { width: 168px; height: 100px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); flex: none; background: var(--panel2); }
.proj-thumb img, .proj-thumb svg { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- building stack ---------- */
.stack-row { display: flex; align-items: center; gap: 10px; }
.stack-row .lv { width: 38px; text-align: center; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.stack-row .bars { flex: 1; display: flex; gap: 2px; height: 16px; padding: 3px; border-radius: 6px; background: var(--sunken); border: 1px solid var(--line); cursor: pointer; }
.stack-row .bars i { height: 100%; border-radius: 3px; }
.stack-row .tot { width: 52px; font-family: var(--mono); font-size: 12px; color: var(--soft); }
.stack-row:hover .bars { border-color: var(--accent); }

/* ---------- plans ---------- */
.plan-wrap { position: relative; background: var(--plan-bg); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.plan-tools { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--panel); }
.plan-svg { display: block; width: 100%; height: 560px; touch-action: none; cursor: grab; }
.plan-svg.dragging { cursor: grabbing; }
.plan-svg .room { fill: var(--plan-room); stroke: var(--plan-wall); stroke-width: .25; }
.plan-svg .room.core { fill: color-mix(in srgb, var(--plan-room) 70%, var(--accent) 6%); }
.plan-svg .corr { fill: color-mix(in srgb, var(--plan-bg) 85%, var(--muted) 10%); stroke: var(--plan-wall); stroke-width: .15; stroke-dasharray: .6 .4; }
.plan-svg .rlabel { fill: var(--plan-text); font-family: var(--font); }
.plan-svg .dev { cursor: pointer; }
.plan-svg .dev:hover { filter: brightness(1.3); }
.plan-svg .sel { stroke: var(--accent); fill: none; }
.title-block { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); border-top: 1px solid var(--line); font-size: 12px; background: var(--panel); }
.title-block > div { padding: 8px 12px; border-inline-end: 1px solid var(--line); }
.title-block b { display: block; font-weight: 500; font-family: var(--mono); color: var(--text); }
.level-tabs { display: flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.level-tabs a { min-width: 38px; padding: 4px 8px; border-radius: 8px; text-align: center; font-family: var(--mono); font-size: 12px; color: var(--soft); text-decoration: none !important; }
.level-tabs a.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; font-size: 12px; color: var(--soft); }
.legend span { display: flex; align-items: center; gap: 6px; }

/* ---------- simulator ---------- */
.ask { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line2); }
[dir=rtl] .ask { padding: 6px 12px 6px 6px; }
.ask input { border: 0; background: transparent; min-height: 44px; font-size: 15px; box-shadow: none !important; }
.bank-cat { width: 100%; display: flex; justify-content: space-between; align-items: center; min-height: 34px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--soft); cursor: pointer; font-size: 13px; text-align: start; }
.bank-cat.on, .bank-cat:hover { background: var(--accent-bg); color: var(--accent-text); }
.q-chip { min-height: 34px; padding: 4px 14px; border-radius: 99px; border: 1px solid var(--line2); background: var(--panel); color: var(--soft); cursor: pointer; font-size: 13px; text-align: start; }
.q-chip:hover { border-color: var(--accent); color: var(--accent-text); }
.src { font-size: 11px; padding: 1px 8px; border-radius: 99px; white-space: nowrap; }
.src.q { background: var(--accent-bg); color: var(--accent-text); } .src.p { background: var(--ok-bg); color: var(--ok); } .src.d { background: var(--panel2); color: var(--muted); border: 1px solid var(--line); }
.dori { display: flex; gap: 3px; } .dori i { flex: 1; height: 6px; border-radius: 3px; background: var(--line2); } .dori i.on { background: var(--ok); }

/* ---------- misc ---------- */
.toast { position: fixed; bottom: 22px; inset-inline-start: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--accent); color: var(--text); padding: 10px 16px; border-radius: 12px; z-index: 90; box-shadow: 0 8px 30px rgba(0,0,0,.35); max-width: 90vw; }
[dir=rtl] .toast { transform: translateX(50%); }
.modal-bg { position: fixed; inset: 0; background: rgba(3,7,18,.6); z-index: 80; display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; }
.modal { width: min(640px, 100%); max-height: 84vh; overflow: auto; background: var(--panel); border: 1px solid var(--line2); border-radius: 18px; padding: 18px; }
.search-res a { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 10px; color: var(--text); text-decoration: none !important; }
.search-res a:hover, .search-res a.on { background: var(--accent-bg); }
.calendar { display: grid; grid-template-columns: 140px repeat(12, minmax(26px, 1fr)); gap: 4px; min-width: 560px; }
.calendar .c { height: 26px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 11px; background: var(--sunken); color: var(--muted); }
.calendar .c.M { background: #1E4B5E; color: #BEEBF7; } .calendar .c.Q { background: #1D9E8A; color: #04221D; } .calendar .c.S { background: #6D5BD0; color: #F1EEFF; } .calendar .c.A { background: #B98A2E; color: #231703; }
.stage { padding: 12px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); cursor: pointer; text-align: start; color: var(--text); }
.stage.run { border-color: var(--accent); }
.delta-up { color: var(--warn); } .delta-down { color: var(--ok); }

/* ---------- home (theme-aware) ---------- */
.home-hero { display: flex; flex-wrap: wrap; gap: 28px; align-items: stretch; }
.hero h1, .home-hero h1 { font-size: 48px; line-height: 1.12; font-weight: 700; }
.home-hero h1 span { color: var(--gold); }
.home-hero p.lead { font-size: 17px; line-height: 1.9; color: var(--soft); max-width: 560px; margin: 0; }
.hero-pill { align-self: flex-start; padding: 6px 14px; border-radius: 99px; background: var(--accent-bg); color: var(--accent-text); font-size: 13px; }
.hero-card { flex: 1.25 1 460px; min-width: 0; border-radius: 22px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; }
.hero-img { height: 320px; position: relative; background: var(--panel2); }
.hero-img img, .hero-img svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-img .tag { position: absolute; top: 16px; inset-inline-end: 16px; padding: 6px 14px; border-radius: 99px; background: rgba(8,12,28,.78); color: #F5C76A; font-size: 13px; }
.credit { position: absolute; bottom: 8px; inset-inline-start: 10px; font-size: 10.5px; color: #fff; background: rgba(0,0,0,.45); padding: 1px 8px; border-radius: 6px; }
.credit a { color: #fff; }
.stat b { display: block; font-family: var(--mono); font-size: 26px; font-weight: 500; }
.stat span { font-size: 13px; color: var(--muted); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.tpl-card { display: block; width: 100%; padding: 0; border-radius: 18px; overflow: hidden; background: var(--panel); border: 2px solid var(--line); cursor: pointer; text-align: start; color: var(--text); transition: transform .15s, border-color .15s; }
.tpl-card:hover { transform: translateY(-2px); border-color: var(--line2); }
.tpl-card.on { border-color: var(--gold); }
.tpl-card .img { height: 132px; background: var(--panel2); overflow: hidden; }
.tpl-card .img img, .tpl-card .img svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.tpl-card .t { padding: 12px 14px; } .tpl-card .t b { display: block; font-size: 15.5px; } .tpl-card .t small { font-family: var(--mono); color: var(--muted); font-size: 12px; }
.param-tile { padding: 10px 12px; border-radius: 12px; background: var(--sunken); border: 1px solid var(--line); } .param-tile small { display: block; font-size: 12px; color: var(--muted); } .param-tile b { font-family: var(--mono); font-weight: 500; font-size: 16px; }
.recent { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); color: var(--text); text-decoration: none !important; }
.recent:hover { border-color: var(--line2); }
.recent .th { width: 96px; height: 64px; border-radius: 10px; overflow: hidden; flex: none; } .recent .th img, .recent .th svg { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- report (print) ---------- */
.report-root { display: none; }
.rpt { background: #fff; color: #0B1220; font-family: var(--font); }
.rpt-page { width: 210mm; min-height: 297mm; padding: 16mm 15mm; margin: 0 auto 18px; background: #fff; box-shadow: 0 2px 16px rgba(0,0,0,.18); position: relative; page-break-after: always; break-after: page; }
.rpt.a3 .rpt-page { width: 297mm; min-height: 420mm; }
.rpt.landscape .rpt-page { width: 297mm; min-height: 210mm; }
.rpt.a3.landscape .rpt-page { width: 420mm; min-height: 297mm; }
.rpt h1 { font-size: 30px; } .rpt h2 { font-size: 18px; border-bottom: 2px solid #0B1220; padding-bottom: 6px; margin-bottom: 10px; } .rpt h3 { font-size: 14px; margin: 12px 0 6px; color: #0E7490; }
.rpt p, .rpt li { font-size: 12px; line-height: 1.8; }
.rpt table { width: 100%; border-collapse: collapse; font-size: 11px; page-break-inside: auto; }
.rpt th, .rpt td { border: 1px solid #CBD5E0; padding: 4px 6px; text-align: start; }
.rpt th { background: #EEF2F7; }
.rpt td.num { text-align: end; font-family: var(--mono); }
.rpt tr { page-break-inside: avoid; }
.rpt .rhead { display: flex; justify-content: space-between; border-bottom: 1px solid #CBD5E0; padding-bottom: 6px; margin-bottom: 12px; font-size: 10px; color: #4A5568; }
.rpt .rfoot { position: absolute; bottom: 8mm; inset-inline: 15mm; display: flex; justify-content: space-between; font-size: 10px; color: #4A5568; border-top: 1px solid #CBD5E0; padding-top: 4px; }
.rpt .formula { background: #F8FAFC; border-color: #CBD5E0; color: #0B1220; }
.rpt .formula .lbl { color: #4A5568; } .rpt .formula .res, .rpt .formula .eq { color: #0B1220; }
.rpt .plan-print svg { width: 100%; height: auto; border: 1px solid #CBD5E0; }
.preview-pane { background: #525A6B; padding: 18px; border-radius: 16px; overflow: auto; max-height: 78vh; }

@media print {
  @page { margin: 0; }
  html, body { background: #fff !important; }
  body.printing > *:not(.report-root) { display: none !important; }
  body.printing .report-root { display: block !important; }
  .rpt-page { box-shadow: none; margin: 0; }
  body.printing-answer > *:not(.print-answer) { display: none !important; }
  body.printing-answer .print-answer { display: block !important; padding: 14mm; color: #000; background: #fff; }
}
.print-answer { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .side-nav { display: none; }
  .topbar { padding: 14px 16px 6px; }
  .content { padding: 6px 14px 96px; }
  .search-btn { min-width: 0; flex: 1; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; inset-inline: 0; z-index: 50; background: var(--panel2); border-top: 1px solid var(--line); padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); min-height: 48px; justify-content: center; text-decoration: none !important; }
  .bottom-nav a.on { color: var(--accent-text); }
  .plan-svg { height: 420px; }
  .hero h1 { font-size: 40px; }
  .entry-page .wrap { padding: 0 16px; }
  .proj-thumb { width: 120px; height: 76px; }
}
@media (max-width: 560px) {
  .topbar h1 { font-size: 18px; }
  .kpi b { font-size: 21px; }
  .hero-img { height: 230px; }
  .result b { font-size: 22px; }
  .proj-hero { align-items: flex-start; }
  .proj-thumb { display: none; }
}

/* report colours are always light, whatever the app theme */
.rpt { --plan-bg: #FFFFFF; --plan-grid: #EEF2F7; --plan-wall: #475569; --plan-text: #334155; --plan-room: #F8FAFC; --accent: #0E7490; --accent-bg: #E0F2FE; --accent-text: #0E7490; --accent-ink: #fff;
  --muted: #5B6578; --soft: #334155; --text: #0B1220; --strong: #000; --line: #CBD5E1; --line2: #94A3B8; --panel: #fff; --panel2: #F1F5F9; --sunken: #F8FAFC; --ok: #047857; --ok-bg: #ECFDF5; --warn: #92400E; --warn-bg: #FFFBEB; --danger: #B91C1C; --danger-bg: #FEF2F2; color: #0B1220; }
.rpt .plan-print .room { fill: #F8FAFC; stroke: #475569; }
.rpt .plan-print .room.core { fill: #EEF6FA; }
.rpt .plan-print .corr { fill: #F1F5F9; stroke: #94A3B8; stroke-dasharray: .6 .4; }
.rpt .plan-print .rlabel { fill: #334155; }
.rpt .legend { color: #0B1220; }
.rpt .chip { background: #F1F5F9; color: #334155; border-color: #CBD5E1; }
.rpt .result { background: #E0F2FE; border-color: #7DD3FC; }

/* bidi: values that mix numbers and Latin units read correctly inside Arabic text */
.mono, .chip, .kpi b, .result b, .stat b, .param-tile b, .tpl-card .t small, .tbl td.num, .title-block b, .tot, .lv { unicode-bidi: plaintext; }
[dir=rtl] .kpi b, [dir=rtl] .result b, [dir=rtl] .stat b, [dir=rtl] .param-tile b, [dir=rtl] div.mono, [dir=rtl] .tpl-card .t small, [dir=rtl] .title-block b { text-align: right; }
[dir=rtl] .tbl td.num, [dir=rtl] .tbl th.num { text-align: left; }
.rpt img, .rpt svg.scene { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-pane .rpt { background: transparent; }
.bank-scroll { max-height: 520px; overflow-y: auto; margin-inline-end: -6px; padding-inline-end: 6px; }
@media (max-width: 980px) {
  .split > .main { order: -1; }
  .split > .side { max-width: 100% !important; }
}
@media (max-width: 560px) {
  .search-btn span:not(.kbd) { display: none; }
  .search-btn .kbd { display: none; }
  .search-btn { flex: 0 0 auto; width: 40px; padding: 0; justify-content: center; min-width: 0; }
}

/* ---------- persistent shell v2.1 ---------- */
.side-nav { width: 264px; gap: 2px; padding: 14px 12px; }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 2px 4px 12px; }
.side-top .brand { padding: 0; }
.collapse-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.collapse-btn:hover { color: var(--text); border-color: var(--line2); }
.proj-switch { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); margin: 4px 0 6px; }
.proj-switch .th { width: 44px; height: 34px; border-radius: 8px; overflow: hidden; flex: none; background: var(--panel2); }
.proj-switch .th img, .proj-switch .th svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.proj-switch select { min-height: 32px; padding: 2px 6px; font-size: 13px; border-radius: 8px; background: transparent; border-color: transparent; font-weight: 600; }
.proj-switch select:hover { border-color: var(--line2); }
.nav-sep { text-transform: none; letter-spacing: 0; }
.nav-item { position: relative; }
.nav-item .badge { margin-inline-start: auto; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.side-foot { font-size: 11.5px; line-height: 1.7; }
.side-foot b { color: var(--soft); font-weight: 600; }
.shell.collapsed .side-nav { width: 68px; padding-inline: 10px; }
.shell.collapsed .side-nav .nav-item span, .shell.collapsed .side-nav .nav-sep, .shell.collapsed .proj-switch, .shell.collapsed .side-foot, .shell.collapsed .brand > span:not(.logo), .shell.collapsed .nav-item .badge { display: none; }
.shell.collapsed .side-top { flex-direction: column; }
.shell.collapsed .nav-item { justify-content: center; padding: 10px 0; }
.topbar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: 12px 26px; margin-bottom: 8px; }
.topbar h1 { font-size: 20px; }
.top-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.menu-btn { display: none; }
.pop { position: absolute; z-index: 60; inset-inline-end: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; padding: 8px; width: 280px; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.pop-wrap { position: relative; }
.theme-opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text); cursor: pointer; text-align: start; }
.theme-opt:hover { background: var(--panel2); } .theme-opt.on { border-color: var(--accent); }
.swatch { width: 46px; height: 30px; border-radius: 8px; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; border: 1px solid rgba(127,127,127,.35); flex: none; }
.swatch i { display: block; }
.fab-ask { position: fixed; bottom: 22px; inset-inline-end: 22px; z-index: 40; display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 99px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 600; cursor: pointer; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.drawer-bg { position: fixed; inset: 0; z-index: 85; background: rgba(3,7,18,.55); }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: min(320px, 88vw); z-index: 86; background: var(--panel2); border-inline-end: 1px solid var(--line); overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; }
.quick-ask { width: min(760px, 100%); }
.ac { position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 55; background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; padding: 6px; box-shadow: 0 12px 36px rgba(0,0,0,.3); }
.ac button { display: flex; width: 100%; gap: 8px; align-items: center; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); cursor: pointer; text-align: start; font-size: 13.5px; }
.ac button:hover, .ac button.on { background: var(--accent-bg); color: var(--accent-text); }
.thread { display: flex; flex-direction: column; gap: 14px; }
.bubble-q { align-self: flex-start; max-width: 85%; padding: 10px 14px; border-radius: 16px; background: var(--accent-bg); color: var(--accent-text); font-size: 14.5px; }
.thread-old { opacity: .9; }
.assume-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; border: 1px dashed var(--line2); background: transparent; color: var(--soft); font-size: 12.5px; cursor: pointer; }
.assume-chip:hover { border-color: var(--accent); color: var(--accent-text); }
.mic.on { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.doc-card { display: flex; flex-direction: column; gap: 10px; }
.doc-card .ic { width: 42px; height: 42px; border-radius: 12px; background: var(--accent-bg); color: var(--accent-text); display: flex; align-items: center; justify-content: center; }
.home-section-title { font-size: 22px; }
@media (max-width: 980px) {
  .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 14px; }
  .top-actions .hide-m { display: none; }
  .fab-ask { bottom: 84px; }
  .home-hero h1 { font-size: 38px; }
}

/* ---------- themes ---------- */
[data-theme="light"], [data-theme="plum"], [data-theme="sand"] { color-scheme: light; --gold: #B7791F; --gold-ink: #fff; }
[data-theme="emerald"] {
  --bg: #0A1814; --panel: #0F221C; --panel2: #0C1D18; --sunken: #091511; --line: #1B3A30; --line2: #2A5245; --text: #E6F3EE; --soft: #C0D8CE; --muted: #8AA99C; --strong: #F4FBF8;
  --accent: #34D399; --accent-ink: #03261A; --accent-bg: #113A2D; --accent-text: #6EE7B7;
  --plan-bg: #09150F; --plan-grid: #14302A; --plan-wall: #5C8576; --plan-text: #8AA99C; --plan-room: #0F241D;
}
[data-theme="plum"] {
  --bg: #F6F2FA; --panel: #FFFFFF; --panel2: #FBF8FE; --sunken: #F3EDF9; --line: #E7DCF1; --line2: #CDBBE0; --text: #24163A; --soft: #46375E; --muted: #6B5B80; --strong: #160B28;
  --accent: #7B3F9E; --accent-ink: #FFFFFF; --accent-bg: #F1E5F8; --accent-text: #6A2E8C;
  --ok: #047857; --ok-bg: #ECFDF5; --warn: #92400E; --warn-bg: #FFF7E6; --danger: #B91C1C; --danger-bg: #FEF2F2;
  --plan-bg: #FFFFFF; --plan-grid: #F1EAF7; --plan-wall: #6B5B80; --plan-text: #5B4B70; --plan-room: #FBF8FE;
}
[data-theme="sand"] {
  --bg: #F6F1E8; --panel: #FFFCF6; --panel2: #FAF5EC; --sunken: #F2EBDF; --line: #E6DCCB; --line2: #D2C3A9; --text: #2A2117; --soft: #4C4032; --muted: #736553; --strong: #1A140D;
  --accent: #A84B1C; --accent-ink: #FFFFFF; --accent-bg: #F7E4D6; --accent-text: #93401A;
  --ok: #2F6B2F; --ok-bg: #EAF4E4; --warn: #8A4B08; --warn-bg: #FCF0DC; --danger: #A61B1B; --danger-bg: #FBECEC;
  --plan-bg: #FFFDF8; --plan-grid: #F2EBDF; --plan-wall: #75664F; --plan-text: #5F5240; --plan-room: #FBF6EC;
}
[data-theme="contrast"] {
  --bg: #000000; --panel: #0B0B0B; --panel2: #050505; --sunken: #000000; --line: #5A5A5A; --line2: #8A8A8A; --text: #FFFFFF; --soft: #F0F0F0; --muted: #CFCFCF; --strong: #FFFFFF;
  --accent: #FFD400; --accent-ink: #000000; --accent-bg: #2B2400; --accent-text: #FFE666;
  --ok: #7CFFB2; --ok-bg: #002B14; --warn: #FFD27A; --warn-bg: #2B1E00; --danger: #FF9C9C; --danger-bg: #2B0000;
  --plan-bg: #000000; --plan-grid: #1E1E1E; --plan-wall: #D0D0D0; --plan-text: #E5E5E5; --plan-room: #0B0B0B;
}
