/* Khawaja OS v3 — Loya-style. Dark by default, light "Look" via [data-theme=light]. */
:root {
  --accent: #22d3ee;
  --blue: #38bdf8;
  --bg: #050709;
  --panel: rgba(12, 16, 21, .86);
  --panel2: #11161d;
  --panel3: #171d26;
  --raise: #1b222c;
  --line: rgba(255, 255, 255, .07);
  --line2: rgba(255, 255, 255, .12);
  --text: #eef2f7;
  --text2: #c9d1dc;
  --muted: #8a94a3;
  --dim: #5b6575;
  --ok: #3ddc84;
  --warn: #f5b544;
  --bad: #f87171;
  --gold: #e9b949;
  --sel: rgba(56, 189, 248, .12);
  --sel-line: rgba(56, 189, 248, .45);
  --input: #0b0f14;
  --shadow: 0 20px 60px rgba(0, 0, 0, .55);
  --r: 14px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Noto Sans Arabic", Tahoma, sans-serif;
  --head: Bahnschrift, "DIN Condensed", "Arial Narrow", "Segoe UI", sans-serif;
  --mono: "Cascadia Code", "Cascadia Mono", Consolas, ui-monospace, monospace;
  color-scheme: dark;
}
:root[data-theme=light] {
  --bg: #e9eef3;
  --panel: rgba(255, 255, 255, .88);
  --panel2: #f6f8fa;
  --panel3: #eef2f6;
  --raise: #ffffff;
  --line: rgba(15, 30, 50, .08);
  --line2: rgba(15, 30, 50, .14);
  --text: #15202b;
  --text2: #2c3a48;
  --muted: #64707e;
  --dim: #97a1ad;
  --sel: rgba(14, 165, 233, .10);
  --sel-line: rgba(14, 165, 233, .45);
  --input: #ffffff;
  --shadow: 0 16px 40px rgba(20, 40, 70, .12);
  --blue: #0ea5e9;
  --ok: #16a34a;
  --warn: #d97706;
  --gold: #c9921a;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; color: var(--text); font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
body { background: radial-gradient(1200px 700px at 70% -20%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%), radial-gradient(900px 600px at 0% 120%, color-mix(in srgb, var(--blue) 6%, transparent), transparent 70%), var(--bg); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
code { font-family: var(--mono); font-size: .86em; background: color-mix(in srgb, var(--text) 6%, transparent); border: 1px solid var(--line); padding: .05em .4em; border-radius: 6px; word-break: break-word; }
pre { font-family: var(--mono); font-size: 12.5px; background: var(--input); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow: auto; margin: 10px 0; }
pre code { background: none; border: 0; padding: 0; font-size: inherit; }
kbd { font-family: var(--font); font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line2); background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--muted); }
h1, h2, h3 { margin: 0; font-family: var(--head); font-stretch: condensed; }
h1 { font-size: 30px; font-weight: 700; letter-spacing: .02em; }
.caps, h2 { text-transform: uppercase; letter-spacing: .04em; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; font-family: var(--font); }
.muted { color: var(--muted); } .dim { color: var(--dim); }
.sm { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 13px; }
.grow { flex: 1; min-width: 0; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.link { color: var(--blue); }
[hidden] { display: none !important; }

#app { display: grid; grid-template-columns: 64px 380px 1fr; gap: 10px; height: 100vh; padding: 10px 10px 10px 4px; }
body.no-list #app { grid-template-columns: 64px 1fr; }
body.no-list #list { display: none; }
#list, #main { background: var(--panel); border: 1px solid var(--line2); border-radius: 22px; backdrop-filter: blur(20px); min-height: 0; overflow: hidden; box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .04); position: relative; }
#main { overflow-y: auto; }

/* ---------- rail ---------- */
#rail { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.ws-list { display: flex; flex-direction: column; gap: 8px; align-items: center; padding: 2px; }
.ws-tile { position: relative; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 14%, var(--panel2)); border: 1px solid color-mix(in srgb, var(--c) 28%, var(--line)); transition: transform .12s, box-shadow .15s; font-size: 19px; }
.ws-tile img { width: 100%; height: 100%; border-radius: 11px; display: block; }
.ws-tile:hover { transform: translateY(-1px); }
.ws-tile.on { box-shadow: 0 0 0 2px var(--c), 0 0 18px color-mix(in srgb, var(--c) 45%, transparent); }
.ws-tile.add { background: transparent; border: 1px dashed var(--line2); color: var(--muted); }
.ws-tile.add svg { width: 16px; height: 16px; }
.rsep { width: 26px; height: 1px; background: var(--line2); margin: 6px 0; flex: none; }
.rgrow { flex: 1; min-height: 8px; }
.rnav { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; width: 56px; padding: 6px 0 5px; border-radius: 14px; color: var(--muted); font-size: 10.5px; font-weight: 600; background: none; border: 0; transition: color .12s, background .12s; }
.rnav svg { width: 20px; height: 20px; }
.rnav:hover { color: var(--text); }
.rnav.on { color: var(--blue); background: color-mix(in srgb, var(--blue) 14%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 30%, transparent); }
.rnav.icon { padding: 7px 0; }
.rbadge { position: absolute; top: -3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--warn); color: #1a1000; font-size: 10.5px; font-weight: 800; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg); }
.ws-tile .rbadge { right: -5px; top: -5px; }
.ravatar { position: relative; width: 38px; height: 38px; display: grid; place-items: center; margin-top: 4px; flex: none; }
.ravatar svg { position: absolute; inset: 0; width: 38px; height: 38px; transform: rotate(-90deg); }
.ravatar .ring-bg { stroke: var(--line2); stroke-width: 3; }
.ravatar .ring { stroke: var(--blue); stroke-width: 3; transition: stroke-dasharray .4s; }
.ravatar b { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #0e7490, #38bdf8); color: #fff; font-weight: 800; font-size: 13px; }

/* ---------- list ---------- */
#list { display: flex; flex-direction: column; }
.lhead { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 4px 20px; gap: 10px; }
.wsname { font-family: var(--head); font-stretch: condensed; font-size: 30px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; display: inline-flex; align-items: center; gap: 4px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wsname span svg { width: 15px; height: 15px; color: var(--muted); margin-top: 6px; }
.lh-act { display: flex; align-items: center; gap: 6px; }
.iconbtn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--muted); background: none; border: 0; transition: .12s; }
.iconbtn:hover { color: var(--text); background: color-mix(in srgb, var(--text) 6%, transparent); }
.iconbtn svg { width: 18px; height: 18px; }
.iconbtn.round { border: 1px solid var(--line2); border-radius: 50%; width: 30px; height: 30px; }
.iconbtn.round svg { width: 16px; height: 16px; }
.crownbtn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: linear-gradient(180deg, #4cc9f0, #1d9bd1); color: #fff; box-shadow: 0 4px 18px rgba(56, 189, 248, .4), inset 0 1px 0 rgba(255, 255, 255, .4); }
.crownbtn svg { width: 19px; height: 19px; }
.lsub { display: flex; align-items: center; gap: 8px; padding: 8px 16px 10px 20px; border-bottom: 1px solid var(--line); }
.lsub h2 { font-size: 20px; font-weight: 700; }
.lcount { color: var(--muted); font-size: 12px; font-weight: 600; margin-right: 2px; }
.pbtn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line2); background: color-mix(in srgb, var(--text) 3%, transparent); color: var(--text2); }
.pbtn svg { width: 16px; height: 16px; }
.pbtn b { font-size: 12px; min-width: 18px; height: 18px; border-radius: 6px; display: grid; place-items: center; background: color-mix(in srgb, var(--text) 8%, transparent); }
.lsearch { padding: 8px 16px 6px; }
.lsearch input { width: 100%; background: var(--input); border: 1px solid var(--line2); border-radius: 10px; padding: 8px 12px; outline: 0; }
.lsearch input:focus { border-color: var(--sel-line); }
.ltree { flex: 1; overflow-y: auto; padding: 8px 10px 12px; scrollbar-width: thin; }
.lempty { color: var(--muted); text-align: center; padding: 50px 20px; line-height: 1.8; }
.lfoot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 16px; border-top: 1px solid var(--line); }
.arch-link { display: inline-flex; align-items: center; gap: 7px; background: none; border: 0; color: var(--muted); font-size: 13px; padding: 0; }
.arch-link svg { width: 16px; height: 16px; }
.arch-link b { color: var(--text2); font-weight: 600; }
.mini-usage { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mini-usage i { width: 46px; height: 5px; border-radius: 3px; background: linear-gradient(90deg, var(--blue) var(--p), var(--line2) var(--p)); }
.mini-usage em { font-style: normal; opacity: .5; }
.arch-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px 8px; }

.ceo-row-wrap { margin-bottom: 8px; }
.ceo-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; border: 1px solid transparent; }
.ceo-row:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.ceo-row.on, .ceo-row.waiting { background: var(--sel); border-color: var(--sel-line); }
.ceo-row .crown { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid color-mix(in srgb, var(--gold) 70%, transparent); color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, transparent); }
.ceo-row .crown svg { width: 15px; height: 15px; }
.ceo-row b { font-family: var(--head); font-stretch: condensed; font-size: 17px; letter-spacing: .05em; color: var(--gold); flex: 1; }
.stime { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.grp { margin-top: 6px; }
.ghead { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 8px; border: 0; background: none; border-radius: 10px; text-align: left; }
.ghead:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.gico { width: 30px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: color-mix(in srgb, var(--g) 22%, var(--panel3)); font-size: 15px; position: relative; box-shadow: inset 0 -6px 0 color-mix(in srgb, var(--g) 30%, transparent); }
.ghead b { font-size: 15.5px; font-weight: 700; }
.gcnt { color: var(--muted); font-size: 12px; }
.gbadge { min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: color-mix(in srgb, var(--blue) 22%, transparent); color: var(--blue); }
.gchev svg { width: 15px; height: 15px; color: var(--muted); transition: transform .15s; }
.grp.col .gchev svg { transform: rotate(-90deg); }
.grp.col .gbody { display: none; }
.gbody { position: relative; margin-left: 22px; padding-left: 12px; border-left: 3px solid color-mix(in srgb, var(--g) 70%, transparent); border-radius: 0 0 0 4px; }

.seat { position: relative; }
.seat.d1 { margin-left: 14px; padding-left: 10px; border-left: 1px solid var(--line2); }
.srow { display: flex; align-items: center; gap: 9px; padding: 7px 10px 7px 6px; border-radius: 12px; border: 1px solid transparent; margin: 2px 0; }
.srow:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.srow.waiting { background: var(--sel); border-color: var(--sel-line); }
.srow.on { background: var(--sel); border-color: var(--sel-line); }
.av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; background: color-mix(in srgb, var(--c) 18%, var(--panel3)); border: 1.5px solid color-mix(in srgb, var(--c) 45%, var(--line2)); flex: none; }
.av.xs { width: 20px; height: 20px; font-size: 11px; border-width: 1px; }
.av.lg { width: 58px; height: 58px; font-size: 28px; border-width: 2px; box-shadow: 0 0 30px color-mix(in srgb, var(--c) 30%, transparent); }
.smain { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.smain b { font-family: var(--head); font-stretch: condensed; font-size: 15.5px; letter-spacing: .05em; text-transform: uppercase; }
.smain span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow.waiting .smain span { color: var(--text2); }
.sdot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); flex: none; display: inline-block; }
.sdot.working { background: var(--blue); box-shadow: 0 0 8px var(--blue); animation: pulse 1.4s infinite; }
.sdot.waiting { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.sdot.done { background: var(--ok); } .sdot.error { background: var(--bad); }
@keyframes pulse { 50% { opacity: .45; } }
.sjobs { margin-left: 18px; padding-left: 12px; border-left: 1px solid var(--line2); }
.ssec { display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 7px 4px 3px; background: none; border: 0; width: 100%; text-align: left; }
.ssec i { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); }
.ssec.working i { background: var(--blue); } .ssec.waiting i { background: var(--warn); } .ssec.done i { background: var(--ok); }
.ssec b { color: var(--muted); font-weight: 600; }
.btnsec svg { width: 13px; height: 13px; margin-left: -2px; }
.jrow { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 10px; border-radius: 10px; border: 1px solid transparent; font-size: 14px; }
.jrow::before { content: ""; position: absolute; left: -13px; top: 50%; width: 9px; border-top: 1px solid var(--line2); }
.jrow:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.jrow.on { background: var(--sel); border-color: var(--sel-line); }
.jrow .jt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.jrow.working .jt { color: var(--blue); }
.jrow.waiting .jt { color: var(--warn); }
.jrow.error .jt { color: var(--bad); }
.jrow.done .jt, .jrow.stopped .jt { color: var(--text2); font-weight: 500; }
.jrow.unread .jt::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--blue); margin-left: 6px; vertical-align: middle; }
.jrow .mchip { display: none; }
.jrow:hover .mchip, .jrow.on .mchip { display: inline-block; }
.jtime { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.jrow.archived::before { display: none; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); flex: none; }
.dot.waiting { background: var(--warn); } .dot.done { background: var(--ok); } .dot.error { background: var(--bad); } .dot.stopped { background: var(--dim); }
.eq { display: inline-flex; gap: 2px; align-items: center; height: 14px; width: 16px; flex: none; }
.eq b { width: 2px; border-radius: 1px; background: var(--blue); animation: eq 1s ease-in-out infinite; height: 40%; }
.eq b:nth-child(2) { animation-delay: -.25s; } .eq b:nth-child(3) { animation-delay: -.5s; } .eq b:nth-child(4) { animation-delay: -.75s; }
@keyframes eq { 0%, 100% { height: 30%; } 50% { height: 100%; } }

.menu { position: absolute; z-index: 30; min-width: 230px; background: var(--raise); border: 1px solid var(--line2); border-radius: 12px; padding: 6px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
#moreMenu { top: 56px; right: 56px; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; border: 0; background: none; font-size: 13.5px; }
.menu button:hover, .menu a:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.menu svg { width: 16px; height: 16px; color: var(--muted); }

/* ---------- common bits ---------- */
.btn { background: color-mix(in srgb, var(--text) 4%, transparent); border: 1px solid var(--line2); border-radius: 12px; padding: 8px 15px; font-weight: 600; font-size: 13.5px; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; transition: filter .12s, border-color .12s, background .12s; color: var(--text); }
.btn:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.btn.primary { background: var(--text); color: var(--bg); border-color: transparent; }
.btn.primary:hover { filter: brightness(.92); }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.btn.on { border-color: var(--sel-line); background: var(--sel); color: var(--blue); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 10px; } .btn.xs { padding: 3px 10px; font-size: 12px; border-radius: 8px; }
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: .4; cursor: default; filter: none; }
.btn kbd { margin-left: 4px; background: transparent; color: inherit; opacity: .6; border-color: currentColor; }
.pill { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--muted); white-space: nowrap; }
.pill.st-working { background: color-mix(in srgb, var(--blue) 18%, transparent); color: var(--blue); }
.pill.st-waiting { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pill.st-done { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.pill.st-error { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.chip { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 600; padding: 2px 10px 2px 7px; border-radius: 99px; background: color-mix(in srgb, var(--c) 15%, transparent); color: color-mix(in srgb, var(--c) 75%, var(--text)); white-space: nowrap; }
.mchip { font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--muted); white-space: nowrap; letter-spacing: .02em; }
.mchip.m-opus { background: color-mix(in srgb, var(--gold) 15%, transparent); color: var(--gold); }
.mchip.m-sonnet { background: rgba(139, 123, 255, .16); color: #a99cff; }
.mchip.m-haiku { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.timer { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; } .timer.warn { color: var(--warn); }
.pane { max-width: 1120px; margin: 0 auto; padding: 26px 32px 60px; display: flex; flex-direction: column; gap: 20px; }
.pane.narrow { max-width: 800px; }
.pane.wide { max-width: none; }
.phead { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.ph-l { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ph-l h1 { font-size: 40px; line-height: 1; }
.ph-ico svg { width: 30px; height: 30px; color: var(--blue); }
.ph-r { display: flex; gap: 8px; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pillbox { padding: 6px 14px; border-radius: 99px; border: 1px solid var(--line2); background: color-mix(in srgb, var(--text) 3%, transparent); font-size: 14px; color: var(--text2); }
.pillbox b { font-family: var(--head); font-stretch: condensed; font-size: 19px; margin-right: 4px; color: var(--text); }
.pillbox.live b { color: var(--blue); } .pillbox.warn b { color: var(--warn); }
.empty { color: var(--muted); padding: 26px; text-align: center; border: 1px dashed var(--line2); border-radius: var(--r); }
.card { background: var(--panel2); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.card h3 { margin-bottom: 10px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: 13.5px; }
.tabs a.on { color: var(--text); border-color: var(--blue); }
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: color-mix(in srgb, var(--text) 4%, transparent); border: 1px solid var(--line); align-self: flex-start; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 9px; font-weight: 600; color: var(--muted); font-size: 13px; }
.seg button.on { background: var(--raise); color: var(--text); box-shadow: 0 1px 6px rgba(0, 0, 0, .25); }
.seg.sm button { padding: 4px 11px; font-size: 12.5px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; }
.form label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; }
.form input:not([type=checkbox]):not([type=color]), .form select, .form textarea { background: var(--input); border: 1px solid var(--line2); border-radius: 10px; padding: 9px 12px; outline: 0; font-weight: 400; width: 100%; font-size: 13.5px; }
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--sel-line); }
.form input[type=color] { width: 100%; height: 40px; background: var(--input); border: 1px solid var(--line2); border-radius: 10px; padding: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 90px 110px; gap: 12px; }
.row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.inline { display: flex; gap: 8px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; } .form-actions.left { justify-content: flex-start; margin-top: 10px; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); } .kv b { font-weight: 600; text-align: right; }
.callout { background: color-mix(in srgb, var(--warn) 8%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); border-radius: 10px; padding: 12px 14px; margin-top: 12px; font-size: 13px; line-height: 1.8; }
.sec-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 10px; }
.doc-wrap { display: flex; flex-direction: column; gap: 10px; }
.doc-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.doc { background: var(--panel2); border: 1px solid var(--line); border-radius: 16px; padding: 20px 24px; }
.doc h4 { margin: 16px 0 6px; font-size: 15px; } .doc h4:first-child { margin-top: 0; }
.doc ul, .doc ol { padding-left: 22px; margin: 6px 0; }
.doc-edit { width: 100%; min-height: 55vh; background: var(--input); border: 1px solid var(--line2); border-radius: var(--r); padding: 16px; resize: vertical; outline: 0; line-height: 1.6; }
.stats { display: flex; gap: 34px; flex-wrap: wrap; margin: 10px 0 16px; }
.stat b { display: block; font-family: var(--head); font-stretch: condensed; font-size: 64px; line-height: 1; color: var(--blue); font-weight: 700; text-shadow: 0 0 30px color-mix(in srgb, var(--blue) 35%, transparent); }
.stat:not(:first-child) b { font-size: 44px; color: var(--text); text-shadow: none; }
.stat span { font-size: 14px; color: var(--muted); }
iframe.vis { width: 100%; height: 120px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel2); margin: 8px 0; display: block; }
.tbl { overflow-x: auto; margin: 8px 0; }
.tbl table { border-collapse: collapse; width: 100%; font-size: 13px; }
.tbl th, .tbl td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.tbl th { color: var(--muted); font-weight: 700; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; }
.handoffs { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.handoff { font-size: 13px; background: var(--panel3); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; display: flex; gap: 8px; align-items: center; }

/* ---------- home: unread cards ---------- */
.home { min-height: 100%; justify-content: center; }
.uhead { display: flex; align-items: baseline; gap: 10px; }
.bign { font-family: var(--head); font-stretch: condensed; font-size: 64px; font-weight: 700; line-height: .9; }
.bigl { font-family: var(--head); font-stretch: condensed; font-size: 22px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text2); }
.ugrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.ucard { display: flex; flex-direction: column; gap: 10px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 16px; padding: 14px 16px; cursor: pointer; transition: transform .12s, border-color .12s; min-height: 140px; }
.ucard:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--c) 45%, var(--line2)); }
.ucard.wait { box-shadow: inset 3px 0 0 var(--warn); }
.uc-h { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.uc-s { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.uc-x { border: 0; background: none; color: var(--dim); padding: 0; display: grid; } .uc-x svg { width: 14px; height: 14px; }
.uc-q { font-weight: 600; font-size: 15px; line-height: 1.4; flex: 1; }
.uc-opts { display: flex; flex-wrap: wrap; gap: 5px; } .uc-opts span { font-size: 11.5px; padding: 2px 8px; border-radius: 6px; background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text2); }
.uc-a { display: flex; align-items: center; gap: 6px; }
.uc-a .btn.primary { background: var(--blue); color: #001a26; }
.uc-open { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: 13px; } .uc-open svg { width: 14px; height: 14px; }
.hkeys { display: flex; gap: 8px; justify-content: center; align-items: center; color: var(--dim); font-size: 12px; }
.caught { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; max-width: 720px; margin: 0 auto; width: 100%; }
.caught .ceo-start { width: 100%; text-align: left; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.qbtn { background: color-mix(in srgb, var(--text) 4%, transparent); border: 1px solid var(--line2); border-radius: 99px; padding: 6px 14px; font-size: 13px; color: var(--text2); }
.qbtn:hover { border-color: var(--sel-line); color: var(--text); }

/* ---------- section page ---------- */
.shead { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.shead h1 { font-size: 34px; }
.newchat .hint { color: var(--dim); font-size: 12.5px; margin-top: 8px; }
.tabbody { display: flex; flex-direction: column; gap: 18px; }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; height: 100%; }
.chead { position: relative; display: flex; align-items: center; gap: 10px; padding: 12px 16px 12px 20px; border-bottom: 1px solid var(--line); min-height: 60px; }
.ctitle { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px 6px; border-radius: 9px; font-size: 18px; font-weight: 600; max-width: 46%; }
.ctitle:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.ctitle #cTitle { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctitle svg { width: 15px; height: 15px; color: var(--muted); }
.cem { font-size: 18px; }
.schip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 9px; font-size: 13px; font-weight: 600; background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text2); white-space: nowrap; }
.schip.waiting { background: color-mix(in srgb, var(--blue) 16%, transparent); color: var(--blue); }
.schip.working { background: color-mix(in srgb, var(--blue) 12%, transparent); color: var(--blue); }
.schip.done { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.schip.error { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.cmeta { display: flex; gap: 6px; align-items: center; }
#ctMenuBox { top: 54px; left: 16px; }
.cbody { flex: 1; overflow-y: auto; padding: 18px 0 10px; scrollbar-width: thin; }
.thread { max-width: 820px; margin: 0 auto; padding: 0 28px; display: flex; flex-direction: column; gap: 14px; }
.msg { line-height: 1.6; font-size: 15px; }
.msg p { margin: 0 0 10px; } .msg p:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: 6px 0; padding-left: 22px; }
.msg h4 { margin: 12px 0 6px; font-size: 15.5px; }
.msg.you { align-self: flex-end; max-width: 78%; background: var(--panel3); border: 1px solid var(--line2); border-radius: 18px 18px 4px 18px; padding: 12px 16px; }
.msg.ai { color: var(--text); }
.brief { background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.brief summary { cursor: pointer; font-size: 13px; color: var(--muted); list-style: none; }
.brief summary::-webkit-details-marker { display: none; }
.brief .who { font-weight: 700; color: var(--gold); margin-right: 4px; }
.brief.report .who { color: var(--blue); }
.brief .md { margin-top: 8px; font-size: 14px; } .brief .md p:first-child { margin-top: 0; }
.work { font-size: 13.5px; }
.work summary { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: var(--muted); list-style: none; padding: 3px 0; }
.work summary::-webkit-details-marker { display: none; }
.work summary:hover { color: var(--text2); }
.wbar { display: inline-flex; gap: 3px; } .wbar b { width: 14px; height: 4px; border-radius: 2px; background: var(--ok); }
.wbar.live b { background: var(--blue); animation: pulse 1.2s infinite; } .wbar.live b:nth-child(2) { animation-delay: .2s; } .wbar.live b:nth-child(3) { animation-delay: .4s; } .wbar.live b:nth-child(4) { animation-delay: .6s; }
.wbar.bad b { background: var(--bad); }
.wchev svg { width: 13px; height: 13px; transition: transform .15s; }
.work[open] .wchev svg { transform: rotate(90deg); }
.work[open] summary { margin-bottom: 6px; }
.trow { display: flex; gap: 10px; padding: 6px 10px; border-left: 2px solid var(--line2); margin-left: 6px; }
.ti { width: 18px; text-align: center; }
.tb { flex: 1; min-width: 0; }
.th { font-size: 12.5px; color: var(--text2); }
.tres { max-height: 220px; font-size: 11.5px; margin: 6px 0 2px; }
.tres.bad { border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.tpend { font-size: 12px; color: var(--blue); }
.note { font-size: 12.5px; color: var(--dim); text-align: center; }
.note.bad { color: var(--bad); text-align: left; background: color-mix(in srgb, var(--bad) 8%, transparent); border: 1px solid color-mix(in srgb, var(--bad) 25%, transparent); border-radius: 10px; padding: 10px 12px; }
.sent { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.sent-l { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.sentchip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 10px; border: 1px solid var(--line2); background: var(--panel2); max-width: 100%; }
.sentchip b { font-family: var(--head); font-stretch: condensed; letter-spacing: .04em; text-transform: uppercase; font-size: 13px; color: color-mix(in srgb, var(--c) 70%, var(--text)); }
.sentchip .dim { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.ring { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--dim); display: inline-block; flex: none; }
.ring.working, .ring.queued { border-color: var(--blue); border-top-color: transparent; animation: spin 1s linear infinite; }
.ring.waiting { border-color: var(--warn); } .ring.done { border-color: var(--ok); background: var(--ok); } .ring.error { border-color: var(--bad); }
@keyframes spin { to { transform: rotate(360deg); } }
.recv { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); padding: 2px 0; flex-wrap: wrap; }
.recv u { text-decoration: none; border-bottom: 1px solid currentColor; color: var(--text); font-weight: 700; font-family: var(--head); font-stretch: condensed; letter-spacing: .04em; text-transform: uppercase; font-size: 14px; }
.recv span { color: var(--muted); flex: 1; min-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recv svg { width: 14px; height: 14px; }
.recv:hover span { color: var(--text2); }
.recv.waiting u { color: var(--warn); } .recv.error u { color: var(--bad); }
.typing { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.spark svg { width: 20px; height: 20px; color: var(--blue); animation: spin 3s linear infinite; }
.pipe { display: flex; flex-direction: column; gap: 18px; padding: 6px 0; }
.stepper { display: flex; align-items: flex-start; gap: 0; }
.step { display: flex; flex-direction: column; gap: 8px; min-width: 76px; max-width: 120px; flex: none; }
.step i { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 700; font-size: 13px; border: 2px solid var(--line2); color: var(--muted); background: var(--panel); }
.step span { font-size: 14px; color: var(--muted); line-height: 1.3; }
.step.done i { background: var(--ok); border-color: var(--ok); color: #03150a; }
.step.done span { color: var(--text); }
.step.cur i { border-color: var(--warn); color: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 15%, transparent); }
.step.cur span { color: var(--text); font-weight: 700; }
.sline { flex: 1; height: 2px; background: var(--line2); margin-top: 15px; min-width: 18px; }
.step.done + .sline { background: var(--ok); }
.checklist { display: flex; flex-direction: column; gap: 4px; }
.cl-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.cl-head b { font-family: var(--head); font-stretch: condensed; font-size: 32px; color: var(--warn); line-height: 1; }
.cl-head span { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.cl-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--line2); display: flex; overflow: hidden; }
.cl-bar b { background: var(--ok); } .cl-bar em { background: var(--warn); }
.cl-row { display: flex; align-items: center; gap: 12px; padding: 5px 0; font-size: 15px; color: var(--muted); }
.cl-row i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line2); flex: none; display: grid; place-items: center; }
.cl-row.done { color: var(--text); } .cl-row.done i { background: var(--ok); border-color: var(--ok); }
.cl-row.done i::after { content: "✓"; color: #03150a; font-weight: 900; font-size: 12px; font-style: normal; }
.cl-row.working { color: var(--text); } .cl-row.working i { border-color: var(--warn); border-top-color: transparent; animation: spin 1.2s linear infinite; }
.cl-row.waiting i { border-color: var(--warn); } .cl-row.waiting { color: var(--warn); }
.cl-row.error i { border-color: var(--bad); } .cl-row.error { color: var(--bad); }
.cl-row span { flex: 1; min-width: 0; }
.cl-row em { font-style: normal; font-size: 13px; }
a.cl-row:hover span { text-decoration: underline; text-decoration-color: var(--line2); }
.cbottom { padding: 8px 20px 14px; display: flex; flex-direction: column; gap: 10px; max-width: 900px; width: 100%; margin: 0 auto; }
.wchips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wl { font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.wchip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 99px; border: 1px solid var(--sel-line); background: var(--sel); font-size: 13.5px; font-weight: 600; }
.wchip b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--panel3); font-size: 12px; }

/* question cards */
.askcard { background: var(--panel2); border: 1px solid var(--line2); border-radius: 18px; padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); outline: 0; }
.askcard.min .ak-opts, .askcard.min .ak-foot, .askcard.min .ak-q { display: none; }
.ak-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 14px; }
.ak-x { border: 0; background: none; color: var(--muted); display: grid; padding: 2px; } .ak-x svg { width: 18px; height: 18px; }
.ak-q { font-size: 18px; font-weight: 600; line-height: 1.45; }
.ak-q.md p { margin: 0; }
.ak-opts { display: flex; flex-direction: column; gap: 2px; }
.ak-opt { display: flex; gap: 14px; align-items: flex-start; text-align: left; padding: 9px 10px; border-radius: 12px; border: 1px solid transparent; background: none; }
.ak-opt:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.ak-opt.on { background: var(--sel); border-color: var(--sel-line); }
.ak-opt .num { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line2); display: grid; place-items: center; font-size: 13px; color: var(--muted); flex: none; margin-top: 1px; }
.ak-opt.on .num { border-color: var(--blue); color: var(--blue); }
.ak-b { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.ak-b b { font-size: 16px; font-weight: 600; } .ak-b em { font-style: normal; color: var(--muted); font-weight: 500; }
.ak-b span { color: var(--muted); font-size: 14px; }
.ak-other input { background: none; border: 0; outline: 0; color: var(--text); font-size: 14px; padding: 0; width: 100%; }
.ak-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 10px; }
.w-perm { font-size: 13px; color: var(--muted); }
.w-actions { display: flex; gap: 8px; align-items: flex-end; }
.w-actions textarea { flex: 1; background: var(--input); border: 1px solid var(--line2); border-radius: 10px; padding: 8px 12px; outline: 0; resize: none; min-height: 38px; }
.w-actions .btn.primary { background: var(--blue); color: #001a26; }

/* composer */
.composer { position: relative; display: flex; flex-direction: column; gap: 6px; }
.cbox { display: flex; align-items: flex-end; gap: 8px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 18px; padding: 8px 8px 8px 10px; transition: border-color .15s, box-shadow .15s; }
.cbox:focus-within { border-color: var(--sel-line); box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 10%, transparent); }
.cbox textarea { flex: 1; background: none; border: 0; outline: 0; resize: none; padding: 7px 4px; font-size: 15px; line-height: 1.45; max-height: 260px; }
.cplus, .cmic, .csend { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 0; background: none; color: var(--muted); flex: none; }
.cplus { border: 1px solid var(--line2); }
.cplus:hover, .cmic:hover { color: var(--text); }
.cmic.rec { color: var(--bad); animation: pulse 1s infinite; }
.csend { background: var(--text); color: var(--bg); }
.csend:disabled { opacity: .3; }
.cplus svg, .cmic svg, .csend svg { width: 18px; height: 18px; }
.composer.disabled .cbox { opacity: .6; }
.cfoot { display: flex; align-items: center; gap: 8px; padding: 0 6px; }
.cfolder { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--muted); font-size: 13px; padding: 2px 0; }
.cfolder svg { width: 15px; height: 15px; }
.cfoot select { background: none; border: 0; color: var(--text2); font-size: 13.5px; font-weight: 600; outline: 0; cursor: pointer; padding: 2px; }
.cfoot select option { background: var(--raise); color: var(--text); }
.cfoot select.ce { color: var(--muted); font-weight: 500; }
.ctxring svg { width: 22px; height: 22px; transform: rotate(-90deg); }
.ctxring .rb { stroke: var(--line2); stroke-width: 4; } .ctxring .rf { stroke: var(--blue); stroke-width: 4; }
.slash { position: absolute; bottom: calc(100% + 6px); left: 0; right: 0; background: var(--raise); border: 1px solid var(--line2); border-radius: 14px; padding: 6px; box-shadow: var(--shadow); z-index: 20; max-height: 320px; overflow-y: auto; }
.slash button { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 7px 10px; border-radius: 9px; border: 0; background: none; }
.slash button.on, .slash button:hover { background: var(--sel); }
.slash code { min-width: 120px; background: none; border: 0; color: var(--blue); }
.slash span { color: var(--muted); font-size: 13px; }

/* toasts (right side) */
#toasts { position: fixed; right: 18px; bottom: 140px; z-index: 60; display: flex; align-items: flex-start; gap: 8px; pointer-events: none; }
.tstack { display: flex; flex-direction: column; gap: 8px; pointer-events: auto; }
.tcard { display: flex; align-items: center; gap: 12px; width: 370px; background: var(--raise); border: 1px solid var(--line2); border-radius: 16px; padding: 12px 12px 12px 14px; box-shadow: var(--shadow); animation: tin .25s ease-out; }
@keyframes tin { from { transform: translateX(30px); opacity: 0; } }
.tcard .av { width: 36px; height: 36px; border-radius: 10px; font-size: 18px; }
.tc-b { flex: 1; min-width: 0; }
.tc-h { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; } .tc-h b { font-family: var(--head); font-stretch: condensed; text-transform: uppercase; letter-spacing: .04em; font-size: 15px; } .tc-h span { color: var(--muted); font-size: 12px; }
.tc-q { font-size: 13.5px; color: var(--text2); line-height: 1.35; }
.tc-a { color: var(--blue); font-weight: 700; font-size: 14px; padding: 6px 8px; border-left: 1px solid var(--line); }
.tc-x { border: 0; background: none; color: var(--dim); padding: 0; display: grid; } .tc-x svg { width: 14px; height: 14px; }
.tside { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 4px; background: var(--raise); border: 1px solid var(--line2); border-radius: 14px; pointer-events: auto; }
.tside b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--blue); color: #001a26; font-size: 12px; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: var(--raise); border: 1px solid var(--line2); padding: 10px 18px; border-radius: 12px; opacity: 0; pointer-events: none; transition: .2s; z-index: 70; font-weight: 600; box-shadow: var(--shadow); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.warn { border-color: var(--warn); } #toast.bad { border-color: var(--bad); }

/* ---------- team chart ---------- */
.team { height: 100%; padding-bottom: 18px; }
.tboard { position: relative; flex: 1; min-height: 520px; display: flex; flex-direction: column; background: #07090c; border: 1px solid var(--line2); border-radius: 22px; overflow: hidden; }
:root[data-theme=light] .tboard { background: #0b0e12; }
.tb-top { position: absolute; z-index: 3; top: 14px; left: 16px; right: 16px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; pointer-events: none; }
.tb-top > * { pointer-events: auto; }
.tboard .pillbox { background: rgba(255, 255, 255, .04); border-color: rgba(255, 255, 255, .1); color: #c9d1dc; }
.tboard .pillbox b { color: #fff; } .tboard .pillbox.live b { color: #38bdf8; } .tboard .pillbox.warn b { color: #f5b544; }
.legend { display: flex; gap: 14px; align-items: center; padding: 7px 16px; border-radius: 99px; border: 1px solid rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .03); font-size: 13px; color: #c9d1dc; }
.legend span { display: inline-flex; align-items: center; gap: 6px; } .legend .ok { color: #3ddc84; }
.tcanvas { position: relative; flex: 1; overflow: hidden; cursor: grab; background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px); background-size: 22px 22px; color: #eef2f7; }
.tcanvas.drag { cursor: grabbing; }
.tworld { position: absolute; left: 0; top: 0; transform-origin: 0 0; padding: 70px 40px 80px; display: flex; flex-direction: column; align-items: center; gap: 46px; min-width: 900px; }
.tlinks { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; z-index: 0; }
.tlinks .ln { fill: none; stroke: rgba(255, 255, 255, .16); stroke-width: 2; }
.tlinks .ln.thin { stroke-width: 1.4; }
.tlinks .ln.dash { stroke-dasharray: 4 5; stroke: #e9b94988; }
.tlinks .ln.working { stroke: #38bdf8; filter: drop-shadow(0 0 5px #38bdf8); stroke-dasharray: 10 6; animation: flow 1.2s linear infinite; }
.tlinks .ln.waiting { stroke: #e9b949; filter: drop-shadow(0 0 4px #e9b94988); }
@keyframes flow { to { stroke-dashoffset: -32; } }
.t-you, .t-ceo, .tgroup, .tseat { position: relative; z-index: 1; }
.t-you { display: flex; align-items: center; gap: 12px; padding: 12px 26px 12px 12px; border-radius: 99px; background: linear-gradient(180deg, #1d2430, #11161d); border: 1.5px solid rgba(255, 255, 255, .25); box-shadow: 0 0 30px rgba(255, 255, 255, .08); }
.tyav { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 30% 30%, #f3f6fa, #9aa6b4); color: #111; font-weight: 800; font-size: 18px; }
.t-you b, .t-ceo b { display: block; font-size: 17px; }
.t-you small, .t-ceo small { color: #8a94a3; font-size: 12.5px; }
.t-ceo a { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-radius: 16px; border: 1.5px solid #e9b949; background: linear-gradient(180deg, #2a2210, #15120a); box-shadow: 0 0 28px rgba(233, 185, 73, .35); min-width: 230px; }
.t-ceo a > span { font-size: 22px; } .t-ceo b { color: #f5c75a; font-family: var(--head); font-stretch: condensed; letter-spacing: .06em; }
.t-ceo .sdot { margin-left: auto; }
.t-groups { display: flex; gap: 26px; align-items: flex-start; flex-wrap: nowrap; }
.tgroup { border: 1px solid rgba(255, 255, 255, .08); background: rgba(255, 255, 255, .015); border-radius: 18px; padding: 12px 16px 16px; }
.tg-h { font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: #8a94a3; margin: 0 0 12px 4px; }
.tg-h span { color: #5b6575; margin-left: 4px; }
.tg-cols { display: flex; gap: 18px; align-items: flex-start; }
.tcol { display: flex; flex-direction: column; gap: 12px; }
.tteam { display: flex; gap: 14px; align-items: flex-start; margin-top: 28px; }
.tcol { align-items: center; }
.tseat.top { align-self: center; }
.tcard { display: block; width: 216px; border-radius: 14px; padding: 10px 12px; background: linear-gradient(180deg, #161b23, #10141a); border: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 8px 22px rgba(0, 0, 0, .4); transition: border-color .15s, box-shadow .15s; }
.tcard:hover { border-color: color-mix(in srgb, var(--c) 60%, transparent); }
.tcard.working { border-color: #38bdf8aa; box-shadow: 0 0 22px rgba(56, 189, 248, .25); }
.tcard.waiting { border-color: #e9b949aa; box-shadow: 0 0 22px rgba(233, 185, 73, .2); }
.tc-top { display: flex; align-items: center; gap: 8px; }
.tc-top b { font-family: var(--head); font-stretch: condensed; font-size: 15px; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #eef2f7; }
.tem { font-size: 15px; }
.bub { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; white-space: nowrap; }
.bub.live { background: rgba(56, 189, 248, .16); color: #38bdf8; } .bub.warn { background: rgba(245, 181, 68, .16); color: #f5b544; }
.tc-sub { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; font-size: 12px; color: #8a94a3; }
.tc-sub span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .tc-sub em { font-style: normal; white-space: nowrap; color: #5b6575; }
.tjobs { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 0 14px; padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, .12); }
.tjob { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: #11161d; border: 1px solid rgba(255, 255, 255, .08); font-size: 12.5px; color: #c9d1dc; width: 190px; }
.tjob::before { content: ""; position: absolute; left: -13px; top: 50%; width: 12px; border-top: 1px solid rgba(255, 255, 255, .12); }
.tjob span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tjob em { font-style: normal; font-size: 11px; color: #5b6575; }
.tjob.donecount { border-style: dashed; color: #8a94a3; background: none; justify-content: center; }
.tb-ctrl { position: absolute; left: 16px; bottom: 16px; display: flex; gap: 8px; z-index: 3; }
.tboard .btn { background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .12); color: #eef2f7; }
.tboard .btn.on { border-color: #38bdf888; color: #38bdf8; background: rgba(56, 189, 248, .1); }

/* ---------- skills ---------- */
.skstats { display: grid; grid-template-columns: 170px 1.1fr 1.4fr; gap: 26px; align-items: center; }
.donut { width: 150px; height: 150px; border-radius: 50%; background: conic-gradient(var(--blue) calc(var(--p) * 1%), var(--line2) 0); display: grid; place-items: center; position: relative; }
.donut::before { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: var(--panel2); }
.donut > div { position: relative; text-align: center; display: flex; flex-direction: column; align-items: center; }
.donut b { font-family: var(--head); font-stretch: condensed; font-size: 46px; line-height: 1; }
.donut span { font-size: 12px; color: var(--muted); line-height: 1.3; margin-top: 2px; }
.sknums { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.sknums b { font-family: var(--head); font-stretch: condensed; font-size: 38px; line-height: 1; display: block; }
.sknums span { font-size: 13px; color: var(--muted); }
.skareas { display: flex; flex-direction: column; gap: 8px; }
.ska { display: grid; grid-template-columns: 130px 1fr 40px; gap: 10px; align-items: center; font-size: 13px; }
.ska span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ska i { height: 6px; border-radius: 3px; background: var(--line2); overflow: hidden; } .ska i b { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), #a78bfa); }
.ska em { font-style: normal; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.skbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.skq { background: var(--input); border: 1px solid var(--line2); border-radius: 10px; padding: 7px 12px; outline: 0; width: 240px; }
.shelf { display: flex; flex-direction: column; gap: 10px; }
.sh-h { display: flex; align-items: baseline; gap: 10px; } .sh-h b { font-size: 16px; } .sh-h span { color: var(--muted); font-size: 12.5px; }
.sh-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.skcard { background: var(--panel2); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.skcard.never { opacity: .7; }
.sk-h { display: flex; align-items: flex-start; gap: 10px; } .sk-h b { display: block; font-size: 14.5px; } .sk-h code { font-size: 11px; color: var(--muted); background: none; border: 0; padding: 0; }
.sk-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, var(--blue) 12%, var(--panel3)); font-size: 16px; flex: none; }
.skcard p { margin: 0; font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.sk-f { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 28px; flex: 1; }
.spark i { width: 4px; background: var(--blue); border-radius: 1px; opacity: .85; } .spark i.z { background: var(--line2); }
.sk-n { text-align: right; } .sk-n b { font-family: var(--head); font-stretch: condensed; font-size: 26px; line-height: 1; display: block; } .sk-n span { font-size: 11px; color: var(--muted); }
.sk-u { font-size: 11.5px; color: var(--dim); }

/* ---------- pages ---------- */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.pcard { background: var(--panel2); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; transition: border-color .15s, transform .12s; }
.pcard:hover { border-color: color-mix(in srgb, var(--c) 50%, var(--line2)); transform: translateY(-2px); }
.pc-h { display: flex; align-items: center; gap: 10px; } .pc-h b { font-family: var(--head); font-stretch: condensed; font-size: 17px; text-transform: uppercase; letter-spacing: .04em; flex: 1; }
.pc-b { font-size: 13px; color: var(--text2); } .pc-b ul { margin: 0; padding-left: 18px; } .pc-b p { margin: 0; }
.pc-bl { font-size: 12.5px; color: var(--warn); }

/* ---------- details + replay ---------- */
.details { display: flex; flex-direction: column; gap: 14px; max-width: 900px; margin: 0 auto; padding: 0 28px; }
.dgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.prompt { font-size: 14px; } .prompt p:first-child { margin-top: 0; } .prompt p:last-child { margin-bottom: 0; }
.ctxbar { display: grid; grid-template-columns: 60px 1fr; gap: 4px 10px; align-items: center; font-size: 12px; color: var(--muted); }
.ctxbar i { height: 8px; background: var(--line2); border-radius: 4px; overflow: hidden; } .ctxbar i b { display: block; height: 100%; background: var(--blue); }
.ctxbar em { grid-column: 2; font-style: normal; }
.replay { padding-bottom: 10px; }
.rp-scale { display: flex; justify-content: space-between; margin-left: 62%; font-size: 10.5px; color: var(--dim); }
.rp-row { display: grid; grid-template-columns: 58px 24px 1fr 38%; gap: 6px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.rp-t { color: var(--dim); font-variant-numeric: tabular-nums; font-size: 11.5px; }
.rp-i { text-align: center; }
.rp-l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text2); }
.rp-row.you .rp-l { color: var(--blue); font-weight: 600; }
.rp-row.done .rp-l { color: var(--ok); } .rp-row.bad .rp-l { color: var(--bad); } .rp-row.hand .rp-l { color: var(--warn); }
.rp-bar { position: relative; height: 8px; background: var(--line); border-radius: 4px; }
.rp-bar b { position: absolute; top: -1px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 8px var(--blue); }
.rp-row.done .rp-bar b { background: var(--ok); } .rp-row.hand .rp-bar b { background: var(--warn); }

/* ---------- routines + accounts ---------- */
.rlist, .alist { display: flex; flex-direction: column; gap: 10px; }
.rcard { display: flex; gap: 14px; align-items: flex-start; background: var(--panel2); border: 1px solid var(--line); border-left: 3px solid var(--c); border-radius: var(--r); padding: 14px; }
.rcard.off { opacity: .55; }
.rcard b { font-size: 14.5px; }
.rprompt { font-size: 12.5px; color: var(--text2); margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ract { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.switch { position: relative; width: 40px; height: 22px; flex: none; margin-top: 2px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: var(--line2); border-radius: 99px; cursor: pointer; transition: .2s; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + i { background: var(--ok); } .switch input:checked + i::after { transform: translateX(18px); }
.acard { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.acard.active { border-color: var(--sel-line); }
.ahead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .ahead b { font-size: 15px; }
.ubar { display: grid; grid-template-columns: 52px 1fr 36px; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.ubar i { height: 6px; background: var(--line2); border-radius: 4px; overflow: hidden; }
.ubar i b { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), #a78bfa); border-radius: 4px; }
.ubar i b.hot { background: linear-gradient(90deg, var(--warn), var(--bad)); }
.ubar em { font-style: normal; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.ubar.big { grid-template-columns: 70px 1fr 44px 150px; font-size: 13px; padding: 4px 0; }
.ubar.big i { height: 9px; }
.ubar small { color: var(--dim); }
.bye { display: grid; place-items: center; height: 100vh; color: var(--muted); font-size: 16px; }

@media (max-width: 1100px) { #app { grid-template-columns: 64px 320px 1fr; } .skstats { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  #app { grid-template-columns: 1fr; padding: 6px; }
  #rail { flex-direction: row; overflow-x: auto; }
  body.in-chat #list { display: none; }
  body:not(.in-chat):not(.no-list) #main { display: none; }
  .dgrid, .row2, .row4 { grid-template-columns: 1fr; }
}

.upd { display: flex; align-items: center; gap: 8px; margin: 8px 12px 0; padding: 8px 10px 8px 12px; border-radius: 12px; border: 1px solid var(--sel-line); background: var(--sel); font-size: 12.5px; }
.upd b { color: var(--blue); } .upd span { color: var(--muted); flex: 1; min-width: 0; }
.upd .btn.primary { background: var(--blue); color: #001a26; }

.blockedbar { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; padding: 8px 12px; border-radius: 12px; border: 1px dashed var(--line); color: var(--muted); font-size: 12.5px; }
.blockedbar span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blockedbar span p { display: inline; margin: 0; }

/* ---------- phone ---------- */
.mback { display: none; }
@media (max-width: 820px) {
  html, body { height: 100%; }
  #app { grid-template-columns: 1fr !important; gap: 0; height: 100dvh; padding: env(safe-area-inset-top) 0 calc(62px + env(safe-area-inset-bottom)) 0; }
  #list, #main { border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; }
  #rail { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(62px + env(safe-area-inset-bottom)); padding: 4px 4px env(safe-area-inset-bottom);
    flex-direction: row; justify-content: space-around; align-items: center; overflow: hidden; background: var(--panel); border-top: 1px solid var(--line2); backdrop-filter: blur(20px); }
  #rail .ws-list, #rail .rsep, #rail .rgrow, #rail #soundBtn, #rail .ravatar, #rail .rnav[href="#/accounts"] { display: none !important; }
  #rail .rnav { flex: 1; min-width: 0; margin: 0; }
  #rail .rnav span:not(.rbadge) { font-size: 10px; }
  body.no-list #app { grid-template-columns: 1fr; }
  body.in-chat #list { display: none; }
  body:not(.in-chat):not(.no-list) #main { display: none; }
  .mback { display: grid; transform: rotate(180deg); }
  .chead { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .chead .cmeta, #cTree, #cFolder { display: none; }
  .ctitle { min-width: 0; overflow: hidden; }
  #toasts { left: 10px; right: 10px; top: calc(10px + env(safe-area-inset-top)); bottom: auto; }
  .dgrid, .row2, .row3, .row4, .ugrid { grid-template-columns: 1fr !important; }
  .pane { padding-left: 14px; padding-right: 14px; }
  textarea, input, select { font-size: 16px; } /* stops iPhone zooming in on tap */
}

/* ---------- phone app: pairing, install / notifications bar, QR ---------- */
.pairs { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; max-width: 420px; margin: 0 auto; }
.pair-logo { width: 84px; height: 84px; border-radius: 22px; box-shadow: 0 0 40px color-mix(in srgb, var(--blue) 35%, transparent); }
#pairForm { display: flex; flex-direction: column; gap: 10px; width: 100%; }
#pairCode { font: 700 34px/1.2 var(--mono); letter-spacing: .35em; text-align: center; padding: 12px; border-radius: 14px; }
#pairName { text-align: center; }
.pair-err { color: var(--red, #ff7a7a); min-height: 20px; }
#phonebar { position: fixed; left: 10px; right: 10px; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 50; display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px;
  border-radius: 16px; background: var(--panel); border: 1px solid var(--sel-line); box-shadow: var(--shadow); backdrop-filter: blur(20px); font-size: 13px; }
#phonebar img { width: 30px; height: 30px; border-radius: 9px; }
#phonebar span { flex: 1; min-width: 0; }
@media (min-width: 821px) { #phonebar { left: auto; right: 20px; bottom: 20px; max-width: 420px; } }
.pairqr { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-top: 12px; padding: 14px; border-radius: 16px; background: color-mix(in srgb, var(--text) 4%, transparent); border: 1px solid var(--line); }
.pairqr svg { border-radius: 12px; flex: none; }
.paircode { font: 700 40px/1.2 var(--mono); letter-spacing: .12em; margin: 6px 0; color: var(--blue); }
.ph4 { margin: 14px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.pnotif { margin-top: 12px; display: grid; gap: 6px; }
