:root {
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --surface-2: #F5F6F7;
  --ink: #0A0C0E;
  --ink-2: #33393F;
  --muted: #6A727B;
  --faint: #9AA1A9;
  --line: #E7E9EC;
  --line-strong: #D5D9DE;
  --accent: #059669;
  --accent-deep: #047857;
  --accent-soft: #ECFDF5;
  --accent-line: #A7F3D0;
  --error: #D92D20;
  --error-soft: #FEF3F2;
  --error-line: #FECDCA;
  --radius: 12px;
  --radius-sm: 8px;
  --ring: 0 0 0 3px rgba(5, 150, 105, .16);
  --shadow-xs: 0 1px 2px rgba(10, 12, 14, .05);
  --shadow: 0 1px 2px rgba(10, 12, 14, .04), 0 1px 1px rgba(10, 12, 14, .02);
  --shadow-lg: 0 12px 32px -12px rgba(10, 12, 14, .18), 0 2px 6px -2px rgba(10, 12, 14, .06);
  --ui: "Geist", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.55 var(--ui);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, p, ul, ol, dl, dd, pre { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--accent-deep); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1 { font: 600 26px/1.2 var(--ui); letter-spacing: -.03em; }
h2 { font: 600 16px/1.3 var(--ui); letter-spacing: -.015em; }
h3 { font: 600 14px/1.35 var(--ui); letter-spacing: -.008em; }
code, .mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: #D1FAE5; }
[hidden] { display: none !important; }

/* ── top bar ── */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 1200px; margin: 0 auto; padding: 0 28px; height: 56px; }
.wordmark { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font: 600 15px/1 var(--ui); letter-spacing: -.02em; }
.wordmark:hover { text-decoration: none; }
.wordmark em { font-style: normal; color: var(--muted); font-weight: 500; }
.topbar-user { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); min-width: 0; }
.user-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-button { background: none; border: 1px solid var(--line-strong); border-radius: 7px; padding: 5px 10px; font: 500 12.5px/1.2 var(--ui);
  color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.link-button:hover { background: var(--surface-2); color: var(--ink); }

.page { max-width: 1200px; margin: 0 auto; padding: 28px 28px 96px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 10px 0 28px; flex-wrap: wrap; }
.page-head .muted { margin-top: 6px; max-width: 64ch; }
.crumbs { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); text-decoration: none; }
.crumbs span { color: var(--line-strong); }

.flash { max-width: 1144px; margin: 16px auto 0; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13.5px;
  width: calc(100% - 56px); border: 1px solid; display: flex; align-items: center; gap: 10px; font-weight: 500; }
.flash::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.flash-ok { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-deep); }
.flash-error { background: var(--error-soft); border-color: var(--error-line); color: var(--error); }
.notice { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13.5px; border: 1px solid; margin-bottom: 4px; font-weight: 500; }
.notice-error { background: var(--error-soft); border-color: var(--error-line); color: var(--error); }

/* ── buttons & fields ── */
.button { 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(--line-strong); background: var(--surface); color: var(--ink);
  font: 500 13.5px/1 var(--ui); letter-spacing: -.005em; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-xs);
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s; }
.button:hover { background: var(--surface-2); border-color: #C3C8CE; text-decoration: none; }
.button:active:not(:disabled) { background: #ECEEF0; }
.button:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.button-primary { background: var(--ink); border-color: var(--ink); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 1px 2px rgba(10, 12, 14, .25); }
.button-primary:hover { background: #24292E; border-color: #24292E; }
.button-primary:active:not(:disabled) { background: #000; }
.button-small { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 7px; }
.button-quiet { border-color: transparent; background: transparent; color: var(--muted); box-shadow: none; }
.button-quiet:hover { background: var(--surface-2); border-color: transparent; color: var(--ink); }
.button-danger { color: var(--error); border-color: var(--error-line); }
.button-danger:hover { background: var(--error); border-color: var(--error); color: #fff; }
.button-block { width: 100%; height: 42px; font-size: 14px; }
.button.is-done { background: var(--accent); border-color: var(--accent); color: #fff; }

label { display: block; font: 500 13px/1.3 var(--ui); color: var(--ink); margin: 18px 0 6px; }
.optional { font-weight: 400; color: var(--faint); margin-left: 4px; }
input:not([type=checkbox]):not([type=radio]), select, textarea.code-area {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: 14px/1.4 var(--ui); box-shadow: var(--shadow-xs);
  transition: border-color .12s, box-shadow .12s; }
input.mono { font-family: var(--mono); font-size: 13px; }
input:not([type=checkbox]):not([type=radio]):hover, select:hover, textarea.code-area:hover { border-color: #B8BEC5; }
input:not([type=checkbox]):not([type=radio]):focus, select:focus, textarea.code-area:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: #A9AFB6; }
textarea.code-area { display: block; font: 13px/1.65 var(--mono); resize: vertical; tab-size: 2; }
textarea.notes-area { min-height: 320px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.field-error { color: var(--error); font-size: 13px; margin-top: 8px; }
.field-row { display: flex; gap: 12px; }
.field-row > .grow { flex: 1; min-width: 0; }
.field-row > .narrow { width: 96px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 400; font-size: 14px; color: var(--ink); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; flex: none; }
.prefixed { display: flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); box-shadow: var(--shadow-xs); }
.prefixed:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.prefixed span { padding-left: 12px; color: var(--muted); font-size: 13px; }
.prefixed input { border: 0 !important; box-shadow: none !important; padding-left: 2px !important; background: transparent !important; }

/* ── login ── */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.login-story { background: #0A0C0E; color: #C9CED4; padding: 40px 56px; display: flex; flex-direction: column;
  justify-content: space-between; gap: 40px; position: relative; overflow: hidden;
  background-image: radial-gradient(700px 420px at 12% 108%, rgba(16, 185, 129, .28), transparent 62%),
    radial-gradient(520px 320px at 96% -6%, rgba(56, 189, 248, .12), transparent 60%),
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: auto, auto, 44px 44px, 44px 44px; }
.wordmark-light { color: #fff; font-size: 16px; }
.wordmark-light em { color: #8B939C; }
.login-pitch { max-width: 500px; position: relative; }
.login-pitch h1 { font: 600 48px/1.04 var(--ui); letter-spacing: -.045em; color: #fff; }
.login-pitch > p { margin-top: 20px; font-size: 16px; line-height: 1.6; color: #A8AFB7; }
.login-pitch ul { margin-top: 32px; display: grid; gap: 12px; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 24px; }
.login-pitch li { font-size: 14px; color: #A8AFB7; padding-left: 24px; position: relative; }
.login-pitch li::before { content: ""; position: absolute; left: 2px; top: .5em; width: 8px; height: 8px; border-radius: 50%;
  background: #10B981; box-shadow: 0 0 0 3px rgba(16, 185, 129, .2); }
.login-pitch strong { color: #fff; font-weight: 500; }
.login-foot { font: 12px/1 var(--mono); color: #6A727B; letter-spacing: .02em; }
.login-form { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 28px; gap: 22px; }
.login-card { width: 100%; max-width: 360px; }
.login-card h2 { font-size: 24px; letter-spacing: -.03em; }
.login-card .muted { margin-top: 8px; }
.login-card form { margin-top: 10px; }
.login-card .button { margin-top: 20px; }
.code-input { font: 500 24px/1.2 var(--mono) !important; letter-spacing: .3em; text-align: center; }
.login-alt { margin-top: 18px; font-size: 13.5px; text-align: center; }
.login-note { font-size: 12.5px; color: var(--faint); max-width: 360px; text-align: center; }

/* ── companies ── */
.company-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.company-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; color: inherit; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s, transform .15s; }
.company-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-lg); transform: translateY(-1px); text-decoration: none; }
.company-card-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.company-card-top > div { min-width: 0; }
.company-card h2 { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-card .mono { color: var(--muted); margin-top: 2px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.monogram { flex: none; width: 38px; height: 38px; border-radius: 9px; color: #fff; display: grid; place-items: center;
  font: 600 16px/1 var(--ui); background: linear-gradient(135deg, #10B981, #047857);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(4, 120, 87, .4); }
.monogram-lg { width: 48px; height: 48px; font-size: 20px; border-radius: 11px; }
.company-facts { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.company-facts div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.company-facts dt { color: var(--muted); }
.company-facts dd { font-weight: 500; }
.company-title { display: flex; align-items: center; gap: 16px; }
.company-title .muted { margin-top: 3px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #C5CAD0; margin-right: 8px; vertical-align: 1px; }
.dot-ok { background: #10B981; box-shadow: 0 0 0 3px rgba(16, 185, 129, .16); }
.dot-error { background: var(--error); box-shadow: 0 0 0 3px rgba(217, 45, 32, .14); }
.empty { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 72px 28px;
  text-align: center; display: grid; justify-items: center; gap: 10px; }
.empty h2 { font-size: 18px; }
.empty p { color: var(--muted); max-width: 46ch; }
.empty .button { margin-top: 10px; }

/* ── panels ── */
.company-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; align-items: start; }
.section-nav { position: sticky; top: 80px; display: grid; gap: 1px; }
.section-nav a { padding: 7px 10px; border-radius: 7px; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.section-nav a:hover { background: #EEF0F2; color: var(--ink); text-decoration: none; }
.sections, .setup { display: grid; gap: 16px; min-width: 0; }
.setup { max-width: 840px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; min-width: 0; }
.panel-head { margin: -24px -24px 22px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.panel-head > div { display: flex; align-items: center; gap: 10px; }
.panel-head .muted { margin-top: 5px; max-width: 72ch; font-size: 13.5px; }
.step { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink-2); display: grid; place-items: center; font: 500 11.5px/1 var(--mono); flex: none; }
.panel-empty { color: var(--muted); padding: 22px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  font-size: 13.5px; text-align: center; }
.panel-foot { margin-top: 20px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.panel-foot .small { flex: 1; min-width: 220px; }
.rule { border: 0; border-top: 1px solid var(--line); margin: 24px -24px 4px; }

.provider-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.provider { border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); min-width: 0; }
.provider.is-connected { border-color: var(--accent-line); box-shadow: 0 0 0 3px rgba(16, 185, 129, .08); }
.provider.is-soon { background: var(--surface-2); border-style: dashed; }
.provider.is-soon h3, .provider.is-soon .provider-logo { opacity: .6; }
.provider-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; min-width: 0; }
.provider-top > div { flex: 1; min-width: 0; }
.provider-top h3, .provider-top p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.provider-top .badge { flex: none; }
.provider-logo { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: #fff;
  font: 600 15px/1 var(--ui); flex: none; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2); }
.provider-economic { background: #2B4A8B; }
.provider-billy { background: #1E7C8A; }
.provider-dinero { background: #B4532A; }
.provider-account { font-weight: 600; }
.provider-blurb { flex: 1; margin-bottom: 12px; }
.provider .button { align-self: flex-start; }
.provider .row-actions { margin-top: 14px; }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px;
  font: 500 12px/1 var(--ui); background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.badge-ok { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-deep); }
.badge-ok::before, .badge-error::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-error { background: var(--error-soft); border-color: var(--error-line); color: var(--error); }

.rows { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; flex-wrap: wrap; }
.row + .row { border-top: 1px solid var(--line); }
.rows-tight .row { padding: 10px 16px; }
.row-main { flex: 1; min-width: 160px; }
.row-main h3 { overflow-wrap: anywhere; }
.row-main h3 a { color: inherit; }
.row-main h3 a:hover { color: var(--accent-deep); }
.row-main p { margin-top: 2px; }
.row-actions { display: flex; gap: 6px; align-items: center; }
.row-stack { align-items: flex-start; }
.row-details { flex-basis: 100%; margin-top: 0 !important; }
.source-type { font: 500 11px/1 var(--mono); color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 8px; }

.copy-field { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 6px 6px 14px; background: var(--surface-2); }
.copy-field code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font-size: 13px; padding: 4px 0; scrollbar-width: thin; }
.copy-field + .small { margin-top: 10px; }
.masked { color: var(--faint); }
.reveal { border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: 10px; padding: 16px; }
.reveal p { font-size: 13.5px; margin-bottom: 12px; }
.reveal .copy-field { background: var(--surface); }
.snippet { position: relative; border-radius: 10px; background: #0A0C0E; padding: 16px 18px; }
.snippet pre { overflow-x: auto; font: 12.5px/1.75 var(--mono); color: #D7DCE1; scrollbar-width: thin; padding-right: 64px; }
.snippet .button { position: absolute; top: 10px; right: 10px; background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .14);
  color: #E6E9EC; box-shadow: none; }
.snippet .button:hover { background: rgba(255, 255, 255, .16); }
.snippet .button.is-done { background: var(--accent); border-color: var(--accent); }
.snippet + .hint { margin-top: 12px; }
.howto { margin-top: 22px; counter-reset: howto; display: grid; gap: 10px; }
.howto li { counter-increment: howto; padding-left: 32px; position: relative; color: var(--ink-2); }
.howto li::before { content: counter(howto); position: absolute; left: 0; top: 0; width: 20px; height: 20px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font: 500 11px/1 var(--mono); color: var(--ink-2); }
.tools { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 16px; }
.tools summary, .advanced summary { cursor: pointer; font-weight: 500; font-size: 13.5px; color: var(--ink-2); }
.tools summary:hover, .advanced summary:hover { color: var(--ink); }
.tools .count { margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--muted); font: 500 11.5px/1.5 var(--mono); }
.tools ul { margin-top: 14px; display: grid; gap: 10px; }
.tools li { display: grid; grid-template-columns: minmax(0, 250px) minmax(0, 1fr); gap: 14px; font-size: 13px; }
.tools li code { color: var(--ink); overflow-wrap: anywhere; }
.tools li span { color: var(--muted); }
.advanced { margin-top: 18px; }
.advanced > form { margin-top: 4px; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font: 500 12px/1.3 var(--ui); color: var(--muted); padding: 0 12px 10px 0; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; padding-right: 0; padding-left: 14px; white-space: nowrap; }
.table td:first-child { overflow-wrap: anywhere; }
.preview { margin-bottom: 18px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.preview > p { padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.table-scroll { overflow-x: auto; scrollbar-width: thin; padding: 12px 14px 4px; }
.table-data { font: 12.5px/1.5 var(--mono); }
.table-data th, .table-data td { white-space: nowrap; padding-right: 20px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.table-data th { font-family: var(--mono); }

.inline-form { display: flex; gap: 10px; margin-top: 14px; max-width: 460px; }
.danger { margin-top: 24px; padding: 16px; border: 1px solid var(--error-line); border-radius: 10px; display: flex; align-items: center;
  justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.danger > div { max-width: 52ch; }

/* ── dialogs ── */
.dialog { border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(460px, calc(100vw - 32px)); color: var(--ink);
  box-shadow: 0 32px 80px -20px rgba(10, 12, 14, .45); }
.dialog::backdrop { background: rgba(10, 12, 14, .5); backdrop-filter: blur(3px); }
.dialog form { padding: 24px; }
.dialog h2 { font-size: 18px; letter-spacing: -.02em; }
.dialog h2 + .muted { margin-top: 6px; font-size: 13.5px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin: 24px -24px -24px; padding: 14px 24px;
  border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 14px 14px; }

/* ── understanding: one row per connected thing ── */
.understanding .u-kind { width: 114px; text-align: center; flex: none; }
.understanding .u-status { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.understanding .row-actions .button { min-width: 64px; justify-content: center; text-align: center; }
.understanding .row:last-child { background: var(--surface-2); }
.panel-foot-first { margin-top: 0; }

/* ── understanding (company guide) ── */
.guide-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.guide-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.guide-editor { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.guide-editor textarea { display: block; width: 100%; min-height: 62vh; resize: vertical; border: 0; outline: none;
  padding: 24px; background: transparent; color: var(--ink); font: 13.5px/1.7 var(--mono); tab-size: 2; }
.guide-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 10px 12px 10px 24px; border-top: 1px solid var(--line); background: var(--surface-2); position: sticky; bottom: 0; }
.guide-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.guide-bar .over { color: var(--error); }
.guide-side { display: grid; gap: 12px; position: sticky; top: 80px; }
.side-block { border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: var(--surface); box-shadow: var(--shadow); }
.side-block h3 { margin-bottom: 10px; font-size: 13px; }
.side-list { display: grid; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.side-list strong { color: var(--ink); font-weight: 600; }
.side-refs { display: grid; gap: 8px; font-size: 13px; margin-bottom: 10px; }
.side-refs li { display: flex; justify-content: space-between; gap: 10px; }
.side-refs em { font-style: normal; font-size: 12px; display: block; }
.side-refs code { color: var(--ink-2); }

/* ── learn this database ── */
.working { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 10px; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent);
  animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 4s; } }
.found { padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 8px; }
.found .small { font: 500 11.5px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.questions { display: grid; gap: 12px; margin-top: 16px; }
.question { border: 1px solid var(--line); border-radius: 10px; margin: 0; padding: 18px; min-width: 0; }
.question:focus-within { border-color: var(--line-strong); box-shadow: var(--shadow); }
.question legend { padding: 0; font: 600 15px/1.4 var(--ui); letter-spacing: -.012em; float: left; width: 100%; margin-bottom: 6px; }
.question legend + * { clear: both; }
.q-topic { display: block; font: 500 11.5px/1.4 var(--mono); color: var(--accent-deep); text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 6px; }
.question .check { margin: 8px 0 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; transition: border-color .12s, background .12s; }
.question .check:hover { border-color: var(--line-strong); background: var(--surface-2); }
.question .check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.question input:not([type=radio]) { margin-top: 10px; }

/* ── how the systems connect ── */
.evidence { margin-top: 10px; font-size: 13.5px; }
.evidence-bad { color: var(--error); }
.evidence-title { margin-top: 12px; margin-bottom: 4px; font: 500 11.5px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.question .table-scroll, .row-main .table-scroll { margin-top: 6px; }
.question .advanced, .row-main .advanced { margin-top: 12px; }
.code-block { margin-top: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2);
  font: 12.5px/1.65 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ── small screens ── */
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-story { padding: 28px 24px 32px; gap: 28px; }
  .login-pitch h1 { font-size: 34px; }
  .login-pitch > p { font-size: 15px; margin-top: 14px; }
  .login-pitch ul, .login-foot { display: none; }
  .login-form { justify-content: flex-start; padding: 36px 24px 48px; }
  .company-layout { grid-template-columns: 1fr; gap: 16px; }
  .section-nav { position: static; display: flex; overflow-x: auto; gap: 4px; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; }
  .section-nav a { white-space: nowrap; background: #EEF0F2; }
  .guide-layout { grid-template-columns: 1fr; }
  .guide-side { position: static; }
  .guide-editor textarea { min-height: 48vh; padding: 18px 16px; }
  .guide-bar { padding: 10px 16px; }
}
@media (max-width: 560px) {
  .topbar-inner { padding: 0 16px; }
  .page { padding: 20px 16px 72px; }
  .flash { width: calc(100% - 32px); }
  h1 { font-size: 22px; }
  .panel { padding: 18px 16px; }
  .panel-head { margin: -18px -16px 18px; padding: 16px; }
  .rule { margin: 20px -16px 4px; }
  .user-email { display: none; }
  .field-row { flex-direction: column; gap: 0; }
  .field-row > .narrow { width: 100%; }
  .tools li { grid-template-columns: 1fr; gap: 2px; }
  .copy-field { flex-wrap: wrap; }
  .copy-field code { flex-basis: 100%; }
  .row-actions { width: 100%; }
  .understanding .u-kind { width: auto; }
  .understanding .row-main { flex-basis: 100%; order: 1; }
  .understanding .u-status { order: 2; flex: 1; }
  .understanding .row-actions { order: 3; width: auto; }
  .inline-form { flex-direction: column; }
  .dialog form { padding: 20px 16px; }
  .dialog-actions { margin: 20px -16px -20px; padding: 12px 16px; }
  .company-title { gap: 12px; }
  .table th:nth-child(3), .table td:nth-child(3) { display: none; }
  .table td:nth-child(2) { white-space: nowrap; }
  .table-data th:nth-child(3), .table-data td:nth-child(3) { display: table-cell; }
}

/* the first field under a panel header sits on the header's own spacing */
.panel-head + label, .panel-head + .field-row label, .panel-head + .notice + .field-row label { margin-top: 0; }
.page-head.is-narrow { max-width: 840px; }
