:root {
  --bg: #fafbfc; --surface: #ffffff; --ink: #0f1729; --mut: #5b6675; --faint: #8a94a4;
  --line: #e7eaf0; --line2: #eef1f5; --accent: #4f46e5; --accent-soft: #eef0fe;
  --green: #16a34a; --green-soft: #e7f6ec; --amber: #d97706; --amber-soft: #fdf2e3;
  --red: #dc2626; --red-soft: #fdeaea; --radius: 12px;
  --shadow: 0 1px 2px rgba(16,23,41,.04), 0 8px 24px rgba(16,23,41,.06);
  font-synthesis: none;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; font-size: 14px;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 14px; }
.muted { color: var(--mut); }

/* ---------- auth ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.auth-card {
  position: relative; width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); padding: 30px;
}
.auth-card .authx { position: absolute; top: 12px; right: 14px; background: none; border: none; font-size: 15px; color: var(--mut); }
.forgot { display: inline-block; margin-top: 12px; font-size: 12.5px; color: var(--accent); font-weight: 600; text-decoration: none; }
.forgot:hover { text-decoration: underline; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 750; font-size: 19px; letter-spacing: -.4px; }
.brand .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft); }
.auth-card h1 { font-size: 18px; margin: 18px 0 4px; letter-spacing: -.4px; }
.auth-tabs { display: flex; gap: 4px; background: var(--line2); padding: 4px; border-radius: 10px; margin: 18px 0; }
.auth-tabs button { flex: 1; border: none; background: transparent; padding: 8px; border-radius: 7px;
  font-weight: 600; color: var(--mut); font-size: 13px; }
.auth-tabs button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.google-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-weight: 600; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.google-btn:hover { background: var(--line2); border-color: var(--mut); }
.auth-or { display: flex; align-items: center; text-align: center; color: var(--faint); font-size: 11px; margin: 14px 0; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.auth-or span { padding: 0 10px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--mut); margin-bottom: 5px; }
.field input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
/* password field with show/hide eye toggle */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 40px; }
.pw-eye { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); background: none; border: none;
  cursor: pointer; font-size: 15px; line-height: 1; padding: 4px 6px; border-radius: 7px; opacity: .55; filter: grayscale(1); }
.pw-eye:hover { opacity: .9; background: var(--line2); }
.pw-eye.on { opacity: 1; filter: none; }
.btn { border: none; border-radius: 9px; padding: 10px 14px; font-weight: 650; font-size: 13.5px; }
.btn.primary { background: var(--accent); color: #fff; width: 100%; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.err { color: var(--red); font-size: 12.5px; margin-top: 8px; min-height: 16px; }

/* ---------- app shell ---------- */
/* Fixed viewport-height row; min-height:0 on each column lets the inner scroll
   region (list / chat / tabs) scroll instead of growing the column and pushing
   the bottom controls (composer, sidebar footer) off-screen. */
.app { position: relative; display: grid; grid-template-columns: var(--w-sidebar, 248px) 5px minmax(320px, 1fr) 5px var(--w-chat, 440px); grid-template-rows: minmax(0, 1fr); height: 100vh; overflow: hidden; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
/* collapsible left column */
.sidebar .top .brandrow { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.side-collapse { background: none; border: none; color: var(--mut); font-size: 15px; line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.side-collapse:hover { background: var(--line2); color: var(--ink); }
.sidebar-expand { display: none; position: absolute; top: 12px; left: 8px; z-index: 20; width: 26px; height: 26px; border-radius: 8px; align-items: center; justify-content: center; background: var(--surface); border: 1px solid var(--line); color: var(--mut); font-size: 16px; box-shadow: var(--shadow); cursor: pointer; }
.sidebar-expand:hover { color: var(--accent); border-color: var(--accent); }
/* collapsed = a slim rail: hides the project list but keeps the avatar clickable */
#app.sidebar-collapsed { grid-template-columns: 58px 0 minmax(320px, 1fr) 5px var(--w-chat, 440px); }
#app.sidebar-collapsed #rsLeft { display: none; }
#app.sidebar-collapsed .sidebar .brand,
#app.sidebar-collapsed .sidebar .newwrap,
#app.sidebar-collapsed .sidebar .searchlist,
#app.sidebar-collapsed .sidebar .usage,
#app.sidebar-collapsed .acct-id,
#app.sidebar-collapsed .acct-kebab { display: none; }
#app.sidebar-collapsed .sidebar .top { padding: 12px 0; }
#app.sidebar-collapsed .brandrow { justify-content: center; margin-bottom: 0; }
#app.sidebar-collapsed .side-collapse { transform: scaleX(-1); }
#app.sidebar-collapsed .sidebar .foot { flex-direction: column; align-items: center; padding: 12px 0; }
#app.sidebar-collapsed .acct-menu { left: 54px; right: auto; bottom: 12px; width: 220px; }
#app.sidebar-collapsed .sidebar-expand { display: none; }
.avatar { cursor: pointer; }
/* "+ New search" split button with an Import submenu */
.newwrap { position: relative; display: flex; margin-top: 14px; }
.newwrap .newbtn { margin-top: 0; flex: 1; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.newcaret { width: 34px; background: var(--accent); color: #fff; border: none; border-left: 1px solid rgba(255,255,255,.28);
  border-radius: 0 9px 9px 0; font-size: 13px; cursor: pointer; }
.newcaret:hover { filter: brightness(1.08); }
.new-menu { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40; background: var(--surface);
  border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow); padding: 5px; }
.new-menu button { display: block; width: 100%; text-align: left; background: none; border: none; padding: 8px 9px;
  border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; }
.new-menu button:hover { background: var(--line2); }
/* shared-project banner above the workspace */
.shared-banner { padding: 8px 20px; font-size: 12.5px; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); border-bottom: 1px solid var(--line); }
/* focus mode: hide all but the chat, centered with max real estate */
.focusbtn { background: none; border: none; color: var(--mut); font-size: 16px; line-height: 1; cursor: pointer;
  padding: 4px 7px; border-radius: 7px; }
.focusbtn:hover { background: var(--line2); color: var(--accent); }
#app.focus-mode { grid-template-columns: 0 0 0 0 minmax(0, 1fr); }
#app.focus-mode .sidebar, #app.focus-mode .work, #app.focus-mode #rsLeft, #app.focus-mode #rsRight,
#app.focus-mode .sidebar-expand { display: none; }
#app.focus-mode .chatpane { border-left: none; }
#app.focus-mode .chatpane > * { max-width: 820px; width: 100%; margin-left: auto; margin-right: auto; }
/* draggable vertical dividers between panels */
.resizer { background: var(--line); cursor: col-resize; position: relative; z-index: 5; }
.resizer::after { content: ''; position: absolute; inset: 0 -3px; }
.resizer:hover, .resizer.active { background: var(--accent); }
/* center work panel (project title + memory + tabs) */
.work { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg); }
.workhead { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.workhead #searchTitle { font-weight: 700; font-size: 15px; }
/* chat moved to the right pane */
.chatpane { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg); border-left: 1px solid var(--line); }
.chat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); font-weight: 700; }
.sidebar .top { padding: 16px; }
.newbtn { width: 100%; margin-top: 14px; display: flex; align-items: center; gap: 8px; justify-content: center;
  background: var(--accent); color: #fff; border: none; border-radius: 9px; padding: 9px; font-weight: 650; }
.importbtn { width: 100%; margin-top: 7px; display: flex; align-items: center; gap: 6px; justify-content: center;
  background: none; color: var(--mut); border: 1px dashed var(--line); border-radius: 9px; padding: 7px; font-weight: 600; font-size: 12.5px; }
.importbtn:hover { border-color: var(--accent); color: var(--accent); }
.searchlist { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px; }
.s-item { padding: 9px 10px; border-radius: 8px; cursor: pointer; margin-bottom: 2px; }
.s-item:hover { background: var(--line2); }
.s-item.on { background: var(--accent-soft); }
.s-item .t { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-item .m { font-size: 11px; color: var(--faint); margin-top: 2px; }
.sidebar .foot { border-top: 1px solid var(--line); padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar .foot .email { font-size: 12px; color: var(--mut); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linklike { background: none; border: none; color: var(--accent); font-weight: 600; font-size: 12px; }

/* usage meter */
.usage { padding: 10px 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 7px; }
.usage .urow { display: flex; flex-direction: column; gap: 3px; }
.usage .ulbl { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--mut); font-weight: 600; }
.usage .ubar { height: 4px; background: var(--line2); border-radius: 3px; overflow: hidden; }
.usage .ubar > i { display: block; height: 100%; background: var(--accent); }
.usage .ubar > i.warn { background: var(--amber); }
.usage .ubar > i.full { background: var(--red); }
.usage .uhead { font-size: 11px; font-weight: 700; color: var(--ink); display: flex; justify-content: space-between; align-items: center; }
.usage .uhead .plan { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.acctbtn { width: 100%; background: var(--accent); color: #fff; border: none; border-radius: 9px; padding: 8px; font-weight: 650; font-size: 12.5px; }
.acctbtn.ghost { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }

/* avatar menu */
.sidebar .foot { position: relative; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; border: none; font-weight: 800; font-size: 13px; display: grid; place-items: center; flex: 0 0 auto; }
.avatar:hover { filter: brightness(1.08); }
.acct-id { font-size: 12px; color: var(--mut); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.acct-kebab { flex: 0 0 auto; background: none; border: none; color: var(--mut); font-size: 18px; font-weight: 700; line-height: 1; padding: 4px 8px; border-radius: 8px; }
.acct-kebab:hover { background: var(--line2); color: var(--ink); }
.acct-menu { position: absolute; bottom: 52px; left: 12px; right: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow); padding: 5px; z-index: 40; }
.acct-menu .mhead { font-size: 11px; color: var(--faint); padding: 6px 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-bottom: 1px solid var(--line2); margin-bottom: 4px; }
.acct-menu button { display: block; width: 100%; text-align: left; background: none; border: none; padding: 8px 9px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--ink); }
.acct-menu button:hover { background: var(--line2); }
.acct-menu button.danger { color: var(--red); }

/* admin screen */
.admin { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; }
.admin-bar { display: flex; align-items: center; gap: 10px; padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.admin-body { flex: 1; overflow-y: auto; padding: 22px; max-width: 1100px; width: 100%; margin: 0 auto; }
.admin h2 { font-size: 15px; margin: 26px 0 12px; letter-spacing: -.2px; }
.admin h2:first-child { margin-top: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.card .k { font-size: 11px; color: var(--faint); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.card .v { font-size: 22px; font-weight: 800; letter-spacing: -.5px; margin-top: 4px; }
.trend { display: flex; align-items: flex-end; gap: 3px; height: 90px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; overflow-x: auto; }
.trend .tcol { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; flex: 0 0 14px; height: 100%; }
.trend .tcol i { width: 9px; background: var(--accent); border-radius: 2px 2px 0 0; display: block; }
.trend .tcol span { font-size: 8px; color: var(--faint); }
.trend-legend { font-size: 11px; color: var(--mut); margin: 6px 0 0; }
.atable { width: 100%; border-collapse: collapse; font-size: 12.5px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.atable th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--faint); padding: 9px 10px; border-bottom: 1px solid var(--line); }
.atable td { padding: 9px 10px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
.atable tr:last-child td { border-bottom: none; }
.atable .kindtag { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px; }
.atable .kindtag.user { background: var(--accent-soft); color: var(--accent); }
.atable .kindtag.anon { background: var(--line2); color: var(--mut); }
.atable .grantbtn { background: var(--line2); border: none; border-radius: 6px; padding: 4px 9px; font-weight: 650; font-size: 11.5px; color: var(--ink); }
.atable .grantbtn:hover { background: var(--accent-soft); color: var(--accent); }
/* pending account approvals */
.pendcount { background: var(--amber); color: #fff; font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 20px; vertical-align: middle; }
.pending-list { display: flex; flex-direction: column; gap: 8px; }
.pending-row { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.pending-row .pe { font-weight: 700; font-size: 13px; }
.pending-row .connbtn { padding: 5px 10px; }
.wl-note { font-size: 11.5px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-status { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; padding: 2px 8px; border-radius: 10px; background: var(--line2); color: var(--mut); }
.wl-status.pending { background: var(--amber-soft); color: var(--amber); }
.wl-status.accepted, .wl-status.active { background: var(--green-soft); color: var(--green); }
.wl-status.denied, .wl-status.revoked, .wl-status.used { background: var(--line2); color: var(--faint); }
.access-add { display: flex; gap: 8px; margin-bottom: 4px; }
.access-add input { flex: 1; max-width: 320px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.access-add input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
/* maintenance kill-switch lever */
.kill-lever { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); margin-bottom: 18px; }
.kill-lever.on { border-color: var(--red); background: var(--red-soft); }
.kill-lever .kl-info { flex: 1; min-width: 0; }
.kill-lever .kl-title { font-weight: 800; font-size: 14px; }
.kill-lever.on .kl-title { color: var(--red); }
.kill-lever .kl-sub { font-size: 12px; color: var(--mut); margin-top: 3px; line-height: 1.4; }
.kl-btn { flex: 0 0 auto; border: none; border-radius: 10px; padding: 10px 16px; font-weight: 700; font-size: 13px; cursor: pointer; background: var(--red); color: #fff; }
.kl-btn:hover { filter: brightness(1.05); }
.kl-btn.on { background: var(--green); }
.setform { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.setform .frow { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 10px; }
.setform label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 700; color: var(--mut); }
.setform input { width: 110px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.setform .plan-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line2); }
.grant-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 4px; }
.grant-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 700; color: var(--mut); }
.grant-grid input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.grant-admin { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink); margin-top: 10px; padding: 8px 10px; background: var(--amber-soft); border: 1px solid #f0d9a8; border-radius: 9px; }

/* plan cards */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 16px; }
.plan-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.plan-card.cur { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft); }
.plan-card h3 { font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--ink); margin: 0; }
.plan-card .price { font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.plan-card .price span { font-size: 12px; font-weight: 600; color: var(--faint); }
.plan-card .plan-tagline { font-size: 11.5px; color: var(--mut); margin: 2px 0 4px; }
.plan-card .plan-period { font-size: 11.5px; color: var(--mut); margin-top: -2px; }
.money-back { margin-top: 16px; text-align: center; font-size: 12.5px; color: var(--green); background: var(--green-soft); border-radius: 10px; padding: 10px 12px; }
.money-back b { color: var(--green); }
.landing-guarantee { margin-top: 12px; font-size: 12px; font-weight: 600; color: var(--green); }
.plan-card.best { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); position: relative; }
.plan-card .best-badge { position: absolute; top: -10px; right: 12px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; }
/* billing / invoices */
.bill-plan { font-size: 14px; margin-bottom: 2px; }
.bill-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 4px; }
.bill-table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--faint); padding: 7px 8px; border-bottom: 1px solid var(--line); }
.bill-table td { padding: 9px 8px; border-bottom: 1px solid var(--line2); vertical-align: top; }
.bill-table td.bill-amt { text-align: right; font-weight: 700; white-space: nowrap; }
.bill-type { font-size: 10px; font-weight: 700; text-transform: uppercase; padding: 2px 7px; border-radius: 10px; background: var(--line2); color: var(--mut); }
.bill-type.payment { background: var(--green-soft); color: var(--green); }
.bill-type.refund { background: var(--red-soft); color: var(--red); }
.bill-type.adjustment { background: var(--amber-soft); color: var(--amber); }
.bill-total { text-align: right; font-size: 13px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
/* admin activity feed */
.act-wrap { max-height: 340px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; }
.act-wrap .atable { border: none; border-radius: 0; }
.act-ts { white-space: nowrap; color: var(--mut); font-size: 11.5px; }
.act-type { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; padding: 2px 7px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.plan-card ul { list-style: none; margin: 8px 0 12px; display: flex; flex-direction: column; gap: 4px; }
.plan-card li { font-size: 12px; color: var(--mut); }
.plan-card li b { color: var(--ink); }
.plan-card button { margin-top: auto; background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 9px; font-weight: 650; font-size: 12.5px; }
.plan-card.cur button { background: var(--line2); color: var(--mut); }
.plan-card button:disabled { opacity: .5; }

/* feedback on assistant messages */
.fb { display: inline-flex; gap: 4px; margin-top: 8px; }
.fb button { background: none; border: 1px solid var(--line); border-radius: 7px; padding: 2px 7px; font-size: 12px; color: var(--mut); }
.fb button:hover { border-color: var(--accent); }
.fb button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* center / chat */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg); }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line);
  background: var(--surface); }
#searchTitle { font-weight: 700; font-size: 15px; letter-spacing: -.3px; outline: none; border-radius: 6px; padding: 2px 4px; min-width: 40px; }
#searchTitle:focus { background: var(--line2); }
.spacer { flex: 1; }
.modelpick { display: flex; align-items: center; gap: 8px; }
.modelpick select { border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: #fff; font-weight: 600; }
.badge { font-size: 10.5px; font-weight: 700; padding: 3px 7px; border-radius: 20px; letter-spacing: .3px; }
.badge.live { background: var(--green-soft); color: var(--green); }
.badge.sim { background: var(--line2); color: var(--mut); }
.chat { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 20px 8px; }
.msgs { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; }
.msg .av { width: 26px; height: 26px; border-radius: 7px; flex: 0 0 auto; display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.msg.user .av { background: var(--ink); color: #fff; }
.msg.assistant .av { background: var(--accent-soft); color: var(--accent); }
.msg .body { padding-top: 3px; line-height: 1.55; }
/* markdown inside assistant messages */
.msg .body p { margin: 0 0 8px; }
.msg .body p:last-child { margin-bottom: 0; }
.msg .body ul, .msg .body ol { margin: 4px 0 8px; padding-left: 20px; }
.msg .body li { margin: 2px 0; }
.msg .body .md-h { font-weight: 750; margin: 10px 0 5px; letter-spacing: -.2px; }
.msg .body .md-h1 { font-size: 17px; }
.msg .body .md-h2 { font-size: 15px; }
.msg .body .md-h3, .msg .body .md-h4, .msg .body .md-h5, .msg .body .md-h6 { font-size: 14px; }
.msg .body code { background: var(--line2); border-radius: 4px; padding: 1px 5px; font-size: 12.5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.msg .body pre { background: var(--line2); border-radius: 8px; padding: 10px 12px; overflow-x: auto; margin: 6px 0 8px; }
.msg .body pre code { background: none; padding: 0; font-size: 12px; line-height: 1.45; }
.msg .body blockquote { margin: 6px 0; padding: 2px 0 2px 11px; border-left: 3px solid var(--line); color: var(--mut); }
.msg .body a { color: var(--accent); }
.msg .body strong { font-weight: 700; }
.msg .who { font-size: 11px; color: var(--faint); font-weight: 600; margin-bottom: 2px; }
.prov-note { font-size: 11.5px; color: var(--amber); background: var(--amber-soft); border-radius: 7px; padding: 5px 8px; margin-top: 7px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.chip { font-size: 12px; font-weight: 600; background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: 4px 11px; color: var(--ink); }
.chip.new { background: var(--accent-soft); border-color: #d9dcfb; color: var(--accent); }
.chip.pivot { cursor: pointer; border-style: dashed; }
.chip.pivot:hover { border-color: var(--accent); color: var(--accent); }
.composer { max-width: 720px; margin: 0 auto; width: 100%; padding: 10px 0 18px; }
.pivots { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.composer .box { display: flex; gap: 8px; align-items: flex-end; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; padding: 8px 8px 8px 10px; box-shadow: var(--shadow); }
.composer .box.drag { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer textarea { flex: 1; border: none; resize: none; outline: none; min-height: 24px; max-height: 140px; padding: 6px 0; line-height: 1.5; background: transparent; }
.composer .attach { background: var(--line2); color: var(--mut); border: none; border-radius: 10px; width: 34px; height: 34px; font-size: 22px; font-weight: 400; line-height: 1; flex: 0 0 auto; }
.composer .attach:hover { background: var(--accent-soft); color: var(--accent); }
.composer .send { background: var(--accent); color: #fff; border: none; border-radius: 10px; width: 38px; height: 38px; font-size: 16px; flex: 0 0 auto; }
.composer .send:disabled { opacity: .45; }

/* attachment chips (composer + message bubbles) */
.attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.att { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; background: var(--surface);
  border: 1px solid var(--line); border-radius: 9px; padding: 5px 8px; max-width: 240px; }
.att .ic { font-size: 13px; }
.att .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .rm { background: none; border: none; color: var(--faint); font-weight: 700; padding: 0 2px; line-height: 1; }
.att .rm:hover { color: var(--red); }
.att img { width: 22px; height: 22px; object-fit: cover; border-radius: 5px; }
.msg .att { background: var(--bg); }

/* connections button + badge */
.connbtn { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-weight: 600; font-size: 12.5px; color: var(--mut); }
.connbtn:hover { border-color: var(--accent); color: var(--accent); }
.connbtn.danger:hover { border-color: var(--red); color: var(--red); }
.connbtn.icon { padding: 7px; width: 32px; display: grid; place-items: center; font-size: 14px; }
.badge { cursor: default; }

/* delete confirmation */
.del-list { list-style: none; margin: 14px 0; display: flex; flex-direction: column; gap: 7px; }
.del-list li { display: flex; align-items: center; gap: 9px; font-size: 13px; padding: 8px 11px; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; }
.del-list li .n { font-weight: 800; color: var(--ink); }
.del-list li.none { color: var(--faint); }
.del-actions { display: flex; align-items: center; gap: 8px; margin-top: 18px; }
.del-actions .spacer { flex: 1; }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger:hover { filter: brightness(1.05); }
.btn.danger:disabled { opacity: .5; }
.btn.ghost { font-size: 13px; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(16,23,41,.4); display: grid; place-items: center; padding: 20px; z-index: 600; }
.modal-card { width: 100%; max-width: 520px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 22px; max-height: 88vh; overflow-y: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-head h2 { font-size: 17px; letter-spacing: -.3px; }
.modal-head .x { background: none; border: none; font-size: 15px; color: var(--mut); }
.conn-list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.conn-row { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.conn-row .top { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.conn-row .pl { font-weight: 700; font-size: 13.5px; }
.conn-row .dot2 { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: 0 0 auto; }
.conn-row .dot2.on { background: var(--green); }
.conn-row .st { font-size: 11.5px; font-weight: 600; color: var(--faint); margin-left: auto; }
.conn-row .st.on { color: var(--green); }
.conn-row .row2 { display: flex; gap: 8px; }
.conn-row input { flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 13px; }
.conn-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.conn-row .sbtn { border: none; border-radius: 8px; padding: 8px 12px; font-weight: 650; font-size: 12.5px; }
.conn-row .sbtn.test { background: var(--line2); color: var(--ink); }
.conn-row .sbtn.save { background: var(--accent); color: #fff; }
.conn-row .sbtn:disabled { opacity: .5; }
.conn-row .msg2 { font-size: 12px; margin-top: 7px; min-height: 15px; }
.conn-row .msg2.ok { color: var(--green); }
.conn-row .msg2.bad { color: var(--red); }
.conn-row .envnote { font-size: 11px; color: var(--faint); margin-top: 6px; }
.conn-row .conn-help { font-size: 11px; color: var(--mut); margin-top: 7px; line-height: 1.4; }
.conn-row .conn-getkey { font-size: 11.5px; margin-top: 7px; }
.conn-row .conn-getkey a { color: var(--accent); font-weight: 650; }
.conn-row .conn-oauth { margin-top: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.conn-row .oauth-btn { background: #000; color: #fff; border: none; border-radius: 8px; padding: 7px 12px; font-weight: 650; font-size: 12.5px; }
.conn-row .oauth-btn:hover { filter: brightness(1.15); }
.conn-group-h { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); font-weight: 700; margin-top: 6px; }
.conn-group-h:not(:first-child) { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.conn-group-note { font-size: 12px; color: var(--mut); line-height: 1.45; margin: 2px 0 2px; }

/* right panel */
.panel { background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }

/* project memory (goal / dimensions / domains) */
.memory { padding: 7px 14px 9px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; background: var(--bg); }
.mem-row { display: flex; gap: 8px; align-items: flex-start; position: relative; }
.mem-label { flex: 0 0 84px; display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); padding: 3px 0; background: none; border: none; cursor: pointer; text-align: left; }
.mem-label:hover { color: var(--mut); }
.mem-label .chev::before { content: '▾'; font-size: 8px; display: inline-block; width: 9px; }
.mem-row.collapsed .mem-label .chev::before { content: '▸'; }
.mem-content { flex: 1; min-width: 0; }
.mem-goal { display: block; font-size: 12.5px; line-height: 1.4; color: var(--ink); outline: none; border-radius: 6px; padding: 2px 5px; min-height: 18px; }
.mem-goal:focus { background: var(--surface); box-shadow: 0 0 0 2px var(--accent-soft); }
.mem-goal:empty::before { content: attr(data-placeholder); color: var(--faint); }
.mem-dims, .mem-tlds, .mem-hist { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
/* collapsed sections: show a one-line peek; full content pops on hover */
.mem-peek { flex: 1; min-width: 0; font-size: 12px; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-top: 3px; display: none; cursor: default; }
.mem-row.collapsed .mem-content { display: none; }
.mem-row.collapsed .mem-peek { display: block; }
.mem-row.collapsed:hover .mem-content { display: block; position: absolute; left: 84px; right: 0; top: 100%; z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 10px 12px; }
.mem-hist .none { font-size: 11.5px; color: var(--faint); }
.mem-hist .wt { font-size: 12px; }
.mem-hist .wt b { font-weight: 700; }
/* alignment: agree vs. diverge observations */
.mem-align { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.mem-align .none { font-size: 11.5px; color: var(--faint); }
.mem-align .al-row { display: flex; gap: 7px; font-size: 12px; line-height: 1.4; }
.mem-align .al-k { flex: 0 0 58px; font-weight: 700; font-size: 10.5px; text-transform: uppercase; letter-spacing: .3px; padding-top: 1px; }
.mem-align .al-row.agree .al-k { color: var(--green); }
.mem-align .al-row.diverge .al-k { color: var(--amber); }
.mem-align .al-v { flex: 1; min-width: 0; color: var(--ink); }
.mem-align .al-add { margin-top: 4px; }
.mem-align .al-adddim { font-size: 11px; font-weight: 650; color: var(--accent); background: var(--accent-soft); border: none; border-radius: 6px; padding: 3px 8px; }
.mem-align .al-adddim:hover { filter: brightness(.97); }
.mem-hist .edit { background: none; border: 1px dashed var(--line); border-radius: 14px; padding: 2px 8px; font-size: 11px; font-weight: 700; color: var(--mut); }
.mem-hist .edit:hover { border-color: var(--accent); color: var(--accent); }

/* name-history editor */
.hist-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.hist-item { border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; display: flex; flex-direction: column; gap: 7px; }
.hist-item .r1 { display: flex; gap: 8px; align-items: center; }
.hist-item .r1 input.nm { flex: 1; font-weight: 700; }
.hist-item .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.hist-item input, .hist-item textarea { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; font-family: inherit; }
.hist-item input:focus, .hist-item textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.hist-item textarea { resize: vertical; min-height: 36px; }
.hist-item .cur-toggle { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--mut); font-weight: 600; }
.hist-item .rm { background: none; border: none; color: var(--faint); font-weight: 700; padding: 0 4px; }
.hist-item .rm:hover { color: var(--red); }
.mem-dims .tag { font-size: 10.5px; }
.mem-dims .none { font-size: 11.5px; color: var(--faint); }
.tld-chip { font-size: 11px; font-weight: 700; padding: 2px 4px 2px 8px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; gap: 3px; }
.tld-chip button { background: none; border: none; color: var(--accent); opacity: .6; font-weight: 700; padding: 0 2px; line-height: 1; }
.tld-chip button:hover { opacity: 1; }
.tld-add { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 14px; background: var(--line2); color: var(--mut); border: 1px dashed var(--line); }
.tld-add:hover { border-color: var(--accent); color: var(--accent); }
.tld-pop { position: absolute; z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; display: flex; flex-wrap: wrap; gap: 4px; max-width: 220px; }
.tld-pop button { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 12px; background: var(--line2); border: none; color: var(--ink); }
.tld-pop button:hover { background: var(--accent-soft); color: var(--accent); }

/* sidebar kebab menu */
.s-item { position: relative; }
.s-item .kebab { position: absolute; top: 7px; right: 6px; background: none; border: none; color: var(--faint); font-size: 15px; line-height: 1; padding: 2px 5px; border-radius: 6px; opacity: 0; }
.s-item:hover .kebab, .s-item .kebab.open { opacity: 1; }
.s-item .kebab:hover { background: var(--line); color: var(--ink); }
.s-item .t { padding-right: 22px; }
.s-menu { position: absolute; top: 28px; right: 6px; z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; min-width: 130px; }
.s-menu button { display: block; width: 100%; text-align: left; background: none; border: none; padding: 7px 10px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.s-menu button:hover { background: var(--line2); }
.s-menu button.danger { color: var(--red); }
.s-menu button.danger:hover { background: var(--red-soft); }

.rename-input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px; margin: 14px 0 4px; }
.rename-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* presence + sharing */
.presence { display: inline-flex; align-items: center; }
.presence .pres-av { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .2px; border: 2px solid var(--surface); margin-left: -7px; box-shadow: 0 1px 2px rgba(0,0,0,.12); cursor: default; }
.presence .pres-av:first-child { margin-left: 0; }
.presence .pres-av.me { box-shadow: 0 0 0 2px var(--accent-soft), 0 1px 2px rgba(0,0,0,.12); }

/* toast notifications */
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; z-index: 1000; pointer-events: none; }
.toast { background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; padding: 9px 16px; border-radius: 999px; box-shadow: 0 6px 20px rgba(0,0,0,.22); opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; max-width: 80vw; }
.toast.in { opacity: 1; transform: translateY(0); }
.toast.join { background: var(--green); }

/* ---------- marketing landing ---------- */
.landing { position: fixed; inset: 0; z-index: 500; display: flex; flex-direction: column; overflow: hidden;
  background: radial-gradient(1100px 560px at 72% -12%, var(--accent-soft), transparent 60%), linear-gradient(180deg, #fff, var(--bg)); }
.landing-orb { position: absolute; border-radius: 50%; filter: blur(72px); pointer-events: none; }
.landing-orb.orb1 { width: 440px; height: 440px; background: var(--accent); top: -130px; right: -70px; opacity: .16; }
.landing-orb.orb2 { width: 380px; height: 380px; background: #16a34a; bottom: -150px; left: -90px; opacity: .12; }
.landing-top { display: flex; align-items: center; justify-content: space-between; padding: 22px 32px; position: relative; z-index: 1; }
.landing-top .brand { font-size: 18px; font-weight: 800; }
.landing-hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px 24px 56px; position: relative; z-index: 1; max-width: 840px; margin: 0 auto; }
.landing .pill { font-size: 12px; font-weight: 700; letter-spacing: .4px; color: var(--accent); background: var(--accent-soft); padding: 6px 14px; border-radius: 999px; margin-bottom: 24px; }
.landing h1 { font-size: clamp(34px, 6vw, 62px); line-height: 1.04; letter-spacing: -1.6px; font-weight: 800; color: var(--ink); margin: 0 0 18px; }
.landing h1 em { font-style: normal; background: linear-gradient(90deg, var(--accent), #7c3aed); -webkit-background-clip: text; background-clip: text; color: transparent; }
.landing .lede { font-size: clamp(15px, 2.2vw, 19px); line-height: 1.6; color: var(--mut); max-width: 640px; margin: 0 auto 30px; }
.landing-cta { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.lbtn { border: none; border-radius: 12px; padding: 14px 26px; font-size: 15px; font-weight: 700; cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s, color .12s; }
.lbtn.primary { background: var(--accent); color: #fff; box-shadow: 0 8px 24px var(--accent-soft); }
.lbtn.primary:hover { transform: translateY(-1px); box-shadow: 0 14px 32px rgba(79, 70, 229, .32); }
.lbtn.ghost { background: rgba(255, 255, 255, .7); color: var(--ink); border: 1px solid var(--line); }
.lbtn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.landing-teaser { margin-top: 26px; max-width: 560px; font-size: 14px; line-height: 1.55; color: var(--mut); background: rgba(255,255,255,.6); border: 1px solid var(--line); border-radius: 12px; padding: 12px 18px; }
.landing-teaser b { color: var(--ink); }
.landing-note { margin-top: 18px; font-size: 12.5px; color: var(--faint); }
.landing-note b { color: var(--mut); }
.landing-fineprint { max-width: 640px; margin: 0 auto; padding: 0 24px; text-align: center; font-size: 11px; line-height: 1.5; color: var(--faint); position: relative; z-index: 1; }
.landing-fineprint b { color: var(--mut); }
.landing-foot { text-align: center; padding: 14px 18px 18px; font-size: 12px; color: var(--faint); position: relative; z-index: 1; }
.wait-ok { margin-top: 14px; padding: 12px 14px; background: var(--green-soft); color: var(--green); border-radius: 10px; font-size: 13px; font-weight: 600; text-align: center; }

/* session compaction divider */
.compact-divider { margin: 14px auto; max-width: 680px; }
.compact-divider.anim { animation: compactIn .5s ease; }
@keyframes compactIn { from { opacity: 0; transform: scaleY(.6); } to { opacity: 1; transform: scaleY(1); } }
.compact-toggle { display: block; width: 100%; background: var(--line2); border: 1px dashed var(--line); color: var(--mut); border-radius: 8px; padding: 7px 12px; font-size: 12px; font-weight: 650; text-align: center; }
.compact-toggle:hover { border-color: var(--accent); color: var(--accent); }
.compact-syn { margin-top: 8px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; color: var(--mut); white-space: pre-wrap; line-height: 1.5; }
.s-item .shared { font-size: 10px; }
.share-add { display: flex; gap: 8px; margin: 14px 0 4px; }
.share-add input { flex: 1; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; font-size: 13.5px; }
.share-add input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.share-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.share-seats { font-size: 11.5px; color: var(--mut); margin-bottom: 4px; }
.share-member { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 8px 11px; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; }
.share-member .role { font-size: 10.5px; font-weight: 700; color: var(--faint); margin-left: auto; }
.share-member .rm { background: none; border: none; color: var(--faint); font-weight: 700; padding: 0 4px; }
.share-member .rm:hover { color: var(--red); }
.share-member.pending { border-style: dashed; }
.share-member .acts { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.share-member .lnk { background: none; border: none; color: var(--accent); font-weight: 600; font-size: 11.5px; }
.share-member .lnk:hover { text-decoration: underline; }
.share-member .pend { font-size: 10.5px; font-weight: 700; color: var(--amber); }
.share-member.accepted .pend { color: var(--green); }
.share-member.denied .pend { color: var(--red); }
/* collaborator "ask to share" form */
.share-ask { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 4px; }
.share-ask input, .share-ask textarea { padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; font-size: 13.5px; font-family: inherit; resize: vertical; }
.share-ask input:focus, .share-ask textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
/* owner's incoming share requests */
.share-reqhead { font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--faint); margin: 10px 0 2px; }
.share-req { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.share-req .rq-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.share-req .rq-email { font-weight: 700; font-size: 13px; }
.share-req .rq-by { font-size: 11px; color: var(--mut); }
.share-req .rq-why { font-size: 12.5px; color: var(--ink); font-style: italic; line-height: 1.45; }
.share-req .rq-acts { display: flex; gap: 8px; margin-top: 2px; }
.btn.sm { width: auto; padding: 6px 12px; font-size: 12.5px; }
.toast.warn { background: var(--amber); }
.invite-banner { background: var(--accent-soft); border: 1px solid #d9dcfb; color: var(--ink); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; line-height: 1.45; margin: 14px 0 4px; }
.field input[readonly] { background: var(--line2); color: var(--mut); cursor: not-allowed; }
.tabs { display: flex; padding: 10px 12px 0; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: none; background: none; padding: 9px 9px; font-weight: 650; color: var(--mut); font-size: 12.5px; border-bottom: 2px solid transparent; white-space: nowrap; flex: 0 0 auto; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.tabwrap { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; }
/* shared documents tab */
.docs { display: flex; flex-direction: column; gap: 6px; }
.docs-empty { font-size: 13px; line-height: 1.5; padding: 6px 0; }
.doc-row { display: flex; align-items: center; gap: 10px; padding: 9px 11px; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; }
.doc-ic { font-size: 16px; flex: 0 0 auto; }
.doc-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.doc-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-meta { font-size: 11px; color: var(--faint); }
.doc-acts { display: flex; gap: 10px; flex: 0 0 auto; }
.doc-acts .lnk { color: var(--accent); font-weight: 600; font-size: 12px; text-decoration: none; }
.doc-acts .lnk:hover { text-decoration: underline; }
.work h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); margin-bottom: 10px; }
.work h3.section-gap { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
/* Fixed-height, relatively-positioned wrapper so the responsive radar can't
   feed back into its own container height (endless-growth / scroll bug). */
.radarwrap { position: relative; height: 240px; width: 100%; }
.radarwrap.tall { height: 300px; }
.radarwrap canvas { position: absolute; inset: 0; }

/* compare tab */
.cmp-controls { display: flex; gap: 6px; margin-bottom: 10px; }
.cmp-controls .mini { background: var(--line2); border: none; border-radius: 7px; padding: 5px 10px; font-weight: 650; font-size: 12px; color: var(--mut); }
.cmp-controls .mini:hover { background: var(--accent-soft); color: var(--accent); }
.compare-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip.cmp { cursor: pointer; }
.chip.cmp.on { border-width: 1.5px; font-weight: 700; }
.compare-chips .empty2 { color: var(--faint); font-size: 12.5px; }
.cov-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.h3edit { background: none; border: 1px dashed var(--line); border-radius: 12px; padding: 1px 8px; font-size: 10.5px; font-weight: 700; color: var(--mut); text-transform: none; letter-spacing: 0; margin-left: 6px; }
.h3edit:hover { border-color: var(--accent); color: var(--accent); }

/* dimensions editor */
.dim-list { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.dim-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.dim-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.dim-head .dlabel { flex: 1; font-weight: 700; font-size: 13px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; }
.dim-head .dlabel:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.dim-head .rm { background: none; border: none; color: var(--faint); font-weight: 700; padding: 0 4px; }
.dim-head .rm:hover { color: var(--red); }
.dim-vals { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.dim-vals .tag { display: inline-flex; align-items: center; gap: 4px; }
.dim-vals .tag button { background: none; border: none; color: var(--accent); opacity: .55; font-weight: 700; padding: 0 1px; }
.dim-vals .tag button:hover { opacity: 1; color: var(--red); }
.dim-desc { width: 100%; margin-top: 7px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; font-family: inherit; }
.dim-desc:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.dim-weight { display: flex; align-items: center; gap: 8px; margin-top: 7px; font-size: 11px; font-weight: 700; color: var(--mut); }
.dim-weight input[type=range] { flex: 1; accent-color: var(--accent); }
.dim-weight .wlbl { flex: 0 0 34px; text-align: right; color: var(--ink); }
.dim-sec { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--faint); margin: 14px 0 8px; }
.dim-domrow { display: flex; align-items: center; gap: 10px; }
.dim-domrow .dom-name { font-weight: 800; font-size: 14px; flex: 0 0 56px; }
.dim-domrow .dim-weight { flex: 1; margin-top: 0; }
.dimscore-head { font-size: 12.5px; color: var(--mut); margin-top: 12px; }
.dimscore-head b { font-size: 15px; color: var(--accent); }
.dim-add { display: flex; gap: 8px; }
.dim-add input { flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.cov-group { margin-bottom: 10px; }
.cov-group .lbl { font-size: 11px; font-weight: 700; color: var(--mut); margin-bottom: 4px; }
.tag { font-size: 11px; padding: 3px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tag.off { background: var(--line2); color: var(--faint); }

/* names table */
.names { display: flex; flex-direction: column; gap: 8px; }
.hidden-toggle { font-size: 11.5px; color: var(--faint); margin-bottom: 2px; }
.hidden-toggle a { color: var(--accent); font-weight: 600; cursor: pointer; }
.hidden-toggle a:hover { text-decoration: underline; }
/* resurface prompt under an assistant message */
.resurface { display: flex; flex-direction: column; gap: 6px; margin-top: 9px; }
.resurf { display: flex; align-items: center; gap: 8px; font-size: 12.5px; background: var(--amber-soft); border: 1px solid #f0d9a8; border-radius: 9px; padding: 6px 10px; }
.resurf > span { flex: 1; }
.resurf button { border: none; border-radius: 7px; padding: 3px 10px; font-weight: 650; font-size: 11.5px; }
.resurf .ok { background: var(--accent); color: #fff; }
.resurf .no { background: var(--surface); border: 1px solid var(--line); color: var(--mut); }
.ncard { border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; display: flex; gap: 10px; align-items: flex-start; }
.ncard .nc-body { flex: 1; min-width: 0; }
.ncard .nc-spider { flex: 0 0 auto; line-height: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ncard .nc-spider .nc-ov { font-size: 11px; font-weight: 800; color: var(--mut); line-height: 1; }
.ncard .nc-spider:hover { opacity: .8; }
.ncard.shortlist { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft); }
.ncard.rejected { opacity: .5; }
.ncard .row1 { display: flex; align-items: center; gap: 8px; }
.ncard .nm { font-weight: 750; font-size: 15px; letter-spacing: -.3px; }
.ncard .sc { margin-left: auto; font-weight: 800; font-size: 13px; color: var(--accent); }
.ncard .st { background: none; border: none; font-size: 13px; padding: 1px 3px; border-radius: 5px; line-height: 1; opacity: .4; }
.ncard .st:hover { opacity: 1; background: var(--line2); }
.ncard .st.on { opacity: 1; }
.ncard .st.star.on { color: var(--accent); }
.ncard .st.rej.on { color: var(--red); }
.ncard .mean { font-size: 12px; color: var(--mut); margin: 5px 0 8px; }
.verdict { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 20px; }
.verdict.clean { background: var(--green-soft); color: var(--green); }
.verdict.contaminated { background: var(--amber-soft); color: var(--amber); }
.verdict.blocked { background: var(--red-soft); color: var(--red); }
.doms { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
.dom { border: 1px solid var(--line2); border-radius: 8px; padding: 6px 8px; }
.dom .tld { font-weight: 700; font-size: 12px; }
.dom .av { font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 10px; margin-left: 5px; }
.dom .av.y { background: var(--green-soft); color: var(--green); }
.dom .av.n { background: var(--red-soft); color: var(--red); }
.dom .pr { font-size: 11px; color: var(--mut); margin-top: 3px; line-height: 1.4; }
.dom .pr b { color: var(--ink); }
.est-tag { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; background: var(--line2); color: var(--faint); padding: 0 4px; border-radius: 4px; }
/* on-demand domain check button */
.dom-check { background: var(--accent-soft); color: var(--accent); border: none; border-radius: 8px; padding: 5px 10px; font-size: 11.5px; font-weight: 700; }
.dom-check:hover { filter: brightness(.97); }
.dom-check:disabled { opacity: .6; }
#spiderBody .dom-check { padding: 3px 9px; }

/* name leaderboard */
.nl { display: flex; flex-direction: column; gap: 7px; }
.nl-row { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; cursor: pointer; }
.nl-row:hover { border-color: var(--accent); }
.nl-row.top { background: var(--accent-soft); border-color: #d9dcfb; }
.nl-row.shortlist { box-shadow: inset 3px 0 0 var(--accent); }
.nl-row.rejected { opacity: .5; }
.nl-rank { font-weight: 800; font-size: 12px; color: var(--faint); width: 16px; text-align: center; flex: 0 0 auto; }
.nl-spider { flex: 0 0 auto; line-height: 0; }
.nl-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.nl-nm { font-weight: 750; font-size: 14px; letter-spacing: -.2px; }
.nl-sub { font-size: 11px; color: var(--mut); display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.nl-score { margin-left: auto; font-weight: 800; font-size: 15px; color: var(--accent); flex: 0 0 auto; }
#spiderBody .axes { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; }
#spiderBody .axrow { display: flex; align-items: center; gap: 8px; font-size: 12px; }
#spiderBody .axrow .lbl { flex: 0 0 96px; color: var(--mut); }
#spiderBody .axrow .bar { flex: 1; height: 6px; background: var(--line2); border-radius: 4px; overflow: hidden; }
#spiderBody .axrow .bar > i { display: block; height: 100%; background: var(--accent); }
#spiderBody .axrow .v { flex: 0 0 28px; text-align: right; font-weight: 700; }
#spiderBody .dtl-head { margin: 14px 0 6px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); font-weight: 700; }
#spiderBody .dtl { display: flex; flex-direction: column; gap: 6px; }
#spiderBody .dtl-row { display: flex; align-items: baseline; gap: 8px; font-size: 12px; }
#spiderBody .dtl-row .dtl-k { flex: 0 0 96px; color: var(--mut); font-weight: 600; }
#spiderBody .dtl-row .dtl-v { flex: 1; min-width: 0; }
#spiderBody .dtl-row .av { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px; }
#spiderBody .dtl-row .av.y { background: var(--green-soft); color: var(--green); }
#spiderBody .dtl-row .av.n { background: var(--red-soft); color: var(--red); }
/* wide two-column name detail popup */
.namepop-card { width: 92vw; }
.namepop { display: grid; grid-template-columns: 300px 1fr; gap: 26px; align-items: start; }
.namepop .np-left { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.namepop .np-spider { line-height: 0; }
.namepop .np-overall { font-size: 13px; }
.namepop .np-overall b { font-size: 16px; color: var(--accent); }
.namepop .np-meta { width: 100%; display: flex; flex-direction: column; gap: 0; margin: 0; border-top: 1px solid var(--line); }
.namepop .np-mrow { display: flex; gap: 10px; padding: 7px 2px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.namepop .np-mrow dt { flex: 0 0 96px; color: var(--mut); font-weight: 600; margin: 0; text-transform: capitalize; }
.namepop .np-mrow dd { flex: 1; min-width: 0; margin: 0; }
.namepop .np-right { min-width: 0; }
.namepop .np-h { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); font-weight: 700; margin-bottom: 10px; }
#spiderBody .axrow .bar > i.warn { background: var(--amber); }
#spiderBody .axrow .bar > i.low { background: var(--red); }
@media (max-width: 620px) { .namepop { grid-template-columns: 1fr; gap: 16px; } }

/* phones: marketing + modals */
@media (max-width: 560px) {
  .landing-top { padding: 16px 18px; }
  .landing-hero { padding: 14px 18px 36px; }
  .landing-cta { width: 100%; }
  .lbtn { flex: 1; min-width: 140px; padding: 13px 18px; }
  .landing-teaser { font-size: 13px; padding: 11px 14px; }
  .modal { padding: 12px; align-items: flex-start; }
  .modal-card, .auth-card { width: 100% !important; max-width: 100% !important; max-height: 92vh; overflow-y: auto; }
  .plans { grid-template-columns: 1fr; }
  .admin-body { padding: 14px; }
  .atable { font-size: 11.5px; }
}
.np-actions { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }
.np-del { background: none; border: 1px solid var(--line); color: var(--red); border-radius: 8px; padding: 6px 12px; font-size: 12px; font-weight: 650; }
.np-del:hover { border-color: var(--red); background: var(--red-soft); }
/* per-name reviews */
.np-reviews { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.rv-like { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.rv-like .rv-lk { font-size: 12.5px; color: var(--mut); flex: 0 0 auto; }
.rv-like input[type=range] { flex: 1; accent-color: var(--accent); }
.rv-like b { min-width: 58px; text-align: right; font-size: 13px; }
.rv-clear { background: none; border: none; color: var(--faint); cursor: pointer; font-size: 12px; padding: 2px 5px; border-radius: 5px; }
.rv-clear:hover { background: var(--line2); color: var(--ink); }
.rv-ta { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; line-height: 1.45; resize: vertical; min-height: 46px; font-family: inherit; margin-bottom: 8px; background: #fff; }
.rv-ta:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rv-note-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--mut); margin: 2px 0 6px; }
.rv-share { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: 11.5px; color: var(--mut); cursor: pointer; }
.rv-save { display: flex; align-items: center; gap: 10px; }
.rv-msg { font-size: 12px; color: var(--mut); }
.rv-others { display: flex; flex-direction: column; gap: 9px; }
.rv-other { display: flex; gap: 9px; align-items: flex-start; }
.rv-av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 800; flex: 0 0 auto; }
.rv-ob { flex: 1; min-width: 0; }
.rv-oh { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.rv-likebadge { font-size: 10.5px; font-weight: 700; background: var(--accent-soft); color: var(--accent); padding: 1px 7px; border-radius: 10px; }
.rv-text { font-size: 12.5px; color: var(--ink); margin-top: 2px; }
.rv-text.rv-note { color: var(--mut); font-style: italic; }
.nl-like { color: var(--accent); font-weight: 700; }

/* direction map (mindmap) */
.mapwrap { display: flex; flex-direction: column; gap: 2px; }
.map-node { display: flex; align-items: center; gap: 7px; padding: 4px 0; cursor: default; }
.map-node .dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.map-node.branch { cursor: pointer; }
.map-node.branch:hover .lbl { color: var(--accent); }
.map-node .twist { width: 12px; text-align: center; color: var(--faint); font-size: 10px; flex: 0 0 auto; }
.map-node .lbl { font-size: 13px; }
.map-node.root .lbl { font-weight: 800; }
.map-node.branch .lbl { font-weight: 650; }
.map-node.leaf .lbl { font-size: 12.5px; }
.map-node .ct { font-size: 10.5px; color: var(--faint); margin-left: 4px; }
.map-leaf-verdict { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }

/* leaderboard (models) */
.lb { display: flex; flex-direction: column; gap: 10px; }
.lb-row { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.lb-row .h { display: flex; align-items: center; gap: 8px; }
.lb-row .rank { width: 20px; height: 20px; border-radius: 6px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.lb-row.top .rank { background: var(--accent); }
.lb-row .ml { font-weight: 700; font-size: 13.5px; }
.lb-row .q { margin-left: auto; font-weight: 800; color: var(--accent); }
.bar { height: 6px; background: var(--line2); border-radius: 4px; margin: 8px 0 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.lb-row .stats { display: flex; gap: 14px; font-size: 11px; color: var(--mut); }
.empty { color: var(--faint); font-size: 13px; text-align: center; padding: 30px 10px; line-height: 1.5; }
.est { font-size: 10.5px; color: var(--faint); margin-top: 10px; }

@media (max-width: 1100px) { .app { grid-template-columns: 200px minmax(0, 1fr) 340px; } .resizer { display: none; } }

/* mobile bar / drawer — hidden on desktop */
.mobilebar, .drawer-backdrop { display: none; }

/* ---------- phones: one pane at a time + drawer sidebar ---------- */
@media (max-width: 800px) {
  .app { display: block; height: 100vh; height: 100dvh; }
  .mobilebar { display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 10px;
    border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 30; }
  .mb-btn { background: none; border: none; font-size: 21px; color: var(--ink); padding: 4px 10px; line-height: 1; }
  .mb-seg { display: flex; gap: 4px; background: var(--line2); padding: 3px; border-radius: 9px; margin-left: auto; }
  .mb-tab { border: none; background: none; padding: 7px 16px; border-radius: 7px; font-weight: 650; font-size: 13px; color: var(--mut); }
  .mb-tab.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

  .resizer, .sidebar-expand { display: none !important; }

  /* sidebar → off-canvas drawer */
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 84vw; max-width: 320px; border-right: 1px solid var(--line);
    transform: translateX(-100%); transition: transform .25s ease; z-index: 410; }
  #app.drawer-open .sidebar { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.25); }
  .drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 405; }
  #app:not(.drawer-open) .drawer-backdrop { display: none; }
  #app.drawer-open .drawer-backdrop { display: block; }
  .side-collapse { display: none; }

  /* work + chat fill the area below the bar; show one at a time */
  .work, .chatpane { position: fixed; top: 50px; left: 0; right: 0; bottom: 0; border: none; }
  #app:not(.mv-work) .work { display: none; }
  #app.mv-work .chatpane { display: none; }
  .workhead { padding: 12px 16px; }
  .composer { max-width: none; padding: 8px 12px 14px; }
  .tabwrap { padding: 14px; }
}
