/* Mercury11 -- ported from design/design-reference (screens/*.html are the
   source of truth for layout, spacing, type and color). Light theme only;
   dark is a later pass. Below 760px the rail becomes a top bar and cards
   stack. */

:root {
  --ground: #F6F4EE;
  --surface: #FFFFFF;
  --surface-2: #FBFAF7;
  --sunken: #EFEDE5;
  --ink: #16201C;
  --ink-2: #2E3A34;
  --ink-3: #4A544E;
  --muted: #5E6863;
  --accent: #1A5C49;
  --accent-soft: #E6EFEA;
  --accent-ink: #134536;
  --amber: #7A4F0F;
  --amber-soft: #F7EFDF;
  --danger: #8A3524;
  --danger-soft: #F6E4DF;
  --border: #E4DFD5;
  --border-2: #EFEBE2;
  --field: #D9D3C7;
  --inset: #ECE7DC;
  --soft-border: #C9D6CF;
  --soft-fill: #F3F8F5;
  --chip: #F0EDE5;
  --serif: "Fraunces", Georgia, serif;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); background: var(--ground); color: var(--ink); }
a { color: var(--accent); }
button { font-family: var(--sans); }
[hidden] { display: none !important; }
.num, .mono { font-family: var(--mono); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- brand */
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink);
  text-decoration: none; }
.mark { flex-shrink: 0; }
.wordmark { font-family: var(--serif); font-size: 21px; font-weight: 500;
  letter-spacing: -0.42px; font-variation-settings: "opsz" 36; }

/* ---------------------------------------------------------------- buttons */
.btn { min-height: 44px; padding: 0 20px; border-radius: 8px; font-size: 14px;
  cursor: pointer; font-weight: 500; }
.btn:disabled { cursor: not-allowed; opacity: 0.55; }
.btn-primary { border: 0; background: var(--accent); color: #FFFFFF; }
.btn-secondary { border: 1px solid var(--field); background: transparent; color: var(--ink-2);
  font-weight: 400; padding: 0 18px; }
.btn-soft { min-height: 42px; border: 1px solid var(--soft-border); background: var(--soft-fill);
  color: var(--accent-ink); font-size: 13.5px; }
.btn-link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0;
  font-size: 13px; font-weight: 500; }
.link-btn { display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; }
.btn-wide { width: 100%; min-height: 50px; border-radius: 9px; font-size: 15.5px; }

input[type=text], input[type=email], input[type=password], select {
  width: 100%; min-height: 44px; padding: 0 14px; border: 1px solid var(--field);
  border-radius: 8px; font-family: var(--sans); font-size: 14px; color: var(--ink);
  background: var(--surface-2); }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- shell */
.shell { display: flex; min-height: 100vh; }
.rail { width: 224px; flex-shrink: 0; padding: 24px 16px; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.rail .brand { padding: 0 8px 26px; }
.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.rail-item { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px;
  border-radius: 8px; color: var(--ink-2); font-size: 14px; text-decoration: none; }
.rail-item svg { flex-shrink: 0; }
.rail-item .rail-label { flex-grow: 1; }
.rail-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink);
  font-weight: 500; }
.rail-item:not(.rail-soon):hover { background: var(--sunken); }
.rail-item[aria-current="page"]:hover { background: var(--accent-soft); }
.rail-soon { color: var(--muted); opacity: 0.6; cursor: default; }
.soon { font-size: 10.5px; letter-spacing: 0.4px; text-transform: uppercase; }
.pill-count { font-family: var(--mono); font-size: 11px; padding: 2px 7px; border-radius: 20px;
  background: var(--amber-soft); color: var(--amber); }
.rail-spacer { flex-grow: 1; }
.rail-foot { padding: 14px 12px 4px; border-top: 1px solid var(--border); }
.rail-business { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.rail-user { font-size: 12px; color: var(--muted); padding-top: 2px; overflow-wrap: anywhere; }
.rail-foot-links { display: flex; gap: 14px; padding-top: 10px; }
.rail-foot-link { font-size: 12.5px; color: var(--accent); background: none; border: 0;
  padding: 0; cursor: pointer; text-decoration: none; }

.pane { flex-grow: 1; min-width: 0; padding: 30px 36px; display: flex; flex-direction: column; }
#pane-body { display: flex; flex-direction: column; gap: 18px; flex-grow: 1; min-width: 0; }
.banner { background: var(--amber-soft); color: #5A3D0C; border-radius: 10px; padding: 10px 14px;
  font-size: 13.5px; margin-bottom: 16px; }
.loading, .empty { color: var(--muted); font-size: 14px; }
.error-text { color: var(--danger); font-size: 13.5px; }

/* ---------------------------------------------------------------- page heads */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 32px; }
.page-head h1, .h1 { margin: 0; font-family: var(--serif); font-size: 27px; font-weight: 600;
  letter-spacing: -0.3px; }
.page-lede { margin: 7px 0 0; font-size: 14.5px; line-height: 1.6; color: var(--ink-3);
  max-width: 640px; }
.count-pill { flex-shrink: 0; font-family: var(--mono); font-size: 12px; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); padding: 8px 13px;
  border-radius: 20px; }
.section-label { font-size: 11px; letter-spacing: 0.7px; text-transform: uppercase;
  color: var(--muted); }
h2.section { margin: 0 0 4px; font-size: 16px; font-weight: 500; }
.section-lede { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); }
.source-group { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.source-group-head { padding-top: 8px; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 22px 24px; display: flex; flex-direction: column; gap: 13px; min-width: 0; }
.badge-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.badge { font-family: var(--mono); font-size: 11px; letter-spacing: 0.4px; padding: 4px 10px;
  border-radius: 6px; background: var(--accent-soft); color: var(--accent-ink); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.card-meta { font-size: 12px; color: var(--muted); }
.observation { margin: 0; font-size: 17px; line-height: 1.55; font-weight: 500;
  overflow-wrap: anywhere; }
.usually { margin: 0; font-size: 14px; line-height: 1.6; color: var(--ink-3); }
.ask-label { font-size: 14.5px; font-weight: 500; padding-top: 4px; }
.card-actions { display: flex; align-items: center; gap: 10px; padding-top: 2px; flex-wrap: wrap; }
.evidence { font-size: 12.5px; color: var(--muted); padding-left: 4px; overflow-wrap: anywhere; }
.members-only { margin: 0; font-size: 13.5px; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--inset); border-radius: 8px; padding: 10px 14px; }

.small-list { display: flex; flex-direction: column; gap: 9px; }
.small-card { background: var(--surface-2); border: 1px solid var(--inset); border-radius: 12px;
  padding: 15px 20px; display: flex; align-items: flex-start; gap: 13px; }
.small-card svg { flex-shrink: 0; margin-top: 2px; }
.small-card .grow { flex-grow: 1; min-width: 0; }
.small-card.is-retired { background: transparent; }
.small-card.is-retired .small-title { color: var(--ink-2); }
.small-title { margin: 0; font-size: 14.5px; line-height: 1.5; font-weight: 500;
  overflow-wrap: anywhere; }
.small-body { margin: 4px 0 0; font-size: 13.5px; line-height: 1.55; color: var(--ink-3);
  overflow-wrap: anywhere; }
.small-meta { flex-shrink: 0; font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------------- sources */
.source-list { background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; }
.source-row { display: flex; align-items: center; gap: 15px; padding: 17px 22px;
  border-bottom: 1px solid var(--border-2); }
.source-row:last-child { border-bottom: 0; }
.source-row.needs-you { background: #FDF8EF; }
.source-icon { width: 38px; height: 38px; flex-shrink: 0; border-radius: 9px;
  background: var(--accent-soft); display: flex; align-items: center; justify-content: center; }
.needs-you .source-icon { background: #F5E8CE; }
.source-text { flex-grow: 1; min-width: 0; }
.source-name { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.source-meta { font-size: 13px; color: var(--muted); padding-top: 2px; overflow-wrap: anywhere; }
.source-meta.problem { color: var(--danger); }
.status-pill { flex-shrink: 0; display: flex; align-items: center; gap: 7px; font-size: 12.5px;
  padding: 6px 12px; border-radius: 20px; background: var(--accent-soft); color: var(--accent-ink); }
.status-pill.partial { background: var(--amber-soft); color: var(--amber); }
.status-pill.failed { background: var(--danger-soft); color: var(--danger); }
.status-pill.pending { background: var(--sunken); color: var(--muted); }

.add-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.add-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 19px 20px; display: flex; flex-direction: column; gap: 9px; }
.add-card.is-disabled { opacity: 0.6; }
.add-card-title { font-size: 15px; font-weight: 500; }
.add-card p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--ink-3); flex-grow: 1; }
.coming { font-size: 12px; color: var(--muted); }

.dropzone { border: 1px dashed #C3BCAB; border-radius: 10px; padding: 22px; text-align: center;
  font-size: 13.5px; color: var(--ink-2); background: var(--surface-2); cursor: pointer; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.progress { height: 6px; border-radius: 6px; background: var(--sunken); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: var(--accent);
  transition: width 0.15s; }
.mapping { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mapping th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted);
  padding: 6px 8px; border-bottom: 1px solid var(--border); }
.mapping td { padding: 7px 8px; border-bottom: 1px solid var(--border-2);
  overflow-wrap: anywhere; }
.mapping td.num { text-align: right; }
.cli { margin: 0; font-family: var(--mono); font-size: 12.5px; line-height: 1.55;
  background: var(--surface-2); border: 1px solid var(--inset); border-radius: 10px;
  padding: 14px 16px; overflow-x: auto; white-space: pre; color: var(--ink-2); }
.upload-summary { font-size: 13.5px; color: var(--ink-3); line-height: 1.6; }
.scroll-x { overflow-x: auto; max-width: 100%; }

/* ---------------------------------------------------------------- ask */
.ask-pane { display: flex; flex-direction: column; gap: 18px; flex-grow: 1; min-width: 0; }
.thread { display: flex; flex-direction: column; gap: 22px; flex-grow: 1; }
.turn { display: flex; flex-direction: column; gap: 14px; }
.asked-label { font-size: 11px; letter-spacing: 0.7px; text-transform: uppercase;
  color: var(--muted); padding-bottom: 6px; }
.asked { font-family: var(--serif); font-size: 25px; font-weight: 500; letter-spacing: -0.2px;
  overflow-wrap: anywhere; }
.answer-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 26px 28px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.status-line { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.status-line::before { content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); animation: pulse 1.2s infinite ease-in-out; }
@keyframes pulse { 50% { opacity: 0.25; } }
.answer { font-size: 15px; line-height: 1.65; color: var(--ink-2); overflow-wrap: anywhere;
  min-width: 0; }
.answer p { margin: 0 0 10px; }
.answer p:last-child { margin-bottom: 0; }
.answer ul, .answer ol { margin: 0 0 10px; padding-left: 22px; }
.answer h3, .answer h4 { font-size: 15px; margin: 12px 0 6px; }
.answer code { font-family: var(--mono); font-size: 13px; background: var(--sunken);
  padding: 1px 4px; border-radius: 4px; }
.answer table { border-collapse: collapse; font-size: 13.5px; margin: 4px 0 10px; }
.answer th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px;
  border-bottom: 1px solid var(--border); padding: 6px 12px 6px 0; }
.answer td { border-bottom: 1px solid var(--border-2); padding: 6px 12px 6px 0;
  font-family: var(--mono); font-size: 13px; }
.answer .table-wrap { overflow-x: auto; max-width: 100%; }
.provenance { border-top: 1px solid var(--border-2); padding-top: 15px; display: flex;
  flex-direction: column; gap: 10px; }
.provenance-line { display: flex; align-items: center; gap: 9px; font-size: 12.5px;
  color: var(--muted); flex-wrap: wrap; }
.source-chip { background: var(--chip); padding: 4px 9px; border-radius: 6px; color: var(--ink-2);
  overflow-wrap: anywhere; }
.rules-list { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.55;
  color: var(--ink-3); }
.chips { display: flex; gap: 9px; flex-wrap: wrap; }
.chip { font-size: 13px; color: var(--ink-2); background: var(--surface);
  border: 1px solid var(--border); border-radius: 20px; padding: 9px 15px; cursor: pointer;
  text-align: left; }
.chip:hover { border-color: var(--soft-border); }
.composer-wrap { position: sticky; bottom: 0; padding: 12px 0 0;
  background: linear-gradient(to bottom, rgba(246, 244, 238, 0), var(--ground) 30%); }
.composer { background: var(--surface); border: 1px solid var(--field); border-radius: 12px;
  padding: 13px 16px; display: flex; align-items: center; gap: 14px; }
.composer input { flex-grow: 1; min-width: 0; border: 0; outline: none; font-size: 15px;
  background: transparent; min-height: 44px; padding: 0; }
.composer input:focus-visible { outline: none; }
.composer:focus-within { border-color: var(--accent); }
.ask-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ask-toolbar #new-question { margin-left: auto; }
.ask-layout { display: flex; flex-direction: column; gap: 14px; flex-grow: 1; min-width: 0; }
.ask-cols { display: flex; gap: 24px; flex-grow: 1; min-width: 0; align-items: flex-start; }
.ask-cols .ask-pane { align-self: stretch; }
.convos { width: 236px; flex-shrink: 0; position: sticky; top: 30px; max-height: calc(100vh - 60px);
  overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.convo-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 44px;
  padding: 0 12px 0 6px; border: 0; border-radius: 8px; background: none; color: var(--ink-2);
  font-size: 13.5px; font-weight: 500; cursor: pointer; }
.convo-toggle:hover { background: var(--sunken); }
.convo-toggle svg { transition: transform 0.15s ease; }
.convo-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.convo-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.convo { display: flex; align-items: flex-start; gap: 4px; border-radius: 8px; padding: 2px; min-width: 0; }
.convo:hover, .convo:focus-within, .convo.is-current { background: var(--sunken); }
.convo.is-current { background: var(--accent-soft); }
.convo-open { flex-grow: 1; min-width: 0; text-align: left; background: none; border: 0; cursor: pointer;
  padding: 7px 8px; display: flex; flex-direction: column; gap: 2px; color: var(--ink-2); }
.convo-title { font-size: 13.5px; line-height: 1.4; overflow-wrap: anywhere; }
.convo-when { font-size: 11.5px; color: var(--muted); }
.convo-acts { display: flex; flex-direction: column; gap: 2px; padding-top: 4px; opacity: 0; }
.convo:hover .convo-acts, .convo:focus-within .convo-acts { opacity: 1; }
.convo-act { font-size: 11.5px; color: var(--muted); background: none; border: 0; cursor: pointer;
  padding: 2px 6px; text-align: right; }
.convo-act:hover { color: var(--ink); }
.convo-rename { min-height: 36px; font-size: 13.5px; background: var(--surface); }
.convo-empty { font-size: 13px; color: var(--muted); padding: 6px 8px; }

/* ---------------------------------------------------------------- people */
.people { width: 100%; border-collapse: collapse; font-size: 14px; }
.people th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted);
  padding: 8px 10px 8px 0; border-bottom: 1px solid var(--border); }
.people td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--border-2);
  vertical-align: middle; overflow-wrap: anywhere; }
.people select { width: auto; min-height: 36px; }
.invite-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.invite-form .field { flex: 1 1 220px; }
.invite-form select { width: auto; }
.dev-link { font-family: var(--mono); font-size: 12px; background: var(--surface-2);
  border: 1px solid var(--inset); border-radius: 8px; padding: 10px 12px; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- auth */
.auth-body { min-height: 100vh; }
.auth { max-width: 452px; margin: 0 auto; padding: 48px 16px; display: flex;
  flex-direction: column; align-items: center; gap: 28px; }
.auth-brand { align-self: center; }
.auth-card { width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 30px 30px 26px; }
.auth-card h1 { margin: 0; font-family: var(--serif); font-size: 29px; line-height: 1.18;
  font-weight: 600; letter-spacing: -0.6px; }
.auth-card .lede { margin: 10px 0 22px; font-size: 15px; line-height: 1.6; color: #3C4641; }
.auth-card .lede:empty { display: none; }
#auth-form { display: flex; flex-direction: column; gap: 15px; }
.field label, label.field-label { display: block; font-size: 13.5px; font-weight: 500;
  padding-bottom: 6px; }
.auth-card input[type=text], .auth-card input[type=email], .auth-card input[type=password] {
  min-height: 46px; border-radius: 9px; font-size: 15px; background: var(--surface); }
.auth-card input[readonly] { background: var(--surface-2); color: var(--muted); }
.optional { font-weight: 400; color: var(--muted); }
.hint { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
.form-error { margin: 0; color: var(--danger); font-size: 13.5px; }
.form-note { margin: 0; color: var(--accent-ink); font-size: 13.5px; overflow-wrap: anywhere; }
.auth-links { margin: 18px 0 0; font-size: 13.5px; text-align: center; color: var(--muted); }
.fine { margin: 14px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--muted); }

/* ---------------------------------------------------------------- rules
   (screens/Rules.html) */
.filter-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filter-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.rule-list { display: flex; flex-direction: column; gap: 10px; }
.rule { background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 22px; display: flex; gap: 18px; align-items: flex-start; min-width: 0; }
.rule.direct { border-color: var(--soft-border); border-left: 3px solid var(--accent);
  background: #FBFDFB; padding-left: 20px; }
.rule.is-retired { background: var(--surface-2); }
.rule.is-retired .rule-text { color: var(--ink-3); }
.rule-num { flex-shrink: 0; font-family: var(--mono); font-size: 12px; color: var(--muted);
  width: 26px; padding-top: 3px; }
.rule-body { flex-grow: 1; min-width: 0; }
.rule-text { font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }
.rule-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px;
  color: var(--muted); margin-top: 8px; overflow-wrap: anywhere; }
.rule-tag { font-family: var(--mono); font-size: 10px; letter-spacing: 0.4px; padding: 3px 7px;
  border-radius: 5px; background: var(--sunken); color: var(--ink-2); overflow-wrap: anywhere; }
.rule-tag.tag-all { background: var(--accent-soft); color: var(--accent-ink); }
.retired-line { color: var(--danger); }
.rule-actions { flex-shrink: 0; display: flex; gap: 6px; }
.rule-act { font-size: 12.5px; color: var(--muted); background: var(--surface); padding: 5px 9px;
  min-height: 32px; border-radius: 6px; border: 1px solid var(--border); cursor: pointer; }
.rule-act:hover { color: var(--ink); border-color: var(--field); }
.rule-history { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.rule-history summary { cursor: pointer; width: fit-content; }
.rule-history ol { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column;
  gap: 8px; }
.rule-old { color: var(--ink-3); font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere;
  white-space: pre-wrap; }
.rule-form { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.rule-form textarea { width: 100%; min-height: 76px; padding: 10px 14px; border: 1px solid var(--field);
  border-radius: 8px; font-family: var(--sans); font-size: 14px; color: var(--ink);
  background: var(--surface); resize: vertical; }
.rule-form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.rule-form-row label { display: flex; flex-direction: column; gap: 6px; padding: 0; }
.rule-form-row select { width: auto; min-width: 160px; }
.rules-foot { padding: 16px 20px; background: var(--surface-2); border: 1px solid var(--inset);
  border-radius: 12px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.rules-foot p { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--ink-3); }
.rules-foot .card-meta { flex-shrink: 0; white-space: nowrap; }

/* ---------------------------------------------------------------- catalog
   (screens/Catalog.html) */
.crumbs { font-size: 12.5px; color: var(--muted); padding-bottom: 6px; }
.crumbs a { text-decoration: none; }
.crumbs .sep { padding: 0 5px; }
.catalog-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search { flex: 1 1 260px; display: flex; align-items: center; gap: 10px; background: var(--surface);
  border: 1px solid var(--field); border-radius: 10px; padding: 0 14px; min-height: 44px; }
.search input { border: 0; background: transparent; padding: 0; min-height: 42px; }
.search input:focus-visible { outline: none; }
.search:focus-within { border-color: var(--accent); }
.filter-chip { font-size: 13px; padding: 10px 14px; min-height: 40px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--border); color: var(--ink-2); cursor: pointer; }
.filter-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--ground); }
.cat-section { display: flex; flex-direction: column; gap: 10px; }
.cat-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding-top: 6px; }
.cat-head h2 { margin: 0; font-size: 15px; font-weight: 500; }
.cat-head small { font-size: 12px; color: var(--muted); }
.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tool-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.tool-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.monogram { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center;
  justify-content: center; font-family: var(--mono); font-size: 15px; font-weight: 500;
  background: var(--sunken); color: var(--ink-2); flex-shrink: 0; }
.monogram.is-live { background: var(--accent-soft); color: var(--accent-ink); }
.monogram.big { width: 48px; height: 48px; border-radius: 12px; font-size: 20px; }
.method { font-family: var(--mono); font-size: 10px; letter-spacing: 0.4px; padding: 3px 7px;
  border-radius: 5px; }
.method-oauth { background: var(--accent-soft); color: var(--accent-ink); }
.method-key { background: var(--sunken); color: var(--ink-2); }
.method-file { background: var(--amber-soft); color: var(--amber); }
.tool-name { font-size: 14.5px; font-weight: 500; overflow-wrap: anywhere; }
.tool-holds { font-size: 12.5px; color: var(--muted); line-height: 1.5; flex-grow: 1;
  overflow-wrap: anywhere; }
.tool-action { min-height: 36px; border-radius: 8px; font-size: 13px; font-weight: 500;
  display: flex; align-items: center; justify-content: center; text-decoration: none; gap: 6px;
  cursor: pointer; padding: 0 10px; }
.tool-action.connect { background: var(--accent); color: #FFFFFF; border: 0; }
.tool-action.request { border: 1px solid var(--field); background: var(--surface); color: var(--ink-2);
  font-weight: 400; }
.tool-action.request[aria-pressed="true"] { border-color: var(--soft-border); background: var(--soft-fill);
  color: var(--accent-ink); }
.tool-action .asked { color: var(--muted); font-size: 12px; font-family: var(--sans); }
.tool-note { font-size: 12px; color: var(--muted); }
.tool-note a { font-weight: 500; }
.dont-see { padding: 18px 22px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; }
.dont-see-title { font-size: 14.5px; font-weight: 500; }
.dont-see p { margin: 4px 0 14px; font-size: 13px; color: var(--muted); }
.dont-see p.form-note { margin: 10px 0 0; }
.dont-see p.form-note:empty { display: none; }
/* Three doors on one row, every control the same height; they stack when
   the row runs out of width. */
.dont-see-row { display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap; }
.dont-see-row form { display: flex; gap: 10px; flex: 1 1 340px; min-width: 0; margin: 0; }
.dont-see-row form input { flex: 1 1 auto; min-width: 0; }
.dont-see-row .btn, .dont-see-row input, .door-link { height: 44px; min-height: 44px;
  box-sizing: border-box; }
.dont-see-row .btn { flex-shrink: 0; }
.door-link { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 16px; border-radius: 8px; border: 1px solid var(--soft-border);
  background: var(--soft-fill); color: var(--accent-ink); font-size: 13.5px; font-weight: 500;
  text-decoration: none; white-space: nowrap; }
.door-talk { border-color: var(--field); background: transparent; color: var(--ink-2);
  font-weight: 400; }
.door-talk .door-lead { color: var(--muted); }
@media (max-width: 760px) {
  .dont-see-row form, .door-link { flex: 1 1 100%; }
}

/* ---------------------------------------------------------------- connect
   (screens/Connect.html) */
.connect-head { display: flex; align-items: center; gap: 14px; }
.connect-head h1 { margin: 0; font-family: var(--serif); font-size: 28px; font-weight: 600;
  letter-spacing: -0.4px; }
.connect-head p { margin: 4px 0 0; font-size: 13.5px; color: var(--muted); }
.connect-cols { display: flex; gap: 20px; align-items: flex-start; }
.connect-main { flex-grow: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 24px 26px; display: flex; flex-direction: column; gap: 18px; }
.connect-side { width: 320px; flex-shrink: 0; display: flex; flex-direction: column; gap: 14px; }
.step { display: flex; gap: 14px; align-items: flex-start; }
.step > div:not(.step-n) { flex-grow: 1; min-width: 0; }
.step-n { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent-ink); display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 12px; margin-top: 1px; }
.step-title { font-size: 15px; font-weight: 500; }
.step-text { margin: 4px 0 0; font-size: 13.5px; color: var(--ink-3); line-height: 1.6; }
.step-text p { margin: 0; }
.step-text code { font-family: var(--mono); font-size: 12.5px; }
.step-text strong { font-weight: 500; color: var(--ink); }
.perms { background: var(--surface-2); border: 1px solid var(--inset); border-radius: 10px;
  padding: 6px 14px; margin-top: 10px; }
.perm { display: flex; align-items: center; gap: 10px; font-size: 13.5px; padding: 8px 0;
  border-bottom: 1px solid var(--border-2); flex-wrap: wrap; }
.perm:last-child { border-bottom: 0; }
.perm-name { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); width: 170px; flex-shrink: 0; }
.perm-access { color: var(--accent-ink); }
.perm-why { color: var(--muted); font-size: 12.5px; }
.key-row { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.key-row input { flex: 1 1 240px; font-family: var(--mono); font-size: 13.5px; background: var(--surface); }
.check { border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.check.ok { background: var(--accent-soft); border: 1px solid var(--soft-border); }
.check.refused { background: var(--amber-soft); border: 1px solid #E6D3AE; }
.check-title { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 500; }
.check.ok .check-title { color: var(--accent-ink); }
.check.refused .check-title { color: var(--amber); }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 20px;
  font-size: 13px; color: var(--ink-2); }
.check-grid .muted { color: var(--muted); }
.check-grid .bad { color: var(--danger); font-weight: 500; }
.check-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.check-actions span { font-size: 12.5px; color: var(--muted); }
.side-card { background: var(--surface-2); border: 1px solid var(--inset); border-radius: 14px;
  padding: 18px 22px; }
.side-card.white { background: var(--surface); border-color: var(--border); }
.side-title { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 500;
  margin-bottom: 8px; }
.side-card p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--ink-3); }
.bullets { display: flex; flex-direction: column; gap: 9px; font-size: 13.5px; color: var(--ink-3);
  line-height: 1.5; margin: 0; padding: 0; list-style: none; }
.bullets li { display: flex; gap: 10px; }
.bullets li::before { content: ""; flex-shrink: 0; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); margin-top: 8px; }
.notice { font-size: 13.5px; line-height: 1.6; color: var(--amber); background: var(--amber-soft);
  border-radius: 10px; padding: 12px 14px; margin: 0; }

/* ---------------------------------------------------------------- requests */
.requests { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.requests th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted);
  padding: 8px 10px 8px 0; border-bottom: 1px solid var(--border); }
.requests td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--border-2);
  overflow-wrap: anywhere; vertical-align: top; }

/* ---------------------------------------------------------------- narrow */
@media (hover: none) { .convo-acts { opacity: 1; } }

@media (max-width: 1100px) {
  .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .connect-cols { flex-direction: column; }
  .connect-side { width: 100%; }
}

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .ask-cols { flex-direction: column; gap: 12px; }
  .convos { width: 100%; position: static; max-height: 45vh; padding: 12px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 12px; }
  .convo-acts { opacity: 1; }
  .rule { flex-wrap: wrap; gap: 10px 14px; padding: 15px 16px; }
  .rule.direct { padding-left: 14px; }
  .rule-body { flex-basis: calc(100% - 44px); }
  .rule-actions { margin-left: 40px; }
  .rules-foot { flex-direction: column; align-items: flex-start; }
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .connect-main { padding: 18px 16px; }
  .check-grid { grid-template-columns: minmax(0, 1fr); }
  .perm-name { width: auto; }
  .requests thead { display: none; }
  .requests tr { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 10px 0;
    border-bottom: 1px solid var(--border-2); }
  .requests td { border: 0; padding: 0; }
  .rail { width: auto; height: auto; position: sticky; top: 0; z-index: 5; flex-direction: row;
    flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 16px;
    border-right: 0; border-bottom: 1px solid var(--border); background: var(--ground); }
  .rail .brand { padding: 0; margin-right: auto; }
  .rail .mark { width: 34px; height: 23px; }
  .rail .wordmark { font-size: 18px; }
  .rail-nav { order: 3; flex-direction: row; flex-wrap: wrap; gap: 2px; width: 100%; }
  .rail-item { min-height: 40px; padding: 0 10px; gap: 6px; font-size: 13.5px; }
  .rail-item .rail-label { flex-grow: 0; }
  .rail-soon .soon { display: none; }
  .rail-spacer { display: none; }
  .rail-foot { order: 2; border-top: 0; padding: 0; text-align: right; }
  .rail-business, .rail-user { display: none; }
  .rail-foot-links { padding-top: 0; }
  .pane { padding: 20px 16px; }
  .page-head { flex-direction: column; gap: 12px; }
  .add-grid { grid-template-columns: minmax(0, 1fr); }
  .card, .answer-card { padding: 18px 16px; }
  .source-row { flex-wrap: wrap; padding: 15px 16px; }
  .small-card { flex-wrap: wrap; padding: 14px 16px; }
  .small-meta { width: 100%; padding-left: 30px; }
  .asked { font-size: 21px; }
  .auth-card { padding: 24px 18px; }
  .people thead { display: none; }
  .people tr { display: flex; flex-wrap: wrap; gap: 6px 12px; padding: 10px 0;
    border-bottom: 1px solid var(--border-2); }
  .people td { border: 0; padding: 0; }
}

@media (max-width: 420px) {
  .tool-grid { grid-template-columns: minmax(0, 1fr); }
}

/* empty status and result holders take no room */
.upload-summary:empty, #upload-panel .small-list:empty { display: none; }
