/* Adwisely: monochrome interface. White surfaces, black ink, gray tones. */
:root {
  --bg: #ffffff;
  --surface: #fafafa;
  --surface-2: #f4f4f5;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --ink: #09090b;
  --ink-2: #27272a;
  --muted: #52525b;
  --subtle: #71717a;
  --faint: #a1a1aa;
  --accent: #09090b;
  --accent-ink: #ffffff;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --ok: #15803d;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(9, 9, 11, .04), 0 4px 16px rgba(9, 9, 11, .06);
  --shadow-lg: 0 12px 40px rgba(9, 9, 11, .14);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar: 240px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 620; }
h3 { font-size: 14px; font-weight: 620; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
mark { background: var(--ink); color: #fff; padding: 0 2px; border-radius: 2px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Layout ------------------------------------------------------------------ */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-right: 1px solid var(--border); background: var(--surface);
  display: flex; flex-direction: column; padding: 16px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 6px; background: var(--ink); display: grid; place-items: center; }
.brand-mark svg { width: 16px; height: 16px; }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.brand-org { font-size: 12px; color: var(--subtle); margin-top: -2px; }
.nav-section { margin-top: 14px; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 6px 10px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--muted); font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--ink); color: #fff; }
.nav a.active svg { stroke: #fff; }
.nav svg { width: 16px; height: 16px; stroke: currentColor; flex: none; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; text-decoration: none; border-radius: var(--radius-sm); }
.me:hover { background: var(--surface-2); }
.me-name { font-weight: 600; font-size: 13px; }
.me-role { font-size: 12px; color: var(--subtle); text-transform: capitalize; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); padding: 12px 32px; display: flex; align-items: center; gap: 12px;
}
.topbar .menu-btn { display: none; }
.i { width: 16px; height: 16px; stroke: currentColor; flex: none; }
.content { padding: 28px 32px 64px; max-width: 1180px; width: 100%; }
.content.narrow { max-width: 820px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 4px; }

/* Global search -------------------------------------------------------------- */
.global-search { position: relative; flex: 1; max-width: 680px; }
.global-search input {
  width: 100%; height: 38px; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0 70px 0 38px; background: var(--surface);
}
.global-search input:focus { background: #fff; border-color: var(--ink); outline: none; }
.global-search .icon { position: absolute; left: 12px; top: 11px; width: 16px; height: 16px; stroke: var(--subtle); }
.kbd {
  position: absolute; right: 10px; top: 9px; font-size: 11px; color: var(--subtle);
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; background: #fff;
}
.suggest {
  position: absolute; top: 44px; left: 0; right: 0; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 20;
}
.suggest button {
  display: flex; width: 100%; gap: 10px; align-items: center; text-align: left; border: 0; background: none;
  padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer;
}
.suggest button:hover, .suggest button.sel { background: var(--surface-2); }
.suggest .kind { font-size: 11px; color: var(--subtle); margin-left: auto; text-transform: uppercase; letter-spacing: .04em; }

/* Controls ----------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--ink); background: var(--ink); color: #fff;
  font-weight: 560; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--ink-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: #fff; color: var(--danger); border-color: #fecaca; }
.btn.danger:hover { background: var(--danger-bg); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 36px; padding: 0; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 560; font-size: 13px; }
.field .hint { font-size: 12px; color: var(--subtle); }
.input, select.input, textarea.input {
  width: 100%; min-height: 38px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 8px 12px; background: #fff;
}
textarea.input { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(9, 9, 11, .08); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; }
.checkbox { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--ink); }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.segmented button { border: 0; background: #fff; padding: 6px 12px; cursor: pointer; color: var(--muted); font-weight: 500; }
.segmented button + button { border-left: 1px solid var(--border-strong); }
.segmented button.on { background: var(--ink); color: #fff; }

/* Surfaces ----------------------------------------------------------------- */
.card { border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 14px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.progress { display: inline-block; width: 120px; height: 6px; border: 1px solid var(--ink); border-radius: 3px; overflow: hidden; vertical-align: middle; }
.progress > span { display: block; height: 100%; background: var(--ink); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack > * + * { margin-top: 12px; }
.muted { color: var(--muted); }
.subtle { color: var(--subtle); font-size: 12.5px; }
.empty { text-align: center; padding: 40px 20px; color: var(--subtle); }
.empty h3 { color: var(--ink); margin-bottom: 4px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 560; border: 1px solid var(--border-strong); color: var(--muted); background: #fff;
}
.badge.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.badge svg { width: 12px; height: 12px; stroke: currentColor; }

.stat { padding: 16px 18px; }
.stat .label { font-size: 12px; color: var(--subtle); font-weight: 500; }
.stat .value { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* Tables ------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 560; color: var(--subtle); padding: 10px 16px;
  border-bottom: 1px solid var(--border); background: var(--surface); white-space: nowrap;
}
.table td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--surface); }
.table .actions { text-align: right; white-space: nowrap; }

/* Lists -------------------------------------------------------------------- */
.list-item { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); text-decoration: none; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--surface); }
.doc-icon {
  width: 32px; height: 32px; flex: none; border-radius: 6px; border: 1px solid var(--border); background: var(--surface);
  display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase;
}
.avatar {
  width: 32px; height: 32px; flex: none; border-radius: 999px; background: var(--ink); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 650;
}
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.light { background: var(--surface-2); color: var(--ink); border: 1px solid var(--border); }

/* Search results ------------------------------------------------------------- */
.search-layout { display: grid; grid-template-columns: 220px 1fr; gap: 28px; }
.facets h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--subtle); margin: 0 0 8px; }
.facet { display: flex; justify-content: space-between; gap: 8px; width: 100%; border: 0; background: none; padding: 6px 8px; border-radius: 6px; cursor: pointer; color: var(--muted); text-align: left; }
.facet:hover { background: var(--surface-2); color: var(--ink); }
.facet.on { background: var(--ink); color: #fff; }
.facet .n { font-variant-numeric: tabular-nums; }
.result { padding: 16px 0; border-bottom: 1px solid var(--border); }
.result:first-child { padding-top: 4px; }
.result-title { font-size: 15.5px; font-weight: 600; text-decoration: none; color: var(--ink); cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
.result-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.result-meta { display: flex; gap: 8px; align-items: center; color: var(--subtle); font-size: 12.5px; margin: 2px 0 6px; flex-wrap: wrap; }
.result-snippet { color: var(--ink-2); }
.feature-card { border: 1px solid var(--ink); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 16px; background: var(--surface); }
.feature-card .eyebrow { font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--subtle); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }

/* Assistant ---------------------------------------------------------------- */
.assistant { display: grid; grid-template-columns: 260px 1fr; height: calc(100vh - 63px); }
.chat-list { border-right: 1px solid var(--border); overflow-y: auto; padding: 14px 10px; background: #fff; }
.chat-list a { display: block; padding: 8px 10px; border-radius: 6px; text-decoration: none; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list a:hover { background: var(--surface-2); color: var(--ink); }
.chat-list a.active { background: var(--surface-2); color: var(--ink); font-weight: 560; }
.chat-pane { display: flex; flex-direction: column; min-width: 0; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 28px 32px; }
.chat-inner { max-width: 780px; margin: 0 auto; }
.msg { margin-bottom: 26px; }
.msg-user { display: flex; justify-content: flex-end; }
.msg-user .bubble { background: var(--ink); color: #fff; border-radius: 14px 14px 4px 14px; padding: 10px 14px; max-width: 80%; white-space: pre-wrap; }
.msg-ai .who { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.msg-ai .body { color: var(--ink-2); }
.msg-ai .body p + p, .msg-ai .body ul + p, .msg-ai .body p + ul { margin-top: 10px; }
.msg-ai .body ul { margin: 8px 0; padding-left: 20px; }
.msg-ai .body li + li { margin-top: 4px; }
.cite { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 4px; margin: 0 1px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border-strong); font-size: 11px; font-weight: 650; cursor: pointer; vertical-align: 2px; color: var(--ink); }
.cite:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.sources { margin-top: 14px; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.source-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; background: #fff; cursor: pointer; text-align: left; }
.source-card:hover { border-color: var(--ink); }
.source-card .n { font-size: 11px; font-weight: 700; color: var(--subtle); }
.source-card .t { font-weight: 600; font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-card .s { font-size: 12px; color: var(--subtle); }
.no-evidence { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 12px 14px; color: var(--muted); background: var(--surface); }
.msg-actions { display: flex; gap: 4px; margin-top: 8px; }
.composer { border-top: 1px solid var(--border); padding: 14px 32px 18px; background: #fff; }
.composer-inner { max-width: 780px; margin: 0 auto; border: 1px solid var(--border-strong); border-radius: 12px; padding: 8px 8px 8px 14px; display: flex; gap: 8px; align-items: flex-end; }
.composer-inner:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(9, 9, 11, .06); }
.composer textarea { flex: 1; border: 0; resize: none; outline: none; min-height: 24px; max-height: 200px; padding: 6px 0; line-height: 1.5; }
.composer-note { max-width: 780px; margin: 8px auto 0; font-size: 12px; color: var(--subtle); display: flex; gap: 6px; align-items: center; }
.composer-note svg { width: 13px; height: 13px; stroke: currentColor; }
.thinking { display: inline-flex; gap: 4px; }
.thinking span { width: 6px; height: 6px; background: var(--faint); border-radius: 999px; animation: blink 1.2s infinite; }
.thinking span:nth-child(2) { animation-delay: .2s; }
.thinking span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.prompt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
.prompt { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: #fff; cursor: pointer; text-align: left; color: var(--ink-2); }
.prompt:hover { border-color: var(--ink); }

/* Home --------------------------------------------------------------------- */
.hero { padding: 24px 0 8px; }
.hero h1 { font-size: 28px; font-weight: 680; letter-spacing: -0.025em; }
.hero p { color: var(--muted); margin-top: 6px; font-size: 15px; }
.hero-search { margin-top: 18px; display: flex; gap: 10px; max-width: 760px; }
.hero-search .input { height: 46px; font-size: 15px; padding-left: 16px; border-radius: 10px; }
.hero-search .btn { height: 46px; border-radius: 10px; padding: 0 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { border: 1px solid var(--border-strong); border-radius: 999px; padding: 4px 12px; font-size: 13px; background: #fff; cursor: pointer; color: var(--muted); }
.chip:hover { border-color: var(--ink); color: var(--ink); }
.announcement { padding: 14px 20px; border-bottom: 1px solid var(--border); }
.announcement:last-child { border-bottom: 0; }

/* Overlays ----------------------------------------------------------------- */
.overlay { position: fixed; inset: 0; background: rgba(9, 9, 11, .4); z-index: 50; display: flex; justify-content: center; align-items: flex-start; padding: 8vh 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; overflow-wrap: anywhere; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface); border-radius: 0 0 12px 12px; }
.drawer-overlay { position: fixed; inset: 0; background: rgba(9, 9, 11, .3); z-index: 50; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100%); background: #fff; z-index: 51; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.drawer-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 12px; }
.drawer-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.doc-text { white-space: pre-wrap; font-size: 14px; line-height: 1.65; color: var(--ink-2); }
.doc-text + .doc-text { border-top: 1px dashed var(--border); margin-top: 14px; padding-top: 14px; }
.quote { border-left: 3px solid var(--ink); padding: 6px 12px; background: var(--surface); margin-bottom: 10px; color: var(--ink-2); }
.secret-box { display: flex; gap: 8px; align-items: center; border: 1px solid var(--ink); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface); word-break: break-all; }
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); max-width: 380px; font-size: 13.5px; }
.toast.error { background: #fff; color: var(--danger); border: 1px solid #fecaca; }
.alert { border: 1px solid var(--border-strong); background: var(--surface); padding: 10px 14px; border-radius: var(--radius-sm); color: var(--muted); }
.alert.error { border-color: #fecaca; background: var(--danger-bg); color: var(--danger); }
.alert.warn { border: 2px solid var(--ink); color: var(--ink); background: var(--surface); }

/* Auth --------------------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: var(--ink); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h2 { font-size: 30px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.2; max-width: 420px; }
.auth-side p { color: #a1a1aa; margin-top: 12px; max-width: 420px; font-size: 15px; }
.auth-points { display: grid; gap: 12px; margin-top: 28px; color: #d4d4d8; }
.auth-points div { display: flex; gap: 10px; align-items: flex-start; }
.auth-points svg { width: 18px; height: 18px; stroke: #fff; flex: none; margin-top: 1px; }
.auth-main { display: grid; place-items: center; padding: 32px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { margin-bottom: 4px; }
.auth-card .switch { margin-top: 18px; color: var(--muted); }
.auth-card .btn { width: 100%; height: 40px; margin-top: 4px; }

/* Bars ----------------------------------------------------------------------- */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding-top: 8px; }
.bars .bar { flex: 1; background: var(--ink); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bars .bar:hover { background: var(--muted); }
.bars-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--subtle); margin-top: 6px; }
.meter { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.meter > div { height: 100%; background: var(--ink); }

/* Responsive --------------------------------------------------------------- */
@media (max-width: 1024px) {
  .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-layout { grid-template-columns: 1fr; }
  .facets { display: flex; gap: 16px; flex-wrap: wrap; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; left: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 16px; }
  .content { padding: 20px 16px 48px; }
  .grid.two, .grid.three, .grid.four { grid-template-columns: 1fr; }
  .assistant { grid-template-columns: 1fr; height: calc(100vh - 59px); }
  .chat-list { display: none; }
  .chat-scroll, .composer { padding-left: 16px; padding-right: 16px; }
  .prompt-grid { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .kbd { display: none; }
  .hero-search { flex-wrap: wrap; }
  .hero-search .input { flex: 1 1 100%; }
  .hero-search .btn { flex: 1; }
}

.list-plain { display: block; text-decoration: none; color: inherit; }
a.list-plain:hover { border-color: var(--ink); }
a.feature-card { display: block; text-decoration: none; }
.card > p.muted, .card-pad > p.muted { margin-top: 8px; }
.auth-side .brand-mark { background: #fff; }
.auth-side .brand-mark svg { stroke: var(--ink); }
.feature-card .eyebrow .i, .badge .i { width: 12px; height: 12px; }
.card-head .i { color: var(--subtle); }
.card-pad .value { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.badge { white-space: nowrap; }
.auth-card .btn + .btn { margin-top: 8px; }
.action-card { border: 1px solid var(--ink); border-radius: var(--radius); padding: 12px 14px; margin-top: 12px; background: #fff; }
.assessment { margin-top: 10px; display: grid; gap: 6px; }
.assessment summary { cursor: pointer; list-style: none; }
.assessment ul { margin: 6px 0 0 18px; padding: 0; }
.next-action { border-left: 2px solid var(--ink); padding: 4px 10px; }
.action-input { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 10px 0; font-size: 13px; }
.action-input dt { color: var(--subtle); font-family: var(--mono); font-size: 12px; }
.action-input dd { margin: 0; white-space: pre-wrap; word-break: break-word; }
.research-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; cursor: pointer; padding: 0 4px; }
.research-toggle input { accent-color: var(--ink); }
.msg-user .author { text-align: right; margin-bottom: 2px; }
.msg-ai .body h2, .msg-ai .body h3 { margin: 14px 0 6px; font-size: 15px; }
.composer-note .btn { height: 24px; padding: 0 8px; font-size: 12px; }
.composer-inner { flex-wrap: wrap; align-items: center; }
.composer textarea { flex: 1 1 100%; order: -1; }
.composer #send { margin-left: auto; }

/* Notifications */
.notif { position: relative; }
.notif .dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 999px; background: var(--ink); border: 2px solid var(--bg); }
.notif-panel { position: absolute; right: 0; top: 44px; width: 360px; max-height: 70vh; overflow-y: auto; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 30; padding: 6px; }
.notif-head { padding: 6px 8px; }
.notif-item { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: var(--radius-sm); text-decoration: none; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { border-left: 3px solid var(--ink); }
.notif-empty { padding: 16px 10px; }
/* People */
.experts { margin-bottom: 16px; }
.experts .eyebrow { font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--subtle); margin-bottom: 8px; display: flex; gap: 6px; align-items: center; }
.expert { gap: 8px; margin-right: 14px; }
.org-tree, .org-tree ul { list-style: none; margin: 0; padding-left: 0; }
.org-tree ul { margin-left: 18px; padding-left: 18px; border-left: 1px solid var(--border); }
.org-node { display: inline-flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin: 6px 0; text-decoration: none; background: var(--bg); }
.org-node:hover { border-color: var(--ink); }

/* Dark theme: same monochrome system, inverted */
:root[data-theme="dark"] {
  --bg: #09090b; --surface: #111113; --surface-2: #1c1c1f; --border: #27272a; --border-strong: #3f3f46;
  --ink: #fafafa; --ink-2: #e4e4e7; --muted: #a1a1aa; --subtle: #8b8b94; --faint: #52525b;
  --danger: #f87171; --danger-bg: #2a1213;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 40px rgba(0, 0, 0, .6);
}
:root[data-theme="dark"] body { background: var(--bg); color: var(--ink); }
:root[data-theme="dark"] .btn { color: var(--bg); }
:root[data-theme="dark"] .btn.secondary, :root[data-theme="dark"] .btn.ghost, :root[data-theme="dark"] .btn.danger { color: var(--ink); background: transparent; }
:root[data-theme="dark"] .btn.secondary:hover, :root[data-theme="dark"] .btn.ghost:hover { background: var(--surface-2); }
:root[data-theme="dark"] .btn:hover:not(.secondary):not(.ghost):not(.danger) { background: #d4d4d8; }
:root[data-theme="dark"] .card, :root[data-theme="dark"] .modal, :root[data-theme="dark"] .drawer, :root[data-theme="dark"] .suggest,
:root[data-theme="dark"] .input, :root[data-theme="dark"] .chat-list, :root[data-theme="dark"] .composer, :root[data-theme="dark"] .source-card,
:root[data-theme="dark"] .prompt, :root[data-theme="dark"] .chip, :root[data-theme="dark"] .badge, :root[data-theme="dark"] .kbd,
:root[data-theme="dark"] .action-card, :root[data-theme="dark"] .segmented button { background: var(--surface); color: var(--ink); }
:root[data-theme="dark"] .topbar { background: rgba(9, 9, 11, .92); }
:root[data-theme="dark"] .nav a.active, :root[data-theme="dark"] .badge.dark, :root[data-theme="dark"] .msg-user .bubble,
:root[data-theme="dark"] .avatar:not(.light), :root[data-theme="dark"] .facet.on, :root[data-theme="dark"] .segmented button.on,
:root[data-theme="dark"] mark, :root[data-theme="dark"] .brand-mark { background: var(--ink); color: var(--bg); }
:root[data-theme="dark"] .nav a.active svg, :root[data-theme="dark"] .brand-mark svg { stroke: var(--bg); }
:root[data-theme="dark"] .modal-foot { background: var(--surface-2); }
:root[data-theme="dark"] .table th { background: var(--surface-2); }
:root[data-theme="dark"] .toast { background: var(--ink); color: var(--bg); }
.nowrap { white-space: nowrap; }

/* Device sign-in --------------------------------------------------------------- */
.device-code { font-size: 28px; font-weight: 650; letter-spacing: .12em; text-align: center; }

/* Chat attachments and document summaries -------------------------------------- */
.attachments { gap: 6px; flex-wrap: wrap; padding: 0 4px; }
.attachments:empty { display: none; }
.attachments .chip { display: inline-flex; align-items: center; gap: 4px; cursor: default; padding: 2px 4px 2px 10px; }
.attachments .chip .i { width: 14px; height: 14px; }
.summary .eyebrow { margin-bottom: 6px; }

/* Agent builder -------------------------------------------------------------------- */
.step { margin-bottom: 10px; }
.step .step-id { width: 140px; }
.step select[data-k="type"] { width: auto; }
ol.trace { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.trace-step { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.trace-step .doc-text { margin-top: 6px; max-height: 160px; overflow: auto; }
.plain-list { margin: 8px 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.meeting { align-items: flex-start; }
.meeting-time { min-width: 92px; font-weight: 600; font-variant-numeric: tabular-nums; }
.meeting .related { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.meeting .related .chip { text-decoration: none; }
.result.card { padding: 16px 20px; margin-bottom: 12px; }
.task { align-items: flex-start; }
.task .quote { margin-top: 6px; }
.overdue { color: var(--danger); font-weight: 600; }
.chip.on { background: var(--ink); color: var(--surface); }
a.chip { text-decoration: none; }
.draft-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; margin-top: 12px; }
.input.draft-body { width: 100%; min-height: 60vh; height: auto; resize: vertical; line-height: 1.6; }
.draft-title { font-size: 18px; font-weight: 600; }
.draft-bar { flex-wrap: wrap; gap: 8px; }
.draft-read { line-height: 1.6; }
@media (max-width: 800px) { .draft-layout { grid-template-columns: 1fr; } }
.draft-layout .list-plain.row { gap: 8px; margin-top: 8px; }
.entity-card { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; }
.entity-card h3 { margin: 4px 0 0; }
.scroll-list { max-height: 180px; overflow: auto; }
.lead { font-size: 15px; max-width: 760px; }
.comment { border-top: 1px solid var(--border); padding: 8px 0; }
.comment.resolved { opacity: .6; }
.comment p { margin: 4px 0; }
.mail.done { opacity: .6; }
.mail details { margin-top: 6px; }
.data-table td, .data-table th { white-space: nowrap; font-variant-numeric: tabular-nums; }
.org-logo { width: 26px; height: 26px; border-radius: 6px; object-fit: contain; background: var(--bg); }
.org-logo.lg { width: 48px; height: 48px; border: 1px solid var(--border); }
.maintenance-banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 24px; border-bottom: 1px solid var(--border); background: var(--surface); font-size: 14px; }
.maintenance-banner svg { width: 16px; height: 16px; margin-top: 2px; flex: none; }
.answer-images { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.answer-images figure { margin: 0; max-width: 240px; border: 1px solid var(--border); border-radius: var(--radius); padding: 6px; background: var(--bg); }
.answer-images img { display: block; max-width: 100%; max-height: 180px; object-fit: contain; border-radius: 4px; }
.answer-images figcaption { font-size: 12px; margin-top: 4px; color: var(--muted); }
.mcp-app { width: 100%; height: 240px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; margin-top: 8px; }

/* Mobile and desktop (installed app) */
.share-preview { white-space: pre-wrap; word-break: break-word; font: inherit; background: var(--surface-2); border-radius: 8px; padding: 12px; margin: 0; max-height: 40vh; overflow: auto; }
#mic-btn.active { background: var(--ink); color: var(--bg); }
#mic-btn.active svg { stroke: var(--bg); }
#push-box:not(:empty) { margin-bottom: 16px; }

/* Autonomous agents: the research plan under an answer */
.agent-plan { margin: 4px 0 8px; font-size: 13px; }
.agent-plan summary { cursor: pointer; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.agent-plan ol { margin: 6px 0 0 18px; padding: 0; }
.agent-plan li { margin: 2px 0; }

/* Charts for query results (monochrome) */
.chart { margin: 0; }
.chart svg { width: 100%; max-width: 720px; height: auto; display: block; }
.chart .bar { fill: var(--ink); }
.chart .axis { stroke: var(--ink); stroke-width: 1; }
.chart text { font-size: 11px; fill: var(--muted); }
.chart .val { fill: var(--ink); font-weight: 600; }
.chart .line { fill: none; stroke: var(--ink); stroke-width: 2; }
.chart .dot { fill: var(--ink); }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dashboard-grid .tile.wide { grid-column: 1 / -1; }
.big-number { font-size: 40px; font-weight: 700; line-height: 1.1; }
@media (max-width: 720px) { .dashboard-grid { grid-template-columns: 1fr; } }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.image-card img { width: 100%; height: auto; display: block; border-radius: 6px; }

/* Graph explorer (Batch 106): monochrome; shapes tell the types apart. */
.graph-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .graph-layout { grid-template-columns: 1fr; } }
.graph-card { padding: 8px; overflow: hidden; }
.graph-canvas { width: 100%; height: auto; display: block; }
.graph-canvas .edges line { stroke: var(--border-strong); }
.graph-canvas .node { cursor: pointer; outline: none; }
.graph-canvas .node > :first-child { fill: var(--surface); stroke: var(--ink); stroke-width: 1.5; }
.graph-canvas .node .ring { fill: none; stroke-dasharray: 3 2; }
.graph-canvas .node text { font: 11px var(--font); fill: var(--muted); text-anchor: middle; pointer-events: none; }
.graph-canvas .node:hover > :first-child, .graph-canvas .node:focus > :first-child { stroke-width: 2.5; }
.graph-canvas .node.center > :first-child { fill: var(--ink); }
.graph-canvas .node.center text { fill: var(--ink); font-weight: 600; }
.graph-side { max-height: 720px; overflow: auto; }
.graph-side h3 { font-size: 13px; margin: 14px 0 6px; }

/* Feedback themes (Batch 114): weekly counts as small monochrome bars. */
.spark { display: block; }
.spark rect { fill: var(--ink); opacity: .7; }
