/* ALTERVYN review page. System fonts only, no external assets. */
:root {
  /* Dark navy with a restrained teal accent (#142, Dave's direction 26 Nov 2026). One theme on every device. */
  color-scheme: dark;
  --bg: #070d1a; --bg-2: #0d1628; --fg: #e8eef7; --muted: #9aa8bf; --faint: #6c7a93;
  --card: #0f1a2e; --line: rgba(148, 180, 220, .10); --line-2: rgba(148, 180, 220, .20);
  --accent: #4fd1c5; --accent-fg: #03201d; --accent-soft: rgba(79, 209, 197, .12);
  --accent-2: #6aa8ff;
  --danger: #ff8a75; --danger-soft: rgba(255, 138, 117, .10);
  --warn: #f2c26b; --ok: #5fd39a; --seg-on: #1b2843;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 32px rgba(0, 0, 0, .35);
  --radius: 18px;
  --glow: radial-gradient(1000px 520px at 85% -15%, rgba(79, 209, 197, .10), transparent 60%),
          radial-gradient(900px 480px at -10% 0%, rgba(106, 168, 255, .08), transparent 60%);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--glow), var(--bg); background-attachment: fixed;
  color: var(--fg); font: 16px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--accent-soft); }

/* Header: brand and sign-out on one row, sections underneath */
header {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px 8px;
  padding: calc(env(safe-area-inset-top) + 14px) 20px 14px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid var(--line);
}
header > *, main { max-width: 720px; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
h1 { margin: 0; font-size: 15px; line-height: 1.2; font-weight: 700; letter-spacing: .22em; }
.byline { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; color: var(--muted); text-decoration: none; white-space: nowrap; }
.byline:hover, .byline:focus-visible { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.brand .mark { width: 30px; height: 30px; border-radius: 9px; }
.signin-foot { margin: 40px auto 0 !important; font-size: 13px; color: var(--muted); }
.signin-foot a { color: var(--fg); font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--line-2); }
.signin-foot a:hover { color: var(--accent); border-color: var(--accent); }
.mark {
  width: 22px; height: 22px; border-radius: 7px; flex: none;
  /* The app icon (option 8, 30 Nov 2026) instead of a plain gradient. */
  background: #050a14 url(/icon-192.png) center / cover no-repeat;
  box-shadow: 0 0 0 1px var(--line-2), 0 4px 14px var(--accent-soft);
}
.mark.large { display: block; width: 56px; height: 56px; border-radius: 18px; margin: 0 auto 20px; }
nav { display: contents; }
nav[hidden] { display: none; }
.seg {
  grid-column: 1 / -1; grid-row: 2; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(max-content, 1fr);
  overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; min-width: 0; position: relative;
  padding: 4px; gap: 4px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line);
}
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: transparent; padding: 9px 10px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 14px; box-shadow: none; }
.seg button[aria-pressed="true"] { background: var(--seg-on); color: var(--fg); box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 0 0 1px var(--line); }
#signout, #passkey { border: 0; background: transparent; color: var(--muted); padding: 6px 4px; font-size: 14px; font-weight: 500; box-shadow: none; }
#signout:hover, #passkey:hover { color: var(--fg); background: transparent; }
.nav-end { grid-column: 2; grid-row: 1; display: flex; gap: 10px; align-items: center; justify-self: end; }

main { margin: 0 auto; padding: 20px 20px calc(env(safe-area-inset-bottom) + 96px); }

/* Buttons */
button {
  font: inherit; font-weight: 600; font-size: 15px; padding: 10px 16px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--card); color: var(--fg); cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, transform .08s, opacity .15s;
}
button:hover { background: var(--bg-2); }
button:active { transform: scale(.97); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
button.primary:hover { filter: brightness(1.06); background: var(--accent); }
button.danger { color: var(--danger); border-color: transparent; background: var(--danger-soft); }
button.danger:hover { background: var(--danger-soft); filter: brightness(1.1); }
button:disabled, button.primary:disabled { opacity: .38; cursor: default; transform: none; filter: none; }

/* Cards */
.card {
  position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 18px 16px; margin-bottom: 14px; box-shadow: var(--shadow);
  animation: rise .28s ease-out both;
}
#list > .card:nth-child(2) { animation-delay: .04s; }
#list > .card:nth-child(3) { animation-delay: .08s; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.card h2 { font-size: 18px; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; margin: 0 0 6px; }
.meta { color: var(--muted); font-size: 13px; font-weight: 500; margin: 0 0 12px; font-variant-numeric: tabular-nums; }
.overview {
  margin: 0 0 16px; white-space: pre-line; color: color-mix(in srgb, var(--fg) 86%, transparent); font-size: 15.5px; line-height: 1.6;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 7; overflow: hidden;
}
#detail .overview { display: block; -webkit-line-clamp: unset; overflow: visible; padding: 14px 16px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions .danger { margin-left: auto; }

/* Keep panel */
.keep-form {
  margin-top: 14px; padding: 14px; display: grid; gap: 12px; border-radius: 14px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  animation: rise .2s ease-out both;
}
.keep-form[hidden] { display: none; }
.keep-form label, .me-form label { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.45; cursor: pointer; }
.keep-form .confirm-keep { width: 100%; padding: 13px 16px; margin-top: 2px; }

/* Checkboxes */
input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; flex: none; width: 22px; height: 22px; margin: 0; border-radius: 7px;
  border: 1.5px solid var(--line-2); background: var(--card); display: grid; place-content: center; cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
input[type="checkbox"]::after { content: ""; width: 11px; height: 6px; border: solid var(--accent-fg); border-width: 0 0 2.5px 2.5px; transform: rotate(-45deg) translate(1px, -1px) scale(0); transition: transform .12s; }
input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Status as a floating toast */
#status {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translateX(-50%); z-index: 20;
  margin: 0; padding: 10px 18px; border-radius: 999px; max-width: calc(100vw - 40px);
  background: var(--fg); color: var(--bg); font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  animation: toast .22s ease-out both;
}
#status:empty { display: none; }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Empty states and section text */
#list > p:only-child {
  text-align: center; color: var(--muted); padding: 72px 20px 40px; margin: 0; font-size: 15px;
}
#list > p:only-child::before {
  content: "\2713"; display: block; width: 48px; height: 48px; margin: 0 auto 16px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-size: 22px; font-weight: 700; line-height: 48px;
}
#list > .meta:first-child { margin: 4px 2px 16px; font-size: 14px; }
#list > button, #detail > button:first-child { margin-bottom: 16px; }
#detail > button:first-child { border-color: transparent; background: transparent; padding-left: 0; color: var(--accent); }
h3 { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 28px 2px 12px; }

/* Sign in */
#signin { text-align: center; padding: 18vh 12px 40px; }
#signin h2 { font-size: 26px; letter-spacing: -.02em; margin: 0 0 8px; }
#signin p { color: var(--muted); margin: 0 auto 28px; max-width: 30ch; }
#signin button { padding: 14px 40px; font-size: 16px; }

/* Conversation detail */
#detail > h2 { font-size: 24px; line-height: 1.25; letter-spacing: -.02em; margin: 0 0 6px; }
#detail > .meta { margin-bottom: 16px; }
.segment { margin: 0 0 14px; padding-left: 14px; border-left: 2px solid var(--line-2); font-size: 15.5px; }
.segment b { display: block; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.full-text { white-space: pre-wrap; font-size: 16px; line-height: 1.7; }

/* AlterEver forms */
.me-form { display: grid; gap: 12px; }
textarea, select, input[type="text"], input[type="file"] {
  font: inherit; font-size: 16px; width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--fg); transition: border-color .15s, box-shadow .15s;
}
input[type="file"] { padding: 10px; font-size: 14px; color: var(--muted); }
textarea:focus, select:focus, input[type="text"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
textarea { min-height: 140px; resize: vertical; line-height: 1.55; }
textarea.memory-text { min-height: 72px; }
.me-form > button { justify-self: start; }

/* Assistant */
.assist { margin: -4px 0 16px; display: grid; gap: 10px; }
.assist.loading .chip { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.chip.warn { background: var(--danger-soft); color: var(--danger); }
.chip.good { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.chip.quiet { background: var(--bg-2); color: var(--muted); }
.assist-reason { margin: 0; color: var(--muted); font-size: 14px; }
.assist-note { margin: 0; font-size: 14px; padding: 10px 12px; border-radius: 12px; background: var(--danger-soft); color: var(--fg); }
.assist-section { padding: 12px 14px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); }
.assist-section h4 { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.assist-section ul { margin: 0; padding-left: 18px; font-size: 15px; }
.assist-section li + li { margin-top: 4px; }
.idea + .idea { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.idea-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 15px; }
.idea-note { margin: 6px 0 10px; font-size: 14.5px; color: color-mix(in srgb, var(--fg) 82%, transparent); }
.idea-form { margin-top: 10px; }
.idea-form[hidden] { display: none; }
.idea .actions button { padding: 7px 14px; font-size: 14px; }

/* Flags */
.flag-box { padding: 12px 14px; border-radius: 14px; background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); display: grid; gap: 8px; }
.flag-head strong { color: var(--danger); font-size: 14.5px; }
.flag-box ul { margin: 0; padding-left: 18px; font-size: 14.5px; }
.flag-box .actions button { padding: 7px 14px; font-size: 14px; }
.flag-lines[hidden] { display: none; }
.flag-lines .segment { margin-top: 6px; }

/* Today */
.brief h2 { font-size: 24px; letter-spacing: -.02em; margin: 4px 2px 4px; }
.brief .meta { margin: 0 2px 4px; }
.empty-line { color: var(--muted); font-size: 14.5px; margin: 0 2px 8px; }
.card.action { padding: 14px 16px 12px; }
.action-text { margin: 0 0 4px; font-size: 16px; font-weight: 600; line-height: 1.4; }
.card.action .meta { margin-bottom: 10px; }
.card.action.done .action-text { text-decoration: line-through; color: var(--muted); }
.card.action input[type="date"] { font: inherit; font-size: 15px; padding: 8px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--fg); }
ul.plain { margin: 0; padding-left: 18px; }
.button-link { display: inline-flex; justify-content: center; align-items: center; text-decoration: none; font-weight: 600; font-size: 15px; padding: 12px 16px; border-radius: 999px; }
.button-link.primary { background: var(--accent); color: var(--accent-fg); }

@media (min-width: 1000px) {
  header { grid-template-columns: auto 1fr auto; padding-left: max(20px, calc((100vw - 720px) / 2)); padding-right: max(20px, calc((100vw - 720px) / 2)); }
  .seg { grid-column: 2; grid-row: 1; justify-self: center; width: auto; }
  body[data-view="atlas"] header { padding-left: max(20px, calc((100vw - 1180px) / 2)); padding-right: max(20px, calc((100vw - 1180px) / 2)); }
  .nav-end { grid-column: 3; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.chat-log { display: grid; gap: 10px; max-height: 420px; overflow-y: auto; }
.chat-turn { margin: 0; line-height: 1.5; white-space: pre-wrap; }
.chat-turn.alterever { padding-left: 12px; border-left: 3px solid var(--accent); }


/* Loading, empty and error states */
.loading-state, .empty-state { display: grid; justify-items: center; gap: 12px; padding: 40px 8px; text-align: center; color: var(--muted); }
.loading-state p, .empty-state p { margin: 0; max-width: 34ch; line-height: 1.5; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { justify-self: stretch; height: 84px; border-radius: 18px; background: linear-gradient(90deg, var(--bg-2), var(--line), var(--bg-2)); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; }
.skeleton.short { height: 56px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.empty-tick { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--bg-2); color: var(--accent); font-size: 24px; font-weight: 700; }

/* Date picker with a visible label */
.date-pill { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 110px; padding: 12px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2); font-weight: 600; font-size: 15px; color: var(--fg); }
.date-pill.empty { color: var(--muted); }
.date-pill input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.warn-text { color: var(--warn, #b45309); }

/* Tab badges and the undo button in the toast */
.seg button { position: relative; }
/* Scrolls sideways on narrow screens; top padding leaves room for the badges. */
.seg { overflow-x: auto; overflow-y: hidden; padding-top: 10px; }
.badge { position: absolute; top: -7px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: var(--accent-fg); font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; border: 2px solid var(--bg); box-sizing: content-box; pointer-events: none; }
.badge[hidden] { display: none; }
.toast-undo { margin-left: 10px; padding: 4px 12px; border-radius: 999px; border: 0; background: var(--accent); color: var(--accent-fg); font-weight: 700; font-size: 14px; box-shadow: none; }
.card[hidden] { display: none; }

/* Triage list */
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; margin: 0 -2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.filters::-webkit-scrollbar { display: none; }
.filter { flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: 14px; font-weight: 600; box-shadow: none; white-space: nowrap; }
.filter[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.bulk { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.triage-row { padding: 14px 16px 12px; margin-bottom: 10px; cursor: pointer; }
.triage-row:active { transform: scale(.99); }
.row-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.row-title { font-size: 16px; line-height: 1.3; }
.row-date { flex: 0 0 auto; color: var(--muted); font-size: 13px; }
.triage-row .chips { margin: 8px 0 6px; }
.row-summary { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.triage-row[hidden] { display: none; }
.brief-lead { margin: 6px 0 2px; font-size: 18px; font-weight: 600; }

/* Voice */
.brief-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brief-head h2 { margin: 0; }
button.listen { padding: 8px 14px; font-size: 14px; }
button.listen::before { content: '\25B6\FE0E'; font-size: 11px; margin-right: 6px; }
button.listen.speaking { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
button.listen.speaking::before { content: '\25A0\FE0E'; }

button.mic { padding: 8px 14px; font-size: 14px; }
button.mic::before { content: '\25CF\FE0E'; color: #d23; margin-right: 6px; font-size: 12px; }
button.mic.recording { background: #d23; color: #fff; border-color: #d23; animation: pulse 1.2s ease-in-out infinite; }
button.mic.recording::before { color: #fff; }
@keyframes pulse { 50% { opacity: .75; } }

/* Feed warning and diary (19 Nov 2026) */
.card.warn { background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }
.card.warn h2 { color: var(--danger); font-size: 16px; }
.card.diary { display: grid; gap: 2px; }
.diary-row { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.diary-row:last-of-type { border-bottom: 0; }
.diary-time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; }
.diary-title { font-weight: 550; overflow-wrap: anywhere; }

/* ---------- Command Centre and Atlas (#142) ---------- */
body[data-view="atlas"] main, body[data-view="atlas"] header > * { max-width: 1180px; }
.cc { display: grid; gap: 20px; }
.cc-atlas { display: flex; flex-direction: column; align-items: stretch; gap: 16px; min-width: 0; }
.cc-atlas[hidden], .cc-side[hidden], .cc-panel[hidden] { display: none; }
.cc-hello { text-align: center; }
.cc-hello h2 { margin: 2px 0 0; font-size: 26px; line-height: 1.2; font-weight: 650; letter-spacing: -.02em; }
.cc-date { margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }

/* The orb: its look follows the real state on .cc[data-state] */
.orb-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 8px 0 0; }
.orb { position: relative; width: 120px; height: 120px; display: grid; place-items: center; }
.orb-core, .orb-ring { position: absolute; inset: 0; border-radius: 50%; }
.orb-core {
  inset: 15%;
  background: radial-gradient(circle at 35% 30%, #c8fff8 0%, var(--accent) 22%, #1f7f9a 58%, #0b2a4a 100%);
  box-shadow: 0 0 40px rgba(79, 209, 197, .35), 0 0 0 1px rgba(200, 255, 248, .18) inset;
  transition: filter .3s, box-shadow .3s, transform .3s;
}
.orb-ring { border: 1.5px solid rgba(79, 209, 197, .35); }
.cc[data-state="idle"] .orb-core { animation: breathe 6s ease-in-out infinite; }
.cc[data-state="listening"] .orb-core { box-shadow: 0 0 56px rgba(79, 209, 197, .6), 0 0 0 1px rgba(200, 255, 248, .3) inset; }
.cc[data-state="listening"] .orb-ring { border-color: var(--accent); animation: ripple 1.4s ease-out infinite; }
.cc[data-state="processing"] .orb-ring, .cc[data-state="transcribing"] .orb-ring {
  border: 0; background: conic-gradient(from 0deg, transparent 0 70%, var(--accent) 100%);
  -webkit-mask: radial-gradient(circle, transparent 66%, #000 67%); mask: radial-gradient(circle, transparent 66%, #000 67%);
  animation: spin 1.2s linear infinite;
}
.cc[data-state="speaking"] .orb-core { animation: speak .7s ease-in-out infinite alternate; box-shadow: 0 0 60px rgba(106, 168, 255, .45); }
.cc[data-state="unavailable"] .orb-core { filter: grayscale(.9) brightness(.7); box-shadow: none; }
.cc[data-state="unavailable"] .orb-ring { border-style: dashed; border-color: var(--line-2); }
.cc[data-state="error"] .orb-core { filter: hue-rotate(150deg) saturate(.8); box-shadow: 0 0 36px rgba(255, 138, 117, .3); }
/* WebGL orb: the canvas replaces the CSS sphere when WebGL is available. */
.orb-gl { position: absolute; inset: -18%; width: 136%; height: 136%; pointer-events: none; }
.orb.has-gl .orb-core { display: none; }
.orb.has-gl .orb-ring { opacity: 0; }
.cc[data-state="listening"] .orb.has-gl .orb-ring { opacity: .5; }
@keyframes breathe { 50% { transform: scale(1.03); } }
@keyframes ripple { from { transform: scale(.9); opacity: 1; } to { transform: scale(1.25); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes speak { from { transform: scale(.97); } to { transform: scale(1.07); } }
.orb-state { margin: 0; min-height: 1.5em; color: var(--muted); font-size: 15px; text-align: center; font-variant-numeric: tabular-nums; }

/* Controls */
.cc-controls { display: flex; justify-content: center; align-items: center; gap: 14px; }
/* An outlined control, so it does not read as a second orb. */
.cc-mic {
  width: 64px; height: 64px; padding: 0; border-radius: 50%; display: grid; place-items: center;
  background: rgba(79, 209, 197, .08); border: 2px solid var(--accent); color: var(--accent); box-shadow: none;
}
.cc-mic:hover { background: rgba(79, 209, 197, .16); }
.cc-mic.live { background: #ff6b5a; border-color: #ff6b5a; color: #fff; box-shadow: 0 0 0 6px rgba(255, 107, 90, .18), 0 8px 28px rgba(255, 107, 90, .3); }
.mic-glyph { position: relative; width: 16px; height: 24px; border-radius: 8px; background: currentColor; margin-bottom: 8px; }
.mic-glyph::before { content: ""; position: absolute; left: -6px; right: -6px; top: 10px; height: 14px; border: 2.5px solid currentColor; border-top: 0; border-radius: 0 0 14px 14px; }
.mic-glyph::after { content: ""; position: absolute; left: 6.5px; top: 26px; width: 3px; height: 6px; background: currentColor; }
.cc-mic.live .mic-glyph { width: 20px; height: 20px; border-radius: 4px; margin: 0; }
.cc-mic.live .mic-glyph::before, .cc-mic.live .mic-glyph::after { display: none; }
.cc-stop { padding: 10px 18px; }
.cc-stop[hidden] { display: none; }

.cc-chips, .cc-suggest { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip { font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--muted); }
button.chip:hover { color: var(--fg); }
.mic-chip::before, .health-chip::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; background: var(--faint); }
.mic-chip.on { color: #ffb3a8; border-color: rgba(255, 107, 90, .5); }
.mic-chip.on::before { background: #ff6b5a; }
.mic-chip.blocked { color: var(--warn); }
.health-chip.healthy::before { background: var(--ok); }
.health-chip.degraded::before, .health-chip.unknown::before { background: var(--warn); }
.health-chip.unavailable::before { background: var(--danger); }
.cc-suggest .chip { color: var(--fg); background: transparent; }
.cc-suggest[hidden], .cc-log[hidden] { display: none; }

/* Conversation */
.cc-log { display: flex; flex-direction: column; gap: 12px; }
.turn { max-width: 92%; padding: 12px 15px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); animation: rise .2s ease-out both; }
.turn.owner { align-self: flex-end; background: var(--accent-soft); border-color: rgba(79, 209, 197, .25); }
.turn.atlas { align-self: flex-start; }
.turn.degraded { border-color: rgba(242, 194, 107, .35); }
.turn.error { border-color: rgba(255, 138, 117, .4); color: var(--danger); }
.turn-text { margin: 0; white-space: pre-line; line-height: 1.6; }
.turn-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; color: var(--faint); font-size: 12.5px; }
.turn-missing { margin: 8px 0 0; color: var(--warn); font-size: 13.5px; }
button.link { padding: 0; border: 0; background: transparent; color: var(--accent); font-size: 13px; box-shadow: none; }
button.link:hover { background: transparent; text-decoration: underline; }
.src { margin-top: 8px; font-size: 13.5px; color: var(--muted); }
.src summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.src ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.src li { color: var(--fg); }
.src-label { display: inline-block; min-width: 26px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.src-kind { display: inline-block; margin-right: 4px; padding: 1px 7px; border-radius: 6px; background: var(--bg-2); color: var(--muted); font-size: 12px; font-weight: 600; }
.src-meta { display: block; margin-left: 30px; color: var(--faint); font-size: 12.5px; }
.src p { margin: 8px 0 0; }

.cc-form { position: sticky; bottom: calc(env(safe-area-inset-bottom) + 12px); display: flex; gap: 8px; align-items: flex-end; padding: 6px; border-radius: 22px; background: color-mix(in srgb, var(--card) 92%, transparent); border: 1px solid var(--line-2); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: var(--shadow); }
.cc-input, .cc-input:focus { box-shadow: none; }
.cc-input { flex: 1; min-width: 0; min-height: 0; height: 42px; resize: none; border: 0; border-radius: 0; background: transparent; color: var(--fg); font: inherit; font-size: 16px; line-height: 1.45; padding: 9px 10px; max-height: 160px; }
.cc-input:focus { outline: none; }
.cc-form:focus-within { border-color: var(--accent); }
.cc-send { background: var(--accent); color: var(--accent-fg); border: 0; padding: 9px 16px; }
.cc-send:hover { background: var(--accent); filter: brightness(1.07); }

/* The side: cards */
.cc-side { display: grid; gap: 14px; align-content: start; }
.cc-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 12px; box-shadow: var(--shadow); }
.cc-card h3 { margin: 0 0 10px; font-size: 12.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.cc-muted { margin: 0 0 8px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.cc-warn { margin: 0 0 8px; color: var(--warn); font-size: 14px; }
.cc-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; font-size: 14.5px; }
.cc-list li { display: flex; justify-content: space-between; gap: 10px; }
.cc-list li.overdue .cc-due { color: var(--danger); }
.cc-time { flex: none; min-width: 58px; color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }
.cc-list li:has(.cc-time) { justify-content: flex-start; }
.cc-due { flex: none; color: var(--faint); font-size: 13px; }
.cc-row { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 2px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--fg); font-size: 14.5px; font-weight: 500; text-align: left; box-shadow: none; }
.cc-row:hover { background: transparent; color: var(--accent); }
.cc-row:active { transform: none; }
.cc-val { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.cc-row.hot .cc-val { color: var(--accent); }

.hl-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 10px; }
.hl { display: grid; grid-template-columns: 12px 1fr auto; gap: 2px 8px; align-items: baseline; font-size: 14.5px; }
.hl .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); align-self: center; }
.hl.healthy .dot { background: var(--ok); }
.hl.degraded .dot, .hl.unknown .dot { background: var(--warn); }
.hl.unavailable .dot { background: var(--danger); }
.hl-state { color: var(--muted); font-size: 13px; font-weight: 600; }
.hl-detail { grid-column: 2 / -1; color: var(--faint); font-size: 13px; }
.hl-list.compact .hl-detail { display: none; }

.cc-panel h2 { margin: 18px 0 6px; font-size: 22px; }
.cc-panel h3 { margin: 22px 0 6px; font-size: 15px; }
.cc-panel p { color: color-mix(in srgb, var(--fg) 88%, transparent); }
.cc-plain { padding-left: 18px; line-height: 1.6; }
.cc-field { border: 1px solid var(--line); border-radius: 14px; padding: 8px 14px 4px; margin: 14px 0; }
.cc-field legend { padding: 0 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
.cc-opt { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.cc-opt span { display: grid; gap: 2px; }
.cc-opt small { color: var(--muted); font-size: 13px; }
.cc-panel select { width: 100%; margin: 4px 0 12px; padding: 10px; border-radius: 12px; background: var(--bg-2); color: var(--fg); border: 1px solid var(--line-2); font: inherit; }
.cc-panel input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; margin-top: 3px; }

@media (min-width: 1000px) {
  .cc { grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
  .cc-panel { grid-column: 1 / -1; max-width: 720px; }
  .cc-side { position: sticky; top: 120px; }
  .orb { width: 176px; height: 176px; }
  .cc-hello h2 { font-size: 30px; }
}
body[data-view="atlas"] #status { bottom: calc(env(safe-area-inset-bottom) + 92px); }

/* ---------- Capture (#142 step 5) ---------- */
.visually-hidden { position: absolute !important; left: 0; width: 1px !important; height: 1px !important; padding: 0 !important; border: 0 !important; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.button-like { display: inline-flex; align-items: center; font-weight: 600; font-size: 15px; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); color: var(--fg); cursor: pointer; }
.button-like:hover { background: var(--bg-2); }
input.visually-hidden:focus-visible + .button-like { outline: 2px solid var(--accent); outline-offset: 2px; }
.rec-bar { position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top) + 10px); display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 999px; background: #3a1414; border: 1px solid rgba(255, 107, 90, .6); color: #ffd7d1; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); font-size: 14px; font-weight: 600; max-width: calc(100vw - 24px); }
.rec-bar[hidden] { display: none; }
.rec-bar.quiet { background: var(--bg-2); border-color: var(--line-2); color: var(--muted); padding: 8px 16px; top: auto; bottom: calc(env(safe-area-inset-bottom) + 150px); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #ff6b5a; animation: blink 1.2s ease-in-out infinite; flex: none; }
.rec-time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.rec-note { color: #ffb3a8; font-weight: 500; font-size: 12.5px; white-space: nowrap; }
.rec-stop { padding: 6px 14px; background: #ff6b5a; color: #2a0905; border: 0; }
.rec-stop:hover { background: #ff6b5a; filter: brightness(1.06); }
@keyframes blink { 50% { opacity: .35; } }
.cap-controls { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 20px; }
.cap-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.cap-head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; margin-bottom: 10px; }
.cap-head .cc-muted { margin: 0; font-size: 13px; }
.cap-status { font-size: 12.5px; font-weight: 700; letter-spacing: .04em; padding: 2px 9px; border-radius: 999px; background: var(--bg-2); color: var(--muted); }
.cap-status.awaiting_review { color: var(--accent); background: var(--accent-soft); }
.cap-status.failed { color: var(--warn); }
.cap-text { white-space: pre-line; max-height: 50vh; overflow: auto; padding: 14px 16px; margin: 12px 0; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); line-height: 1.6; }
.cc-panel input[type="text"] { margin-bottom: 12px; }
.meta.quality { color: var(--warn); margin-top: -6px; }

/* Siri device code: shown once, easy to copy, never wraps off screen. */
.cc-token-value { display: block; padding: 10px 12px; border-radius: 10px; background: rgba(79, 209, 197, .08); border: 1px solid var(--line-2); font-size: 13px; word-break: break-all; user-select: all; -webkit-user-select: all; }
.cc-siri input[type="text"] { flex: 1 1 180px; min-width: 0; }

/* Safeguard settings: one row per switch, label and hint stacked. */
.cc-toggle { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cc-toggle > span { display: flex; flex-direction: column; gap: 2px; }
.cc-toggle small { font-size: 13px; }
.cc-field { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; }
.cc-field select { max-width: 100%; }

/* Review in groups */
.group-card .group-sample { margin: 6px 0 10px; padding-left: 18px; color: var(--muted); font-size: 14px; }
.group-card .group-sample li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Morning news */
.news-item .news-head { display: block; color: var(--fg); font-weight: 600; font-size: 17px; line-height: 1.35; text-decoration: none; }
.news-item .news-head:hover { text-decoration: underline; }
.news-why { color: var(--accent); }
.news-settings label { display: flex; gap: 10px; align-items: center; padding: 6px 0; }
.news-settings input[type="text"] { width: 100%; }

/* Minutes of a call or event */
.minutes h5 { margin: 10px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* Weather */
.weather .weather-days { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.weather .weather-day { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }

/* Share panel */
.share-panel { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.share-panel .share-text { width: 100%; min-height: 120px; font: inherit; }
/* Add to calendar (28 Nov 2026). */
.cal-panel { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.cal-panel .date-field { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.cal-panel .date-field input { font: inherit; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); color: var(--fg); }
.cal-panel .button-link:not(.primary) { border: 1px solid var(--line); background: var(--bg-2); color: var(--fg); }
button.recommend { border-color: var(--accent); color: var(--accent); }
/* Dave's own social accounts (28 Nov 2026). */
.cc-account { display: flex; flex-direction: column; gap: 4px; }
.cc-link { color: var(--accent); font-weight: 600; text-decoration: none; padding: 2px 0 8px; }
.share-panel .meta a { color: var(--accent); }
/* Atlas answer while it streams in (29 Nov 2026). */
.turn.atlas.streaming .turn-text::after { content: '▍'; margin-left: 2px; opacity: .6; animation: cc-caret 1s steps(2) infinite; }
@keyframes cc-caret { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .turn.atlas.streaming .turn-text::after { animation: none; } }
/* The question as it is being spoken (29 Nov 2026). */
.turn.owner.draft { opacity: .65; border-style: dashed; }
/* Newest exchange first (29 Nov 2026): a question and its answer together. */
.cc-exchange { display: flex; flex-direction: column; gap: 12px; }
.cc-exchange + .cc-exchange { padding-top: 12px; border-top: 1px solid var(--line); }
/* Speaker data from Omi (30 Nov 2026): compact rows for one screenshot. */
.spk-row { display: flex; justify-content: space-between; gap: 12px; margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.spk-row b { text-align: right; word-break: break-word; }
/* Privacy note screen (30 Nov 2026): a QR code that scans in any light. */
.pv-qr { background: #fff; border-radius: 12px; padding: 12px; width: fit-content; margin: 12px auto; }
.pv-qr img { display: block; width: min(264px, 70vw); height: auto; }
.pv-url { text-align: center; margin: 0 0 16px; }
.pv-confirm { flex-wrap: wrap; }
.pv-confirm p { flex-basis: 100%; margin: 0 0 8px; }
.pv-result { margin-top: 10px; }
/* News: UK / region / international filter (30 Nov 2026). */
.news-where { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.news-where button.chip { min-height: 36px; padding: 6px 14px; font-size: 14px; border: 1px solid var(--line-2); background: transparent; color: inherit; cursor: pointer; }
.news-where button.chip.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
button.news-fresh { width: 100%; margin: 4px 0 10px; }
/* Tick off (30 Nov 2026): tap a diary item or commitment. */
.cc-list li.cc-tick { cursor: pointer; border-radius: 8px; transition: opacity .2s; }
.cc-list li.cc-tick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cc-list li.cc-tick.done { opacity: .55; text-decoration: line-through; text-decoration-thickness: 2px; }
.turn-done { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.turn-done .done-note { align-self: center; color: var(--muted, inherit); font-size: 14px; }
.diary-row.diary-tick { cursor: pointer; border-radius: 8px; }
.diary-row.diary-tick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.diary-row.done { opacity: .55; text-decoration: line-through; text-decoration-thickness: 2px; }
