/* MyWorldAI web app - dark premium theme. No external fonts/CDNs: system fonts (Segoe UI on Windows). */
:root {
  --bg: #05070f;
  --bg-2: #080b17;
  --panel: rgba(12, 16, 30, 0.92);
  --panel-solid: #0b0f1d;
  --card: #0f1426;
  --card-2: #121831;
  --line: rgba(120, 134, 190, 0.14);
  --line-2: rgba(120, 134, 190, 0.22);
  --text: #e8ebf7;
  --text-2: #c3c9de;
  --muted: #8a92ad;
  --dim: #5f6884;
  --accent: #7c5cff;
  --accent-2: #5b7cff;
  --accent-3: #22c7ee;
  --accent-soft: rgba(124, 92, 255, 0.16);
  --accent-line: rgba(140, 112, 255, 0.55);
  --grad: linear-gradient(100deg, #8b5cf6 0%, #6366f1 45%, #22b8f0 100%);
  --grad-soft: linear-gradient(135deg, rgba(139, 92, 246, .22), rgba(34, 184, 240, .12));
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #f43f5e;
  --gold: #f5b83d;
  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 20px;
  --font: "Segoe UI Variable Text", "Segoe UI", "Inter", system-ui, -apple-system, "Heebo", "Rubik", Arial, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", "Fira Code", Consolas, "SF Mono", Menlo, monospace;
  --shadow: 0 10px 40px rgba(0, 0, 0, .45);
  --glow: 0 0 0 1px rgba(124, 92, 255, .35), 0 0 32px rgba(124, 92, 255, .18);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
body::before { /* subtle ambient gradients */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(900px 500px at 50% 115%, rgba(99, 102, 241, .14), transparent 60%),
    radial-gradient(700px 420px at 0% 0%, rgba(124, 92, 255, .08), transparent 60%),
    radial-gradient(600px 400px at 100% 0%, rgba(34, 199, 238, .05), transparent 60%);
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: #a5b4fc; }
.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i.sm { width: 15px; height: 15px; } .i.lg { width: 22px; height: 22px; }
.i.fill { fill: currentColor; stroke: none; }
::selection { background: rgba(124, 92, 255, .35); }
* { scrollbar-width: thin; scrollbar-color: rgba(120, 134, 190, .25) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: rgba(120, 134, 190, .22); border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Shell: sidebar | chat | preview (visual order kept as in the mockup, also in RTL) ---------- */
.shell {
  position: relative; z-index: 1; height: 100vh; display: grid; direction: ltr;
  grid-template-columns: 284px minmax(0, 1fr) 404px; gap: 0;
}
/* Desktop frameless titlebar (1.0.7+): injectTitlebar adds body.mwai-framed + 36px padding-top */
body.mwai-framed .shell,
body.mwai-framed .app { height: calc(100vh - 36px); max-height: calc(100vh - 36px); }
body.has-titlebar .shell,
body.has-titlebar .app { height: calc(100vh - 36px); max-height: calc(100vh - 36px); }
.shell.no-preview { grid-template-columns: 284px minmax(0, 1fr) 0; }
.shell > * { direction: rtl; min-height: 0; }

/* ---------- Sidebar ---------- */
.sidebar {
  display: flex; flex-direction: column; background: linear-gradient(180deg, rgba(10, 13, 26, .96), rgba(7, 9, 19, .98));
  border-inline-start: 1px solid var(--line); padding: 18px 14px 14px; gap: 6px; overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 14px; direction: ltr; justify-content: flex-start; }
.brand .logo { width: 34px; height: 34px; filter: drop-shadow(0 0 10px rgba(124, 92, 255, .55)); }
.brand .name { font-size: 22px; font-weight: 650; letter-spacing: -.2px; }
.brand .name b { font-weight: 650; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: var(--r);
  padding: 11px 14px; background: var(--grad); color: #fff; font-weight: 600; font-size: 14.5px;
  box-shadow: 0 6px 24px rgba(99, 102, 241, .35), inset 0 1px 0 rgba(255, 255, 255, .18); transition: filter .15s, transform .15s;
}
.btn-primary:hover { filter: brightness(1.1); } .btn-primary:active { transform: translateY(1px); }
.side-section { display: flex; flex-direction: column; min-height: 0; }
.side-section.convs { flex: 1 1 52%; margin-top: 14px; }
.side-section.projects { flex: 1 1 40%; margin-top: 8px; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; color: var(--muted); font-size: 11.5px; font-weight: 650; letter-spacing: .08em; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); transition: background .15s, color .15s; }
.icon-btn:hover { background: rgba(255, 255, 255, .06); color: var(--text); }
.icon-btn.on { color: var(--gold); }
.pv-head .icon-btn.on { color: #c4b5fd; background: var(--accent-soft); }
.search { margin: 2px 4px 6px; display: none; }
.search.open { display: block; }
.search input { width: 100%; background: var(--card); border: 1px solid var(--line-2); border-radius: 9px; padding: 7px 10px; outline: none; }
.search input:focus { border-color: var(--accent-line); }
.list { overflow-y: auto; min-height: 0; padding: 0 2px; display: flex; flex-direction: column; gap: 2px; }
.conv {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--text-2);
  border: 1px solid transparent; cursor: pointer; font-size: 13.5px; transition: background .12s;
}
.conv:hover { background: rgba(255, 255, 255, .04); }
.conv.active { background: linear-gradient(90deg, rgba(124, 92, 255, .2), rgba(99, 102, 241, .1)); border-color: var(--accent-line); color: var(--text); box-shadow: 0 0 18px rgba(124, 92, 255, .12); }
.conv .i { color: var(--dim); } .conv.active .i { color: #a78bfa; }
.conv .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .when { color: var(--dim); font-size: 11.5px; white-space: nowrap; }
.empty-note { color: var(--dim); font-size: 12.5px; padding: 8px 10px; }
.tree-node > .row {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 10px; color: var(--text-2); cursor: pointer; font-size: 13.5px;
}
.tree-node > .row:hover { background: rgba(255, 255, 255, .04); }
.tree-node.open > .row { background: rgba(255, 255, 255, .045); color: var(--text); }
.tree-node .row .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-node .row .count { color: var(--dim); font-size: 11.5px; }
.tree-node .chev { color: var(--dim); transition: transform .15s; }
.tree-node.open .chev { transform: rotate(-90deg); }
.tree-kids { display: none; padding-inline-start: 18px; margin-inline-start: 16px; border-inline-start: 1px solid var(--line); }
.tree-node.open .tree-kids { display: block; }
.tree-kids .conv { padding: 6px 10px; font-size: 13px; }
.folder { color: #93a4ff; }
.plan-card {
  margin-top: 10px; padding: 14px; border-radius: var(--r-lg); background: linear-gradient(160deg, rgba(25, 30, 58, .9), rgba(14, 18, 36, .95));
  border: 1px solid var(--line-2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}
.plan-top { display: flex; align-items: center; gap: 11px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, #8b5cf6, #6366f1); box-shadow: 0 0 0 2px rgba(139, 92, 246, .35); flex: none; }
.plan-name { font-weight: 650; font-size: 14.5px; }
.plan-sub { color: var(--muted); font-size: 12px; }
.crown { color: var(--gold); margin-inline-start: auto; filter: drop-shadow(0 0 6px rgba(245, 184, 61, .45)); }
.meter { margin-top: 10px; }
.meter .lbl { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.meter .lbl b { color: var(--text-2); font-weight: 600; direction: ltr; unicode-bidi: isolate; }
.bar { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 6px; background: var(--grad); box-shadow: 0 0 10px rgba(99, 102, 241, .6); transition: width .4s; }
.bar.warn > i { background: linear-gradient(90deg, #f59e0b, #f43f5e); }
.plan-actions { display: flex; gap: 8px; margin-top: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 10px; padding: 8px 12px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .04); color: var(--text); font-size: 13px; transition: background .15s, border-color .15s; }
.btn:hover { background: rgba(255, 255, 255, .08); border-color: rgba(140, 150, 210, .35); }
.btn.grad { border: 0; background: var(--grad); font-weight: 600; box-shadow: 0 4px 16px rgba(99, 102, 241, .3); }
.btn.danger { color: #fda4af; border-color: rgba(244, 63, 94, .35); }
.btn.block { flex: 1; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; position: relative; min-width: 0; background: linear-gradient(180deg, rgba(6, 8, 17, .6), rgba(6, 8, 17, .2)); }
.chat-head { display: flex; align-items: center; gap: 6px; padding: 14px 22px; border-bottom: 1px solid var(--line); min-height: 62px; }
.title-btn { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; font-size: 17px; font-weight: 600; padding: 6px 8px; border-radius: 10px; min-width: 0; }
.title-btn:hover { background: rgba(255, 255, 255, .05); }
.title-btn .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.title-btn .i { color: var(--muted); }
.head-actions { margin-inline-start: auto; display: flex; gap: 2px; }
.mobile-only { display: none !important; }
.log { flex: 1; overflow-y: auto; padding: 26px 28px 190px; scroll-behavior: smooth; }
.thread { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.msg-user { align-self: flex-end; max-width: min(78%, 620px); }
.bubble-user {
  background: linear-gradient(180deg, rgba(28, 34, 62, .95), rgba(20, 25, 48, .95)); border: 1px solid var(--line-2); border-radius: 16px;
  padding: 12px 16px 8px; color: var(--text); box-shadow: 0 6px 20px rgba(0, 0, 0, .25); white-space: pre-wrap; word-wrap: break-word; unicode-bidi: plaintext;
}
.bubble-user .time { display: block; text-align: end; color: var(--dim); font-size: 11px; margin-top: 4px; }
.msg-ai { display: flex; gap: 12px; align-items: flex-start; }
.ai-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; background: radial-gradient(circle at 30% 30%, #2a2f5e, #121633); border: 1px solid rgba(139, 92, 246, .45); box-shadow: 0 0 16px rgba(124, 92, 255, .3); }
.ai-avatar svg { width: 20px; height: 20px; }
.ai-body { flex: 1; min-width: 0; }
.ai-name { display: flex; align-items: center; gap: 8px; font-weight: 650; margin-bottom: 4px; font-size: 14.5px; }
.badge { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: var(--accent-soft); color: #c4b5fd; border: 1px solid rgba(139, 92, 246, .4); }
.badge.model { background: rgba(255, 255, 255, .05); color: var(--muted); border-color: var(--line-2); font-weight: 600; direction: ltr; }
.md { color: var(--text-2); line-height: 1.7; font-size: 14.5px; overflow-wrap: anywhere; }
.md p { margin: 0 0 10px; } .md p:last-child { margin-bottom: 0; }
.md h2, .md h3, .md h4, .md h5 { color: var(--text); margin: 14px 0 8px; line-height: 1.35; } .md h2 { font-size: 19px; } .md h3 { font-size: 16.5px; } .md h4, .md h5 { font-size: 15px; }
.md strong { color: var(--text); }
.md ul, .md ol { margin: 6px 0 10px; padding-inline-start: 22px; } .md li { margin: 3px 0; }
.md li::marker { color: #8b7cf6; }
.md code { font-family: var(--mono); font-size: 12.5px; background: rgba(124, 92, 255, .12); border: 1px solid rgba(124, 92, 255, .22); padding: 1px 6px; border-radius: 6px; color: #d8ccff; unicode-bidi: isolate; }
.md blockquote { margin: 8px 0; padding: 4px 14px; border-inline-start: 3px solid var(--accent); color: var(--muted); background: rgba(255, 255, 255, .02); border-radius: 0 8px 8px 0; }
.md hr { border: 0; border-top: 1px solid var(--line-2); margin: 14px 0; }
.md a { color: #a5b4fc; text-decoration: none; border-bottom: 1px solid rgba(165, 180, 252, .35); }
.md-table { overflow-x: auto; margin: 8px 0 12px; border: 1px solid var(--line-2); border-radius: 10px; }
.md table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.md th, .md td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: start; }
.md th { background: rgba(255, 255, 255, .03); color: var(--text); font-weight: 600; }
.md li.task { list-style: none; margin-inline-start: -18px; display: flex; gap: 8px; align-items: center; }
.md .chk { width: 15px; height: 15px; border-radius: 4px; border: 1.5px solid var(--muted); display: inline-block; } .md .chk.on { background: var(--accent); border-color: var(--accent); }
.code-card { margin: 12px 0; border-radius: 12px; background: #090c18; border: 1px solid var(--line-2); overflow: hidden; box-shadow: 0 8px 28px rgba(0, 0, 0, .35); text-align: left; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 8px 14px; background: rgba(255, 255, 255, .025); border-bottom: 1px solid var(--line); }
.code-title { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); }
.code-copy { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--muted); font-size: 12px; padding: 4px 8px; border-radius: 7px; }
.code-copy:hover { background: rgba(255, 255, 255, .06); color: var(--text); }
.code-copy svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.code-copy.done { color: var(--ok); }
.code-card pre { margin: 0; padding: 12px 0; overflow-x: auto; max-height: 520px; }
.code-card code { font-family: var(--mono); font-size: 13px; line-height: 1.65; display: block; counter-reset: ln; color: #d6dbf0; background: none; border: 0; padding: 0; white-space: pre; tab-size: 2; }
.code-card .line { display: block; padding: 0 16px 0 0; }
.code-card .line::before { counter-increment: ln; content: counter(ln); display: inline-block; width: 3.2em; padding-right: 1.2em; text-align: right; color: #3f4766; user-select: none; }
.code-card.streaming .line:last-child::after { content: ""; display: inline-block; width: 7px; height: 15px; background: #a78bfa; vertical-align: -2px; margin-left: 2px; animation: blink 1s steps(2) infinite; }
.tok-kw { color: #c792ea; } .tok-str { color: #a5e3a1; } .tok-com { color: #5c6690; font-style: italic; } .tok-num { color: #f9a86b; }
.tok-fn { color: #82aaff; } .tok-type { color: #ffcb6b; } .tok-tag { color: #f07178; } .tok-attr { color: #c3e88d; } .tok-op { color: #89ddff; } .tok-pun { color: #8a93b8; }
.cursor::after { content: ""; display: inline-block; width: 8px; height: 17px; border-radius: 2px; background: linear-gradient(180deg, #a78bfa, #6366f1); vertical-align: -3px; margin-inline-start: 3px; animation: blink 1s steps(2) infinite; box-shadow: 0 0 10px rgba(139, 92, 246, .7); }
@keyframes blink { 50% { opacity: 0; } }
.thinking { display: inline-flex; gap: 5px; padding: 8px 2px; } .thinking i { width: 7px; height: 7px; border-radius: 50%; background: #8b7cf6; animation: bounce 1.2s infinite ease-in-out; } .thinking i:nth-child(2) { animation-delay: .15s; } .thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(.6); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }
.ai-foot { display: flex; align-items: center; gap: 4px; margin-top: 8px; color: var(--dim); font-size: 12px; flex-wrap: wrap; }
.ai-foot .icon-btn { width: 30px; height: 30px; }
.ai-foot .icon-btn.on { color: #a78bfa; background: var(--accent-soft); }
.ai-foot .time { margin-inline-start: auto; }
.applied { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.applied a { color: #a5b4fc; text-decoration: none; cursor: pointer; }
.chip-note { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); background: rgba(255, 255, 255, .04); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; }
.chip-note.warn { color: #fcd34d; border-color: rgba(245, 158, 11, .35); }
.err-card { border: 1px solid rgba(244, 63, 94, .35); background: rgba(244, 63, 94, .08); color: #fecdd3; border-radius: 12px; padding: 10px 14px; }
body.mwai-framed .welcome, body.has-titlebar .welcome { min-height: calc(100vh - 360px - 36px); }
.welcome { min-height: calc(100vh - 360px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; padding-top: 30px; }
.welcome .logo-xl { width: 72px; height: 72px; filter: drop-shadow(0 0 26px rgba(124, 92, 255, .55)); }
.welcome h1 { margin: 6px 0 0; font-size: 30px; font-weight: 650; letter-spacing: -.3px; }
.welcome h1 b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.welcome p { margin: 0; color: var(--muted); }
.suggest { display: grid; grid-template-columns: repeat(2, minmax(0, 260px)); gap: 10px; margin-top: 18px; }
.suggest button { text-align: start; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line-2); background: rgba(15, 20, 38, .7); color: var(--text-2); display: flex; gap: 10px; align-items: flex-start; transition: border-color .15s, background .15s; }
.suggest button:hover { border-color: var(--accent-line); background: rgba(124, 92, 255, .08); }
.suggest button .i { color: #a78bfa; margin-top: 2px; }
.suggest small { display: block; color: var(--dim); font-size: 12px; }

/* ---------- Composer ---------- */
.composer-wrap { position: absolute; inset-inline: 0; bottom: var(--kb, 0px); padding: 0 28px 20px; background: linear-gradient(180deg, transparent, rgba(5, 7, 15, .92) 34%); pointer-events: none; }
.composer {
  pointer-events: auto; max-width: 860px; margin: 0 auto; border-radius: 18px; padding: 12px 12px 10px;
  background: linear-gradient(180deg, rgba(17, 21, 42, .97), rgba(12, 15, 31, .97)); border: 1px solid rgba(124, 92, 255, .45);
  box-shadow: 0 0 0 1px rgba(124, 92, 255, .12), 0 0 40px rgba(99, 102, 241, .22), 0 18px 50px rgba(0, 0, 0, .5); transition: border-color .2s, box-shadow .2s;
}
.composer:focus-within { border-color: rgba(139, 112, 255, .75); box-shadow: 0 0 0 1px rgba(124, 92, 255, .25), 0 0 54px rgba(99, 102, 241, .3), 0 18px 50px rgba(0, 0, 0, .5); }
.composer textarea { width: 100%; resize: none; border: 0; outline: none; background: transparent; color: var(--text); font-size: 15px; line-height: 1.55; padding: 4px 8px 10px; max-height: 220px; min-height: 30px; unicode-bidi: plaintext; }
.composer textarea::placeholder { color: var(--dim); }
.attachments { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 6px 8px; }
.attachments:empty { display: none; }
.att { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 6px 4px 10px; border-radius: 9px; background: rgba(124, 92, 255, .12); border: 1px solid rgba(124, 92, 255, .3); color: #ddd6fe; }
.att button { border: 0; background: transparent; color: var(--muted); padding: 0 2px; display: grid; }
.tools { display: flex; align-items: center; gap: 6px; }
.tool { display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; color: var(--text-2); padding: 7px 10px; border-radius: 10px; font-size: 13.5px; transition: background .15s, color .15s; }
.tool:hover { background: rgba(255, 255, 255, .06); color: var(--text); }
.tool:disabled { opacity: .45; cursor: not-allowed; }
.tool.rec { color: #fda4af; background: rgba(244, 63, 94, .12); }
.wave { display: none; align-items: center; gap: 2px; height: 20px; margin-inline-start: 2px; cursor: pointer; opacity: .55; } /* part of the mic control (mockup); shown only when voice input works */
.wave.ready, .wave.live { display: inline-flex; } .wave.live { opacity: 1; } .wave.ready:hover { opacity: .9; }
.wave i { width: 2.5px; border-radius: 2px; background: linear-gradient(180deg, #a78bfa, #6366f1); height: 30%; }
.wave i:nth-child(1) { height: 35%; } .wave i:nth-child(2) { height: 70%; } .wave i:nth-child(3) { height: 100%; } .wave i:nth-child(4) { height: 55%; } .wave i:nth-child(5) { height: 85%; } .wave i:nth-child(6) { height: 40%; } .wave i:nth-child(7) { height: 65%; }
.wave.live i { animation: wave 0.9s ease-in-out infinite; } .wave.live i:nth-child(2n) { animation-delay: .2s; } .wave.live i:nth-child(3n) { animation-delay: .4s; }
@keyframes wave { 50% { transform: scaleY(.35); } }
.tools .grow { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .035); color: var(--text-2); padding: 7px 11px; border-radius: 10px; font-size: 13.5px; max-width: 200px; transition: border-color .15s, background .15s; }
.pill:hover { border-color: rgba(140, 150, 210, .4); background: rgba(255, 255, 255, .06); }
.pill .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill .i.sm { color: var(--muted); }
.kbd { font-family: var(--mono); font-size: 11.5px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 9px; background: rgba(255, 255, 255, .03); direction: ltr; white-space: nowrap; }
.send { width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--grad); color: #fff; box-shadow: 0 0 22px rgba(99, 102, 241, .5), inset 0 1px 0 rgba(255, 255, 255, .25); transition: transform .15s, filter .15s; flex: none; }
.send:hover { filter: brightness(1.1); } .send:active { transform: scale(.96); }
.send .i { width: 20px; height: 20px; transform: scaleX(-1); } /* paper plane points "forward" in RTL */
.send.stop { background: linear-gradient(135deg, #f43f5e, #a855f7); }
.send.stop .i { transform: none; }
.send:disabled { opacity: .5; cursor: not-allowed; }
.composer-note { text-align: center; color: var(--dim); font-size: 11.5px; margin-top: 8px; pointer-events: auto; }

/* ---------- Menus / popovers ---------- */
.menu {
  position: fixed; z-index: 60; min-width: 220px; max-width: 320px; padding: 6px; border-radius: 12px; background: rgba(16, 20, 40, .98);
  border: 1px solid var(--line-2); box-shadow: var(--shadow), 0 0 30px rgba(99, 102, 241, .12); backdrop-filter: blur(12px); direction: rtl;
  max-height: 60vh; overflow-y: auto;
}
.menu .mi { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; padding: 9px 10px; border-radius: 8px; color: var(--text-2); text-align: start; font-size: 13.5px; }
.menu .mi:hover, .menu .mi:focus { background: rgba(124, 92, 255, .14); color: var(--text); outline: none; }
.menu .mi.sel { color: var(--text); } .menu .mi.sel::after { content: "✓"; margin-inline-start: auto; color: #a78bfa; }
.menu .mi small { display: block; color: var(--dim); font-size: 11.5px; }
.menu .mi[disabled] { opacity: .45; cursor: not-allowed; }
.menu .sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu .mh { font-size: 11px; color: var(--dim); padding: 6px 10px 4px; letter-spacing: .06em; font-weight: 650; }

/* ---------- Preview panel ---------- */
.preview { display: flex; flex-direction: column; border-inline-end: 1px solid var(--line); background: linear-gradient(180deg, rgba(10, 13, 26, .96), rgba(7, 9, 19, .98)); padding: 14px 16px 16px; gap: 12px; overflow: hidden; min-width: 0; }
.shell.no-preview .preview { display: none; }
.pv-head { display: flex; align-items: center; gap: 10px; min-height: 34px; }
.pv-head h2 { margin: 0; font-size: 16px; font-weight: 650; }
.status-dot { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; }
.status-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 10px rgba(245, 158, 11, .7); }
.status-dot.ok::before { background: var(--ok); box-shadow: 0 0 10px rgba(34, 197, 94, .7); }
.pv-head .head-actions { margin-inline-start: auto; }
.pv-frame { flex: 1; min-height: 0; border-radius: 14px; border: 1px solid var(--line-2); background: #0a0d1a; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow); }
.pv-top { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); }
.pv-top .app-ic { width: 22px; height: 22px; border-radius: 6px; background: var(--grad); display: grid; place-items: center; }
.pv-top .muted { color: var(--dim); }
.pv-tabs { display: flex; gap: 4px; padding: 8px 8px 0; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); direction: ltr; }
.pv-tab { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; border: 0; background: transparent; color: var(--muted); padding: 8px 10px; border-radius: 9px 9px 0 0; font-size: 12.5px; border-bottom: 2px solid transparent; }
.pv-tab:hover { color: var(--text); }
.pv-tab.on { color: var(--text); background: rgba(124, 92, 255, .1); border-bottom-color: #8b5cf6; }
.pv-tab .i { width: 14px; height: 14px; }
.pv-tab.icon-only { margin-left: auto; padding: 8px 10px; }
.pv-body { flex: 1; min-height: 0; position: relative; overflow: hidden; }
.vm { position: absolute; inset: 0; display: flex; flex-direction: column; direction: ltr; }
.vm-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--text-2); }
.vm-bar .spec { color: var(--dim); }
.vm-bar .state { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: #fcd34d; }
.vm-bar .state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.vm-screen { flex: 1; min-height: 0; display: grid; grid-template-columns: 96px 1fr; gap: 0; filter: saturate(.95); opacity: .72; }
.vm-nav { border-right: 1px solid var(--line); padding: 10px 6px; display: flex; flex-direction: column; gap: 4px; }
.vm-nav span { font-size: 11px; color: var(--muted); padding: 6px 8px; border-radius: 7px; } .vm-nav span.on { background: rgba(124, 92, 255, .16); color: var(--text); }
.vm-main { padding: 12px; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.vm-main h4 { margin: 0; font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { border: 1px solid var(--line); background: rgba(255, 255, 255, .025); border-radius: 10px; padding: 8px; }
.stat small { display: block; color: var(--dim); font-size: 10px; } .stat b { font-size: 15px; } .stat em { display: block; font-style: normal; font-size: 10px; color: var(--ok); }
.chart { border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: rgba(255, 255, 255, .02); }
.chart svg { width: 100%; height: 110px; display: block; }
.activity { border: 1px solid var(--line); border-radius: 10px; padding: 8px; font-size: 11px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.activity div { display: flex; justify-content: space-between; }
.soon {
  position: absolute; inset: auto 14px 14px 14px; direction: rtl; border-radius: 14px; padding: 16px; text-align: center;
  background: linear-gradient(160deg, rgba(23, 27, 56, .96), rgba(14, 17, 36, .97)); border: 1px solid rgba(124, 92, 255, .4); box-shadow: 0 0 30px rgba(99, 102, 241, .2), var(--shadow);
}
.soon .tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em; padding: 3px 10px; border-radius: 999px; background: var(--grad); color: #fff; margin-bottom: 8px; }
.soon h3 { margin: 0 0 4px; font-size: 15.5px; }
.soon p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.html-preview { position: absolute; inset: 0; display: flex; flex-direction: column; }
.html-preview iframe { flex: 1; border: 0; background: #fff; }
.html-preview .empty { margin: auto; text-align: center; color: var(--muted); padding: 20px; direction: rtl; }

/* ---------- Modals ---------- */
/* feature flags off (admin): hide the entry points; the server rejects them anyway */
body[data-off~="sms"] #navSms, body[data-off~="domains"] #navDomains,
body[data-off~="voice"] #micBtn, body[data-off~="voice"] #wave,
body[data-off~="plans"] #upgradeBtn, body[data-off~="feedback"] .ai-foot [data-fb],
body[data-off~="memory"] [data-pane="memory"], body[data-off~="knowledge"] [data-pane="knowledge"], body[data-off~="devices"] [data-pane="devices"],
body[data-off~="live_preview"] .pv-tab[data-tab="html"], body[data-off~="projects"] .pv-tab[data-tab="code"],
body[data-off~="projects"] #projectsSection, body[data-off~="attachments"] #attachBtn { display: none !important; }
.maint-screen { position: fixed; inset: 0; z-index: 75; display: grid; place-items: center; background: rgba(5, 7, 15, .92); backdrop-filter: blur(8px); }
.maint-screen .card { max-width: 420px; text-align: center; padding: 28px; }

/* conversation loading / load error */
.thread-loading { display: grid; place-items: center; padding: 60px 0; }
.open-error { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 16px; }

/* confirm/form dialogs must stack above the SMS / Domains / settings modals that open them */
#dialog.overlay, #formModal.overlay { z-index: 58; }
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(3, 5, 12, .72); backdrop-filter: blur(6px); display: none; align-items: center; justify-content: center; padding: 20px; }
.overlay.open { display: flex; }
.modal { width: min(760px, 100%); max-height: min(86vh, 760px); display: flex; flex-direction: column; border-radius: var(--r-xl); background: linear-gradient(180deg, #10142a, #0b0e1e); border: 1px solid var(--line-2); box-shadow: var(--shadow), 0 0 60px rgba(99, 102, 241, .15); overflow: hidden; direction: rtl; }
.modal.sm { width: min(440px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16.5px; }
.modal-head .icon-btn { margin-inline-start: auto; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { border: 0; background: transparent; color: var(--muted); padding: 12px 12px; border-bottom: 2px solid transparent; display: inline-flex; gap: 7px; align-items: center; white-space: nowrap; }
.tab.on { color: var(--text); border-bottom-color: #8b5cf6; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12.5px; color: var(--muted); }
.input, .field input, .field textarea, .field select, select.input {
  width: 100%; background: #080b17; border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px rgba(124, 92, 255, .15); }
.row { display: flex; gap: 8px; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card { border: 1px solid var(--line-2); background: rgba(255, 255, 255, .025); border-radius: 14px; padding: 14px; }
.card h4 { margin: 0 0 8px; font-size: 14px; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 12.5px; }
.items { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.items li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); font-size: 13.5px; }
.items li .t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.plans { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.plan { border: 1px solid var(--line-2); border-radius: 14px; padding: 14px; background: rgba(255, 255, 255, .025); display: flex; flex-direction: column; gap: 6px; }
.plan.current { border-color: var(--accent-line); background: var(--grad-soft); box-shadow: 0 0 24px rgba(124, 92, 255, .15); }
.plan h4 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.plan ul { margin: 0; padding-inline-start: 18px; color: var(--text-2); font-size: 12.5px; }
.note { font-size: 12px; color: var(--dim); margin-top: 10px; }
.toggle-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; } .toggle-dot.on { background: var(--ok); box-shadow: 0 0 8px rgba(34, 197, 94, .7); }

/* ---------- Auth screen ---------- */
.auth { position: fixed; inset: 0; z-index: 70; display: none; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(800px 500px at 50% 0%, rgba(124, 92, 255, .2), transparent 60%), radial-gradient(700px 500px at 50% 110%, rgba(34, 199, 238, .1), transparent 60%), var(--bg); }
.auth.open { display: flex; }
.auth-card { width: min(410px, 100%); padding: 28px; border-radius: 22px; background: linear-gradient(180deg, rgba(18, 22, 44, .96), rgba(11, 14, 30, .97)); border: 1px solid var(--line-2); box-shadow: var(--shadow), 0 0 60px rgba(99, 102, 241, .18); direction: rtl; }
.auth-card .brand { justify-content: center; padding-bottom: 6px; }
.auth-card .lead { text-align: center; color: var(--muted); margin: 0 0 20px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 12px; background: #080b17; border: 1px solid var(--line); margin-bottom: 16px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 8px; border-radius: 9px; font-weight: 600; }
.seg button.on { background: var(--card-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.auth-card .btn-primary { width: 100%; margin-top: 6px; padding: 12px; }
.auth-err { min-height: 20px; margin-top: 10px; color: #fda4af; font-size: 13px; text-align: center; }
.auth-link { display: block; margin: 10px auto 0; background: none; border: 0; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; }
.auth-link:hover { color: var(--text); }
.auth-ok { min-height: 0; margin-top: 8px; color: #86efac; font-size: 13px; text-align: center; }
.auth-foot { text-align: center; color: var(--dim); font-size: 12px; margin-top: 14px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 80; top: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; direction: rtl; padding: 10px 16px; border-radius: 12px; background: rgba(20, 24, 48, .97); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 13.5px; animation: pop .2s ease-out; max-width: 520px; }
.toast.err { border-color: rgba(244, 63, 94, .45); color: #fecdd3; } .toast.ok { border-color: rgba(34, 197, 94, .4); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }


/* ---------- v4: project files, editor, tools, SMS, domains ---------- */
.grow { flex: 1; }
.i.starred { color: var(--gold) !important; }
.side-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.tool-link { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .025); color: var(--text-2); font-size: 13px; transition: border-color .15s, background .15s; }
.tool-link:hover { border-color: var(--accent-line); background: rgba(124, 92, 255, .08); color: var(--text); }
.tool-link .i { color: #a78bfa; }
.tree-node.active > .row .t { color: var(--text); }
.tree-node.active > .row .folder { color: #c4b5fd; }
.tree-node > .row .mini.more { opacity: 0; }
.tree-node > .row:hover .mini.more, .tree-node.open > .row .mini.more { opacity: 1; }
.tree-node > .row .chev { order: 0; }
.mini { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; border: 0; background: transparent; color: var(--dim); flex: none; }
.mini:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.frow { display: flex; align-items: center; gap: 7px; padding: 4px 8px; border-radius: 8px; color: var(--text-2); font-size: 12.8px; cursor: pointer; min-height: 27px; }
.frow:hover { background: rgba(255, 255, 255, .04); }
.frow.active { background: rgba(124, 92, 255, .16); color: var(--text); box-shadow: inset 2px 0 0 #8b5cf6; }
.frow .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; font-family: var(--mono); font-size: 12.3px; }
.frow .i { color: var(--dim); } .frow.file .i { color: #8fa0d8; } .frow .folder { color: #93a4ff; }
.frow .mini { opacity: 0; } .frow:hover .mini { opacity: 1; }
.frow.dir .chev { transition: transform .15s; } .frow.dir.open .chev { transform: rotate(-90deg); }
.tree-sep { font-size: 10.5px; color: var(--dim); letter-spacing: .08em; padding: 8px 10px 2px; font-weight: 650; }
.tree-kids .empty-note a { cursor: pointer; }
.side-section.projects .list { gap: 1px; }

.pv-src { display: flex; gap: 4px; padding: 6px 8px; border-bottom: 1px solid var(--line); direction: rtl; }
.pv-src button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 12px; padding: 4px 9px; border-radius: 8px; max-width: 50%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-src button.on { color: var(--text); background: rgba(124, 92, 255, .14); border-color: rgba(124, 92, 255, .35); }
.pv-src button:disabled { opacity: .45; cursor: not-allowed; }
.pv-view { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.pv-view iframe { flex: 1; border: 0; background: #fff; }
.pv-warn { font-size: 11px; color: #fcd34d; background: rgba(245, 158, 11, .1); border-bottom: 1px solid rgba(245, 158, 11, .25); padding: 4px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editor { position: absolute; inset: 0; display: flex; flex-direction: column; }
.ed-bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--text-2); min-height: 40px; }
.ed-bar .path { font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ed-bar .dirty { color: var(--warn); font-size: 14px; }
.ed-main { flex: 1; min-height: 0; display: flex; direction: ltr; background: #080b16; }
.ed-main .gutter { margin: 0; padding: 12px 10px 12px 8px; min-width: 44px; text-align: right; color: #3f4766; font: 12.5px/1.65 var(--mono); overflow: hidden; user-select: none; border-right: 1px solid var(--line); }
.ed-main textarea { flex: 1; border: 0; outline: none; resize: none; background: transparent; color: #d6dbf0; font: 12.5px/1.65 var(--mono); padding: 12px; white-space: pre; tab-size: 2; overflow: auto; }
.ed-image { flex: 1; display: grid; place-items: center; padding: 16px; background: repeating-conic-gradient(#0d1120 0 25%, #10152a 0 50%) 0 0 / 18px 18px; }
.ed-image img { max-width: 100%; max-height: 100%; image-rendering: auto; border-radius: 6px; box-shadow: var(--shadow); }
.btn.slim { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.input.slim { width: auto; padding: 6px 10px; font-size: 13px; max-width: 220px; }
.modal.lg { width: min(1000px, 100%); max-height: min(90vh, 860px); }
.modal-head .input.slim { margin-inline-start: auto; }
.modal-head .input.slim + .icon-btn { margin-inline-start: 4px; }
.demo-badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; color: #fde68a; background: rgba(245, 158, 11, .14); border: 1px solid rgba(245, 158, 11, .4); white-space: nowrap; cursor: help; }
.check { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-2); margin: 4px 0 10px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: #8b5cf6; }
.row.wrap { flex-wrap: wrap; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat-card { border: 1px solid var(--line-2); border-radius: 14px; padding: 14px; background: var(--grad-soft); display: flex; flex-direction: column; gap: 2px; }
.stat-card small { color: var(--muted); font-size: 12px; } .stat-card b { font-size: 26px; font-weight: 650; } .stat-card b em { font-style: normal; font-size: 14px; color: var(--muted); }
.stat-card span { color: var(--dim); font-size: 11.5px; }
h4.sec { margin: 20px 0 10px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.bundles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.bundle { border: 1px solid var(--line-2); border-radius: 14px; padding: 14px; background: rgba(255, 255, 255, .025); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bundle b { font-size: 22px; } .bundle > span { color: var(--muted); font-size: 12px; } .bundle .price { font-size: 15px; font-weight: 600; margin: 6px 0 8px; }
.chip-note.ok { color: #86efac; border-color: rgba(34, 197, 94, .35); } .chip-note.bad { color: #fda4af; border-color: rgba(244, 63, 94, .4); }
.ok-text { color: #86efac; } .bad-text { color: #fda4af; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; margin-top: 12px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: middle; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; background: rgba(255, 255, 255, .02); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td .chip-note { margin-inline-end: 4px; }
.tbl td.actions { white-space: nowrap; text-align: end; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: rgba(255, 255, 255, .025); }
.tbl td.clip { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl.dns code { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.compose { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; }
.compose-preview { display: flex; flex-direction: column; gap: 10px; }
.phone { border-radius: 26px; border: 1px solid var(--line-2); background: linear-gradient(180deg, #0e1226, #0a0d1c); padding: 14px; min-height: 230px; box-shadow: inset 0 0 0 6px rgba(255, 255, 255, .02); }
.phone-top { text-align: center; font-size: 12px; color: var(--muted); padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.phone-msg { background: #2b2f4a; color: #eef; border-radius: 16px 16px 16px 4px; padding: 10px 12px; font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 92%; unicode-bidi: plaintext; }
.seg-info { display: flex; flex-wrap: wrap; gap: 5px; }
.violations { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; }
.violations li { padding: 7px 10px; border-radius: 9px; border: 1px solid rgba(244, 63, 94, .3); background: rgba(244, 63, 94, .07); color: #fecdd3; }
.violations li.ok { border-color: rgba(34, 197, 94, .3); background: rgba(34, 197, 94, .07); color: #bbf7d0; }
.dom-card { margin-top: 12px; }
.verify-out:not(:empty) { margin-top: 8px; }
.empty-state { text-align: center; padding: 30px; color: var(--muted); }
.dropzone { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; background: rgba(5, 7, 15, .72); backdrop-filter: blur(4px); pointer-events: none; }
.dropzone.open { display: flex; }
.dz-card { border: 2px dashed rgba(139, 92, 246, .7); border-radius: 22px; padding: 34px 44px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; background: rgba(16, 20, 42, .9); box-shadow: 0 0 60px rgba(124, 92, 255, .25); max-width: 520px; direction: rtl; }
.dz-card .i { width: 40px; height: 40px; color: #a78bfa; } .dz-card b { font-size: 18px; } .dz-card span { color: var(--muted); font-size: 13px; }
.toast.progress { display: flex; align-items: center; gap: 10px; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(167, 139, 250, .3); border-top-color: #a78bfa; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.att.img { padding: 3px 6px 3px 3px; }
.att.img img { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; }
.att.busy { opacity: .6; }
.bubble-imgs { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.bubble-imgs img { width: 120px; height: 90px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line-2); cursor: zoom-in; background: #0b0f1d; }
.code-actions { display: inline-flex; gap: 2px; }
button.kbd { cursor: pointer; } button.kbd:hover { color: var(--text); border-color: var(--accent-line); }
.modal-body > .field:last-child { margin-bottom: 0; }
@media (max-width: 820px) {
  .grid3, .bundles, .grid2 { grid-template-columns: 1fr; }
  .compose { grid-template-columns: 1fr; }
  .code-actions .code-copy span { display: none; }
}

/* ---------- Responsive ---------- */
.scrim { display: none; }
@media (max-width: 1280px) {
  .shell { grid-template-columns: 264px minmax(0, 1fr) 360px; }
  .shell.no-preview { grid-template-columns: 264px minmax(0, 1fr) 0; }
  .kbd { display: none; }
}
@media (max-width: 1100px) {
  .shell, .shell.no-preview { grid-template-columns: 264px minmax(0, 1fr); }
  .preview { position: fixed; top: 0; bottom: 0; right: 0; width: min(420px, 92vw); z-index: 40; box-shadow: var(--shadow); }
  .shell.no-preview .preview { display: none; }
}
@media (max-width: 820px) {
  html, body { overflow-x: hidden; max-width: 100vw; }
  .shell, .shell.no-preview {
    grid-template-columns: minmax(0, 1fr);
    width: 100%; max-width: 100vw; overflow-x: hidden;
  }
  .chat {
    width: 100%; max-width: 100vw; min-width: 0;
    overflow-x: hidden; position: relative;
  }
  /* Drawer: physical right edge in our RTL app; fully off-canvas when closed */
  .sidebar {
    position: fixed !important;
    top: 0; bottom: 0;
    right: 0; left: auto;
    width: min(300px, 86vw);
    max-width: 86vw;
    z-index: 60;
    transform: translate3d(100%, 0, 0);
    transition: transform .22s ease;
    box-shadow: var(--shadow);
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    will-change: transform;
  }
  html[dir="ltr"] .sidebar {
    left: 0; right: auto;
    transform: translate3d(-100%, 0, 0);
  }
  .shell.side-open .sidebar,
  html[dir="ltr"] .shell.side-open .sidebar {
    transform: translate3d(0, 0, 0);
  }
  /* Backdrop only when drawer open (not when preview open) */
  .scrim { display: none; }
  .shell.side-open .scrim {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: rgba(0, 0, 0, .55);
  }
  .mobile-only { display: inline-grid !important; }
  .log {
    padding: 18px 14px calc(180px + env(safe-area-inset-bottom, 0px));
    overflow-x: hidden; max-width: 100%;
  }
  .composer-wrap {
    padding: 0 8px calc(8px + env(safe-area-inset-bottom, 0px));
    padding-inline: max(8px, env(safe-area-inset-left, 0px)) max(8px, env(safe-area-inset-right, 0px));
    max-width: 100vw; box-sizing: border-box;
  }
  .composer {
    max-width: 100%; width: 100%; box-sizing: border-box;
    padding: 10px 10px 8px; border-radius: 16px;
  }
  .composer textarea {
    font-size: 16px; box-sizing: border-box; width: 100%;
    max-width: 100%;
  }
  /* Compact phone tools: primary row only; extras in + menu */
  .tools {
    display: flex; align-items: center; gap: 4px;
    flex-wrap: nowrap; max-width: 100%; overflow: hidden;
  }
  .tools .grow { display: none; }
  .tool .lbl, .pill .lbl { display: none; }
  .wave, .kbd { display: none !important; }
  .tool, .pill, .icon-btn, .send, .mini {
    min-height: 44px; min-width: 44px; flex: none;
  }
  .tool, .pill { padding: 8px; }
  .send { width: 46px; height: 46px; margin-inline-start: auto; }
  /* Hide less-used on phone; shown via #moreToolsBtn menu */
  .tools .phone-hide { display: none !important; }
  .slash-menu {
    max-height: min(50vh, 320px);
    inset-inline: 6px;
    bottom: calc(100% + 4px);
    max-width: calc(100vw - 24px);
  }
  .slash-item { min-height: 48px; padding: 12px; }
  .chat-head {
    padding: calc(10px + env(safe-area-inset-top, 0px)) 10px 10px;
    gap: 6px; max-width: 100%; overflow: hidden;
  }
  .title-btn { min-width: 0; flex: 1 1 auto; overflow: hidden; }
  .title-btn .t {
    max-width: none; width: 100%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    display: block;
  }
  .head-actions { flex: none; }
  .welcome { min-height: auto; padding: 10px 4px; max-width: 100%; overflow: hidden; }
  .welcome h1 { font-size: 22px; overflow-wrap: anywhere; }
  .suggest { grid-template-columns: 1fr; }
  .msg-user { max-width: 90%; }
  /* Preview bottom sheet */
  .preview {
    display: flex !important;
    position: fixed !important;
    left: 0; right: 0; top: auto !important;
    bottom: 0; width: 100% !important; max-width: none !important;
    height: min(88vh, 100%);
    z-index: 50; border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 40px rgba(0,0,0,.5);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transform: translateY(105%); transition: transform .22s ease;
  }
  .shell:not(.no-preview) .preview { transform: none; visibility: visible; }
  .shell.no-preview .preview {
    display: flex !important; transform: translateY(105%);
    pointer-events: none; visibility: hidden;
  }
  body.editor-fs .sidebar,
  body.editor-fs .composer-wrap,
  body.editor-fs .chat-head,
  body.editor-fs .log { display: none !important; }
  body.editor-fs .preview {
    top: 0 !important; height: 100% !important; border-radius: 0;
    transform: none !important; z-index: 70; visibility: visible !important;
  }
  body.editor-fs .shell { grid-template-columns: minmax(0,1fr) !important; }
}

/* ---------- v4 mockup layout: preview window card, machine bar, workspaces, compact plan ---------- */
.pv-frame { background: rgba(12, 15, 30, .9); padding: 0 10px 10px; gap: 0; }
.pv-top { border-bottom: 0; padding: 10px 4px; }
.pv-top #pvProject { color: var(--text); font-weight: 600; }
.pv-win { flex: 1; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: 12px; background: #0a0d1a; overflow: hidden; }
.pv-win .pv-tabs { align-items: center; padding: 6px 6px 0; }
.pv-win .pv-tabs .grow { flex: 1; }
.pv-win .win-btn { width: 26px; height: 26px; }
.pv-win.min .pv-mbar, .pv-win.min .pv-body { display: none; }
.pv-win.min { flex: 0 0 auto; }
.pv-tab.os.win .i { color: #60a5fa; } .pv-tab.os.lin .i { color: #fbbf24; } .pv-tab.os.mac .i { color: #e5e7eb; }
.pv-mbar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--text-2); min-height: 34px; }
.pv-mbar .mb-l { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-mbar .grow { flex: 1; }
.pv-mbar .mb-state { font-size: 11.5px; color: #fcd34d; white-space: nowrap; }
.pv-mbar .mb-state.ok { color: var(--ok); }
.pv-mbar .icon-btn { width: 26px; height: 26px; }
.pv-run.err::before { background: var(--err, #ef4444); box-shadow: none; }
.vm .soon { position: static; margin: auto 16px; }
.vm .soon > .i { display: block; margin: 0 auto 8px; width: 34px; height: 34px; opacity: .8; }
.vm { justify-content: center; }
#dlgText { white-space: pre-line; }
.ws-group { margin-bottom: 4px; }
.ws-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 10px; cursor: pointer; }
.ws-row:hover { background: rgba(255, 255, 255, .04); }
.ws-row .chev { transition: transform .15s; color: var(--dim); }
.ws-group.open > .ws-row .chev { transform: rotate(-90deg); }
.ws-row .ws-ic { width: 26px; height: 26px; border-radius: 8px; background: var(--grad); display: grid; place-items: center; color: #fff; flex: none; }
.ws-row .ws-ic .i { stroke: #fff; }
.ws-row .t { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.ws-row .t b { font-size: 13px; font-weight: 600; } .ws-row .t small { font-size: 11px; color: var(--dim); }
.ws-kids { padding-inline-start: 14px; border-inline-start: 1px solid var(--line); margin-inline-start: 20px; }
.applied { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--ok); background: rgba(34, 197, 94, .08); border: 1px solid rgba(34, 197, 94, .25); padding: 4px 10px; border-radius: 999px; cursor: pointer; }
.applied code { color: var(--text-2); }
.plan-card.compact { cursor: pointer; padding: 10px 12px; }
.plan-card.compact .meter, .plan-card.compact .plan-actions { display: none; }
.plan-card.compact .plan-top { margin: 0; }
.plan-card.compact:hover { border-color: rgba(124, 92, 255, .45); }
.crown-btn { margin-inline-start: auto; }
body[data-off~="plans"] #crownBtn { display: none !important; }
.applied-list { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }

/* ---------- v5 main-screen fix (design/main-screen-fix-spec.md): navy palette, 20%/flex/34% grid, framed preview ---------- */
body:not(.admin-page) {
  --bg: #000c18; --bg-2: #06111c; --panel: #0a1828; --panel-solid: #0a1828;
  --card: #0a1828; --card-2: #0d1d30; --line: #15263a; --line-2: #1c3149;
  background: #09131d;
}
body:not(.admin-page) .sidebar { background: #000c18; border-inline-start: 1px solid #15263a; }
body:not(.admin-page) .chat { background: #09131d; }
body:not(.admin-page) .preview { background: #000c18; border-inline-end: 1px solid #15263a; }
body:not(.admin-page) .pv-frame { background: #0a1828; border: 1px solid #15263a; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
body:not(.admin-page) .pv-win { background: #071321; border-color: #1c3149; }
body:not(.admin-page) .code-card { background: #06111d; border-color: #1c3149; }
body:not(.admin-page) .composer, body:not(.admin-page) .plan-card, body:not(.admin-page) .suggest button:not(:hover) { background-color: #0a1828; border-color: #15263a; }
body:not(.admin-page) input, body:not(.admin-page) textarea, body:not(.admin-page) select, body:not(.admin-page) .seg { background-color: #06111c; }
body:not(.admin-page) .pv-mbar .mb-tool.on { color: #c4b5fd; background: var(--accent-soft); }
body[data-off~="projects"] #pvCodeBtn { display: none; }
@media (min-width: 1101px) {
  .shell { grid-template-columns: 20% minmax(0, 1fr) max(420px, 34%); }
  .shell.no-preview { grid-template-columns: 20% minmax(0, 1fr) 0; }
}

/* ---------- v6: image generation, provider note, web citations ---------- */
body[data-off~="image_gen"] #imgModeBtn, body[data-off~="web_search"] #webBtn { display: none !important; }
.tool.on { color: #c4b5fd; background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.gen-wait { display: inline-flex; align-items: center; gap: 10px; padding: 14px 16px; border: 1px dashed var(--line-2); border-radius: 12px; color: var(--text-2); }
.gen-images { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0 4px; }
.gen-img { margin: 0; width: min(100%, 360px); border: 1px solid var(--line-2); border-radius: 14px; overflow: hidden; background: #06111c; }
.gen-frame { aspect-ratio: 1 / 1; display: grid; place-items: center; }
.gen-frame img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.gen-img figcaption { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line); font-size: 12px; }
.gen-img figcaption .muted { color: var(--dim); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: start; }
.gen-img .demo-badge { flex: 1; }
.mini-btn { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line-2); background: transparent; color: var(--text-2); border-radius: 8px; padding: 4px 8px; font-size: 12px; cursor: pointer; }
.mini-btn:hover { border-color: var(--accent-line); color: #fff; }
.ai-note { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; color: #fcd34d; background: rgba(252, 211, 77, .07); border: 1px solid rgba(252, 211, 77, .22); padding: 3px 10px; border-radius: 999px; }
.cites { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.cites a { color: #93c5fd; text-decoration: none; border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 9px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cites a:hover { border-color: #93c5fd; }

/* ---------- v7: announcements, notification badge, 2FA, support tickets ---------- */
.ann-bar { position: fixed; bottom: 16px; left: 16px; z-index: 40; width: min(380px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 6px; }
.ann { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 12px; background: rgba(16, 22, 44, .96); border: 1px solid rgba(124, 92, 255, .45); box-shadow: 0 10px 30px rgba(0, 0, 0, .45); font-size: 13px; }
.ann.warning { border-color: rgba(245, 158, 11, .55); } .ann.success { border-color: rgba(34, 197, 94, .5); }
.ann b { display: block; } .ann .t { flex: 1; min-width: 0; } .ann .t span { color: var(--muted, #9aa3c7); }
.nbadge { position: absolute; top: -4px; left: -4px; min-width: 16px; height: 16px; border-radius: 8px; background: #ef4444; color: #fff; font-size: 10px; line-height: 16px; padding: 0 4px; font-family: Inter, sans-serif; }
.nbadge.in { position: static; display: inline-block; margin-inline-start: 6px; }
.nbadge[hidden] { display: none; }
.tfa-qr { background: #fff; padding: 6px; border-radius: 8px; line-height: 0; display: inline-block; }
.codes { font-family: ui-monospace, Consolas, monospace; direction: ltr; display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 16px; padding: 10px; border-radius: 10px; background: rgba(0, 0, 0, .3); }
.tmsg { padding: 8px 12px; border-radius: 10px; margin: 6px 0; white-space: pre-wrap; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .08); }
.tmsg.staff { background: rgba(124, 92, 255, .12); border-color: rgba(124, 92, 255, .35); }
.tmsg small { display: block; opacity: .65; font-size: 11px; margin-bottom: 3px; }
.items li.unread .t { font-weight: 600; }
.avatar.has-n { position: relative; } .avatar.has-n::after { content: ''; position: absolute; top: -2px; inset-inline-end: -2px; width: 10px; height: 10px; border-radius: 50%; background: #f43f5e; border: 2px solid #0b1020; }
.tfa-qr { display: inline-block; background: #fff; padding: 8px; border-radius: 10px; line-height: 0; } .tfa-qr svg { width: 160px; height: 160px; display: block; }
/* v8: cloud VM (Linux tab) */
.spinner { display: inline-block; width: 22px; height: 22px; border: 2.5px solid rgba(255, 255, 255, .15); border-top-color: #8b5cf6; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; margin-inline-end: 8px; }
.spinner.sm { width: 13px; height: 13px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.vm .vm-screen { position: absolute; inset: 0; display: block; background: #05070d; overflow: hidden; opacity: 1; filter: none; }
.vm .vm-screen > div:not(.vm-connecting) { width: 100%; height: 100%; }
.vm-connecting { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted, #9aa3c7); font-size: 13px; direction: rtl; }
.vm-demo { display: flex; gap: 8px; align-items: flex-start; text-align: start; margin: 10px auto; max-width: 420px; padding: 9px 12px; border-radius: 10px; font-size: 12.5px; color: #fcd34d; background: rgba(245, 158, 11, .08); border: 1px solid rgba(245, 158, 11, .35); }
.vm-start { direction: rtl; }
.vm-start .btn { margin: 6px auto; }
.btn.sm { padding: 4px 10px; font-size: 12px; }

/* v10 store builds */
.bld-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.bld-kind { text-align: start; cursor: pointer; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .025); border-radius: 14px; padding: 12px; color: var(--text); font: inherit; }
.bld-kind.on { border-color: rgba(129, 140, 248, .8); background: rgba(99, 102, 241, .12); box-shadow: 0 0 0 1px rgba(129, 140, 248, .35) inset; }
.bld-kind[disabled] { opacity: .45; cursor: not-allowed; }
.bld-kind b { display: block; font-size: 13.5px; margin-bottom: 4px; }
.bld-kind small { color: var(--muted); font-size: 11.5px; }
.bld-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.bld-form label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.bld-log { direction: ltr; text-align: left; background: #05070f; border: 1px solid var(--line); border-radius: 10px; padding: 10px; height: 260px; overflow: auto; font: 11.5px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; color: #cbd5e1; white-space: pre-wrap; word-break: break-all; margin: 8px 0 0; }
.bld-list .bld-row { display: flex; align-items: center; gap: 8px; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.bld-list .bld-row:hover { background: rgba(255, 255, 255, .03); }
.bld-list .bld-row.on { background: rgba(99, 102, 241, .1); }
.bld-stores { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.bld-stores ul { margin: 6px 0 0; padding-inline-start: 18px; font-size: 12px; color: var(--muted); }
@media (max-width: 760px) { .bld-grid, .bld-stores { grid-template-columns: 1fr; } .bld-form { grid-template-columns: 1fr 1fr; } }
.demo-badge[hidden] { display: none; } /* v10: the hidden attribute lost against display:inline-flex (domains + builds headers) */

/* v11 AI build-fix loop */
.fix-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fix-mode { display: block; border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.fix-mode input { margin-inline-end: 6px; }
.fix-mode small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.fix-mode.off { opacity: .45; }
.fix-head, .fix-att { margin-top: 10px; }
.fix-why { margin: 8px 0 4px; font-size: 13px; line-height: 1.55; }
.fix-file { margin-top: 6px; }
.fix-file summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
.fix-diff { direction: ltr; text-align: left; background: #05070f; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; max-height: 320px; overflow: auto; font: 11.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; color: #cbd5e1; margin: 6px 0 0; white-space: pre; }
.fix-diff .da { color: #86efac; background: rgba(34, 197, 94, .1); display: inline-block; min-width: 100%; }
.fix-diff .dd { color: #fca5a5; background: rgba(239, 68, 68, .1); display: inline-block; min-width: 100%; }
.fix-diff .dm { color: #a5b4fc; }
.fix-diff .dh { color: #94a3b8; font-weight: 600; }
.bld-log.fix-short { height: auto; max-height: 200px; }
.spinner.sm { width: 14px; height: 14px; border-width: 2px; margin: 0; }
@media (max-width: 760px) { .fix-modes { grid-template-columns: 1fr; } }
/* v11 checkpoints */
.cp-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 12px; min-height: 360px; }
.cp-list { display: flex; flex-direction: column; gap: 6px; max-height: 520px; overflow: auto; }
.cp-row { text-align: start; border: 1px solid var(--line); background: rgba(255, 255, 255, .02); border-radius: 10px; padding: 8px 10px; color: var(--text); font: inherit; cursor: pointer; }
.cp-row.on { border-color: rgba(129, 140, 248, .8); background: rgba(99, 102, 241, .12); }
.cp-row .row { gap: 6px; }
.cp-label { font-size: 12.5px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-detail { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; max-height: 520px; overflow: auto; }
@media (max-width: 760px) { .cp-wrap { grid-template-columns: 1fr; } }
.composer-note { cursor: help; }
.composer-note.warn { color: #fbbf24; }
.est-line { font-size: 12px; color: var(--muted); }
.est-line b { color: var(--text); }
/* v12: unit tests + runtime errors */
.t-list { padding: 6px 10px; }
.t-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 7px 4px; border-bottom: 1px solid var(--line); }
.t-row:last-child { border-bottom: 0; }
.t-ic { width: 18px; text-align: center; font-weight: 700; }
.t-row.ok .t-ic { color: #34d399; } .t-row.bad .t-ic { color: #f87171; }
.t-err { flex-basis: 100%; margin: 4px 0 0; padding: 8px; background: rgba(248,113,113,.08); border-radius: 8px; font-size: 11.5px; white-space: pre-wrap; color: #fca5a5; }
.rt-chip { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; border: 1px solid rgba(248,113,113,.5); color: #fca5a5; background: rgba(248,113,113,.1); border-radius: 999px; padding: 1px 8px; font-size: 11.5px; cursor: pointer; margin-inline-end: 6px; }
.rt-chip.ok { border-color: rgba(52,211,153,.4); color: #6ee7b7; background: rgba(52,211,153,.08); cursor: default; }
.rt-list { max-height: 260px; overflow: auto; }
.rt-ev { font-size: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.rt-ev code { font-size: 11px; }
.mon-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0 8px; }
.mon-kpis div { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.mon-kpis b { display: block; font-size: 18px; }
.mon-kpis span { font-size: 11.5px; color: var(--muted); }
.mon-bars { display: flex; gap: 2px; align-items: flex-end; height: 26px; margin: 6px 0; direction: ltr; }
.mon-bar { flex: 0 0 6px; height: 100%; border-radius: 2px; background: #34d399; opacity: .85; }
.mon-bar.bad { background: #f87171; }

/* v13: multi-file change review */
.chg-list { display: flex; flex-direction: column; gap: 6px; max-height: 58vh; overflow: auto; }
.chg-file { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; background: rgba(255,255,255,.02); }
.chg-file.same { opacity: .55; }
.chg-file summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; font-size: 13px; }
.chg-file summary::-webkit-details-marker { display: none; }
.chg-file .grow { flex: 1; }
.chg-file .fix-diff { max-height: 260px; }

/* v13: AI tasks */
.tk-steps { display: flex; flex-direction: column; gap: 6px; }
.tk-step { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: rgba(255,255,255,.02); }
.tk-step .tk-n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: rgba(139,92,246,.18); color: #c4b5fd; flex: none; }
.tk-step.done .tk-n { background: rgba(34,197,94,.18); color: #86efac; }
.tk-step.failed { border-color: rgba(244,63,94,.4); }
.tk-step.working, .tk-step.review { border-color: rgba(245,158,11,.4); }
.tk-step .tk-t { flex: 1; min-width: 160px; }
.tk-step .tk-title { flex: 1; min-width: 200px; }
.tk-step .tk-detail { flex-basis: 100%; padding-inline-start: 30px; }
.tk-step [data-up] svg { transform: rotate(180deg); }
.tk-run { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 10px; padding: 10px; border: 1px dashed var(--line); border-radius: 10px; }
.tk-progress { height: 6px; border-radius: 6px; background: rgba(255,255,255,.07); overflow: hidden; margin: 4px 0 10px; }
.tk-progress span { display: block; height: 100%; background: linear-gradient(90deg, #8b5cf6, #22c55e); transition: width .3s; }
.tk-report { margin-top: 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(34,197,94,.35); background: rgba(34,197,94,.06); }
/* v13: VM control panel (AI operator, terminal, screenshot, files, log) */
.vmc { position: fixed; top: 64px; bottom: 14px; left: 14px; width: min(440px, calc(100vw - 28px)); z-index: 60; display: none; flex-direction: column; background: var(--bg-2, #0d1626); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.vmc.open { display: flex; }
.vmc-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.vmc-tabs { display: flex; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--line); }
.vmc-tabs button { background: none; border: 0; color: var(--muted); padding: 6px 10px; font: inherit; font-size: 13px; border-bottom: 2px solid transparent; cursor: pointer; }
.vmc-tabs button.on { color: var(--text, #fff); border-bottom-color: var(--accent, #7c5cff); }
.vmc-body { flex: 1; overflow: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.vmc-sec { display: flex; flex-direction: column; gap: 6px; }
.vmc-goal { font-weight: 600; margin: 4px 0; }
.vmc-step { border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.vmc-step.skipped { opacity: .6; }
.vmc-cmd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: rgba(0, 0, 0, .35); border-radius: 6px; padding: 4px 8px; text-align: left; overflow-wrap: anywhere; }
.vmc-out { margin: 0; max-height: 220px; overflow: auto; font-size: 12px; background: #05080f; color: #d1fae5; border-radius: 6px; padding: 6px 8px; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; }
.vmc-prop { border: 1px solid var(--accent-line, #7c5cff); border-radius: 10px; padding: 10px; background: rgba(124, 92, 255, .08); }
.vmc-prop.risky { border-color: rgba(244, 63, 94, .6); background: rgba(244, 63, 94, .08); }
.vmc-sum { border: 1px solid rgba(34, 197, 94, .4); border-radius: 10px; padding: 10px; background: rgba(34, 197, 94, .06); }
.vmc-shot { width: 100%; border-radius: 8px; border: 1px solid var(--line); margin-top: 6px; }
.vmc-log { border-bottom: 1px solid var(--line); padding: 6px 0; }
/* v15: owner / staff-test free access badge */
.free-badge{display:inline-block;padding:2px 8px;border-radius:999px;background:rgba(245,180,60,.16);color:#ffcf7a;border:1px solid rgba(245,180,60,.45);font-size:11.5px;font-weight:600;white-space:nowrap}
.free-badge.top{margin-inline-start:10px;align-self:center}
.demo-why{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.demo-why a{color:#9ec5ff;text-decoration:underline}

/* v16: AI on my computer panel */
.desk-run{position:fixed;bottom:16px;left:16px;width:420px;max-height:70vh;overflow:auto;z-index:70;background:#0f1729;border:1px solid #2a3a5e;border-radius:14px;padding:12px 14px;box-shadow:0 10px 40px rgba(0,0,0,.5)}
.desk-run .dr-hd{display:flex;align-items:center;gap:8px;margin-bottom:6px}.desk-run .grow{flex:1}
.dr-st{font-size:11.5px;padding:2px 8px;border-radius:999px;border:1px solid #33456b}.dr-st.a{color:#ffd58a;border-color:#7a5a1d}.dr-st.g{color:#86efac;border-color:#1f6b3a}.dr-st.r{color:#fca5a5;border-color:#7f1d1d}
.dr-goal{color:#cbd5e1;font-size:13px;margin-bottom:6px}.dr-steps{margin:0;padding-inline-start:18px}.dr-steps li{margin:6px 0;font-size:13px}.dr-steps .mono{font-family:Consolas,monospace;color:#93a4c3;word-break:break-all}
.dr-steps .ok{color:#86efac}.dr-steps .bad{color:#fca5a5}.dr-steps .warn{color:#ffd58a}.dr-steps li.pend{opacity:.9}.dr-msg{color:#ffd58a;margin:6px 0}.dr-sum{background:#0b1324;border:1px solid #22304d;border-radius:8px;padding:8px;margin-top:6px;font-size:13px;white-space:pre-wrap}


/* v18 slash autocomplete */
.composer { position: relative; }
.slash-menu {
  position: absolute; inset-inline: 10px; bottom: calc(100% - 4px);
  max-height: 280px; overflow: auto; z-index: 40;
  background: #0c1524; border: 1px solid #2a3b55; border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.45); padding: 6px; pointer-events: auto;
}
.slash-menu[hidden] { display: none !important; }
.slash-item {
  display: flex; gap: 10px; align-items: flex-start; width: 100%;
  text-align: start; border: 0; background: transparent; color: var(--text);
  padding: 8px 10px; border-radius: 8px; cursor: pointer; font: inherit;
}
.slash-item:hover, .slash-item.active { background: rgba(124, 92, 255, .18); }
.slash-item .sc { font-weight: 700; color: #a78bfa; min-width: 72px; direction: ltr; text-align: left; }
.slash-item .sd { flex: 1; font-size: 12.5px; color: var(--dim); line-height: 1.35; }
.slash-item .sl { font-size: 12px; color: #c4b5fd; margin-inline-start: auto; }

/* settings-tabs-scroll */
#settings .tabs, .settings-modal .tabs, #settings .tabbar {
  display: flex; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
  gap: 4px; max-width: 100%;
}
#settings .tabs .tab, #settings .tab { flex: none; white-space: nowrap; }

/* —— v19 Design Studio —— */
.design-overlay { z-index: 80; display: flex; align-items: stretch; justify-content: stretch; padding: 0; background: rgba(2,6,14,.72); backdrop-filter: blur(8px); }
.design-overlay[hidden] { display: none !important; }
.design-shell { display: flex; flex-direction: column; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border-radius: 0; background: var(--bg, #05070f); color: var(--fg, #e2e8f0); }
.design-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid rgba(148,163,184,.18); flex-wrap: wrap; }
.design-head h3 { margin: 0; font-size: 16px; }
.design-select { max-width: 140px; padding: 6px 8px; font-size: 13px; }
.design-body { display: grid; grid-template-columns: 88px 1fr minmax(200px, 240px); flex: 1; min-height: 0; }
.design-tools { display: flex; flex-direction: column; gap: 6px; padding: 10px 8px; border-inline-end: 1px solid rgba(148,163,184,.15); overflow: auto; }
.design-tools .dtool { width: 44px; height: 44px; border-radius: 12px; border: 1px solid rgba(148,163,184,.2); background: rgba(15,23,42,.6); color: inherit; font-size: 18px; cursor: pointer; }
.design-tools .dtool.on, .design-tools .dtool:hover { border-color: #6366f1; background: rgba(99,102,241,.18); }
.design-tools hr { border: 0; border-top: 1px solid rgba(148,163,184,.15); margin: 6px 0; }
.design-tools .dcolor { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: #94a3b8; align-items: center; }
.design-tools .dcolor input { width: 44px; height: 32px; border: 0; padding: 0; background: transparent; }
.design-tools .btn.block { width: 100%; font-size: 12px; padding: 8px 4px; }
.design-canvas-wrap { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.design-prompt-row { padding: 8px 12px; }
.design-stage { flex: 1; overflow: auto; display: grid; place-items: center; padding: 16px; background:
  linear-gradient(45deg, #0b1220 25%, transparent 25%),
  linear-gradient(-45deg, #0b1220 25%, transparent 25%),
  linear-gradient(45deg, transparent 75%, #0b1220 75%),
  linear-gradient(-45deg, transparent 75%, #0b1220 75%);
  background-size: 24px 24px; background-position: 0 0, 0 12px, 12px -12px, -12px 0; background-color: #020617; }
#designSvg { max-width: 100%; height: auto; background: #0f172a; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.45); touch-action: none; }
.design-status { padding: 6px 12px; font-size: 12px; color: #94a3b8; border-top: 1px solid rgba(148,163,184,.12); }
.design-layers { border-inline-start: 1px solid rgba(148,163,184,.15); padding: 10px; overflow: auto; min-height: 0; }
.design-layer-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.design-layer-list li { display: flex; align-items: center; gap: 6px; padding: 8px; border-radius: 10px; background: rgba(15,23,42,.55); border: 1px solid transparent; cursor: pointer; font-size: 13px; }
.design-layer-list li.on { border-color: #6366f1; background: rgba(99,102,241,.15); }
.design-layer-list li .vis { width: 22px; text-align: center; opacity: .7; }
.design-critique { margin-top: 8px; font-size: 11px; line-height: 1.35; color: #cbd5e1; background: rgba(15,23,42,.7); border-radius: 10px; padding: 8px; max-height: 160px; overflow: auto; }

@media (max-width: 820px) {
  .design-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .design-tools { flex-direction: row; flex-wrap: wrap; align-items: center; border-inline-end: 0; border-bottom: 1px solid rgba(148,163,184,.15); max-height: none; }
  .design-tools .btn.block { width: auto; flex: 1; }
  .design-tools hr { display: none; }
  .design-layers { border-inline-start: 0; border-top: 1px solid rgba(148,163,184,.15); max-height: 34vh; }
  .design-head .design-select { max-width: 110px; }
  .design-stage { padding: 8px; }
}

/* v19b UI fixes */
.design-tools .dtool { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 64px; height: auto; min-height: 48px; padding: 6px 4px; }
.design-tools .dtool .dico { font-size: 16px; line-height: 1; }
.design-tools .dtool .dlbl { font-size: 10px; color: #94a3b8; line-height: 1.1; }
.design-tools .dcolor .dlbl { font-size: 10px; }
.design-fmt-note { margin-top: 10px; padding: 10px; border-radius: 12px; background: rgba(15,23,42,.65); border: 1px solid rgba(148,163,184,.15); overflow-wrap: anywhere; word-break: break-word; }
.design-fmt-note .fmt-title { font-size: 12px; font-weight: 700; margin-bottom: 6px; color: #e2e8f0; }
.design-fmt-note .fmt-list { margin: 0; padding: 0 0 0 1.1em; font-size: 11px; line-height: 1.45; color: #94a3b8; }
.design-fmt-note .fmt-list .warn { color: #fbbf24; }
.design-layers { overflow-x: hidden; }
.design-variant-strip { display: flex; gap: 8px; padding: 0 12px 8px; overflow-x: auto; }
.design-variant-strip[hidden] { display: none !important; }
.design-variant-strip .vcard { flex: 0 0 auto; width: 88px; border-radius: 10px; border: 2px solid transparent; background: #0f172a; cursor: pointer; padding: 4px; text-align: center; }
.design-variant-strip .vcard.on { border-color: #22c7ee; }
.design-variant-strip .vcard img { width: 80px; height: 80px; object-fit: contain; border-radius: 6px; background: #020617; }
.design-variant-strip .vcard .vs { font-size: 10px; color: #94a3b8; }
@media (max-width: 820px) {
  .design-tools .dtool { width: auto; min-width: 56px; flex-direction: column; }
  .design-fmt-note { margin: 8px; }
}

/* v19 / desktop-parity modern thin scrollbar (RTL-safe) */
* { scrollbar-width: thin; scrollbar-color: #475569 #05070f; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #475569; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #64748b; background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* v19.2 F9: composer tools never overflow (sidebar at 900px, or preview panel open at any width).
   Container queries follow the COMPOSER width, not the viewport. */
.composer { container-type: inline-size; container-name: composer; }
.tools { min-width: 0; }
.tool .lbl { white-space: nowrap; }
.tools .pill { min-width: 0; flex-shrink: 1; }
#securityScanBtn { flex: none; }
@container composer (max-width: 820px) { #securityScanBtn .lbl, .tools .kbd { display: none; } .tools .pill { max-width: 150px; } }
@container composer (max-width: 600px) { .tool .lbl { display: none; } .tools .pill { max-width: 120px; } }

/* v21.1 checkout */
.pay-sum { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: rgba(255, 255, 255, .03); margin-bottom: 12px; }
.pay-sum span { font-variant-numeric: tabular-nums; font-weight: 600; }
.pay-methods { display: flex; flex-direction: column; gap: 8px; }
.pay-method { display: flex; align-items: center; gap: 12px; width: 100%; text-align: start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: transparent; color: inherit; cursor: pointer; font: inherit; }
.pay-method:hover, .pay-method:focus-visible { border-color: var(--accent, #7c5cff); background: rgba(124, 92, 255, .08); outline: none; }
.pay-method img, .pay-link img { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; flex: none; }
.pay-method span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pay-method small { color: var(--muted, #94a3b8); font-size: 12px; }
.pay-box { white-space: pre-line; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, .04); border: 1px dashed var(--line-2); margin: 8px 0 12px; font-size: 13px; }
.pay-link { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line-2); text-decoration: none; color: inherit; font-weight: 600; margin-top: 6px; }
.pay-link:hover { border-color: var(--accent, #7c5cff); }
.pay-done { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 12px 0; }
.pay-done p { margin: 0; color: var(--muted, #94a3b8); }
.lbl { display: block; font-size: 12px; color: var(--muted, #94a3b8); margin: 8px 0 4px; }

/* v22.3 code search */
.code-hit { margin-bottom: 10px; }
.code-snip { margin: 8px 0 0; max-height: 220px; overflow: auto; background: var(--panel-solid, #0b0f1d); border-radius: 8px; padding: 10px; font-family: var(--mono); font-size: 12px; text-align: left; white-space: pre; }

/* v22.4: "new version" bar */
.update-bar { position: fixed; z-index: 9999; inset-inline: 0; margin: 0 auto; bottom: 18px; width: max-content; max-width: calc(100% - 32px); display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 8px 14px; border-radius: 14px; background: rgba(20, 24, 38, .96); border: 1px solid rgba(139, 92, 246, .45); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); color: #fff; font-size: 14px; }
