:root {
  color-scheme: light dark;
  --ink: light-dark(#17201d, #eef5f1);
  --muted: light-dark(#66716c, #9caaa3);
  --faint: light-dark(#89938e, #7d8b84);
  --line: light-dark(rgba(23, 32, 29, 0.12), rgba(238, 245, 241, 0.12));
  --background: light-dark(#eef1ec, #0b100e);
  --surface: light-dark(#f8f9f5, #111715);
  --panel: light-dark(#ffffff, #19211e);
  --panel-soft: light-dark(#edf1eb, #202a26);
  --mint: light-dark(#1d745e, #82d5b7);
  --mint-soft: light-dark(#dcefe7, #173b31);
  --violet: light-dark(#6f58a3, #bba8eb);
  --amber: light-dark(#986124, #e3b271);
  --danger: light-dark(#a53e3e, #ef9999);
  --shadow: light-dark(0 24px 70px rgba(20, 35, 29, 0.12), 0 24px 70px rgba(0, 0, 0, 0.35));
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--background); }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, light-dark(rgba(75, 158, 128, 0.13), rgba(75, 158, 128, 0.08)), transparent 30%),
    radial-gradient(circle at 90% 88%, light-dark(rgba(111, 88, 163, 0.09), rgba(111, 88, 163, 0.08)), transparent 26%),
    var(--background);
}

button, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

button:focus-visible, a:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  width: min(1440px, calc(100% - 48px));
  height: min(880px, calc(100vh - 48px));
  min-height: 680px;
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  grid-template-rows: 68px minmax(0, 1fr);
  position: relative;
  margin: 24px auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.topbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 208px 1fr auto;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(18px);
  z-index: 20;
}

.brand {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  border-right: 1px solid var(--line);
}

.brand small {
  padding: 2px 6px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.presence-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--mint) 13%, transparent);
}

[data-presence="listening"] .presence-dot { animation: status-pulse 1.35s ease-in-out infinite; }
[data-presence="thinking"] .presence-dot { background: var(--violet); }
[data-presence="speaking"] .presence-dot { background: var(--amber); }

.topbar-state {
  display: flex;
  align-items: center;
  gap: 9px;
  justify-self: end;
  margin-right: 14px;
  color: var(--muted);
  font-size: 13px;
}

.state-copy { color: var(--ink); }
.state-copy::after { content: "·"; margin-left: 9px; color: var(--faint); }
.connection-state { padding: 4px 7px; border-radius: 999px; color: var(--faint); background: var(--panel-soft); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.connection-state.is-connected { color: var(--mint); background: var(--mint-soft); }

.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  margin-right: 14px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: var(--panel);
  cursor: pointer;
}

.side-nav {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 60%, var(--surface));
}

.side-nav nav { display: grid; gap: 5px; }

.nav-item {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 12px;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}

.nav-item:hover { color: var(--ink); background: color-mix(in srgb, var(--panel-soft) 55%, transparent); }
.nav-item.is-active { color: var(--ink); background: var(--panel-soft); }
.nav-item span:first-child { width: 18px; text-align: center; }

.side-note {
  display: grid;
  gap: 2px;
  padding: 12px;
  color: var(--muted);
}

.side-note span { color: var(--ink); font-size: 13px; }
.side-note small { font-size: 11px; }

.main-surface { min-width: 0; min-height: 0; overflow: auto; }

.view {
  min-height: 100%;
  padding: clamp(24px, 4vw, 52px);
  animation: view-in 220ms ease-out;
}

.presence-view {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  overflow: hidden;
}

.context-line {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.context-line button, .text-button, .memory-marker {
  border: 0;
  padding: 0;
  color: var(--mint);
  background: transparent;
  cursor: pointer;
}

.presence-center {
  display: grid;
  justify-items: center;
  gap: 26px;
  margin: auto 0;
  text-align: center;
}

.oti-orb {
  width: 176px;
  height: 176px;
  position: relative;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.orb-core {
  position: absolute;
  inset: 13px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 33% 28%, rgba(255, 255, 255, 0.95), transparent 14%),
    radial-gradient(circle at 64% 68%, color-mix(in srgb, var(--violet) 58%, transparent), transparent 42%),
    radial-gradient(circle at 45% 45%, color-mix(in srgb, var(--mint) 90%, white 8%), color-mix(in srgb, var(--mint) 30%, transparent) 62%, transparent 71%);
  box-shadow: 0 18px 60px color-mix(in srgb, var(--mint) 24%, transparent);
  transition: transform 260ms ease, filter 260ms ease;
}

.oti-orb:hover .orb-core { transform: scale(1.025); filter: saturate(1.08); }

.orb-ripple {
  position: absolute;
  inset: 1px;
  border: 1px solid color-mix(in srgb, var(--mint) 26%, transparent);
  border-radius: 50%;
  opacity: 0;
}

[data-presence="listening"] .orb-core { animation: orb-listen 1.7s ease-in-out infinite; }
[data-presence="listening"] .orb-ripple { animation: orb-ripple 2s ease-out infinite; }
[data-presence="listening"] .ripple-two { animation-delay: 0.65s; }
[data-presence="thinking"] .orb-core { animation: orb-think 2.4s ease-in-out infinite; }
[data-presence="speaking"] .orb-core { animation: orb-speak 0.9s ease-in-out infinite; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.presence-message h1, .section-heading h1 {
  margin: 0;
  font-size: clamp(30px, 4.4vw, 54px);
  line-height: 1.05;
  font-weight: 420;
  letter-spacing: -0.035em;
}

.presence-summary {
  max-width: 600px;
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.conversation-dock { width: min(100%, 680px); }

.listening-status {
  margin: 0 auto 10px;
  text-align: center;
  color: var(--mint);
  font-size: 13px;
}

.audio-bars { display: inline-flex; align-items: center; gap: 2px; height: 14px; margin-right: 7px; }
.audio-bars i { width: 2px; height: 5px; border-radius: 2px; background: currentColor; animation: audio-bar 0.8s ease-in-out infinite; }
.audio-bars i:nth-child(2) { animation-delay: 0.12s; }
.audio-bars i:nth-child(3) { animation-delay: 0.24s; }
.audio-bars i:nth-child(4) { animation-delay: 0.36s; }

.composer {
  min-height: 62px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 12px 32px light-dark(rgba(20, 35, 29, 0.08), rgba(0, 0, 0, 0.18));
}

.composer textarea {
  min-width: 0;
  flex: 1;
  resize: none;
  border: 0;
  outline: 0;
  padding: 12px 10px 10px;
  color: var(--ink);
  background: transparent;
  line-height: 1.4;
}

.composer textarea::placeholder { color: var(--faint); }
.composer textarea:disabled, .composer .send-button:disabled, .composer .deep-toggle:disabled { opacity: 0.55; cursor: not-allowed; }

.deep-toggle {
  align-self: center;
  height: 32px;
  flex: 0 0 auto;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.deep-toggle:hover { color: var(--ink); }
.deep-toggle[aria-pressed="true"], .deep-toggle.is-active { color: var(--surface); background: var(--violet); border-color: var(--violet); }

.voice-button, .send-button {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;
}

.voice-button { border: 1px solid var(--line); color: var(--mint); background: var(--surface); }
.send-button { border: 0; color: var(--surface); background: var(--ink); font-size: 22px; }
[data-presence="listening"] .voice-button { color: var(--surface); background: var(--mint); }

.dock-caption { margin: 10px 8px 0; color: var(--faint); text-align: center; font-size: 11px; line-height: 1.4; }

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 36px;
}

.section-heading h1 { font-size: clamp(30px, 4vw, 48px); }

.quiet-chip {
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--mint);
  background: var(--mint-soft);
  font-size: 12px;
}

.thread-view { display: flex; flex-direction: column; }
.thread-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 36px; }
.message-stream { min-width: 0; }
.date-divider { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; color: var(--faint); font-size: 12px; }
.date-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }

.message { max-width: 76%; margin-bottom: 22px; line-height: 1.6; }
.message p { margin: 0; }
.message-content > * + * { margin-top: .75em; }
.message-content ul { padding-left: 1.3em; }
.message-content li + li { margin-top: .45em; }
.message-content a { text-decoration: underline; overflow-wrap: anywhere; }
.message-author { margin-bottom: 6px; color: var(--mint); font-size: 13px; font-weight: 600; }
.response-provider { display: block; margin-top: 8px; color: var(--faint); font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; }
.graph-provenance { margin-top: 8px; font-size: 11px; color: var(--faint); }
.graph-provenance summary { cursor: pointer; }
.graph-provenance ul { margin: 6px 0 0; padding-left: 18px; }
.graph-provenance li { margin-bottom: 3px; }
.tool-provenance { margin-top: 8px; font-size: 11px; color: var(--faint); }
.tool-provenance p { margin: 3px 0 0; }
.user-message { margin-left: auto; padding: 12px 16px; border-radius: 18px 18px 5px 18px; background: var(--panel-soft); }
.memory-marker { display: flex; align-items: center; gap: 7px; margin-top: 10px; font-size: 12px; text-align: left; }

.shared-context { padding-left: 28px; border-left: 1px solid var(--line); }
.shared-context h2, .event-panel h2, .governance-panel h2 { margin: 0 0 18px; font-size: 14px; font-weight: 600; }
.shared-context dl { margin: 0; }
.shared-context dl div { padding: 15px 0; border-top: 1px solid var(--line); }
.shared-context dt, .state-list dt { margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.shared-context dd, .state-list dd { margin: 0; line-height: 1.45; }
.thread-composer { width: min(100%, 700px); margin-top: auto; }

.memory-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.memory-card { min-height: 250px; display: flex; flex-direction: column; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.memory-primary { background: linear-gradient(145deg, var(--mint-soft), var(--panel)); }
.memory-card-head, .evidence-row { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; }
.confidence { color: var(--mint); }
.memory-card h2 { margin: 22px 0 10px; font-size: 22px; font-weight: 500; overflow-wrap: anywhere; }
.memory-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.memory-intro { color: var(--muted); max-width: 680px; line-height: 1.6; }
.memory-tools { display: grid; gap: 14px; margin: 24px 0; }
.memory-search { display: grid; gap: 7px; max-width: 540px; font-size: 13px; }
.memory-search input { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); font: inherit; }
.memory-categories { display: flex; flex-wrap: wrap; gap: 8px; }
.memory-categories button { border: 1px solid var(--line); padding: 9px 14px; border-radius: 999px; background: var(--panel); color: var(--ink); cursor: pointer; font: inherit; font-size: 13px; }
.memory-categories button[aria-pressed=true] { color: white; background: var(--mint); border-color: var(--mint); }
.memory-count { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.memory-details { margin-top: auto; padding-top: 18px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.memory-details summary { cursor: pointer; color: var(--mint); padding: 5px 0; }
.memory-details ul { padding-left: 18px; }
.memory-details li { margin: 10px 0; }
.memory-details small { display: block; margin-top: 4px; }
.memory-details .memory-record-name { font-size: 11px; padding-top: 8px; }
.memory-card .memory-review-note { border-left: 2px solid var(--line); padding-left: 10px; margin-top: 14px; font-size: 12px; }
.memory-more { margin: 20px 0; }
.evidence-row { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); }
.memory-explainer { margin-top: 18px; padding: 18px; border-left: 3px solid var(--mint); color: var(--muted); background: var(--panel-soft); line-height: 1.55; }
.memory-explainer strong { color: var(--ink); }

.studio-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.studio-badge { color: var(--violet); background: color-mix(in srgb, var(--violet) 15%, var(--panel)); }
.event-stream { border-top: 1px solid var(--line); }
.runtime-event { display: grid; grid-template-columns: 36px 1fr; gap: 13px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.event-glyph { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; color: var(--mint); background: var(--mint-soft); }
.runtime-event h3 { margin: 0 0 4px; font-size: 14px; font-weight: 600; }
.runtime-event p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.runtime-event time { display: block; margin-top: 6px; color: var(--faint); font-size: 11px; }

.governance-panel { padding-left: 28px; border-left: 1px solid var(--line); }
.state-list { margin: 0; }
.affect-heading { margin-top: 24px; }
.state-list div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.state-list dt { margin: 0; }
.approval-card { margin-top: 24px; padding: 18px; border-radius: 16px; background: var(--mint-soft); }
.rsi-card { margin-top: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.rsi-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.rsi-card-head .eyebrow { margin-bottom: 0; }
.rsi-status { color: var(--violet); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.rsi-card h3 { margin: 14px 0 8px; font-size: 16px; font-weight: 600; line-height: 1.4; }
.rsi-card > p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.approval-card h3 { margin: 0 0 8px; font-size: 17px; font-weight: 600; }
.approval-card > p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.approval-actions { display: flex; gap: 8px; margin-top: 16px; }
.primary-action, .secondary-action { min-height: 40px; border-radius: 11px; padding: 8px 13px; cursor: pointer; }
.primary-action { border: 0; color: var(--surface); background: var(--ink); }
.secondary-action { border: 1px solid var(--line); background: var(--panel); }

.jobs-view { display: flex; flex-direction: column; gap: 32px; }

.personal-import { margin: 20px 0; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.personal-import > summary { cursor: pointer; font-weight: 600; }
.personal-import form, .personal-import label, [data-import-confirm], .passport-security, .passport-security label { display: grid; gap: 10px; }
.passport-security { max-width: 520px; margin: 16px 0; }
.passport-security input { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); }
.personal-import form { max-width: 560px; margin: 16px 0; }
.personal-import input, .personal-import select { width: 100%; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); }
.personal-import p, .personal-import blockquote { overflow-wrap: anywhere; }
.import-job { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.import-job h3 { margin: 0; }
.import-candidate { margin-top: 12px; padding: 16px; border-radius: 12px; background: var(--mint-soft); }
.import-candidate blockquote { white-space: pre-wrap; margin: 12px 0; padding-left: 12px; border-left: 2px solid var(--mint); }
.job-form { display: grid; gap: 14px; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.job-form h2 { margin: 0; font-size: 16px; font-weight: 600; }
.job-form label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.job-form label small { color: var(--faint); font-weight: 400; text-transform: none; letter-spacing: 0; }
.job-form input, .job-form textarea, .lesson-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--surface);
  font: inherit;
  resize: vertical;
}
.job-form input::placeholder, .job-form textarea::placeholder, .lesson-form input::placeholder { color: var(--faint); }
.job-form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.job-form .primary-action { justify-self: start; }

.jobs-list { display: grid; gap: 18px; }
.jobs-empty { padding: 24px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); text-align: center; }

.job-card { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.job-card.is-archived { opacity: 0.7; }
.job-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--faint); font-size: 12px; }
.job-status-badge { padding: 3px 9px; border-radius: 999px; color: var(--mint); background: var(--mint-soft); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.job-card.is-archived .job-status-badge { color: var(--muted); background: var(--panel-soft); }
.job-card h2 { margin: 14px 0 6px; font-size: 20px; font-weight: 500; }
.job-description { margin: 0 0 14px; color: var(--muted); line-height: 1.55; }
.job-quality-bar { margin: 0 0 18px; padding: 14px; border-radius: 12px; background: var(--mint-soft); }
.job-quality-bar strong { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.job-quality-bar p { margin: 0; line-height: 1.5; }
.job-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.job-section h3 { margin: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.job-section ul, .job-section ol { margin: 0; padding-left: 20px; color: var(--ink); font-size: 13px; line-height: 1.6; }
.job-empty-item { color: var(--faint); list-style: none; margin-left: -20px; }
.job-last-run { margin-bottom: 18px; padding: 14px; border-radius: 12px; background: var(--panel-soft); }
.job-last-run p { margin: 0; color: var(--ink); font-size: 13px; line-height: 1.6; white-space: pre-wrap; }
.job-lessons { padding-top: 18px; border-top: 1px solid var(--line); }
.job-lessons ul { padding-left: 0; }
.job-lesson { list-style: none; margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--panel-soft); }
.job-lesson p { margin: 0 0 4px; line-height: 1.5; }
.job-lesson span { color: var(--faint); font-size: 11px; }
.lesson-form { display: flex; gap: 8px; margin-top: 12px; }
.lesson-form input { flex: 1; }
.job-card-actions { display: flex; gap: 8px; margin-top: 18px; }
.job-card-actions .primary-action:disabled { opacity: 0.5; cursor: not-allowed; }

.activity-drawer {
  width: min(400px, 92vw);
  position: absolute;
  z-index: 50;
  top: 0;
  right: 0;
  bottom: 0;
  padding: 24px;
  border-left: 1px solid var(--line);
  background: var(--panel);
  box-shadow: -22px 0 60px rgba(0, 0, 0, 0.18);
  transform: translateX(105%);
  transition: transform 240ms ease;
}

.activity-drawer header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.activity-drawer h2 { margin: 0; font-size: 24px; font-weight: 500; }
.activity-drawer .icon-button { margin: 0; }
.drawer-open .activity-drawer { transform: translateX(0); }
.drawer-backdrop { position: absolute; z-index: 40; inset: 0; border: 0; background: rgba(5, 10, 8, 0.45); }
.drawer-events { max-height: calc(100% - 70px); overflow: auto; }

.bottom-nav { display: none; }

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 30px;
  max-width: min(420px, calc(100% - 32px));
  transform: translateX(-50%);
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow);
  font-size: 13px;
  text-align: center;
}

@keyframes view-in { from { opacity: 0; transform: translateY(5px); } }
@keyframes status-pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--mint) 4%, transparent); } }
@keyframes orb-ripple { 0% { opacity: 0.6; transform: scale(0.86); } 100% { opacity: 0; transform: scale(1.18); } }
@keyframes orb-listen { 50% { transform: scale(1.055); filter: saturate(1.18); } }
@keyframes orb-think { 50% { transform: rotate(5deg) scale(0.97); filter: hue-rotate(18deg); } }
@keyframes orb-speak { 50% { transform: scale(1.035); } }
@keyframes audio-bar { 50% { height: 13px; } }

@media (max-width: 920px) {
  .app-shell { width: calc(100% - 28px); margin: 14px auto; height: calc(100vh - 28px); grid-template-columns: 82px minmax(0, 1fr); }
  .topbar { grid-template-columns: 82px 1fr auto; }
  .brand { justify-content: center; padding: 0; }
  .brand > span:not(.presence-dot), .brand small, .nav-item span:last-child, .side-note { display: none; }
  .nav-item { justify-content: center; padding: 8px; font-size: 18px; }
  .thread-grid, .studio-grid { grid-template-columns: 1fr; }
  .shared-context, .governance-panel { padding: 24px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .memory-grid { grid-template-columns: 1fr; }
  .memory-card { min-height: 220px; }
  .job-form-row, .job-columns { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { background: var(--surface); }
  .app-shell { width: 100%; height: 100dvh; min-height: 620px; margin: 0; grid-template-columns: 1fr; grid-template-rows: 62px minmax(0, 1fr) 68px; border: 0; border-radius: 0; box-shadow: none; }
  .topbar { grid-row: 1; grid-template-columns: 1fr auto auto; }
  .brand { justify-content: flex-start; gap: 10px; padding: 0 17px; border-right: 0; }
  .brand > span:not(.presence-dot), .brand small { display: inline; }
  .topbar-state { margin-right: 6px; }
  .state-time { display: none; }
  .connection-state { display: none; }
  .state-copy::after { display: none; }
  .icon-button { margin-right: 12px; }
  .side-nav { display: none; }
  .main-surface { grid-row: 2; }
  .view { padding: 22px 18px; }
  .presence-view { padding-bottom: 16px; }
  .context-line { align-items: flex-start; font-size: 11px; }
  .context-line button { max-width: 178px; text-align: right; }
  .presence-center { gap: 18px; }
  .oti-orb { width: 146px; height: 146px; }
  .presence-message h1 { font-size: 36px; }
  .presence-summary { margin-top: 10px; font-size: 14px; line-height: 1.55; }
  .composer { min-height: 58px; border-radius: 18px; }
  .voice-button, .send-button { width: 42px; height: 42px; }
  .dock-caption { display: none; }
  .section-heading { align-items: flex-start; margin-bottom: 28px; }
  .section-heading h1 { font-size: 34px; }
  .thread-view { padding-bottom: 16px; }
  .thread-grid { display: block; }
  .shared-context { display: none; }
  .message { max-width: 88%; font-size: 14px; }
  .thread-composer { position: sticky; bottom: 0; margin-top: 24px; }
  .memory-card { min-height: 210px; }
  .evidence-row { flex-direction: column; gap: 4px; }
  .studio-grid { display: block; }
  .governance-panel { margin-top: 24px; }
  .activity-drawer { position: fixed; }
  .drawer-backdrop { position: fixed; }
  .bottom-nav { grid-row: 3; display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); border-top: 1px solid var(--line); background: var(--panel); }
  .bottom-item { min-height: 50px; display: grid; place-items: center; align-content: center; gap: 2px; color: var(--muted); text-decoration: none; }
  .bottom-item.is-active { color: var(--ink); }
  .bottom-item span { font-size: 18px; }
  .bottom-item small { font-size: 10px; }
  .toast { bottom: 86px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Preferences (Studio) and memory controls */
.preferences-heading { margin: 18px 0 0; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.preferences-form { display: grid; gap: 10px; margin-top: 10px; }
.preferences-form label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.preferences-form input, .preferences-form select { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: inherit; }
.preferences-note { margin: 0; font-size: 12px; color: var(--faint); min-height: 1em; }
.memory-forget { margin-top: 10px; }
.memory-empty { padding: 24px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); text-align: center; }

/* Work / Personal toggle */
.mode-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--panel); margin-left: auto; margin-right: 14px; }
.mode-toggle button { font: inherit; font-size: 12px; padding: 5px 12px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.mode-toggle button[aria-pressed="true"] { background: var(--accent, #1f6f5f); color: #fff; }


/* Connect (Google seat) */
.connect-card { display: grid; gap: 10px; margin-top: 10px; }
.event-panel > [data-connect-card] { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); margin: 0 0 28px; }
.connect-status { margin: 0; font-size: 13px; }
.connect-status.is-connected { color: var(--accent, #1f6f5f); }
.connect-steps { margin: 0; padding-left: 18px; font-size: 12px; color: var(--muted); display: grid; gap: 4px; }
.connect-scopes { margin: 0; font-size: 11px; color: var(--faint); word-break: break-all; }
.connect-form { display: grid; gap: 8px; }
.connect-form label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.connect-form input[type="file"] { font: inherit; font-size: 12px; }

/* First-run sign-up */
.signup-veil { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(20, 28, 24, 0.55); backdrop-filter: blur(6px); z-index: 40; }
.signup-card { width: min(560px, 100%); max-height: calc(100dvh - 48px); overflow-y: auto; display: grid; gap: 14px; padding: 28px; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); box-shadow: 0 30px 80px rgba(0,0,0,0.25); }
.signup-card h1 { margin: 0; font-size: 30px; }
.signup-copy { margin: 0; color: var(--muted); }
.signup-card label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.signup-card input[type="text"], .signup-card input[type="password"], .signup-card textarea, .signup-card select { width: 100%; min-width: 0; box-sizing: border-box; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: inherit; }
.signup-card textarea { resize: vertical; }
.signup-options { border-top: 1px solid var(--line); padding-top: 12px; }
.signup-options summary { cursor: pointer; font-size: 14px; }
.signup-options summary small { color: var(--muted); margin-left: 6px; }
.signup-options[open] > :not(summary) { margin-top: 12px; }
.signup-privacy { font-size: 12px; line-height: 1.5; }
.onboarding-result { padding: 14px; margin: 0 0 18px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); overflow-wrap: anywhere; }
.signup-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.signup-google { display: grid; gap: 8px; padding: 12px; border: 1px dashed var(--line); border-radius: 14px; }
.signup-google-copy { margin: 0; font-size: 13px; }
.signup-check { display: flex !important; align-items: center; gap: 8px; font-size: 13px !important; color: inherit !important; }
@media (max-width: 600px) { .signup-row { grid-template-columns: 1fr; } }

/* The hidden attribute always wins over a display rule. */
[hidden] { display: none !important; }

/* Self card */
.self-card { display: grid; gap: 10px; margin-top: 10px; }
.self-authority { margin: 0; font-size: 12px; color: var(--muted); }
.gate-switch { padding: 8px 10px; border: 1px dashed var(--line); border-radius: 12px; }

/* Her own code */
.source-card { display: grid; gap: 10px; margin-top: 10px; }
.source-form { display: grid; gap: 8px; }
.source-form label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.source-form textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: inherit; resize: vertical; }
.source-list { display: grid; gap: 10px; }
.source-item { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; }
.source-item h3 { margin: 0; font-size: 14px; }
.source-item .job-meta { font-size: 12px; }
.source-state { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.source-state.is-ok { color: var(--accent, #1f6f5f); }
.source-state.is-failed { color: #b04a3a; }
.source-diff { margin: 0; max-height: 240px; overflow: auto; padding: 10px; border-radius: 10px; background: rgba(0,0,0,0.04); font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; }

/* Feedback on a reply */
.message-feedback { display: flex; gap: 8px; margin-top: 6px; }
.message-feedback .text-button { font-size: 12px; opacity: 0.7; }
.message-feedback .text-button.is-active { opacity: 1; font-weight: 600; }
.message-feedback .text-button:disabled { cursor: default; }

/* Today (plan 9.1) */
.today-greeting { margin: 0 0 18px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.today-board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.today-section { padding: 18px 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.today-section h2 { margin: 0 0 10px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.today-section ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.today-item, .today-task, .today-notice { display: grid; gap: 3px; padding: 10px 12px; border-radius: 12px; background: var(--panel-soft); }
.today-item strong, .today-task strong, .today-notice strong { font-weight: 500; }
.today-item small, .today-task small, .today-notice p { color: var(--faint); font-size: 12px; margin: 0; }
.notice-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.today-item.is-overdue { border-left: 3px solid var(--danger, #d24); }
.today-task { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.today-task > div { display: grid; gap: 2px; }
.today-kind { color: var(--mint); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.today-empty, .today-empty-item { color: var(--faint); font-size: 13px; list-style: none; margin: 0; }
/* Meetings (plan 9.2) */
.meeting-form { margin-bottom: 18px; }
.meeting-open { margin-bottom: 18px; }
.meeting-card.is-live .job-status-badge { color: var(--danger, #d24); background: color-mix(in srgb, var(--danger, #d24) 12%, transparent); }
.meeting-transcript { margin: 0; padding: 12px; border-radius: 12px; background: var(--panel-soft); color: var(--ink); font: inherit; font-size: 13px; line-height: 1.6; white-space: pre-wrap; max-height: 320px; overflow: auto; }
.transcript-form { display: grid; gap: 10px; margin-top: 14px; }
.transcript-form textarea { width: 100%; box-sizing: border-box; min-height: 72px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-soft); color: var(--ink); font: inherit; resize: vertical; }
.meeting-candidates ul { padding: 0; list-style: none; display: grid; gap: 10px; }
.meeting-candidate { display: grid; gap: 6px; padding: 12px 14px; border-radius: 12px; background: var(--panel-soft); }
.meeting-candidate.is-dismissed { opacity: 0.6; }
.meeting-candidate q { color: var(--faint); font-size: 12px; quotes: "“" "”"; }
.candidate-kind { color: var(--mint); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.candidate-actions { display: flex; gap: 8px; margin-top: 4px; }
.candidate-outcome { color: var(--muted); font-size: 12px; }
@media (max-width: 760px) { .today-board { grid-template-columns: 1fr; } }

/* Calendar (plan 9.3) */
.window-switch { display: flex; gap: 6px; flex-wrap: wrap; }
.window-switch .secondary-action.is-active { color: var(--surface); background: var(--ink); border-color: var(--ink); }
.calendar-board { display: grid; gap: 12px; }
.calendar-event { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 16px; align-items: start; padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.calendar-when { color: var(--muted); font-size: 13px; padding-top: 3px; }
.calendar-body h3 { margin: 0 0 4px; font-size: 16px; font-weight: 500; }
.calendar-body small { color: var(--faint); font-size: 12px; }
.known-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.known-chip { padding: 3px 9px; border-radius: 999px; color: var(--mint); background: var(--mint-soft); font-size: 11px; }
.known-chip.is-empty { color: var(--faint); background: var(--panel-soft); }
.prepared-notes { display: grid; gap: 10px; margin-top: 12px; }
.prepared-note { padding: 10px 12px; border-radius: 12px; background: var(--panel-soft); }
.prepared-note h4 { margin: 0 0 6px; font-size: 13px; font-weight: 600; }
.prepared-note ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.55; }
.prepared-open { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
/* Weather (plan 9.4) */
.weather-form { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: end; margin-bottom: 18px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.weather-form label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.weather-form input[type=text] { min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-soft); color: var(--ink); font: inherit; }
.weather-remember { grid-column: 1 / -1; display: flex !important; align-items: center; gap: 8px; }
.weather-card { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.weather-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.weather-head h2 { margin: 0; font-size: 22px; font-weight: 500; }
.weather-condition { margin: 6px 0 0; font-size: 18px; }
.weather-now { margin: 4px 0 14px; color: var(--muted); }
.weather-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
.weather-grid div { padding: 10px 12px; border-radius: 12px; background: var(--panel-soft); }
.weather-grid dt { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.weather-grid dd { margin: 2px 0 0; font-size: 16px; }
.weather-summary { margin: 0 0 8px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.weather-sources { margin: 0; font-size: 12px; }
.weather-sources a { color: var(--mint); }
@media (max-width: 760px) {
  .calendar-event { grid-template-columns: 1fr; }
  .weather-form { grid-template-columns: 1fr; }
  .weather-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Connect card (plan 2.6b): mail and calendar first, Google as the advanced path */
.photo-button { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); cursor: pointer; }
.today-habit { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.today-habit.is-kept strong { color: var(--muted); }
.passport { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.passport-actions { flex-wrap: wrap; }
.passport-import { display: inline-flex; align-items: center; cursor: pointer; }
.passport-delete { color: var(--danger, #b3261e); }
.pairing { display: grid; gap: 8px; margin-top: 10px; }
.pairing-qr { width: min(240px, 100%); }
.pairing-qr svg { display: block; width: 100%; height: auto; border-radius: 8px; }
.pairing-link { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
.pairing-code { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 24px; letter-spacing: 0.14em; }
.device-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.device-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.device-list small { color: var(--muted); margin-left: 6px; }
.connect-block { padding: 14px 0; border-top: 1px solid var(--line); }
.connect-block:first-child { border-top: 0; padding-top: 0; }
.connect-block h3 { margin: 0 0 6px; font-size: 14px; font-weight: 600; }
.connect-block summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.connect-advanced { margin: 4px 0 8px; }
.connect-advanced > summary { font-size: 12px; }
.connect-advanced label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; margin-top: 8px; }
.connect-form input[type=email], .connect-form input[type=password], .connect-form input[type=url], .connect-form input[type=text], .connect-form select { width: 100%; box-sizing: border-box; min-height: 38px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-soft); color: var(--ink); font: inherit; }
.connect-form > label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.connect-status.is-connected { color: var(--mint); }
.signup-connect-note { color: var(--faint); font-size: 12px; }

/* Review (plan 9.9) */
.review-board { display: grid; gap: 12px; }
.review-item { display: grid; gap: 6px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.review-item strong { font-weight: 500; font-size: 15px; }
.review-item p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.review-item.is-source { border-left: 3px solid var(--mint); }
.nav-badge { margin-left: auto; padding: 1px 7px; border-radius: 999px; color: var(--surface); background: var(--ink); font-size: 10px; }

/* Mail (plan 9.5) */
.mail-search { display: flex; gap: 8px; }
.mail-search input { min-height: 38px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-soft); color: var(--ink); font: inherit; }
.mail-board { display: grid; gap: 10px; margin-bottom: 18px; }
.mail-message { display: grid; gap: 6px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.mail-head { display: flex; justify-content: space-between; gap: 12px; }
.mail-head small { color: var(--faint); font-size: 12px; }
.mail-subject { margin: 0; color: var(--muted); }
.mail-open { margin-bottom: 18px; }
.mail-compose { margin-bottom: 18px; }
.mail-compose summary { cursor: pointer; font-weight: 600; }
.mail-compose-form { display: grid; gap: 12px; margin-top: 12px; }
.mail-compose-form textarea, .mail-compose-form input { width: 100%; box-sizing: border-box; padding: 8px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-soft); color: var(--ink); font: inherit; }
.mail-drafts ul { padding: 0; list-style: none; display: grid; gap: 10px; }

/* Candidate memory (plan 10.2) */
.thread-review-card { display: grid; gap: 8px; margin-top: 10px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--mint); background: var(--mint-soft); }
.thread-review-card strong { font-size: 14px; }
.thread-review-fields { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0; font-size: 13px; }
.thread-review-fields dt { color: var(--muted, #5b6477); }
.thread-review-fields dd { margin: 0; overflow-wrap: anywhere; }
.thread-review-body { margin: 0; padding: 10px; border-radius: 10px; background: var(--panel-soft, rgba(255,255,255,.6)); font: inherit; font-size: 13px; line-height: 1.5; white-space: pre-wrap; max-height: 260px; overflow: auto; }
.thread-review-summary, .thread-review-note { margin: 0; font-size: 13px; }
.thread-review-note { color: var(--muted, #5b6477); font-size: 12px; }
.thread-review-outcome { margin: 0; font-size: 13px; font-weight: 600; }
.thread-review-card.is-approved, .thread-review-card.is-closed { opacity: .85; }
.thread-review-card .candidate-actions button { white-space: nowrap; }
.memory-candidates { display: grid; gap: 6px; margin-top: 8px; }
.memory-candidate { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: var(--mint-soft); font-size: 13px; }
.memory-candidate span { flex: 1 1 200px; }

/* Phone-width pass (plan 7.0a) */
.sheet-button { display: none; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); color: var(--ink); font-size: 18px; cursor: pointer; }
.presence-sheet { position: fixed; inset: 0; z-index: 60; display: grid; align-items: end; background: rgba(0, 0, 0, 0.35); }
.sheet-card { display: grid; gap: 12px; padding: 18px 18px max(18px, env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; background: var(--panel); }
.sheet-card .mode-toggle { display: flex; }
.sheet-card .deep-toggle { justify-self: start; }
.message-receipt { margin-top: 6px; font-size: 12px; color: var(--muted); }
.message-receipt ul { margin: 6px 0 0; padding-left: 18px; }
.message-receipt li { margin: 2px 0; }
.receipt-button { font-size: 12px; }
@media (max-width: 640px) {
  .topbar .mode-toggle { display: none !important; }
  .composer .deep-toggle { display: none; }
  .sheet-button { display: inline-grid; place-items: center; }
  .bottom-nav { display: flex; overflow-x: auto; scrollbar-width: none; gap: 2px; }
  .bottom-nav::-webkit-scrollbar { display: none; }
  .bottom-item { flex: 0 0 64px; min-height: 50px; }
  .message p { font-size: 17px; line-height: 1.5; }
  .primary-action, .secondary-action, .text-button, .candidate-actions button, .bottom-item, .sheet-button { min-height: 44px; }
  .today-task > div strong, .review-item strong, .calendar-body h3 { font-size: 17px; }
  .view { padding-bottom: 24px; }
}

/* The rhythm line (plan 4.5) */
.today-rhythm { grid-column: 1 / -1; margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--mint-soft); color: var(--muted); font-size: 13px; }

/* Four everyday destinations; account and specialist views stay one tap away. */
button.nav-item, button.bottom-item { font: inherit; border: 0; background: transparent; cursor: pointer; text-align: left; }
.nav-item.is-active { color: var(--mint); background: var(--mint-soft); }
.navigation-menu { width: min(480px, calc(100vw - 28px)); max-height: calc(100dvh - 40px); overflow: auto; padding: 24px; border: 1px solid var(--line); border-radius: 22px; color: var(--ink); background: var(--panel); box-shadow: var(--shadow); }
.navigation-menu::backdrop { background: rgba(0, 0, 0, 0.35); backdrop-filter: blur(3px); }
.navigation-menu header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.navigation-menu h2 { margin: 0; font-size: 22px; }
.navigation-menu .icon-button { margin: 0; flex: 0 0 40px; }
.navigation-menu nav { display: grid; gap: 6px; margin-top: 18px; }
.navigation-menu nav a { display: grid; gap: 3px; padding: 12px; border-radius: 12px; text-decoration: none; color: var(--ink); }
.navigation-menu nav a:hover, .navigation-menu nav a.is-active { background: var(--mint-soft); }
.navigation-menu nav span { color: var(--muted); font-size: 13px; }
.task-progress { margin-top: 32px; }
.task-progress > h2 { font-size: 20px; margin-bottom: 8px; }
.task-progress > p { color: var(--muted); line-height: 1.5; }
.task-progress-card { padding: 18px; margin-top: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); overflow-wrap: anywhere; }
.task-progress-card header { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.task-progress-card h3 { margin: 0; font-size: 15px; font-weight: 600; }
.task-progress-card .quiet-chip { white-space: normal; text-align: center; flex: 0 0 auto; max-width: 40%; }
.task-progress-card ol { margin: 14px 0 0; padding-left: 22px; }
.task-progress-card li { padding: 6px 0; }
.task-progress-card li small { display: block; margin-top: 3px; color: var(--muted); }
.privacy-card { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.privacy-card dl { margin: 0; display: grid; gap: 20px; }
.privacy-card dt { font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.privacy-card dd { margin: 0; font-size: 14px; line-height: 1.6; color: var(--muted); }
.privacy-card button { margin-top: 22px; }
.session-activity { margin-top: 24px; }
.session-activity summary { cursor: pointer; color: var(--muted); padding: 12px 0; }

/* Settings use the full content width; everyday controls lead, diagnostics fold away. */
.studio-view { max-width: 1080px; margin-inline: auto; }
.settings-intro { color: var(--muted); margin: -8px 0 24px; line-height: 1.5; }
.settings-intro-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.settings-intro-row .text-button { flex-shrink: 0; }
.connections-overview { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 28px; }
.connection-tile { grid-column: span 2; display: flex; flex-direction: column; align-items: flex-start; padding: 20px; min-width: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.connection-tile:nth-last-child(-n+2) { grid-column: span 3; }
.connection-tile:only-child { grid-column: 1 / -1; }
.connection-tile header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.connection-tile h3 { font-size: 16px; margin: 0; }
.connection-symbol { display: grid; place-items: center; width: 32px; height: 32px; background: var(--mint-soft); color: var(--mint); border-radius: 10px; font-size: 19px; }
.connection-badge { display: inline-block; padding: 4px 8px; background: var(--panel-soft); color: var(--muted); border-radius: 6px; font-size: 12px; line-height: 1.5; }
.connection-badge[data-tone="configured"] { background: var(--mint-soft); color: var(--mint); }
.connection-badge[data-tone="attention"] { color: var(--amber); }
.connection-tile p { font-size: 13px; line-height: 1.6; color: var(--muted); flex: 1; }
.connection-tile .text-button { padding: 8px 0; font-size: 13px; text-align: left; }
.getting-started { border-radius: 20px; padding: 24px; background: linear-gradient(125deg, var(--mint-soft), var(--panel)); border: 1px solid var(--line); margin-bottom: 24px; }
.getting-started-heading { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.getting-started h2 { font-size: clamp(21px, 2.5vw, 27px); margin: 0; font-weight: 550; letter-spacing: -.5px; }
.getting-started p { color: var(--muted); line-height: 1.6; font-size: 14px; }
.getting-started .eyebrow { margin-top: 0; font-size: 11px; }
.starter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.starter-tile { text-align: left; display: flex; flex-direction: column; gap: 10px; padding: 18px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); cursor: pointer; min-width: 0; transition: border-color .15s, transform .15s; }
.starter-tile:hover { border-color: var(--mint); transform: translateY(-2px); }
.starter-tile strong { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 550; }
.starter-tile > span { color: var(--muted); font-size: 12px; line-height: 1.6; }
.work-status { display: flex; align-items: start; gap: 12px; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin: 20px 0 12px; background: var(--panel); font-size: 12px; }
.work-status > div { min-width: 0; flex: 1; }
.work-status strong { font-weight: 550; }
.work-status p { margin: 4px 0; color: var(--muted); line-height: 1.5; }
.work-status small { font-size: 11px; color: var(--muted); }
.work-status > button { font-size: 12px; flex-shrink: 0; padding: 0; }
.work-dot { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.work-dot[data-tone="configured"] { background: var(--mint); }
.work-dot[data-tone="attention"] { background: var(--amber); }
.activity-learning { border-bottom: 1px solid var(--line); padding: 12px 0 20px; margin-bottom: 24px; }
.activity-learning > summary { font-size: 14px; color: var(--mint); cursor: pointer; }
.learning-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 20px 0; }
.learning-overview > div { padding-left: 12px; border-left: 2px solid var(--mint-soft); }
.learning-overview span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.learning-overview strong { font-size: 14px; line-height: 1.6; font-weight: 500; }
.learning-stages { font-size: 13px; line-height: 1.8; color: var(--muted); }
.learning-stages summary { color: var(--mint); cursor: pointer; }
.learning-stages ul { padding-left: 20px; }
@media (max-width: 760px) {
  .settings-intro-row { display: block; margin-bottom: 20px; }
  .settings-intro-row .settings-intro { margin-bottom: 8px; }
  .getting-started { padding: 18px; }
  .connections-overview { grid-template-columns: minmax(0, 1fr); }
  .connection-tile, .connection-tile:nth-last-child(-n+2) { padding: 16px; grid-column: auto; }
  .connection-tile header { margin-bottom: 10px; }
  .connection-tile p { margin: 8px 0; }
  .starter-grid { grid-template-columns: minmax(0, 1fr); }
  .starter-tile { padding: 14px; gap: 5px; }
  .work-status { padding: 12px; gap: 8px; flex-wrap: wrap; }
  .work-status > div { flex-basis: calc(100% - 20px); }
  .work-status > button { margin-left: 15px; }
  .learning-overview { grid-template-columns: minmax(0, 1fr); gap: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .starter-tile { transition: none; }
  .starter-tile:hover { transform: none; }
}
.studio-view .studio-grid { display: grid; gap: 14px; }
.settings-section { min-width: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.settings-section > summary { position: relative; padding: 20px 46px 20px 22px; cursor: pointer; list-style: none; }
.settings-section > summary::-webkit-details-marker { display: none; }
.settings-section > summary::after { content: "+"; position: absolute; right: 22px; top: 24px; color: var(--muted); font-size: 20px; }
.settings-section[open] > summary::after { content: "−"; }
.settings-section > summary:focus-visible, .settings-manage > summary:focus-visible, .source-details > summary:focus-visible { outline: 2px solid var(--accent, #1f6f5f); outline-offset: 3px; border-radius: 8px; }
.settings-section-title { display: block; font-size: 17px; font-weight: 600; }
.settings-section-description { display: block; margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.settings-section-body { padding: 0 22px 22px; min-width: 0; }
.settings-section-body > h2 { font-size: 16px; margin: 24px 0 12px; }
.settings-connections { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin: 0; }
.settings-connection { min-width: 0; }
.settings-connection + .settings-connection { padding-left: 24px; border-left: 1px solid var(--line); }
.settings-connection h3 { font-size: 15px; margin: 0 0 12px; }
.settings-connection p { line-height: 1.6; }
.settings-connection .connect-block { border-top: 0; padding: 0; }
.settings-connection > .connect-google { margin-top: 12px; }
.settings-manage > summary, .settings-connection .connect-google > summary, .source-details > summary { cursor: pointer; padding: 12px 0; font-size: 13px; color: var(--accent, #1f6f5f); }
.settings-manage[open] > :not(summary), .settings-connection .connect-google[open] > :not(summary) { margin-top: 12px; }
.settings-alternatives { margin-top: 4px; border-top: 1px solid var(--line); }
.settings-alternatives > summary { color: var(--muted); }
.settings-alternatives .connect-block { padding: 12px 0; }
.settings-alternatives .connect-block + .connect-block { border-top: 1px solid var(--line); }
.settings-section .preferences-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 22px; }
.settings-section .preferences-form .preferences-note { grid-column: 1 / -1; }
.settings-section .privacy-card { border: 0; padding: 0; }
.settings-section .privacy-card h2 { font-size: 16px; margin: 0 0 20px; }
.settings-section .session-activity { margin-top: 12px; }
.settings-explanation { line-height: 1.6; color: var(--muted); margin-top: 0; font-size: 14px; }
.settings-section .source-item { padding: 18px; gap: 10px; overflow-wrap: anywhere; }
.source-outcome { font-size: 14px; line-height: 1.6; margin: 0; }
.source-details { min-width: 0; }
.source-details > summary { padding: 6px 0; }
.source-details .source-criterion { font-size: 13px; line-height: 1.6; }
@media (max-width: 760px) {
  .settings-connections, .settings-section .preferences-form { grid-template-columns: minmax(0, 1fr); }
  .settings-connection + .settings-connection { padding: 20px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .settings-section > summary { padding: 18px 40px 18px 16px; }
  .settings-section > summary::after { right: 16px; top: 22px; }
  .settings-section-body { padding: 0 16px 18px; }
  .settings-section .source-item { padding: 14px; }
  .settings-section .approval-actions { flex-wrap: wrap; }
}
@media (min-width: 641px) and (max-width: 920px) {
  .app-shell { grid-template-columns: 160px minmax(0, 1fr); }
  .topbar { grid-template-columns: 160px 1fr auto; }
  .side-nav .nav-item { justify-content: flex-start; font-size: 14px; }
  .side-nav .nav-item span:last-child { display: inline; }
}
@media (max-width: 640px) {
  .app-shell { min-height: 0; grid-template-rows: 62px minmax(0, 1fr) auto; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); overflow: visible; gap: 0; }
  .bottom-item { min-width: 0; }
  .bottom-item.is-active { color: var(--mint); background: var(--mint-soft); border-radius: 12px; }
  .bottom-item small { font-size: 11px; }
  .navigation-menu { padding: 18px; }
}
