/* Thetatron memory page. Light: the logo of record (white, teal #16465A). Dark: thetatron.com's own palette. */
:root {
  --bg: #FFFFFF;
  --surface: #F4F7F8;
  --surface-2: #E9EFF1;
  --line: #D9E2E6;
  --ink: #0F2430;
  --ink-2: #4A5F6B;
  --ink-3: #6E808A;
  --brand: #16465A;
  --brand-ink: #FFFFFF;
  --brand-soft: #E3EEF2;
  --pulse: #16465A;
  --ask: #8A5A00;
  --ask-soft: #FFF6E3;
  --danger: #C4232F;
  --danger-soft: #FDECEE;
  --focus: #2B7FA0;
  --quote: #2B7FA0;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(15, 36, 48, .06), 0 8px 24px rgba(15, 36, 48, .06);
  --font-head: "Space Grotesk", system-ui, sans-serif;
  --font-body: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0A0C10;
    --surface: #12161C;
    --surface-2: #1C222B;
    --line: #2A3240;
    --ink: #EEF1F4;
    --ink-2: #B8C1CC;
    --ink-3: #8C96A3;
    --brand: #E5EAEF;
    --brand-ink: #0A0C10;
    --brand-soft: #1C222B;
    --pulse: #FF4D52;
    --ask: #FFC56B;
    --ask-soft: #2A2214;
    --danger: #FF8A8C;
    --danger-soft: #2A1418;
    --quote: #5FB3C8;
    --focus: #FF8A8C;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }

.shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 16px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

/* header */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; padding-top: max(14px, env(safe-area-inset-top));
  background: var(--bg);
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--brand); }
.mark { width: 30px; height: 30px; flex: none; }
.mark-ring { fill: var(--brand); }
.mark-pulse { stroke: var(--pulse); }
.wordmark { font-family: var(--font-head); font-weight: 600; font-size: 17px; letter-spacing: .34em; margin-right: -.34em; }
.top-actions { position: relative; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg); display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; fill: var(--ink-2); }
.icon-btn:hover { background: var(--surface); }
.menu {
  position: absolute; right: 0; top: 48px; min-width: 210px; padding: 6px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.menu button {
  display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: 10px;
  background: none; cursor: pointer; font-size: 15px;
}
.menu button:hover, .menu button:focus-visible { background: var(--surface); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.menu .danger { color: var(--danger); }

.dev-banner {
  margin: 0 0 8px; padding: 8px 12px; border-radius: 10px; font-size: 13px;
  background: var(--ask-soft); color: var(--ask); text-align: center;
}

.view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.center { align-items: center; justify-content: center; gap: 8px; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--surface-2); border-top-color: var(--brand);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* signed out */
.signin { display: grid; grid-template-columns: 1fr; gap: 28px; padding: 24px 0 40px; align-content: start; }
@media (min-width: 820px) { .signin { grid-template-columns: 1.1fr 1fr; align-items: start; padding-top: 56px; gap: 48px; } }
.hero h1 {
  font-family: var(--font-head); font-weight: 700; color: var(--ink);
  font-size: clamp(30px, 6vw, 44px); line-height: 1.1; letter-spacing: -.01em; margin: 0 0 16px;
}
.lede { font-size: 18px; color: var(--ink-2); margin: 0 0 24px; max-width: 34em; }
.points { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.points li { padding-left: 28px; position: relative; color: var(--ink-2); }
.points li::before {
  content: ""; position: absolute; left: 4px; top: .55em; width: 10px; height: 10px; border-radius: 50%;
  background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft);
}
.points strong { color: var(--ink); font-weight: 600; }
.signin-card { display: flex; flex-direction: column; align-items: center; gap: 12px; min-height: 120px; }
#clerk-signin { width: 100%; display: flex; justify-content: center; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; cursor: pointer; min-height: 44px; white-space: nowrap;
}
.btn.wide { width: 100%; max-width: 400px; }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: var(--surface); }
.btn.danger { background: var(--danger); color: #FFFFFF; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }

/* conversation */
.chat { padding-bottom: 8px; }
/* In the chat the page itself never scrolls: the shell is exactly one screen tall and the conversation scrolls
   inside it, so the newest reply and the composer are always in view. */
body.in-chat .shell { height: 100vh; height: 100dvh; min-height: 0; }
.conversation {
  flex: 1; min-height: 0; overflow-y: auto; padding: 8px 2px 16px; display: flex; flex-direction: column; gap: 10px;
  overscroll-behavior: contain; outline: none;
}
.empty { margin: auto 0; padding: 24px 4px; text-align: center; }
.empty h2 { font-family: var(--font-head); font-weight: 600; font-size: 24px; margin: 0 0 6px; }
.empty.start { text-align: left; max-width: 880px; margin: 8px auto 0; padding: 16px 4px 24px; }
.start-line { color: var(--ink-2); font-size: 16px; margin: 0 0 18px; max-width: 62ch; }
.start-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.start-card { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); padding: 16px; }
.start-card h3 { font-family: var(--font-head); font-size: 17px; margin: 0; }
.start-card p { color: var(--ink-2); font-size: 14px; margin: 0; flex: 1; }
.start-card .btn { align-self: flex-start; }
.start-small { color: var(--ink-3); font-size: 13px; margin: 16px 0 0; }
.tab-hint { font-size: 14px; margin: 2px 0 10px; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 9px 14px; cursor: pointer; font-size: 14px; color: var(--ink-3); text-align: left;
}
.chip span { color: var(--ink); }
.chip:hover { border-color: var(--brand); }

.msg { display: flex; flex-direction: column; max-width: min(85%, 560px); animation: rise .18s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .msg, .spinner, .dots i { animation: none; } }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.it { align-self: flex-start; }
.bubble { padding: 11px 15px; border-radius: var(--radius); white-space: pre-wrap; overflow-wrap: anywhere; }
.me .bubble { background: var(--brand); color: var(--brand-ink); border-bottom-right-radius: 6px; }
.it .bubble { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.it.ask_back .bubble, .it.unknown_word .bubble { background: var(--ask-soft); border-color: transparent; }
.it.refused_which_owner .bubble { background: var(--ask-soft); border-color: transparent; }
.it.forgotten .bubble, .it.deleted .bubble { background: var(--brand-soft); border-color: transparent; }
.it.error .bubble, .it.unavailable .bubble { background: var(--danger-soft); border-color: transparent; }
.it.doc_quote .bubble { background: var(--bg); border: 1px solid var(--line); border-left: 4px solid var(--quote); font-style: italic; }
.tag { font-size: 12px; color: var(--ink-3); margin: 4px 6px 0; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.quick .chip { color: var(--ink); max-width: 100%; overflow-wrap: anywhere; }
.retry { margin-top: 6px; font-size: 13px; background: none; border: 0; color: var(--brand); text-decoration: underline; cursor: pointer; padding: 4px 6px; }
.dots { display: inline-flex; gap: 4px; padding: 4px 2px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: blink 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* composer */
.composer {
  position: sticky; bottom: 0;
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 0; padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: var(--bg);
}
.composer textarea {
  flex: 1; resize: none; max-height: 40vh; min-height: 48px;
  padding: 12px 16px; border-radius: 24px; border: 1px solid var(--line);
  background: var(--surface); line-height: 1.45; font-size: 16px;
}
.composer textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.send {
  width: 48px; height: 48px; flex: none; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--brand); display: grid; place-items: center;
}
.send svg { width: 22px; height: 22px; stroke: var(--brand-ink); }
.send:disabled { opacity: .35; cursor: not-allowed; }

/* the size of the memory, beside the menu */
.mem-count {
  font-size: 13px; color: var(--ink-3); white-space: nowrap; margin-right: 4px;
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
}
.top-actions { display: flex; align-items: center; gap: 6px; }

/* files: the attach button, a file's bubble, the reading summary, sources, the photo viewer */
.attach {
  width: 48px; height: 48px; flex: none; border-radius: 999px; border: 1px solid var(--line); cursor: pointer;
  background: var(--surface); display: grid; place-items: center;
}
.attach svg { width: 22px; height: 22px; stroke: var(--ink-2); }
.attach:hover { border-color: var(--brand); }
.attach:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 35%, transparent); }
.conversation.drop { outline: 2px dashed var(--focus); outline-offset: -6px; border-radius: 12px; }
.file-card { display: grid; gap: 6px; white-space: normal; min-width: min(240px, 100%); }
.file-line { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; }
.file-name { font-weight: 600; overflow-wrap: anywhere; }
.file-size { font-size: 12px; opacity: .8; flex: none; }
.progress { height: 4px; border-radius: 4px; background: color-mix(in srgb, currentColor 25%, transparent); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: currentColor; transition: width .15s; }
.file-acts { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.file-acts:empty { display: none; }
.link { background: none; border: 0; padding: 2px 0; cursor: pointer; font-size: 13px; color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.it .link { color: var(--brand); }
.link.danger { color: inherit; opacity: .85; }
.it .link.danger { color: var(--danger); }
.thumb { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 12px; overflow: hidden; max-width: 100%; }
.thumb img { display: block; width: min(240px, 62vw); height: 170px; object-fit: cover; border-radius: 12px;
  background: color-mix(in srgb, currentColor 15%, transparent); }
.thumb.small img { width: 112px; height: 84px; }
.gone .file-name { text-decoration: line-through; opacity: .75; }
.file-note { font-size: 13px; opacity: .85; }
.msg.flash .bubble { box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 45%, transparent); }
.not-read { margin-top: 8px; font-size: 14px; }
.not-read summary { cursor: pointer; color: var(--brand); }
.not-read ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.not-read b { font-weight: 600; }
.not-read .why { color: var(--ink-3); }
.sources { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; margin: 6px 4px 0; }
.source { display: grid; gap: 4px; justify-items: start; }
.source.gone .source-label { text-decoration: line-through; }
.source .file-note { font-size: 12px; color: var(--ink-3); }
.photo-view { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 94vh; }
.photo-view::backdrop { background: rgba(5, 7, 10, .82); }
.photo-view img { display: block; max-width: 96vw; max-height: 90vh; object-fit: contain; border-radius: 10px; }
.photo-close {
  position: fixed; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 999px; border: 0;
  background: rgba(255, 255, 255, .9); color: #0F2430; font-size: 26px; line-height: 1; cursor: pointer;
}
#caption-input { letter-spacing: normal; }

/* footer */
.foot {
  display: flex; gap: 16px; justify-content: center; padding: 12px 0 18px;
  font-size: 13px; color: var(--ink-3);
}
.foot a { color: var(--ink-3); }
body.in-chat .foot { display: none; }

/* dialogs */
.dialog {
  width: min(440px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 20px;
  padding: 24px; background: var(--bg); color: var(--ink); box-shadow: var(--shadow);
}
.dialog-wide { width: min(880px, calc(100vw - 32px)); padding: 12px; }
.dialog::backdrop { background: rgba(10, 12, 16, .45); }
.dialog h2 { font-family: var(--font-head); font-size: 22px; margin: 0 0 8px; }
.dialog p { color: var(--ink-2); margin: 0 0 14px; }
.dialog label { display: block; font-size: 14px; margin-bottom: 6px; }
.dialog input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); letter-spacing: .08em;
}
.dialog .account-terms { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; margin: 0; cursor: pointer; }
.dialog .account-terms input[type="checkbox"] { width: 18px; height: 18px; flex: none; margin: 2px 0 0; padding: 0; border: 0; accent-color: var(--brand); }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.error { color: var(--danger); font-size: 14px; margin: 10px 0 0; }
#clerk-profile { display: flex; justify-content: center; }

@media (max-width: 480px) {
  .wordmark { font-size: 15px; letter-spacing: .28em; margin-right: -.28em; }
  .msg { max-width: 92%; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .btn { width: 100%; }
}

/* Agent keys */
.keys-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.keys-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.keys-list .key-meta { flex: 1 1 200px; min-width: 0; font-size: 14px; line-height: 1.45; }
.keys-list .key-scope { display: inline-block; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); font-size: 12px; margin-left: 6px; }
.keys-list .key-confirm { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; }
.key-once { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; }
.key-once p { margin: 0 0 8px; }
.key-row { display: flex; gap: 8px; align-items: center; }
.key-row code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13px; user-select: all; }
.key-new { border: 0; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.key-new legend { font-weight: 600; margin-bottom: 4px; padding: 0; }
.dialog .key-new label { display: flex; gap: 10px; align-items: center; justify-content: flex-start; font-size: 15px; margin: 0; }
.dialog .key-new input[type="radio"] { width: 18px; height: 18px; flex: none; margin: 0; padding: 0; border: 0; accent-color: var(--brand); }

/* Pending forgets */
.menu-count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 12px; line-height: 20px; text-align: center; }
.menu-btn-dot { position: relative; }
.menu-btn-dot::after { content: ""; position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.forget-q { margin: 0 0 6px; font-size: 15px; line-height: 1.45; }
.forget-actions { display: flex; flex-wrap: wrap; gap: 8px; flex-basis: 100%; }
.forget-result { flex-basis: 100%; margin: 6px 0 0; font-size: 14px; }

/* ---- the STRUCTURED page: three tabs, the facts list, the add / look-up forms ---- */
.memory { padding: 8px 0 24px; gap: 12px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button { font: 600 15px var(--font-body); color: var(--ink-2); background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 10px 14px; cursor: pointer; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand); }
.tabs button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.pane { padding-top: 8px; }
.facts-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; }
.facts-groups { display: grid; gap: 18px; }
.fact-group h3 { font: 600 17px var(--font-head); margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.fact-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.fact { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.fact.history { opacity: .7; border-style: dashed; }
.fact.flash { box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 40%, transparent); }
.fact .pick { margin-top: 4px; width: 18px; height: 18px; flex: none; }
.fact-body { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.fact-line .rel { color: var(--ink-2); }
.fact-line .not { display: inline-block; font: 700 12px var(--font-body); letter-spacing: .04em; color: var(--danger);
  border: 1px solid currentColor; border-radius: 6px; padding: 0 5px; vertical-align: 1px; }
.fact-meta { font-size: 13px; margin-top: 2px; }
.fact-actions { display: flex; gap: 6px; flex: none; }
.btn.small { padding: 5px 10px; font-size: 13px; min-height: 32px; }
.danger-text { color: var(--danger); }
.fact-form { display: grid; gap: 14px; max-width: 560px; }
.fact-form h2 { font: 600 22px var(--font-head); margin: 0; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > label:first-child, .field legend { font-weight: 600; font-size: 15px; padding: 0; }
.field input:not([type]), .field input[type="text"] { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink); width: 100%; }
.field input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.check input { width: 18px; height: 18px; margin: 0; flex: none; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; }
.receipt { border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 12px; padding: 10px 14px; background: var(--surface); }
.receipt p { margin: 4px 0; }
.receipt-fact { font-weight: 600; overflow-wrap: anywhere; }
.find-out .not-stored { font-weight: 600; margin: 4px 0; }
.delete-list { margin: 0 0 8px; padding-left: 20px; display: grid; gap: 4px; overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .fact { flex-wrap: wrap; }
  .fact-actions { width: 100%; justify-content: flex-end; }
  .tabs button { padding: 10px 10px; font-size: 14px; }
}
.field input.locked { background: transparent; border-style: dashed; color: var(--ink-2); }
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.field-hint { font-size: 13px; margin: 0; }
.fact.chat-era { background: var(--ask-soft); border-color: color-mix(in srgb, var(--ask) 45%, var(--line)); }
.chat-era-tag { font-size: 12px; font-weight: 600; color: var(--ask); margin-bottom: 2px; }

/* column export */
.export-status:empty { display: none; }
.export-status { margin: 12px 0 0; font-weight: 500; }
.export-done a.btn { text-decoration: none; display: inline-block; }
.export-left { margin-top: 12px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line, #d9d4c7); overflow-wrap: anywhere; }
.export .key-row code { overflow-wrap: anywhere; }
#export-size { margin-left: 10px; }

/* reader download */
.reader-list { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 10px; }
.reader-list li { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.reader-meta { min-width: 0; }
.reader-sha { display: block; font-size: 12px; overflow-wrap: anywhere; margin-top: 4px; }

/* plans */
.plans-list { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 8px; }
.plans-list li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.plans-list .btn { margin-left: 6px; }

/* pending forgets */
.pending { margin: 0 0 14px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); }
.pending-head { margin: 0 0 8px; font-weight: 600; }
.pending-item ul { margin: 4px 0 8px; padding-left: 18px; overflow-wrap: anywhere; }
.pending-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* admin: read-only numbers */
.dialog.admin { max-width: 980px; width: calc(100vw - 32px); }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 12px 0; }
.admin-panel { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.admin-panel h3 { margin: 0 0 6px; font-size: 15px; }
.admin-panel dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; font-size: 14px; }
.admin-panel dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* Connect your AI */
.connect { width: min(640px, calc(100vw - 32px)); }
.connect h3 { font-size: 15px; margin: 18px 0 6px; }
.connect .connect-label { font-size: 13px; font-weight: 600; color: var(--ink); margin: 10px 0 4px; }
.config-row { display: flex; gap: 8px; align-items: flex-start; }
.config-row pre { flex: 1; min-width: 0; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); overflow-x: auto; }
.config-row code { font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; user-select: all; }
@media (max-width: 480px) { .config-row { flex-direction: column; align-items: stretch; } }

/* the plans side by side (a table when wide, one card per plan when narrow) */
.dialog.dialog-plans { width: min(1120px, calc(100vw - 32px)); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.plans-compare { margin: 10px 0; }
.plans-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.plans-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.plans-table th, .plans-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.plans-table thead th { font-weight: 400; min-width: 112px; }
.plans-table thead th strong { display: block; font-weight: 600; }
.plans-table tbody th { font-weight: 500; color: var(--ink); position: sticky; left: 0; background: var(--bg); min-width: 150px; }
.plans-table tfoot td, .plans-table tfoot th { border-bottom: 0; }
.plans-table .is-current { background: var(--surface); }
.plan-price { display: block; color: var(--ink-2); font-size: 12.5px; }
.plan-current { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--ink); border: 1px solid var(--ink); border-radius: 999px; padding: 1px 8px; }
.dialog .plans-note { color: var(--ink-2); font-size: 14px; margin: 12px 0 18px; }
.plan-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.plan-actions .btn { white-space: nowrap; }
.plan-cards { display: none; gap: 10px; }
.plan-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.plan-card.is-current { border-color: var(--ink); }
.plan-card h4 { margin: 0; font-size: 16px; }
.plan-card dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 10px 0; font-size: 13px; }
.plan-card dt { color: var(--ink-2); }
.plan-card dd { margin: 0; text-align: right; }
@media (max-width: 720px) {
  .plans-table-wrap { display: none; }
  .plan-cards { display: grid; }
}
.connect .connect-file { overflow-wrap: anywhere; font-size: 13px; }

/* Help: a "?" is a small round button (drawn here, so it never joins the words it sits beside; its name is its aria-label);
   its panel is a quiet box right under what it explains. */
.help-btn::before { content: "?"; }
.help-btn { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; margin: 0 0 0 6px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: 600 13px/1 var(--font-body, inherit);
  cursor: pointer; vertical-align: middle; flex: none; }
.help-btn:hover, .help-btn[aria-expanded="true"] { border-color: var(--brand); color: var(--ink); }
.help-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.help-tip-btn { width: 18px; height: 18px; font-size: 11px; margin-left: 4px; }
.help-panel { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 10px 12px; margin: 6px 0 12px; max-width: 64ch; }
.help-panel p { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.help-tip-panel { display: block; margin: 6px 0 8px; font-weight: 400; text-align: left; }
.help-tip-panel[hidden] { display: none; }
.help-tip-panel > span { display: block; margin: 0; color: var(--ink-2); font-size: 13px; line-height: 1.5; }
.help-head { display: flex; align-items: center; gap: 4px; }
.help-head > h2 { margin-bottom: 0; }
.dialog .help-head { margin-bottom: 8px; }
.help-row { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin: 0 0 6px; font-size: 13px; color: var(--ink-2); }
.plans-table th.has-tip, .plan-card dt.has-tip { font-weight: inherit; }
legend .help-tip-panel, th .help-tip-panel, dt .help-tip-panel { max-width: 32ch; }
.help-inline { font-size: 13px; margin: 0 0 10px; }
