/* CogTwin browser screens. No external fonts or images. */
[hidden] { display: none !important; }
:root {
  --bg: #f7f7f5; --panel: #ffffff; --text: #1d1d1f; --muted: #5f6368; --line: #d7d7d2;
  --accent: #1f5fbf; --accent-text: #ffffff; --accent-soft: #e8f0fb;
  --good: #1e7d3a; --good-soft: #e6f4ea; --bad: #b3261e; --bad-soft: #fce8e6; --warn-soft: #fff4d6;
  --radius: 10px; --focus: 3px solid #f0a500;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181a; --panel: #212226; --text: #ececec; --muted: #a4a7ad; --line: #3a3c42;
    --accent: #7fb0ff; --accent-text: #0d1b33; --accent-soft: #22324d;
    --good: #7fd49a; --good-soft: #1d3325; --bad: #ff8a80; --bad-soft: #3d1f1d; --warn-soft: #3a3320;
  }
}
* { box-sizing: border-box; }
html { font-size: 17px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.5;
}
:focus-visible { outline: var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--panel); padding: .5rem 1rem; z-index: 10; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem;
  padding: .75rem 1.25rem; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 1.15rem; }
#nav { display: flex; flex-wrap: wrap; gap: .25rem; }
#nav a { padding: .35rem .7rem; border-radius: 999px; color: var(--text); text-decoration: none; }
#nav a:hover { background: var(--accent-soft); }
#nav a[aria-current="page"] { background: var(--accent); color: var(--accent-text); }
.where { margin-left: auto; color: var(--muted); font-size: .9rem; }
.banner { padding: .6rem 1.25rem; background: var(--warn-soft); border-bottom: 1px solid var(--line); }

main { max-width: 46rem; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
main:focus { outline: none; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: .25rem 0 1rem; }
h2 { font-size: 1.2rem; margin: 1.75rem 0 .5rem; }
h3 { font-size: 1.05rem; margin: 1.25rem 0 .4rem; }
p { margin: .5rem 0; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.25rem; margin: 1rem 0;
}
.card > :first-child { margin-top: 0; }
.card.tinted { background: var(--accent-soft); }
.grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }

label { display: block; font-weight: 600; margin: 1rem 0 .3rem; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: .9rem; }
input[type="text"], input[type="password"], input[type="number"], textarea, select {
  width: 100%; font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem;
}
textarea { min-height: 7rem; resize: vertical; }
textarea.short { min-height: 3.2rem; }
input[type="number"] { max-width: 9rem; }

.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: 1.25rem; }
button, .button {
  font: inherit; cursor: pointer; border-radius: 8px; padding: .55rem 1.1rem;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); text-decoration: none;
  display: inline-block;
}
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.link { border: 0; background: none; color: var(--accent); padding: .2rem 0; text-decoration: underline; }
button:disabled { opacity: .55; cursor: progress; }

.choices { display: grid; gap: .5rem; margin: .75rem 0; border: 0; padding: 0; }
.choices legend { font-weight: 600; margin-bottom: .4rem; padding: 0; }
.choice {
  display: flex; gap: .7rem; align-items: flex-start; margin: 0; font-weight: 400;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; cursor: pointer;
}
.choice:hover { border-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin-top: .3rem; }
.choice .key { margin-left: auto; color: var(--muted); font-size: .85rem; }
.choice.none { border-style: dashed; }
.choices.modes { display: flex; flex-wrap: wrap; gap: .5rem; }
.choices.modes .choice { padding: .35rem .85rem; align-items: center; }
.choices.modes .choice input { margin-top: 0; }
.choices.modes .hint { flex-basis: 100%; margin: 0; }

.progress { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .9rem; }
.bar { flex: 1; height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.weight { display: flex; align-items: center; gap: .6rem; }
.weight .bar { max-width: 8rem; }
.pill { display: inline-block; padding: .05rem .55rem; border-radius: 999px; font-size: .85rem; border: 1px solid var(--line); }
.pill.match { background: var(--good-soft); color: var(--good); border-color: var(--good); }
.pill.miss { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }

.notice { border-left: 4px solid var(--accent); background: var(--accent-soft); padding: .7rem 1rem; border-radius: 6px; margin: 1rem 0; }
.error { border-left: 4px solid var(--bad); background: var(--bad-soft); padding: .7rem 1rem; border-radius: 6px; margin: 1rem 0; }
.saved { color: var(--good); font-size: .9rem; }
.waiting { display: flex; align-items: center; gap: .8rem; }
.spinner {
  width: 1.3rem; height: 1.3rem; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin 1s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; border-top-color: var(--line); } }

table { width: 100%; border-collapse: collapse; margin: .5rem 0; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: .9rem; }
.quote { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .7rem .9rem; }
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 1rem; }
.tabs button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.option-row { display: flex; gap: .5rem; align-items: center; margin: .4rem 0; }
.option-row input { flex: 1; }
.table-wrap { overflow-x: auto; }
tr.off td { color: var(--muted); }
td.num { white-space: nowrap; }
td input[type="checkbox"] { width: 1.15rem; height: 1.15rem; margin: .2rem 0 0; cursor: pointer; }
code { overflow-wrap: anywhere; }
.path { display: inline-block; min-width: 9rem; overflow-wrap: anywhere; }
details { margin: .5rem 0; }
summary { cursor: pointer; color: var(--accent); }
ul.plain { list-style: none; padding: 0; }
ul.plain li { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.block-title { font-weight: 600; color: var(--muted); margin: 1rem 0 0; }
.steps label { font-weight: 500; }
.clarify { margin-top: 1.5rem; border-top: 1px solid var(--line); }
.entry { white-space: pre-wrap; }

/* What AI Ted knows */
.known { padding: .9rem 0; border-bottom: 1px solid var(--line); }
.known:last-child { border-bottom: 0; padding-bottom: 0; }
.known:first-of-type { padding-top: 0; }
.known-question { font-weight: 600; margin: 0 0 .3rem; }
.known-status { font-size: .9rem; color: var(--good); margin: .2rem 0; }
.known-status.left-out { color: var(--muted); font-weight: 600; }
.known.off .entry { color: var(--muted); }
.known .actions { margin-top: .6rem; }
.fix label { margin-top: .6rem; }
/* Private topics: the consent and who it covers (PC only) */
.consent > .choice { margin: .75rem 0; }
.audiences { grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); }
.audiences:disabled .choice { opacity: .55; cursor: default; }
.audiences:disabled .choice:hover { border-color: var(--line); }

/* Chat with AI Ted */
.thread { list-style: none; padding: 0; margin: 1rem 0; display: flex; flex-direction: column; gap: .75rem; }
.msg {
  max-width: 88%; align-self: flex-start; padding: .6rem .9rem; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel);
}
.msg.visitor { align-self: flex-end; background: var(--accent-soft); }
.msg:focus { outline: none; }
.msg:focus-visible { outline: var(--focus); outline-offset: 2px; }
.msg .who { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); }
.msg .text { white-space: pre-wrap; overflow-wrap: anywhere; margin: .15rem 0 0; }
.msg .error { margin: .6rem 0 .1rem; }
.msg .error .actions { margin-top: .6rem; }
.msg-actions { margin-top: .2rem; }
.msg-actions label { margin-top: .5rem; font-weight: 500; }
.msg-actions .actions { margin-top: .6rem; }
.composer label { margin-top: 0; }
textarea.message { min-height: 5.5rem; }

/* Documents (PC only) */
h4 { font-size: 1rem; margin: 1rem 0 .3rem; }
.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: .8rem 1rem; margin: .75rem 0;
  background: var(--bg);
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop p { margin: .3rem 0; }
.doc-group { border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem .9rem .9rem; margin: .9rem 0; }
.doc-group legend { font-weight: 600; padding: 0 .3rem; }
.doc-group label { margin-top: .6rem; }
.doc-group.numbers { display: grid; gap: 0 .9rem; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); }
.doc-group.numbers legend, .doc-group.numbers > .hint { grid-column: 1 / -1; }
.doc-group.numbers input { max-width: 7rem; }
.values p { margin: .35rem 0; }
.excerpt .quote { margin: .2rem 0 .6rem; }
.analysis { border-top: 1px solid var(--line); margin-top: 1.25rem; padding-top: .25rem; }
.ai-label { display: inline-block; font-size: .85rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: .05rem .6rem; }
.use .choice { margin: .75rem 0; }
.use .hint { display: block; }
.remove { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .4rem; }
.paste { margin-top: 1rem; }

/* Phone: the page opened at the PC's Tailscale address (app.js PHONE). Everything here is under html.phone, so the
   PC's page is unchanged. One column, text inputs of 16px or more (iOS zooms into smaller ones), full-width buttons
   at least 48px tall, and nothing wider than the screen. */
.phone .top { padding: .5rem 1rem; gap: 0 .75rem; }
.phone #nav a { display: inline-block; padding: .7rem .85rem; }
.phone .where { margin-left: 0; flex-basis: 100%; }
.phone .where a { display: inline-block; padding: .7rem .2rem; }
.phone main { padding: 1rem 1rem 3rem; }
.phone main h1, .phone main p, .phone main li, .phone main code, .phone .entry, .phone .notice { overflow-wrap: anywhere; }
.phone h1 { font-size: 1.45rem; }
.phone #interview-question { font-size: 1.6rem; line-height: 1.3; margin-top: .5rem; }
.phone input, .phone textarea, .phone select { font-size: max(16px, 1rem); }
.phone main textarea:not(.short) { min-height: 13rem; }
.phone .card { padding: 1rem; }
.phone .progress { flex-wrap: wrap; gap: .3rem .75rem; }
.phone .progress .bar { flex: 1 0 100%; }
.phone .actions { flex-direction: column; align-items: stretch; gap: .6rem; }
.phone .actions > button, .phone .actions > a {
  display: block; width: 100%; min-height: 48px; padding: .7rem 1rem; text-align: center;
}
.phone .actions > button.link { text-align: left; }
.phone input.pair-input { font-size: 1.8rem; letter-spacing: .3em; text-align: center; padding: .6rem; }
.phone main textarea.message { min-height: 7rem; }
.phone .msg { max-width: 100%; }
.phone .msg-actions > button.link { min-height: 44px; padding: .5rem 0; }

/* The Phone panel on the PC's Home */
.phone-address code { font-size: 1.1rem; }
.pair-code { font-size: 1.6rem; letter-spacing: .12em; }
