:root {
  --bg: #f6f7f8; --surface: #ffffff; --surface-2: #f1f3f5; --ink: #111827; --ink-2: #4b5563; --muted: #8a93a0;
  --line: #e5e7eb; --accent: #0f766e; --accent-ink: #ffffff; --accent-soft: #e6f4f2; --ok: #15803d; --ok-soft: #e8f5ec;
  --warn: #b45309; --warn-soft: #fdf3e2; --bad: #b91c1c; --bad-soft: #fdecec; --side: #0f1720; --side-ink: #cbd5e1;
  --radius: 12px; --shadow: 0 1px 2px rgba(17,24,39,.05), 0 6px 18px rgba(17,24,39,.05);
  --sans: "Inter", system-ui, -apple-system, sans-serif; --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0b0f14; --surface: #121821; --surface-2: #18202b; --ink: #e8edf3; --ink-2: #b4bfcc; --muted: #7c8796;
  --line: #243041; --accent: #2dd4bf; --accent-ink: #062b27; --accent-soft: #0e2f2c; --ok: #4ade80; --ok-soft: #10291a;
  --warn: #fbbf24; --warn-soft: #2d230d; --bad: #f87171; --bad-soft: #2f1414; --side: #070a0e; --side-ink: #a8b3c2;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.3); } }
:root[data-theme="dark"] {
  --bg: #0b0f14; --surface: #121821; --surface-2: #18202b; --ink: #e8edf3; --ink-2: #b4bfcc; --muted: #7c8796;
  --line: #243041; --accent: #2dd4bf; --accent-ink: #062b27; --accent-soft: #0e2f2c; --ok: #4ade80; --ok-soft: #10291a;
  --warn: #fbbf24; --warn-soft: #2d230d; --bad: #f87171; --bad-soft: #2f1414; --side: #070a0e; --side-ink: #a8b3c2; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.01em; } h2 { font-size: 17px; margin: 0 0 12px; } h3 { font-size: 14px; margin: 0 0 6px; }
p { margin: 0 0 10px; } .muted { color: var(--muted); } .small { font-size: 12.5px; }
code, pre { font-family: var(--mono); font-size: 12.5px; }
pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow: auto; margin: 8px 0 14px; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* layout */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; color: #fff; font-weight: 700; letter-spacing: -.01em; }
.logo .mark { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, #2dd4bf, #0ea5e9); display: grid; place-items: center; color: #062b27; font-size: 15px; }
.logo small { display: block; font-weight: 500; color: var(--side-ink); font-size: 11px; letter-spacing: .04em; }
.nav a { display: flex; align-items: center; gap: 10px; color: var(--side-ink); padding: 8px 10px; border-radius: 8px; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav a.on { background: rgba(45,212,191,.14); color: #fff; }
.side .org { margin-top: auto; border-top: 1px solid rgba(255,255,255,.08); padding: 12px 8px 0; font-size: 12.5px; }
.side select { width: 100%; background: rgba(255,255,255,.06); color: #fff; border: 1px solid rgba(255,255,255,.12); border-radius: 8px; padding: 6px 8px; font: inherit; }
.side .org a { color: var(--side-ink); }
.main { padding: 28px 32px 60px; max-width: 1280px; width: 100%; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }

/* components */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat .v { font-size: 28px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 12.5px; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.n { background: var(--surface-2); color: var(--ink-2); }
.pill.acc { background: var(--accent-soft); color: var(--accent); }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; background: var(--accent); color: var(--accent-ink); font: 600 13px var(--sans); padding: 8px 14px; border-radius: 9px; cursor: pointer; text-decoration: none !important; }
.btn:hover { filter: brightness(1.05); } .btn.sec { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.sm { padding: 5px 10px; font-size: 12px; } .btn.danger { background: var(--bad); color: #fff; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea, input[type=file] {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
label { font-weight: 600; font-size: 12.5px; display: block; margin: 0 0 4px; }
.field { margin-bottom: 12px; } .helptext, .field .help { color: var(--muted); font-size: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.msgs { margin-bottom: 16px; display: grid; gap: 8px; }
.msg-flash { padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--ink); border: 1px solid var(--line); }
.msg-flash.error { background: var(--bad-soft); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 12.5px; font-weight: 500; }
.chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); text-decoration: none; }
.chip:hover { text-decoration: none; border-color: var(--ink-2); }

/* entity cards & agents */
.entity { display: flex; flex-direction: column; gap: 8px; }
.entity .top { display: flex; justify-content: space-between; align-items: center; }
.unlocks { font-size: 12px; color: var(--muted); }
.agent { display: flex; flex-direction: column; gap: 8px; }
.agent .top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.agent h3 a { color: var(--ink); } .agent .desc { color: var(--ink-2); font-size: 13px; flex: 1; }
.agent .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.agent.roadmap { background: var(--surface-2); box-shadow: none; } .agent.roadmap h3 { color: var(--ink-2); }
.domain-head { display: flex; align-items: baseline; gap: 10px; margin: 26px 0 10px; }
.domain-head h2 { margin: 0; }
.steps { counter-reset: s; display: grid; gap: 10px; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step .n { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.step.done .n { background: var(--ok); color: #fff; }
.bar { height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }

/* chat */
.chat { display: grid; grid-template-rows: 1fr auto; height: calc(100vh - 210px); min-height: 460px; padding: 0; overflow: hidden; }
.chat .log { overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.chat form { border-top: 1px solid var(--line); padding: 12px; display: flex; gap: 8px; }
.chat textarea { resize: none; height: 44px; }
.bubble-u { align-self: flex-end; background: var(--ink); color: var(--surface); padding: 9px 13px; border-radius: 14px 14px 4px 14px; max-width: 80%; white-space: pre-wrap; }
.bubble-a { max-width: 100%; }
.bubble-a .who { font-size: 12px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.bubble-a .text p { margin: 0 0 8px; } .bubble-a .text ul { margin: 4px 0 8px; padding-left: 18px; }
.bubble-a .text table { margin: 8px 0; }
.tools { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.tool { font: 11.5px var(--mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; color: var(--ink-2); }
.cards { display: flex; gap: 10px; overflow-x: auto; padding: 6px 2px 8px; }
.pcard { flex: 0 0 140px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.pcard img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; background: var(--surface-2); }
.pcard .b { padding: 6px 8px 8px; font-size: 12px; } .pcard .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .role { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 700; }
.mini { border: 1px solid var(--line); border-radius: 10px; overflow: auto; margin: 6px 0; max-height: 280px; }
.typing { display: inline-flex; gap: 4px; } .typing i { width: 6px; height: 6px; background: var(--muted); border-radius: 50%; animation: b 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s } .typing i:nth-child(3) { animation-delay: .4s }
@keyframes b { 0%,80%,100% { opacity: .25 } 40% { opacity: 1 } }
.starters { display: flex; flex-wrap: wrap; gap: 8px; }
.starters button { text-align: left; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 8px 12px; cursor: pointer; font: 13px var(--sans); }
.starters button small { display: block; color: var(--muted); font-size: 11px; }
.starters button:hover { border-color: var(--accent); }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth .card { width: min(400px, 100%); padding: 28px; }
.auth .logo { color: var(--ink); padding: 0 0 18px; } .auth .logo small { color: var(--muted); }

@media (max-width: 1000px) { .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 10px 12px; }
  .side .nav { display: flex; flex-wrap: wrap; gap: 2px; } .side .org { display: none; } .logo { padding: 4px 8px; }
  .main { padding: 18px 16px 48px; } .g4, .g3, .g2 { grid-template-columns: 1fr; }
}

/* i18n / RTL / white-label additions */
html[lang="ar"] body { font-family: "Noto Sans Arabic", var(--sans); }
html[lang="hi"] body { font-family: var(--sans), "Noto Sans Devanagari", sans-serif; }
th { text-align: start; }
.end { text-align: end; }
.side .powered { margin-top: 10px; font-size: 11px; opacity: .55; }
.msg-flash.warning { background: var(--warn-soft); }
.msg-flash.success { background: var(--ok-soft); }
.msg-flash.info { background: var(--accent-soft); }
.meter { display: grid; gap: 6px; }
.meter .top { display: flex; justify-content: space-between; font-size: 13px; }
.bar > i.hot { background: var(--warn); } .bar > i.full { background: var(--bad); }
.plans { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.plans .card.current { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.plans .price { font-size: 22px; font-weight: 700; margin: 4px 0 10px; }
.plans ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 13px; }
.plans li::before { content: "✓ "; color: var(--accent); font-weight: 700; }
.plans li.no { color: var(--muted); } .plans li.no::before { content: "– "; color: var(--muted); }
.swatch { width: 18px; height: 18px; border-radius: 5px; display: inline-block; vertical-align: middle; border: 1px solid var(--line); }
@media (max-width: 1000px) { .plans { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

html[lang="th"] body { font-family: "Noto Sans Thai", var(--sans); }
.guide-link { display: block; padding: 7px 10px; border-radius: 8px; color: var(--ink-2); font-size: 13.5px; }
.guide-link:hover { background: var(--surface-2); text-decoration: none; }
.guide-link.on { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.guide { padding: 26px 30px; line-height: 1.65; }
.guide h1 { font-size: 24px; margin-bottom: 12px; } .guide h2 { margin-top: 28px; } .guide h3 { margin-top: 18px; }
.guide img { max-width: 100%; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); margin: 8px 0 14px; }
.guide blockquote { margin: 10px 0; padding: 10px 14px; background: var(--surface-2); border-inline-start: 3px solid var(--accent); border-radius: 6px; }
.guide blockquote p { margin: 0; } .guide ol, .guide ul { padding-inline-start: 22px; } .guide li { margin: 4px 0; }
.guide table { margin: 10px 0 16px; }
.logo .brand-mark { width: 30px; height: 30px; flex: none; }

html[lang="zh-hans"] body { font-family: var(--sans, "Inter"), "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif; }
