/* CarryBrain web UI. Tokens from landing/brand.md. */

:root {
  color-scheme: dark;
  --orange: #FF7A2F;
  --main: #FFFFFF;
  --on-main: #0E0E0E;
  --ink: #F5F5F5;
  --muted: #A3A3A3;
  --bg: #0E0E0E;
  --surface: #151515;
  --surface-2: #1C1C1C;
  --line: #333333;
  --line-strong: #4A4A4A;
  --chip: #2E1E14;
  --on-chip: #FFD7BD;
  --bubble-line: #4A2E1C;
  --danger: #FF9B8F;

  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-full: 9999px;
  --topbar: 72px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body.has-drawer { overflow: hidden; }
h1, h2, h3, p, ul, ol { margin: 0; }
p { text-wrap: pretty; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
main:focus-visible { outline: none; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 16px; top: -48px; z-index: 100; background: var(--main); color: var(--on-main); padding: 8px 16px; border-radius: var(--r-full); font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }

.muted { color: var(--muted); }
.fineprint { color: var(--muted); font-size: 14px; }
.center { text-align: center; }
.boot { padding: 48px 32px; color: var(--muted); }

/* ---------------------------------------------------------------- top bar */

.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar);
  display: flex; align-items: center; gap: 40px; padding: 0 32px;
  background: rgba(14, 14, 14, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.logo { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
/* The CarryBrain mark (carrybrain-mark.svg): the tilt is in the drawing */
.logo-tile { display: block; flex: none; width: auto; height: 37px; }
.logo-tile-lg { height: 61px; }
.logo-word { font-family: var(--font-display); font-weight: 800; font-size: 22px; letter-spacing: -0.03em; }

.tabs {
  display: inline-flex; gap: 2px; padding: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-full);
}
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 20px; border-radius: var(--r-full);
  color: var(--muted); text-decoration: none; font-weight: 500; font-size: 16px;
  transition: color .15s, background-color .15s;
}
.tab:hover { color: var(--ink); }
.tab.is-active { background: var(--surface-2); color: var(--ink); }
.tab.is-active::after {
  content: ""; position: absolute; left: 50%; bottom: 3px; width: 16px; height: 2px; margin-left: -8px;
  border-radius: 2px; background: var(--orange);
}
.tab-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); }

/* ---------------------------------------------------------------- buttons, chips, dots */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 24px; border-radius: var(--r-full); border: 1px solid transparent;
  font-family: var(--font-body); font-weight: 700; font-size: 15px; line-height: 1.2;
  text-decoration: none; white-space: nowrap; background: transparent; color: var(--ink);
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-main { background: var(--main); color: var(--on-main); }
.btn-main:hover { background: #E8E8E8; }
.btn-outline { border-color: var(--line-strong); }
.btn-outline:hover { border-color: #777; background: var(--surface-2); }
.btn-quiet { color: var(--muted); font-weight: 500; }
.btn-quiet:hover { color: var(--ink); }
.btn-sm { min-height: 38px; padding: 0 16px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-danger { color: var(--danger); }
.btn-danger.btn-outline { border-color: #6B3A34; }
.btn-danger.btn-outline:hover { border-color: var(--danger); background: transparent; }
.btn-copy {
  min-height: 32px; padding: 0 12px; border-radius: var(--r-sm); font-size: 13px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line);
}
.btn-copy:hover { background: #262626; }

.link-btn {
  padding: 0; border: 0; background: none; color: var(--ink); font-weight: 500;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: #777;
}
.link-btn:hover { text-decoration-color: var(--ink); }

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0;
  border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--muted);
}
.icon-btn:hover:not(:disabled) { color: var(--ink); border-color: var(--line-strong); }
.icon-flip .ico { transform: scaleX(-1); }
.ico { display: inline-flex; flex: none; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: var(--r-full);
  background: var(--chip); color: var(--on-chip); font-size: 13px; font-weight: 500; line-height: 1.5; white-space: nowrap;
}
.chip-sm { padding: 1px 9px; font-size: 12px; }

.dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; }
.dot-orange { background: var(--orange); box-shadow: 0 0 0 4px rgba(255, 122, 47, .16); }
.dot-grey { background: #777; }
.dot-off { background: #444; }
.dot-hollow { border: 1.5px solid var(--muted); }

.status { font-size: 13px; color: var(--muted); border: 1px solid var(--line); border-radius: var(--r-full); padding: 1px 9px; }
.status-held { color: var(--on-chip); border-color: var(--bubble-line); }

/* agent marks: the real logo as a mask, so it takes the text colour */
.mark {
  display: inline-grid; place-items: center; flex: none; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid #262626; color: #E5E5E5;
}
.mark-img { width: 58%; height: 58%; background: currentColor; -webkit-mask: var(--logo) center / contain no-repeat; mask: var(--logo) center / contain no-repeat; }
.mark-letter { font-family: var(--font-display); font-weight: 800; font-size: 14px; color: var(--muted); }
.mark-xs { width: 18px; height: 18px; border: 0; background: none; border-radius: 4px; }
.mark-xs .mark-img { width: 100%; height: 100%; }
.mark-xs.mark-letter { background: #2A2A2A; font-size: 11px; }
.mark-sm { width: 30px; height: 30px; }
.mark-md { width: 44px; height: 44px; border-radius: 12px; }
.mark-md.mark-letter { font-size: 20px; }

.spinner {
  display: inline-block; flex: none; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--orange); animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 24px 0; }

.error-box { border: 1px solid #5A2E28; background: #1A1210; border-radius: var(--r-md); padding: 16px 20px; display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

.label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.text-input, .login input {
  width: 100%; min-height: 46px; padding: 0 16px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--line); color: var(--ink);
}
.text-input:focus-visible, .login input:focus-visible, .editor:focus-visible, .search:focus-within { outline: 2px solid var(--ink); outline-offset: 1px; }
.editor {
  width: 100%; resize: vertical; padding: 12px 14px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--line-strong); color: var(--ink); font-size: 17px; line-height: 1.4;
}

/* ---------------------------------------------------------------- pages */

.page { max-width: 1240px; margin: 0 auto; padding: 40px 32px 96px; }
.page-narrow { max-width: 800px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.page-title { font-family: var(--font-display); font-weight: 800; font-size: 44px; line-height: 1.08; letter-spacing: -0.02em; text-wrap: balance; }
.page-lede { margin: -12px 0 24px; }

/* ---------------------------------------------------------------- login */

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: min(420px, 100%); display: flex; flex-direction: column; align-items: stretch; gap: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 26px; padding: 40px 32px;
}
.login-card .logo-tile { align-self: center; margin-bottom: 20px; }
.login-title { font-family: var(--font-display); font-weight: 800; font-size: 34px; text-align: center; letter-spacing: -0.02em; }
.login-card > .muted { text-align: center; margin: 6px 0 28px; }
.field-error { min-height: 22px; margin: 6px 0 10px; color: var(--danger); font-size: 14px; }
.login-card .fineprint { margin-top: 16px; text-align: center; }

/* ---------------------------------------------------------------- first run */

.empty { max-width: 720px; margin: 0 auto; padding: 56px 24px 96px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.hub { width: min(400px, 100%); height: auto; overflow: visible; }
.hub-line { stroke: #4A4A4A; stroke-width: 1.5; stroke-dasharray: 2 5; stroke-linecap: round; }
.hub-node { fill: var(--bg); stroke: #4A4A4A; stroke-width: 1.5; stroke-dasharray: 3 5; }
.hub-core { fill: var(--surface-2); stroke: var(--orange); stroke-width: 2; }
.empty-title { margin-top: 36px; font-family: var(--font-display); font-weight: 800; font-size: 60px; line-height: 1.02; letter-spacing: -0.03em; text-wrap: balance; }
.empty-lede { margin: 16px 0 32px; color: var(--muted); font-size: 19px; }
.works-with { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 24px; margin-top: 32px; color: var(--muted); font-size: 14px; }
.works-with li { display: inline-flex; align-items: center; gap: 8px; }
.works-with .mark { color: var(--muted); }

/* ---------------------------------------------------------------- brain */

.brain {
  max-width: 1320px; margin: 0 auto; padding: 28px 32px 96px;
  display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start;
}
.topics {
  position: sticky; top: calc(var(--topbar) + 28px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px;
  min-height: min(560px, calc(100vh - var(--topbar) - 56px));
}
.topic-list { display: flex; flex-direction: column; gap: 2px; }
.topic {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 10px;
  text-decoration: none; color: var(--ink); font-size: 17px; font-weight: 500;
  transition: background-color .15s;
}
.topic .ico { color: var(--muted); }
.topic:hover { background: #191919; }
.topic.is-active { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--orange); }
.topic.is-active .ico { color: var(--orange); }
.topic-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topic-count { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 16px; }
.topic-sep { height: 1px; background: var(--line); margin: 8px 6px; }

.brain-main { min-width: 0; }

/* "In progress": the open handoff (spec 6.16) */
.progress-slot:not(:empty) { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.progress {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: inset 4px 0 0 var(--orange); padding: 18px 22px 14px 26px;
}
.progress-label { color: var(--muted); font-size: 15px; }
.progress-text {
  margin: 6px 0 10px; font-family: var(--font-display); font-weight: 600; font-size: 26px; line-height: 1.2;
  letter-spacing: -0.01em; white-space: pre-line; overflow-wrap: anywhere;
}
.progress-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; }
.progress-meta { color: var(--muted); font-size: 15px; }
.progress-done { margin-right: -12px; }
.needs-slot:not(:empty) { margin-bottom: 20px; }
.needs { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.needs.is-open { border-color: var(--bubble-line); }
.needs-head { display: flex; align-items: center; gap: 10px; padding: 13px 20px; font-size: 17px; flex-wrap: wrap; }
.needs-head .dot { margin-right: 4px; }
.needs-body { padding: 4px 20px 22px; }

.brain-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 4px 0 20px; }
.brain-title { font-family: var(--font-display); font-weight: 800; font-size: 52px; line-height: 1.05; letter-spacing: -0.03em; min-width: 0; overflow-wrap: anywhere; }
.search {
  flex: 0 1 380px; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: var(--bg);
}
.search-input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; font-size: 17px; color: var(--ink); }
.search-input::placeholder { color: var(--muted); }
.search-input::-webkit-search-cancel-button { filter: invert(.7); }

.fact-group + .fact-group { margin-top: 28px; }
.group-title { display: flex; align-items: baseline; gap: 10px; margin: 0 0 10px 4px; font-family: var(--font-display); font-weight: 600; font-size: 20px; }
.group-title a { text-decoration: none; }
.group-title a:hover { text-decoration: underline; text-underline-offset: 3px; }
.group-count { color: var(--muted); font-family: var(--font-body); font-size: 15px; font-weight: 400; }
.result-count { color: var(--muted); margin: 0 0 12px 4px; }

.fact-list { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.fact-list > li + li { border-top: 1px solid var(--line); }
.fact-row {
  width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px;
  padding: 20px 24px; border: 0; background: transparent; text-align: left; color: var(--ink);
  transition: background-color .15s;
}
.fact-row:hover { background: #131313; }
.fact-row:focus-visible { outline-offset: -2px; border-radius: 0; }
.fact-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fact-text { font-size: 18px; line-height: 1.4; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; overflow-wrap: anywhere; }
.fact-changed { color: var(--muted); font-size: 14px; }
.tag-old { color: var(--muted); font-size: 12px; line-height: 1.5; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--r-full); }
.fact-meta { color: var(--muted); font-size: 16px; white-space: nowrap; text-align: right; }

.list-empty { border: 1px dashed var(--line); border-radius: var(--r-md); padding: 40px 28px; text-align: center; }
.list-empty-title { font-family: var(--font-display); font-weight: 600; font-size: 22px; margin-bottom: 6px; }

/* review ("needs a look") */
.review { padding-top: 12px; }
.review-card { border: 1px solid var(--line); border-radius: 20px; background: var(--bg); padding: 28px 28px 24px; text-align: center; }
.review-flag, .review-why { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 15px; }
.review-text { margin: 20px auto 18px; max-width: 640px; font-family: var(--font-display); font-weight: 800; font-size: 34px; line-height: 1.12; letter-spacing: -0.02em; text-wrap: balance; overflow-wrap: anywhere; }
.review-meta { color: var(--muted); font-size: 15px; }
.review-text-sm { font-size: 26px; line-height: 1.2; white-space: pre-line; }
.review-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.review-card .editor { margin: 18px 0; text-align: left; }
.review-title { text-align: center; font-family: var(--font-display); font-weight: 800; font-size: 34px; letter-spacing: -0.02em; margin-bottom: 10px; }
.review-why { margin-bottom: 22px; }
.versus { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 20px; align-items: start; }
.versus-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.versus-card { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); padding: 20px 22px 26px; min-height: 140px; }
.versus-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 15px; margin-bottom: 12px; }
.versus-text { font-family: var(--font-display); font-weight: 800; font-size: 26px; line-height: 1.15; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.versus-vs { align-self: center; margin-top: -60px; color: var(--muted); font-family: var(--font-display); font-weight: 600; font-size: 20px; }
.versus-more { display: flex; justify-content: center; gap: 8px; margin-top: 14px; }
.versus-edit { margin-top: 8px; }
.review-conflict .fineprint { margin-top: 6px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; color: var(--muted); font-size: 14px; }

/* fact detail panel */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .55); animation: fade .15s ease-out; }
.drawer {
  position: fixed; z-index: 41; top: 0; right: 0; bottom: 0; width: min(560px, 100vw);
  display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line);
  animation: slide .2s cubic-bezier(.2, .8, .2, 1);
}
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.drawer-close { position: absolute; top: 18px; right: 18px; z-index: 1; background: var(--surface); }
.drawer-body { flex: 1; overflow-y: auto; padding: 32px 36px 28px; }
.detail-topic { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 15px; margin-bottom: 14px; padding-right: 48px; }
.detail-topic a { text-decoration: none; }
.detail-topic a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.detail-title { font-family: var(--font-display); font-weight: 800; font-size: 44px; line-height: 1.04; letter-spacing: -0.03em; text-wrap: balance; overflow-wrap: anywhere; }
.drawer-body > .fact-changed { margin-top: 10px; }
.editor-title { font-family: var(--font-display); font-weight: 600; font-size: 26px; line-height: 1.2; }
.detail-label { margin: 32px 0 12px; color: var(--muted); font-family: var(--font-body); font-weight: 500; font-size: 16px; }
.said-by { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-source { padding: 6px 14px 6px 8px; font-size: 15px; gap: 8px; }
.chip-source .mark { color: var(--on-chip); }
.chip-source .mark-letter { background: #4A2E1C; color: var(--on-chip); border-radius: 50%; }
.excerpts { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.excerpts q { color: var(--ink); }
.history { display: flex; flex-direction: column; gap: 10px; }
.history-row { color: var(--muted); font-size: 16px; }
.history-text { color: #D4D4D4; }
.history-meta { margin-right: 10px; }
.drawer-body > .fineprint { margin-top: 32px; }
.drawer-foot { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding: 16px 24px; border-top: 1px solid var(--line); }

/* ---------------------------------------------------------------- connect */

.agent-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.agent-card {
  height: 100%; min-height: 212px; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px 26px;
}
.agent-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.agent-card .mark-md { background: none; border: 0; color: var(--ink); width: 36px; height: 36px; }
.agent-card .mark-md .mark-img { width: 100%; height: 100%; }
.agent-card .mark-md.mark-letter { background: var(--surface-2); border: 1px solid #262626; }
.agent-name { font-family: var(--font-display); font-weight: 800; font-size: 28px; line-height: 1.1; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.agent-added, .agent-activity { color: var(--muted); font-size: 17px; margin-top: 4px; line-height: 1.4; }
.agent-activity.is-warn { display: flex; align-items: baseline; gap: 10px; color: var(--ink); }
.agent-activity.is-warn .dot { position: relative; top: -1px; }
.agent-status { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 15px; margin-top: auto; padding-top: 18px; }
.agent-add {
  align-items: center; justify-content: center; gap: 10px; text-decoration: none; color: var(--muted);
  background: transparent; border: 1.5px dashed #444; font-size: 17px;
  transition: color .15s, border-color .15s;
}
.agent-add:hover { color: var(--ink); border-color: #777; }

.flow { background: var(--surface); border: 1px solid var(--line); border-radius: 26px; padding: 40px 40px 32px; }
.flow-title { font-family: var(--font-display); font-weight: 800; font-size: 42px; line-height: 1.05; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.steps { margin-top: 32px; }
.step { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 18px; padding-bottom: 30px; }
.step:not(:last-child)::before { content: ""; position: absolute; left: 17px; top: 44px; bottom: 8px; width: 2px; background: var(--line); border-radius: 2px; }
.step-mark {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--line); color: var(--muted); font-weight: 700; font-size: 15px;
}
.step-done .step-mark { background: #8F8F8F; border-color: #8F8F8F; color: var(--bg); }
.step-current .step-mark { border-color: var(--orange); color: var(--orange); }
.step-main { min-width: 0; padding-top: 3px; }
.step-label { font-family: var(--font-body); font-weight: 500; font-size: 21px; line-height: 1.35; }
.step-todo .step-label { color: var(--muted); }
.step-sub { color: var(--muted); font-size: 17px; }

.client-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.client {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); color: var(--ink);
  font-weight: 500; font-size: 16px; text-align: left;
  transition: border-color .15s, background-color .15s;
}
.client:hover:not(:disabled) { border-color: var(--line-strong); background: #131313; }
.other-name { margin-top: 14px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form .text-input { flex: 1 1 220px; }

.snippet { margin-top: 12px; }
.snippet-steps { list-style: decimal; padding-left: 20px; color: var(--muted); font-size: 15px; margin-bottom: 12px; }
.code { border: 1px solid var(--line); border-radius: 12px; background: var(--bg); overflow: hidden; }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 8px 6px 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-family: var(--font-mono); font-size: 13px; line-height: 1.6; color: #E5E5E5; white-space: pre; }
.code-text pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.once { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; color: var(--on-chip); font-size: 14px; }
.rule { margin-top: 18px; }
.rule-label { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.file-sync { margin-top: 18px; }
.file-sync > summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 4px 0; width: fit-content; }
.file-sync > summary:hover, .file-sync[open] > summary { color: var(--ink); }
.file-sync[open] > summary { margin-bottom: 10px; }
.warn { margin-top: 16px; padding: 14px 18px; border-radius: 12px; background: var(--chip); border: 1px solid var(--bubble-line); color: var(--on-chip); font-size: 15px; }
.warn-title { font-weight: 700; margin-bottom: 4px; }
.snippet > .fineprint { margin-top: 10px; }
.snippet .fineprint a { color: var(--muted); text-underline-offset: 3px; }
.snippet .fineprint a:hover { color: var(--ink); }

.waiting { display: flex; align-items: center; gap: 10px; color: var(--muted); margin-top: 8px; font-size: 16px; }
.learned { margin-top: 4px; }
.learned-big { font-family: var(--font-display); font-weight: 800; font-size: 32px; line-height: 1.15; letter-spacing: -0.02em; }
.flow-foot { display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); padding-top: 20px; margin-top: 4px; }

/* ---------------------------------------------------------------- more */

.more-section { margin-top: 40px; }
.section-title { font-family: var(--font-display); font-weight: 600; font-size: 24px; }
.section-lede { margin: 4px 0 16px; }
.more-list { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.more-list > li + li { border-top: 1px solid var(--line); }
.more-row { display: flex; align-items: center; gap: 14px; padding: 16px 20px; flex-wrap: wrap; }
.more-row-text { flex: 1 1 180px; min-width: 0; }
.more-row-title { font-weight: 500; font-size: 17px; }
.more-row .agent-status { padding-top: 2px; margin: 0; font-size: 14px; }
.agent-row.is-revoked .more-row-title { color: var(--muted); }
.agent-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.seg { display: inline-flex; margin: 0; padding: 3px; border: 1px solid var(--line); border-radius: var(--r-full); background: var(--bg); min-width: 0; }
.seg-opt { position: relative; padding: 6px 14px; border-radius: var(--r-full); color: var(--muted); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.seg-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-opt:hover { color: var(--ink); }
.seg-opt.is-on { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--orange); }
.seg-opt:focus-within { outline: 2px solid var(--ink); outline-offset: 1px; }

.confirm { flex-basis: 100%; padding: 14px 16px; border-radius: 12px; background: var(--bg); border: 1px solid #5A2E28; }
.confirm-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ---------------------------------------------------------------- toasts */

.toast-wrap { position: fixed; left: 0; right: 0; bottom: 24px; z-index: 60; display: flex; justify-content: center; padding: 0 16px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 16px; max-width: 560px;
  padding: 10px 10px 10px 20px; border-radius: var(--r-full); background: var(--surface-2); border: 1px solid var(--line-strong);
  font-size: 15px; animation: rise .18s ease-out;
}
.toast-error { border-color: #6B3A34; }
.toast-out { opacity: 0; transition: opacity .18s; }
.toast-text { flex: 1; }
.toast-undo { min-height: 34px; padding: 0 16px; border-radius: var(--r-full); border: 1px solid var(--line-strong); background: transparent; color: var(--ink); font-weight: 700; font-size: 14px; }
.toast-undo:hover { background: #262626; }
.toast:not(:has(.toast-undo)) { padding-right: 20px; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .spinner { animation: none; border-top-color: var(--line); border-right-color: var(--orange); }
}

/* ---------------------------------------------------------------- smaller screens */

@media (max-width: 1080px) {
  .agent-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  .brain { grid-template-columns: minmax(0, 1fr); gap: 16px; padding-top: 20px; }
  .topics { position: static; min-height: 0; padding: 0; background: none; border: 0; }
  .topic-list { flex-direction: row; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
  .topic-list::-webkit-scrollbar { display: none; }
  .topic { padding: 7px 14px; gap: 8px; font-size: 15px; border: 1px solid var(--line); border-radius: var(--r-full); white-space: nowrap; }
  .topic .ico { display: none; }
  .topic.is-active { box-shadow: inset 0 0 0 1px var(--orange); border-color: transparent; }
  .topic-count { font-size: 14px; }
  .topic-sep { display: none; }
}

/* connect flow: "Try it" */
.try { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.try-line {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 10px 10px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
}
.try-q { font-family: var(--font-body); font-size: 17px; color: var(--ink); overflow-wrap: anywhere; }
.try-slow { display: flex; flex-direction: column; gap: 8px; }
.try-slow .try-q { font-family: var(--font-mono); font-size: 14px; }
.tried-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 17px; margin-top: 6px; }
.tried-line > .ico { color: var(--orange); }
.tried-from { display: contents; }
.tried-agent { display: inline-flex; align-items: center; gap: 6px; }

@media (max-width: 640px) {
  .progress { padding: 14px 16px 10px 20px; }
  .progress-text { font-size: 21px; }
  .progress-done { margin: 0 0 0 -16px; }
  .topbar { gap: 12px; padding: 0 16px; justify-content: space-between; height: 64px; --topbar: 64px; }
  .logo-word { display: none; }
  .tab { padding: 8px 16px; font-size: 15px; }
  .page, .brain { padding-left: 16px; padding-right: 16px; }
  .page { padding-top: 28px; }
  .page-title { font-size: 34px; }
  .page-head .btn { width: 100%; }

  .brain-head { flex-direction: column; align-items: stretch; gap: 14px; }
  .brain-title { font-size: 38px; }
  .search { flex-basis: auto; height: 48px; }
  .needs-head { padding: 12px 16px; font-size: 16px; }
  .needs-body { padding: 0 12px 16px; }
  .fact-row { grid-template-columns: auto minmax(0, 1fr); padding: 16px; gap: 4px 12px; align-items: start; }
  .fact-row .mark { margin-top: 1px; }
  .fact-meta { grid-column: 2; text-align: left; font-size: 14px; white-space: normal; }
  .fact-text { font-size: 17px; }

  .review-card { padding: 22px 16px 20px; }
  .review-text, .review-title { font-size: 26px; }
  .review-actions .btn { flex: 1 1 auto; }
  .versus { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .versus-vs { margin: 0; text-align: center; font-size: 16px; }
  .versus-card { min-height: 0; }
  .versus-text { font-size: 22px; }

  .drawer { width: 100vw; border-left: 0; }
  .drawer-body { padding: 24px 20px; }
  .detail-title { font-size: 34px; }
  .drawer-foot { padding: 12px 16px; justify-content: stretch; }
  .drawer-foot .btn { flex: 1; }

  .agent-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .agent-card { min-height: 0; }

  .flow { padding: 26px 18px 22px; border-radius: 20px; }
  .flow-title { font-size: 32px; }
  .step { grid-template-columns: 30px minmax(0, 1fr); gap: 12px; }
  .step-mark { width: 30px; height: 30px; font-size: 13px; }
  .step:not(:last-child)::before { left: 14px; top: 38px; }
  .step-label { font-size: 18px; }
  .client-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .client { padding: 9px 12px; }
  .learned-big { font-size: 26px; }

  .empty { padding-top: 32px; }
  .empty-title { font-size: 40px; }
  .empty-lede { font-size: 17px; }

  .more-row { padding: 14px 16px; }
  .toast-wrap { bottom: 16px; }
  .toast { border-radius: 18px; }
}
