/* Inblaj Partners Studio — mobile first, Arabic/English (RTL), dark/light. Brand: Inblaj bulb gold on warm ink. */
:root {
  --font: "Inter", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --brand: "Alexandria", "IBM Plex Sans Arabic", "Inter", sans-serif;
  --gold-1: #ffe7b0; --gold-2: #ffc45a; --gold-3: #f2932a;
  --grad: linear-gradient(135deg, var(--gold-1), var(--gold-2) 45%, var(--gold-3));
  --r-s: 10px; --r-m: 14px; --r-l: 20px; --r-xl: 26px;
  --t-fast: 140ms; --t-med: 240ms; --ease: cubic-bezier(.2, .8, .2, 1);
  --side: 300px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
  --bg: #0c0a10; --bg-2: #110e16; --panel: #16131c; --panel-2: #1d1925; --panel-3: #262130;
  --line: rgba(255, 236, 210, .08); --line-2: rgba(255, 236, 210, .14);
  --text: #f4eee6; --text-2: #cfc6ba; --muted: #9a9084; --faint: #6d655c;
  --acc: #ffb547; --acc-ink: #1b1206; --acc-soft: rgba(255, 181, 71, .14); --acc-line: rgba(255, 181, 71, .35);
  --user: #2a2232; --user-text: #fbf6ef;
  --ok: #5fd39a; --warn: #ffc45a; --bad: #ff7a6b; --info: #8fb4ff;
  --shadow: 0 10px 40px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);
  --glow: radial-gradient(60% 50% at 50% 0%, rgba(255, 166, 61, .16), transparent 70%);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #faf6ef; --bg-2: #f4eee4; --panel: #ffffff; --panel-2: #f7f2ea; --panel-3: #efe7da;
  --line: rgba(60, 40, 10, .09); --line-2: rgba(60, 40, 10, .16);
  --text: #1c1710; --text-2: #3e352a; --muted: #6f655a; --faint: #a3988a;
  --acc: #c8741c; --acc-ink: #ffffff; --acc-soft: rgba(214, 128, 36, .12); --acc-line: rgba(200, 116, 28, .35);
  --user: #f3e6d2; --user-text: #241a0d;
  --ok: #19935c; --warn: #b7791f; --bad: #d64534; --info: #3561c9;
  --shadow: 0 10px 40px rgba(70, 45, 10, .12), 0 2px 8px rgba(70, 45, 10, .08);
  --glow: radial-gradient(60% 50% at 50% 0%, rgba(255, 166, 61, .18), transparent 70%);
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    color-scheme: light;
    --bg: #faf6ef; --bg-2: #f4eee4; --panel: #ffffff; --panel-2: #f7f2ea; --panel-3: #efe7da;
    --line: rgba(60, 40, 10, .09); --line-2: rgba(60, 40, 10, .16);
    --text: #1c1710; --text-2: #3e352a; --muted: #6f655a; --faint: #a3988a;
    --acc: #c8741c; --acc-ink: #ffffff; --acc-soft: rgba(214, 128, 36, .12); --acc-line: rgba(200, 116, 28, .35);
    --user: #f3e6d2; --user-text: #241a0d;
    --ok: #19935c; --warn: #b7791f; --bad: #d64534; --info: #3561c9;
    --shadow: 0 10px 40px rgba(70, 45, 10, .12), 0 2px 8px rgba(70, 45, 10, .08);
    --glow: radial-gradient(60% 50% at 50% 0%, rgba(255, 166, 61, .18), transparent 70%);
  }
}
[dir="rtl"] { --font: "IBM Plex Sans Arabic", "Inter", system-ui, sans-serif; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[dir="rtl"] svg.flip { transform: scaleX(-1); }
.brandname { font-family: var(--brand); letter-spacing: -.01em; }

/* ── login ─────────────────────────────────────────────────────────────────────────────────────────────── */
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px 16px calc(24px + var(--safe-b));
  background: radial-gradient(90% 60% at 50% 110%, rgba(242, 147, 42, .28), transparent 60%),
              radial-gradient(70% 50% at 50% -10%, rgba(255, 196, 90, .10), transparent 70%), var(--bg); overflow: auto; }
.login .horizon { position: absolute; inset: auto 0 0 0; height: 46vh; pointer-events: none;
  background: radial-gradient(50% 60% at 50% 100%, rgba(255, 166, 61, .35), rgba(255, 120, 40, .08) 55%, transparent 75%); filter: blur(10px); }
.login .card { position: relative; width: min(400px, 100%); padding: 34px 26px 26px; border-radius: var(--r-xl);
  background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--line-2); box-shadow: var(--shadow);
  animation: rise .5s var(--ease) both; }
.login .logo { width: 64px; height: 64px; margin: 0 auto 16px; display: block; filter: drop-shadow(0 6px 22px rgba(255, 166, 61, .45)); }
.login h1 { margin: 0; text-align: center; font: 600 23px/1.25 var(--brand); }
.login h1 small { display: block; margin-top: 4px; font: 400 14px/1.4 var(--font); color: var(--muted); }
.login form { margin-top: 24px; display: grid; gap: 12px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; color: var(--text-2); }
.input { width: 100%; padding: 12px 14px; border-radius: var(--r-m); background: var(--panel-2); border: 1px solid var(--line-2);
  outline: none; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.input:focus { border-color: var(--acc-line); box-shadow: 0 0 0 4px var(--acc-soft); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 16px; border-radius: var(--r-m);
  font-weight: 600; transition: transform var(--t-fast), background var(--t-fast), opacity var(--t-fast); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--grad); color: #1b1206; box-shadow: 0 6px 24px rgba(242, 147, 42, .28); }
.btn.ghost { background: var(--panel-2); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--panel-3); }
.btn.danger { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.login .err { min-height: 20px; color: var(--bad); font-size: 13px; text-align: center; }
.login .foot { margin-top: 16px; display: flex; justify-content: center; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--panel-2);
  border: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.pill:hover { background: var(--panel-3); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* ── shell ─────────────────────────────────────────────────────────────────────────────────────────────── */
.shell { position: fixed; inset: 0; display: grid; grid-template-columns: var(--side) 1fr; }
.side { position: relative; display: flex; flex-direction: column; min-height: 0; background: var(--bg-2); border-inline-end: 1px solid var(--line); }
.side-head { display: flex; align-items: center; gap: 10px; padding: calc(14px + var(--safe-t)) 14px 10px; }
.side-head img { width: 30px; height: 30px; filter: drop-shadow(0 3px 10px rgba(255, 166, 61, .4)); }
.side-head .t { flex: 1; min-width: 0; font: 600 15px/1.2 var(--brand); }
.side-head .t small { display: block; font: 400 11.5px/1.3 var(--font); color: var(--muted); letter-spacing: .02em; }
.iconbtn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: var(--text-2); transition: background var(--t-fast), color var(--t-fast); }
.iconbtn:hover { background: var(--panel-2); color: var(--text); }
.iconbtn.acc { color: var(--acc); }
.newchat { margin: 4px 12px 10px; display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--r-m);
  background: var(--panel); border: 1px solid var(--line-2); font-weight: 600; transition: border-color var(--t-fast), background var(--t-fast); }
.newchat:hover { border-color: var(--acc-line); background: var(--panel-2); }
.newchat .plus { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--grad); color: #1b1206; }
.tree { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 8px 14px; scrollbar-width: thin; }
.sec { display: flex; align-items: center; gap: 6px; padding: 14px 8px 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--faint); }
[dir="rtl"] .sec { letter-spacing: 0; font-size: 12.5px; }
.sec span { flex: 1; }
.sec .iconbtn { width: 28px; height: 28px; border-radius: 8px; }
.client { margin-top: 2px; }
.crow { display: flex; align-items: center; gap: 8px; padding: 8px 8px; border-radius: 11px; cursor: pointer; user-select: none;
  transition: background var(--t-fast); }
.crow:hover { background: var(--panel); }
.crow .chev { width: 16px; height: 16px; color: var(--faint); transition: transform var(--t-med) var(--ease); }
.client.open .crow .chev { transform: rotate(90deg); }
[dir="rtl"] .client.open .crow .chev { transform: rotate(-90deg); }
[dir="rtl"] .crow .chev { transform: scaleX(-1); }
.crow .av { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font: 600 12px var(--brand); flex: none;
  background: var(--panel-3); color: var(--text-2); }
.crow .av.star { background: var(--grad); color: #1b1206; }
.crow .av.star img { width: 17px; height: 17px; }
.crow .nm { flex: 1; min-width: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crow .nm small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.crow .add { opacity: 0; width: 26px; height: 26px; border-radius: 8px; }
.crow:hover .add, .crow:focus-within .add, .client.cur .add { opacity: 1; }
@media (hover: none) { .crow .add { opacity: 1; } }
.gdot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.gdot.ok { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.gdot.no { background: var(--warn); }
.sessions { display: none; padding-inline-start: 18px; margin: 2px 0 4px; border-inline-start: 1px solid var(--line); margin-inline-start: 20px; }
.client.open .sessions { display: block; }
.srow { position: relative; display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px; cursor: pointer;
  color: var(--text-2); font-size: 14px; transition: background var(--t-fast), color var(--t-fast); }
.srow:hover { background: var(--panel); color: var(--text); }
.srow.cur { background: var(--acc-soft); color: var(--text); }
.srow.cur::before { content: ""; position: absolute; inset-inline-start: -19px; top: 9px; bottom: 9px; width: 2px; border-radius: 2px; background: var(--acc); }
.general .srow.cur::before { display: none; }
.srow .tt { text-align: start; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow .ow { font-size: 11px; color: var(--faint); }
.srow .when { font-size: 11.5px; color: var(--faint); }
.st { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.st.running { background: var(--acc); animation: pulse 1.4s ease-in-out infinite; }
.st.queued { background: var(--info); }
.st.wait { background: var(--warn); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--acc) 50%, transparent); } 50% { box-shadow: 0 0 0 5px transparent; } }
.empty-s { padding: 4px 10px 8px; font-size: 12.5px; color: var(--faint); }
.side-foot { display: flex; align-items: center; gap: 10px; padding: 10px 12px calc(10px + var(--safe-b)); border-top: 1px solid var(--line); }
.me { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px; border-radius: 12px; text-align: start; }
.me:hover { background: var(--panel); }
.me .av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #1b1206; font: 600 14px var(--brand); flex: none; }
.me .n { min-width: 0; font-weight: 600; font-size: 14px; }
.me .n small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.slots { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }

/* ── main / chat ───────────────────────────────────────────────────────────────────────────────────────── */
.main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.main::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 320px; background: var(--glow); pointer-events: none; }
.top { position: relative; z-index: 2; display: flex; align-items: center; gap: 8px; padding: calc(10px + var(--safe-t)) 14px 10px;
  border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.top .menu { display: none; }
.top .ti { flex: 1; min-width: 0; }
.top .ti h2 { text-align: start; margin: 0; font: 600 15.5px/1.25 var(--brand); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .ti .sub { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 500;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text-2); white-space: nowrap; }
.chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.chip.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.chip.acc { color: var(--acc); border-color: var(--acc-line); background: var(--acc-soft); }
.scroll { position: relative; flex: 1; overflow-y: auto; overflow-anchor: none; overscroll-behavior: contain; scroll-behavior: auto; }
.thread { max-width: 820px; margin: 0 auto; padding: 22px 18px 26px; display: flex; flex-direction: column; gap: 18px; }
.msg { display: flex; gap: 12px; animation: msgin .32s var(--ease) both; }
@keyframes msgin { from { opacity: 0; transform: translateY(6px); } }
.msg .ava { width: 30px; height: 30px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--panel-2);
  border: 1px solid var(--line); margin-top: 2px; }
.msg .ava img { width: 18px; height: 18px; }
.msg .body { flex: 1; min-width: 0; }
.msg .who { font-size: 12px; color: var(--muted); margin-bottom: 3px; display: flex; gap: 8px; align-items: baseline; }
.msg.user { justify-content: flex-end; }
.msg.user .body { flex: 0 1 auto; max-width: min(84%, 620px); }
.msg.user .bubble { background: var(--user); color: var(--user-text); padding: 10px 14px; border-radius: 18px; border-end-end-radius: 6px;
  border: 1px solid var(--line); white-space: pre-wrap; word-wrap: break-word; }
.msg.user .meta { font-size: 11px; color: var(--faint); text-align: end; margin-top: 4px; }
.msg.user.pending .bubble { opacity: .7; }
.md { word-wrap: break-word; overflow-wrap: anywhere; color: var(--text); }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .7em; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--brand); font-weight: 600; line-height: 1.3; margin: 1.1em 0 .45em; }
.md h1 { font-size: 1.3em; } .md h2 { font-size: 1.18em; } .md h3 { font-size: 1.06em; }
.md ul, .md ol { margin: .2em 0 .8em; padding-inline-start: 1.3em; }
.md li { margin: .2em 0; }
.md li::marker { color: var(--acc); }
.md blockquote { margin: .6em 0; padding: .3em 1em; border-inline-start: 3px solid var(--acc-line); color: var(--text-2); background: var(--panel); border-radius: 8px; }
.md code { font: 13px/1.5 ui-monospace, "SF Mono", Menlo, monospace; background: var(--panel-2); padding: .12em .4em; border-radius: 6px; direction: ltr; unicode-bidi: isolate; }
.md pre { background: var(--panel); border: 1px solid var(--line); padding: 12px 14px; border-radius: 12px; overflow-x: auto; direction: ltr; text-align: left; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; margin: .6em 0 1em; font-size: 14px; display: block; overflow-x: auto; max-width: 100%; }
.md th, .md td { border: 1px solid var(--line-2); padding: 6px 10px; text-align: start; }
.md th { background: var(--panel-2); font-weight: 600; }
.md hr { border: 0; border-top: 1px solid var(--line-2); margin: 1.2em 0; }
.md img { max-width: 100%; border-radius: 12px; }
.md a { word-break: break-all; }
.caret::after { content: ""; display: inline-block; width: 8px; height: 15px; margin-inline-start: 2px; vertical-align: -2px; border-radius: 2px;
  background: var(--acc); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* working / status row */
.work { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 9px 12px; border-radius: 14px; background: var(--panel);
  border: 1px solid var(--line); font-size: 13.5px; color: var(--text-2); max-width: 100%; }
.work .sun { width: 22px; height: 22px; flex: none; position: relative; }
.work .sun::before, .work .sun::after { content: ""; position: absolute; inset: 0; border-radius: 50%; }
.work .sun::before { background: var(--grad); transform: scale(.55); box-shadow: 0 0 14px rgba(255, 166, 61, .7); animation: breathe 1.8s ease-in-out infinite; }
.work .sun::after { border: 2px solid transparent; border-top-color: var(--acc); border-right-color: color-mix(in srgb, var(--acc) 40%, transparent); animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { transform: scale(.7); } }
.work .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work .lbl b { color: var(--text); font-weight: 600; }
.work .lbl span { color: var(--muted); }
.work .el { font-variant-numeric: tabular-nums; color: var(--faint); font-size: 12px; }
.work .stop { padding: 5px 10px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line-2); font-size: 12.5px; font-weight: 600; }
.work .stop:hover { background: var(--panel-3); }
.work.queued .sun::after { border-top-color: var(--info); animation-duration: 2.2s; }
.steps { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.steps summary { cursor: pointer; list-style: none; display: inline-flex; gap: 6px; align-items: center; }
.steps summary::-webkit-details-marker { display: none; }
.steps ol { margin: 6px 0 0; padding-inline-start: 18px; }
.steps li { margin: 2px 0; }
.mfoot { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 11.5px; color: var(--faint); }
.mfoot .cp { opacity: 0; transition: opacity var(--t-fast); }
.msg:hover .mfoot .cp { opacity: 1; }
@media (hover: none) { .mfoot .cp { opacity: 1; } }
.errbox { margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--bad) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); color: var(--text-2); font-size: 13.5px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* event cards (approvals) */
.evt { align-self: center; max-width: min(520px, 100%); display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line-2); font-size: 13.5px; animation: msgin .3s var(--ease) both; }
.evt .ic { font-size: 18px; line-height: 1.2; }
.evt b { font-weight: 600; }
.evt small { display: block; color: var(--muted); margin-top: 2px; }
.evt.pending { border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.evt.approved { border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.evt.declined { border-color: color-mix(in srgb, var(--bad) 45%, transparent); }

/* attachments */
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.msg.user .files { justify-content: flex-end; }
.thumb { position: relative; width: 168px; height: 168px; border-radius: 14px; overflow: hidden; background: var(--panel-2); border: 1px solid var(--line); cursor: zoom-in; }
.files.one .thumb { width: min(360px, 100%); height: auto; max-height: 440px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.files.one .thumb img { height: auto; max-height: 440px; object-fit: contain; }
.fcard { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line-2);
  min-width: 220px; max-width: 100%; color: var(--text); }
.fcard:hover { text-decoration: none; border-color: var(--acc-line); }
.fcard .fi { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--acc-soft); color: var(--acc); flex: none; font: 700 10.5px var(--font); }
.fcard .fn { min-width: 0; flex: 1; }
.fcard .fn b { display: block; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fcard .fn small { color: var(--muted); font-size: 12px; }
.voice { display: grid; gap: 6px; padding: 10px 12px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line-2); width: min(340px, 100%); }
.msg.user .voice { background: var(--user); }
.voice audio, .aud audio { width: 100%; height: 38px; }
.voice .tr { font-size: 13px; color: var(--text-2); white-space: pre-wrap; }
.voice .tr::before { content: "“"; color: var(--acc); font-weight: 700; margin-inline-end: 2px; }
.aud { width: min(380px, 100%); padding: 10px 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line-2); }
.aud .nm { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.vid { width: min(380px, 100%); border-radius: 14px; overflow: hidden; background: #000; border: 1px solid var(--line-2); }
.vid video { width: 100%; display: block; max-height: 560px; }
.drive { margin-top: 10px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line-2); background: var(--panel); max-width: 420px; }
.drive .dh { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.drive .dh .fi { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--grad); color: #1b1206; flex: none; }
.drive .dh .fn { flex: 1; min-width: 0; font-size: 13.5px; }
.drive .dh .fn b { display: block; font-weight: 600; }
.drive .dh .fn small { color: var(--muted); font-size: 12px; }
.drive iframe { display: block; width: 100%; aspect-ratio: 9 / 16; max-height: 70vh; border: 0; background: #000; }
.drive.land iframe { aspect-ratio: 16 / 9; }

/* empty state */
.hello { max-width: 640px; margin: 0 auto; padding: 9vh 20px 20px; text-align: center; }
.hello img { width: 74px; height: 74px; filter: drop-shadow(0 10px 30px rgba(255, 166, 61, .45)); animation: rise .6s var(--ease) both; }
.hello h3 { margin: 18px 0 6px; font: 600 24px/1.3 var(--brand); }
.hello p { margin: 0 auto; color: var(--muted); max-width: 460px; }
.hello .ctx { margin-top: 12px; display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.ideas { margin: 26px auto 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; max-width: 560px; }
.idea { text-align: start; padding: 12px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); font-size: 13.5px; color: var(--text-2);
  transition: border-color var(--t-fast), transform var(--t-fast); }
.idea:hover { border-color: var(--acc-line); color: var(--text); transform: translateY(-1px); }
.idea b { display: block; color: var(--text); font-weight: 600; margin-bottom: 2px; }

/* composer */
.composer { position: relative; z-index: 2; padding: 10px 14px calc(12px + var(--safe-b)); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.cbox { max-width: 820px; margin: 0 auto; border-radius: 22px; background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow);
  transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.cbox:focus-within { border-color: var(--acc-line); box-shadow: var(--shadow), 0 0 0 4px var(--acc-soft); }
.cbox.drag { border-color: var(--acc); border-style: dashed; }
.pending-files { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 12px 0; }
.pf { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line);
  font-size: 12.5px; max-width: 240px; }
.pf img { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; }
.pf .fi { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--acc-soft); color: var(--acc); font: 700 10px var(--font); flex: none; }
.pf .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf .nm small { display: block; color: var(--muted); }
.pf .x { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-3); flex: none; }
.pf .bar { position: absolute; inset: auto 8px 3px 8px; height: 2px; border-radius: 2px; background: var(--line); overflow: hidden; }
.pf .bar i { display: block; height: 100%; width: 0; background: var(--acc); transition: width .2s; }
.crow2 { display: flex; align-items: flex-end; gap: 6px; padding: 8px 8px 8px 8px; }
.crow2 textarea { flex: 1; min-height: 24px; max-height: 40vh; resize: none; border: 0; outline: 0; background: none; padding: 8px 6px; line-height: 1.5; }
.crow2 textarea::placeholder { color: var(--faint); }
.cbtn { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; color: var(--text-2); flex: none; transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast); }
.cbtn:hover { background: var(--panel-2); color: var(--text); }
.cbtn.send { background: var(--grad); color: #1b1206; box-shadow: 0 4px 16px rgba(242, 147, 42, .35); }
.cbtn.send[disabled] { background: var(--panel-3); color: var(--faint); box-shadow: none; }
.cbtn:active { transform: scale(.94); }
.rec { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; }
.rec .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); animation: pulse-r 1.2s ease-in-out infinite; flex: none; }
@keyframes pulse-r { 50% { opacity: .35; } }
.rec .tm { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 44px; }
.rec canvas { flex: 1; height: 34px; min-width: 0; }
.rec .cbtn.cancel { color: var(--bad); }
.hint { max-width: 820px; margin: 6px auto 0; text-align: center; font-size: 11.5px; color: var(--faint); }

/* modals, menus, toasts, lightbox */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(5, 3, 8, .55); display: grid; place-items: center; padding: 16px;
  animation: fade .2s ease both; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(440px, 100%); max-height: 90vh; overflow: auto; border-radius: var(--r-xl); background: var(--panel); border: 1px solid var(--line-2);
  box-shadow: var(--shadow); padding: 22px; animation: rise .3s var(--ease) both; }
.modal h3 { margin: 0 0 4px; font: 600 18px/1.3 var(--brand); }
.modal p.s { margin: 0 0 16px; color: var(--muted); font-size: 13.5px; }
.modal .row { display: grid; gap: 12px; }
.modal .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); gap: 2px; }
.seg button { padding: 6px 12px; border-radius: 9px; font-size: 13px; color: var(--text-2); }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }
.menu-pop { position: fixed; z-index: 50; min-width: 200px; padding: 6px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow);
  animation: rise .18s var(--ease) both; }
.menu-pop button, .menu-pop a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 9px; font-size: 14px; color: var(--text); text-align: start; }
.menu-pop button:hover, .menu-pop a:hover { background: var(--panel-2); text-decoration: none; }
.menu-pop .sep { height: 1px; margin: 5px 4px; background: var(--line); }
.menu-pop .danger { color: var(--bad); }
.menu-pop .lab { padding: 6px 10px 2px; font-size: 11.5px; color: var(--faint); }
.toasts { position: fixed; z-index: 60; inset-inline: 0; bottom: calc(96px + var(--safe-b)); display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; padding: 10px 16px; border-radius: 14px; background: var(--panel-3); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 13.5px; animation: rise .25s var(--ease) both; }
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .88); display: grid; place-items: center; padding: 20px; cursor: zoom-out; animation: fade .2s both; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 20px 80px rgba(0, 0, 0, .6); }
.lightbox a { position: absolute; top: calc(14px + var(--safe-t)); inset-inline-end: 14px; color: #fff; background: rgba(255, 255, 255, .14); padding: 8px 12px; border-radius: 10px; font-size: 13px; }

/* admin */
.admin { max-width: 1100px; margin: 0 auto; padding: 22px 18px 40px; }
.admin h3 { font: 600 20px/1.3 var(--brand); margin: 0 0 4px; }
.admin .lead { color: var(--muted); margin: 0 0 16px; font-size: 13.5px; }
.admin .bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.kpi { padding: 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
.kpi small { color: var(--muted); font-size: 12px; }
.kpi b { display: block; font: 600 24px/1.2 var(--brand); margin-top: 4px; font-variant-numeric: tabular-nums; }
.ptable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.ptable th, .ptable td { padding: 10px 12px; text-align: end; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ptable th:first-child, .ptable td:first-child { text-align: start; }
.ptable th { font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--panel-2); }
.ptable tr:last-child td { border-bottom: 0; }
.tablewrap { overflow-x: auto; border-radius: 16px; }
.cards2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-top: 18px; }
.box { padding: 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
.box h4 { margin: 0 0 10px; font: 600 14px var(--brand); }
.appr { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.appr:first-of-type { border-top: 0; }
.appr .tx { flex: 1; min-width: 0; }
.appr .tx small { display: block; color: var(--muted); }
.mini { padding: 6px 10px; border-radius: 9px; font-size: 12.5px; font-weight: 600; }
.mini.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.mini.no { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }

/* phone */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 30; inset-block: 0; inset-inline-start: 0; width: min(86vw, 340px); transform: translateX(-104%);
    transition: transform var(--t-med) var(--ease); box-shadow: var(--shadow); }
  [dir="rtl"] .side { transform: translateX(104%); }
  .shell.drawer .side { transform: none; }
  .shell.drawer::after { content: ""; position: fixed; inset: 0; z-index: 25; background: rgba(5, 3, 8, .5); animation: fade .2s both; }
  .top .menu { display: grid; }
  .thread { padding: 16px 12px 20px; gap: 16px; }
  .msg { gap: 10px; }
  .msg .ava { width: 26px; height: 26px; border-radius: 8px; }
  .msg.user .body { max-width: 88%; }
  .composer { padding: 8px 10px calc(10px + var(--safe-b)); }
  .ideas { grid-template-columns: 1fr; }
  .hello { padding-top: 6vh; }
  .hello h3 { font-size: 21px; }
  .thumb { width: 132px; height: 132px; }
  .hint { display: none; }
  .crow .add { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
