/* Palette mirrors noah-frontend-v2 (dark theme): emerald brand + green-black surfaces. */
:root {
  --brand-primary:#4ade80; --brand-accent:#5fbd83;
  --canvas:#07120e; --surface-1:#0c1a14; --surface-2:#142823; --surface-3:#1c3329;
  --line:#1f3329; --line-strong:#2c4a3c;
  --ink:#f0f5f1; --muted:#a3b5a8; --faint:#7f948a;
  --ok:#4ade80; --warn:#f0b429; --err:#e5645b;
  --radius:16px;
}
* { box-sizing:border-box; }
body { margin:0; font:14px/1.55 Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  background:var(--canvas); color:var(--ink); -webkit-font-smoothing:antialiased; }

/* header */
header { padding:12px 20px; border-bottom:1px solid var(--line); display:flex; align-items:center; gap:12px; background:var(--surface-1); }
header .logo { height:22px; width:auto; display:block; }
header .divider { width:1px; height:20px; background:var(--line-strong); }
header .title { font-size:15px; font-weight:650; }
header .tag { color:var(--faint); font-size:12px; }
header .claude { margin-left:auto; display:flex; align-items:center; gap:7px; font-size:12px; color:var(--muted);
  border:1px solid var(--line-strong); padding:6px 12px; border-radius:20px; cursor:default; white-space:nowrap; background:var(--surface-2); }
header .claude.bad { border-color:#5a2530; color:var(--err); }
.dot { width:8px; height:8px; border-radius:50%; display:inline-block; }
.dot-ok { background:var(--ok); box-shadow:0 0 0 3px rgba(74,222,128,.18); }
.dot-bad { background:var(--err); box-shadow:0 0 0 3px rgba(229,100,91,.18); }
.dot-wait { background:var(--muted); animation:pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* layout */
.wrap { display:grid; grid-template-columns:300px 1fr; height:calc(100vh - 50px); }
.side { border-right:1px solid var(--line); overflow:auto; padding:14px; background:var(--surface-1); }
.main { overflow:auto; padding:18px 24px 60px; }
.search { width:100%; margin-bottom:10px; }

/* sidebar client groups */
.grp { margin-bottom:6px; }
.grp > summary { cursor:pointer; font-weight:600; padding:9px 11px; border-radius:10px; background:var(--surface-2);
  border:1px solid var(--line); list-style:none; }
.grp > summary::-webkit-details-marker { display:none; }
.grp > summary::before { content:"▸ "; color:var(--faint); }
.grp[open] > summary::before { content:"▾ "; }
.grp > summary:hover { border-color:var(--brand-primary); }
.grp-body { padding:6px 0 4px 6px; }
.ds { padding:9px 11px; border:1px solid var(--line); border-radius:10px; margin:6px 0; cursor:pointer; background:var(--surface-2); }
.ds:hover { border-color:var(--brand-primary); }
.ds.active { border-color:var(--brand-primary); box-shadow:0 0 0 1px var(--brand-primary) inset; }
.ds .n { font-weight:600; }
.ds .m { color:var(--faint); font-size:12px; display:flex; gap:6px; flex-wrap:wrap; margin-top:3px; }
.pill { font-size:10px; padding:2px 7px; border-radius:20px; border:1px solid var(--line-strong); color:var(--muted); }
.pill.vpn { color:var(--warn); border-color:#5a4a1e; }

/* empty state */
.empty { display:flex; align-items:center; justify-content:center; height:70%; }
.empty-box { text-align:center; max-width:440px; }
.empty-title { font-size:19px; font-weight:650; margin-bottom:6px; }

/* breadcrumb */
.crumb { font-size:14px; margin:2px 0 16px; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.crumb .sep { color:var(--faint); }

/* tabs */
.tabs { display:flex; gap:4px; border-bottom:1px solid var(--line); margin-bottom:18px; flex-wrap:wrap;
  position:sticky; top:0; background:var(--canvas); z-index:5; padding-top:2px; }
.tab { background:transparent; border:none; border-bottom:2px solid transparent; color:var(--muted);
  font-weight:600; font-size:13px; padding:10px 14px; cursor:pointer; }
.tab:hover { color:var(--ink); }
.tab.active { color:var(--ink); border-bottom-color:var(--brand-primary); }
.tab .muted { font-weight:400; }
.tab-panel { animation:fade .16s ease; }
@keyframes fade { from{opacity:0; transform:translateY(3px)} to{opacity:1; transform:none} }

/* cards */
.card { background:var(--surface-1); border:1px solid var(--line); border-radius:var(--radius); padding:18px;
  box-shadow:0 1px 3px rgba(0,0,0,.25); margin-bottom:14px; }
.card h3 { margin:0 0 10px; font-size:13px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); }

/* key-value meta */
.kv { display:flex; gap:12px; padding:3px 0; font-size:13px; }
.kv > span:first-child { color:var(--faint); min-width:96px; }
.dk { white-space:pre-wrap; font-size:13px; }

/* schema grouping */
.grp.db { margin:6px 0; }
.grp.db > summary { background:var(--surface-2); }
.schema-t { margin:3px 0 3px 8px; }
.schema-t summary { cursor:pointer; }
.schema-t .cols { color:var(--muted); font-size:12px; padding:6px 0 10px 16px; }

/* tables (interactive) */
.tbl { max-height:340px; overflow:auto; border:1px solid var(--line); border-radius:12px; margin-top:10px; }
table { border-collapse:collapse; width:100%; font-size:12.5px; }
th,td { text-align:left; padding:7px 10px; border-bottom:1px solid var(--line); vertical-align:top; white-space:nowrap; }
th { color:var(--muted); font-weight:600; position:sticky; top:0; background:var(--surface-2); cursor:pointer; user-select:none; }
th:hover { color:var(--ink); }
th .arrow { color:var(--brand-primary); font-size:10px; }
td.num, th.num { text-align:right; font-variant-numeric:tabular-nums; }
tbody tr:hover { background:var(--surface-2); }
.pager { display:flex; gap:8px; align-items:center; margin-top:8px; font-size:12px; color:var(--muted); }

/* forms */
input,textarea,button,select { font:inherit; color:var(--ink); background:var(--surface-2); border:1px solid var(--line-strong); border-radius:10px; padding:9px 11px; }
input::placeholder,textarea::placeholder { color:var(--faint); }
input:focus,textarea:focus,select:focus { outline:none; border-color:var(--brand-primary); }
textarea { width:100%; min-height:130px; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:12.5px; }
input[type=text],input[type=number],input[type=date],input[type=password],select { width:100%; }
button { background:var(--brand-primary); border:none; color:#06231a; cursor:pointer; font-weight:650;
  box-shadow:0 8px 24px -12px rgba(74,222,128,.6); }
button:hover { filter:brightness(1.06); }
button.ghost { background:var(--surface-2); border:1px solid var(--line-strong); color:var(--ink); font-weight:550; box-shadow:none; }
button.ghost:hover { border-color:var(--brand-primary); filter:none; }
button.danger { background:transparent; border:1px solid #5a2530; color:var(--err); box-shadow:none; font-weight:550; }
button:disabled { opacity:.45; cursor:not-allowed; filter:none; }
button.sm { padding:7px 11px; font-size:13px; white-space:nowrap; }
label { display:block; font-size:12px; color:var(--muted); margin:10px 0 4px; }
.grid2 { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.row { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.muted { color:var(--muted); } .faint { color:var(--faint); }
.ok { color:var(--ok); } .err { color:var(--err); } .warn { color:var(--warn); }
pre { background:#050d0a; border:1px solid var(--line); border-radius:10px; padding:12px; overflow:auto; font-size:12px; }

/* param bar */
.parambar { display:flex; flex-wrap:wrap; gap:12px; align-items:flex-end; }
.param { min-width:180px; flex:0 1 220px; }
.param label { margin-top:0; }

/* docs manager */
.doc { display:flex; align-items:center; gap:10px; padding:8px 10px; border:1px solid var(--line); border-radius:10px;
  margin:6px 0; background:var(--surface-2); cursor:pointer; }
.doc.active { border-color:var(--brand-primary); box-shadow:0 0 0 1px var(--brand-primary) inset; }
.doc .name { font-weight:600; flex:1; }
.doc .meta { color:var(--faint); font-size:11px; }

/* chat-style composer */
.composer { position:relative; }
.composer-row { display:flex; align-items:flex-end; gap:8px; background:var(--surface-2);
  border:1px solid var(--line-strong); border-radius:16px; padding:7px 8px 7px 10px; }
.composer-row:focus-within { border-color:var(--brand-primary); }
.composer #draft-notes { flex:1; border:none; background:transparent; padding:6px 4px; box-shadow:none;
  min-height:0; resize:none; overflow-y:auto; line-height:1.5; font-family:Inter,ui-sans-serif,system-ui,sans-serif; font-size:14px; }
.composer #draft-notes:focus { outline:none; }
.icon-btn { background:transparent; border:none; color:var(--muted); font-size:17px; padding:6px 8px; border-radius:10px; box-shadow:none; cursor:pointer; }
.icon-btn:hover { background:var(--surface-3); color:var(--ink); filter:none; }
.send-btn { background:var(--brand-primary); border:none; color:#06231a; font-size:16px; width:38px; height:38px;
  border-radius:12px; display:flex; align-items:center; justify-content:center; flex:0 0 auto; }
.send-btn:hover { filter:brightness(1.06); }
.send-btn:disabled { opacity:.5; }
.send-btn.stop { background:var(--err); color:#fff; }

/* @mention */
.mention-wrap { position:relative; }
.chips { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:6px; }
.chips:empty { display:none; }
.chip { display:inline-flex; align-items:center; gap:6px; font-size:12px; padding:3px 8px; border-radius:16px;
  background:rgba(74,222,128,.12); border:1px solid #25543a; color:var(--brand-primary); }
.chip b { font-weight:600; }
.chip .x { cursor:pointer; color:var(--muted); }
.chip .x:hover { color:var(--err); }
.docsearch { width:100%; margin:8px 0; }
.mention-list { position:absolute; z-index:20; left:0; right:0; top:calc(100% + 2px); background:var(--surface-1);
  border:1px solid var(--line-strong); border-radius:10px; max-height:200px; overflow:auto; box-shadow:0 12px 30px rgba(0,0,0,.4); }
.mention-list[hidden] { display:none; }
.mention-item { padding:8px 11px; cursor:pointer; font-size:13px; }
.mention-item:hover, .mention-item.sel { background:var(--surface-2); color:var(--brand-primary); }

/* conversation (live Claude Code activity) */
.convo { max-height:420px; overflow:auto; display:flex; flex-direction:column; gap:8px; }
.bub { border:1px solid var(--line); border-radius:12px; padding:9px 12px; font-size:13px; max-width:92%; }
.bub.say { background:var(--surface-2); align-self:flex-start; }
.bub.say::before { content:"✦ Claude "; color:var(--brand-primary); font-weight:600; font-size:11px; }
.bub.sys { align-self:flex-start; background:transparent; border-style:dashed; color:var(--muted); }
.bub.tool { align-self:flex-start; background:rgba(74,222,128,.08); border-color:#25543a; font-family:ui-monospace,Menlo,monospace; font-size:12px; color:var(--brand-primary); }
.bub.err { align-self:flex-start; border-color:#5a2530; color:var(--err); background:rgba(229,100,91,.08); }
.bub.done { align-self:flex-start; border-color:#25543a; background:rgba(74,222,128,.1); color:var(--ok); font-weight:600; }
.bub pre { margin:6px 0 0; }

/* thinking */
.thinking { display:inline-flex; gap:4px; align-items:center; color:var(--muted); }
.thinking .d { width:6px; height:6px; border-radius:50%; background:var(--brand-primary); animation:pulse 1s infinite; }
.thinking .d:nth-child(2){animation-delay:.15s} .thinking .d:nth-child(3){animation-delay:.3s}

/* match banner */
.banner { border-radius:12px; padding:10px 12px; font-size:13px; margin:10px 0; border:1px solid var(--line); }
.banner.good { border-color:#25543a; background:rgba(74,222,128,.08); }
.banner.bad { border-color:#5a2530; background:rgba(229,100,91,.08); }

/* auth inputs: fix white autofill on the dark theme + password reveal */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus, input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--ink);
  -webkit-box-shadow: 0 0 0 1000px var(--surface-2) inset;
  box-shadow: 0 0 0 1000px var(--surface-2) inset;
  caret-color: var(--ink);
  transition: background-color 9999s ease-in-out 0s;
}
.pass-wrap { position:relative; }
.pass-wrap input { width:100%; padding-right:64px; }
.pass-eye { position:absolute; right:6px; top:50%; transform:translateY(-50%);
  background:transparent; border:none; box-shadow:none; color:var(--muted); cursor:pointer;
  font-size:12px; font-weight:600; padding:4px 8px; }
.pass-eye:hover { color:var(--brand-primary); filter:none; }

/* login modal */
.modal { position:fixed; inset:0; background:rgba(3,8,6,.7); backdrop-filter:blur(3px); display:flex; align-items:center; justify-content:center; z-index:50; }
.modal[hidden] { display:none; }
.modal-box { position:relative; background:var(--surface-1); border:1px solid var(--line-strong); border-radius:var(--radius); padding:24px; width:520px; max-width:92vw; box-shadow:0 24px 60px rgba(0,0,0,.5); }
.modal-x { position:absolute; top:12px; right:12px; background:transparent; border:none; color:var(--muted); font-size:14px; padding:6px 9px; border-radius:8px; cursor:pointer; box-shadow:none; }
.modal-x:hover { background:var(--surface-2); color:var(--ink); }
.modal-head { display:flex; gap:12px; align-items:flex-start; margin-bottom:18px; }
.modal-title { font-size:17px; font-weight:650; }
.modal-sub { color:var(--muted); font-size:12.5px; margin-top:4px; line-height:1.5; }
.login-step { margin-top:4px; }
.btn-lg { padding:11px 18px; font-size:14px; }
.steps { list-style:none; counter-reset:s; margin:0; padding:0; }
.steps li { counter-increment:s; position:relative; padding:0 0 18px 34px; }
.steps li::before { content:counter(s); position:absolute; left:0; top:0; width:22px; height:22px; border-radius:50%;
  background:var(--surface-2); border:1px solid var(--line-strong); color:var(--ink); font-size:12px; font-weight:600;
  display:flex; align-items:center; justify-content:center; }
.step-label { font-size:13px; font-weight:500; margin-bottom:7px; }
.url-row { display:flex; gap:8px; align-items:center; }
.url-row input { flex:1; }
.login-url { flex:1; word-break:break-all; color:var(--brand-primary); font-size:11.5px; background:#050d0a;
  border:1px solid var(--line); border-radius:8px; padding:8px 10px; text-decoration:none; max-height:60px; overflow:auto; }
/* settings */
.settings-body { max-height:74vh; overflow:auto; padding-right:4px; }
.set-row { display:grid; grid-template-columns:250px 1fr 90px; gap:12px; align-items:center; padding:9px 0; border-bottom:1px solid var(--line); }
.set-row .sn { font-family:ui-monospace,Menlo,monospace; font-size:12px; }
.set-row .sn small { color:var(--faint); }
.set-row input, .set-row select { padding:7px 10px; }
.set-row .ro { color:var(--muted); font-size:13px; word-break:break-all; }
.set-row.dirty input, .set-row.dirty select { border-color:var(--brand-primary); }
.set-row .save { width:100%; }
.hint2 { color:var(--muted); font-size:12px; margin-bottom:8px; }
.hint2 code { background:#050d0a; border:1px solid var(--line); border-radius:4px; padding:1px 5px; font-size:11px; }
