:root {
  color-scheme: light;
  --navy: #1b213f;
  --navy-2: #262e55;
  --paper: #f4f0e7;
  --paper-2: #ebe4d7;
  --white: #fffdf8;
  --ink: #171a29;
  --muted: #6e6e75;
  --line: rgba(27,33,63,.17);
  --coral: #f46e5b;
  --turquoise: #25bdc0;
  --shadow: 0 18px 60px rgba(27,33,63,.11);
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: "DM Sans", sans-serif;
  background:
    linear-gradient(rgba(27,33,63,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(27,33,63,.025) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .48; }
.hidden { display: none !important; }
.visually-hidden { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.app-shell { min-height: 100dvh; padding-bottom: calc(88px + env(safe-area-inset-bottom)); }

.app-header {
  height: 70px;
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 0 clamp(16px, 4vw, 42px);
  color: var(--white);
  background: rgba(27,33,63,.96);
  backdrop-filter: blur(18px);
  border-bottom: 3px solid var(--coral);
}
.back-link {
  justify-self: start;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font: 600 10px "IBM Plex Mono", monospace;
  letter-spacing: .12em;
}
.wordmark { text-align: center; line-height: 1; }
.wordmark-name { display: block; font: 600 21px "DM Sans", sans-serif; letter-spacing: .2em; }
.wordmark-sub { display: block; margin-top: 5px; color: var(--turquoise); font: 500 7px "IBM Plex Mono", monospace; letter-spacing: .18em; }
.sync-pill {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255,255,255,.18);
  background: transparent;
  color: rgba(255,255,255,.68);
  padding: 8px 9px;
  font: 500 8px "IBM Plex Mono", monospace;
  letter-spacing: .1em;
}
.sync-pill i { width: 6px; height: 6px; border-radius: 50%; background: #888; }
.sync-pill.online i { background: var(--turquoise); box-shadow: 0 0 10px var(--turquoise); }
.sync-pill.pending i { background: #ffc94a; box-shadow: 0 0 10px #ffc94a; }
.sync-pill.offline i { background: var(--coral); }
.header-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-logout {
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.18);
  color: rgba(255,255,255,.68);
  background: transparent;
  font: 600 8px "IBM Plex Mono", monospace;
  letter-spacing: .12em;
}
.header-logout:hover,
.header-logout:focus-visible { color: var(--navy); background: var(--coral); border-color: var(--coral); }

.app-main { width: min(100%, 1120px); margin: 0 auto; }
.loading-view { min-height: calc(100dvh - 160px); display: grid; place-content: center; text-align: center; }
.loading-mark { margin: auto; width: 82px; height: 82px; display: grid; place-items: center; color: var(--white); background: var(--navy); font: italic 60px "Instrument Serif", serif; box-shadow: 12px 12px 0 var(--coral); }
.loading-view p { margin-top: 28px; color: var(--muted); font: 10px "IBM Plex Mono", monospace; letter-spacing: .12em; text-transform: uppercase; }
.view { padding: clamp(34px, 7vw, 78px) clamp(18px, 5vw, 64px); }
.view-intro { max-width: 800px; margin-bottom: 34px; }
.view-intro.compact { margin-bottom: 26px; }
.eyebrow { display: block; margin: 0 0 10px; color: var(--coral); font: 600 9px "IBM Plex Mono", monospace; letter-spacing: .22em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 14px; color: var(--navy); font: 400 clamp(50px, 10vw, 92px)/.88 "Instrument Serif", serif; letter-spacing: -.035em; }
h2 { margin-bottom: 0; color: var(--navy); font-size: clamp(24px, 4vw, 38px); line-height: 1; letter-spacing: -.025em; }
.lead { max-width: 650px; color: var(--muted); font-size: clamp(15px, 2.2vw, 18px); line-height: 1.6; }

.today-card {
  position: relative;
  overflow: hidden;
  min-height: 350px;
  display: grid;
  align-content: space-between;
  color: var(--white);
  background: var(--navy);
  padding: clamp(26px, 6vw, 58px);
  box-shadow: var(--shadow);
}
.today-card::after { content: "M"; position: absolute; right: -12px; bottom: -72px; color: rgba(255,255,255,.045); font: italic 360px "Instrument Serif", serif; pointer-events: none; }
.today-card.done { background: var(--turquoise); color: var(--navy); }
.today-card .task-top { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.today-card .task-date { color: var(--turquoise); font: 500 9px "IBM Plex Mono", monospace; letter-spacing: .18em; text-transform: uppercase; }
.today-card.done .task-date { color: var(--navy); }
.today-card .task-badge { border: 1px solid rgba(255,255,255,.25); padding: 7px 9px; font: 500 8px "IBM Plex Mono", monospace; letter-spacing: .12em; }
.today-card h2 { position: relative; z-index: 1; max-width: 780px; margin: 30px 0 12px; color: inherit; font: 400 clamp(48px, 9vw, 88px)/.87 "Instrument Serif", serif; }
.today-card .task-detail { position: relative; z-index: 1; color: rgba(255,255,255,.62); font: 9px "IBM Plex Mono", monospace; letter-spacing: .1em; text-transform: uppercase; }
.today-card.done .task-detail { color: rgba(27,33,63,.72); }
.task-resume { position: relative; z-index: 1; display: grid; gap: 6px; max-width: 720px; margin-top: 20px; padding: 13px 15px; border-left: 4px solid rgba(27,33,63,.35); background: rgba(255,255,255,.18); }
.task-resume strong { font: 600 8px "IBM Plex Mono", monospace; letter-spacing: .12em; }
.task-resume span { line-height: 1.5; }
.task-actions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 36px; }
.primary-action, .secondary-action, .finish-action, .small-action {
  border: 0;
  font: 600 10px "IBM Plex Mono", monospace;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.primary-action { padding: 16px 20px; color: var(--navy); background: var(--turquoise); }
.primary-action.coral { color: var(--white); background: var(--coral); }
.primary-action.full { width: 100%; }
.task-actions .secondary { padding: 15px 19px; color: var(--white); border: 1px solid rgba(255,255,255,.28); background: transparent; font: 500 9px "IBM Plex Mono", monospace; letter-spacing: .1em; }

.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-top: 0; background: var(--white); }
.metric-grid article { padding: 24px; border-right: 1px solid var(--line); }
.metric-grid article:last-child { border-right: 0; }
.metric-grid strong { display: block; color: var(--navy); font: 400 clamp(32px, 5vw, 48px) "Instrument Serif", serif; }
.metric-grid span { color: var(--muted); font: 500 8px "IBM Plex Mono", monospace; letter-spacing: .13em; text-transform: uppercase; }

.section-block { margin-top: clamp(44px, 7vw, 78px); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.compact-list { border-bottom: 1px solid var(--line); }
.compact-item { display: grid; grid-template-columns: 82px 1fr auto; gap: 18px; align-items: center; min-height: 76px; border-top: 1px solid var(--line); }
.compact-item:first-child { border-top: 0; }
.compact-item time { color: var(--coral); font: 500 8px "IBM Plex Mono", monospace; letter-spacing: .08em; }
.compact-item strong { color: var(--navy); font-size: 14px; }
.compact-item span { color: var(--muted); font: 8px "IBM Plex Mono", monospace; }
.compact-item.complete { opacity: .46; }
.book-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.book-mini { min-height: 170px; display: flex; flex-direction: column; justify-content: space-between; padding: 19px; color: var(--white); background: var(--navy); border-top: 4px solid var(--turquoise); }
.book-mini:nth-child(2n) { border-top-color: var(--coral); }
.book-mini span { color: rgba(255,255,255,.5); font: 8px "IBM Plex Mono", monospace; letter-spacing: .12em; text-transform: uppercase; }
.book-mini strong { font: 400 25px/1 "Instrument Serif", serif; }
.book-mini small { color: rgba(255,255,255,.55); }

.session-idle { min-height: 65dvh; display: grid; place-content: center; text-align: center; }
.session-idle .lead { margin-inline: auto; }
.session-idle .primary-action { margin: 20px auto 0; }
.session-hero { color: var(--white); background: var(--navy); padding: clamp(26px, 7vw, 62px); text-align: center; border-bottom: 5px solid var(--turquoise); }
.session-hero.is-paused { border-bottom-color: var(--coral); }
.session-meta { display: flex; justify-content: center; gap: 10px; color: var(--turquoise); font: 500 8px "IBM Plex Mono", monospace; letter-spacing: .16em; }
.session-meta span + span::before { content: "//"; margin-right: 10px; opacity: .5; }
.timer { margin: 12px 0 18px; font: 400 clamp(70px, 17vw, 150px)/.9 "Instrument Serif", serif; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.session-hero.is-paused .timer { color: rgba(255,255,255,.58); }
.session-clock-actions { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px 14px; margin: -2px 0 20px; }
.pause-action { min-width: 170px; padding: 11px 16px; border: 1px solid rgba(255,255,255,.3); color: var(--white); background: transparent; font: 600 8px "IBM Plex Mono", monospace; letter-spacing: .13em; }
.pause-action[aria-pressed="true"] { border-color: var(--coral); color: var(--navy); background: var(--coral); }
.session-clock-actions span { color: rgba(255,255,255,.48); font: 500 7px "IBM Plex Mono", monospace; letter-spacing: .12em; }
.session-hero.is-paused .session-clock-actions span { color: var(--coral); }
.book-select { width: min(100%, 520px); border: 0; border-bottom: 1px solid rgba(255,255,255,.25); border-radius: 0; background: transparent; color: white; padding: 12px 8px; text-align: center; outline: none; }
.book-select option { color: var(--ink); }
.session-location { margin-top: 13px; color: rgba(255,255,255,.5); font: 8px "IBM Plex Mono", monospace; letter-spacing: .1em; }

.capture-panel { margin-top: 18px; border: 1px solid var(--line); background: var(--white); box-shadow: var(--shadow); }
.dictionary-launch { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; border: 0; border-bottom: 1px solid var(--line); color: var(--navy); background: #eff9f8; text-align: left; }
.dictionary-launch span { font: 600 9px "IBM Plex Mono", monospace; letter-spacing: .12em; }
.dictionary-launch small { color: #55716f; font: 500 7px "IBM Plex Mono", monospace; letter-spacing: .08em; }
.dictionary-launch:hover, .dictionary-launch:focus-visible { color: white; background: var(--navy); }
.dictionary-launch:hover small, .dictionary-launch:focus-visible small { color: var(--turquoise); }
.capture-kinds { display: grid; grid-template-columns: repeat(5, 1fr); border-bottom: 1px solid var(--line); }
.capture-kinds button { min-width: 0; padding: 14px 5px; border: 0; border-right: 1px solid var(--line); color: var(--muted); background: transparent; }
.capture-kinds button:last-child { border-right: 0; }
.capture-kinds button.active { color: var(--white); background: var(--navy); }
.capture-kinds b { display: block; font: 400 22px "Instrument Serif", serif; }
.capture-kinds span { display: block; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; font: 500 7px "IBM Plex Mono", monospace; letter-spacing: .04em; text-transform: uppercase; }
.annotation-form { padding: 17px; }
.capture-line { display: grid; grid-template-columns: minmax(80px, 1fr) auto auto; gap: 8px; }
.annotation-form input, .annotation-form textarea, .modal input, .modal textarea, .modal select {
  width: 100%; border: 1px solid var(--line); border-radius: 0; background: var(--paper); color: var(--ink); padding: 13px; outline: none;
}
.annotation-form textarea { margin-top: 9px; resize: vertical; line-height: 1.55; }
.annotation-form input:focus, .annotation-form textarea:focus, .modal input:focus, .modal textarea:focus, .modal select:focus { border-color: var(--turquoise); box-shadow: 0 0 0 1px var(--turquoise); }
.utility-button { border: 1px solid var(--line); background: var(--paper); color: var(--navy); padding: 0 12px; font: 500 8px "IBM Plex Mono", monospace; letter-spacing: .06em; }
.save-note { width: 100%; margin-top: 9px; border: 0; background: var(--navy); color: var(--white); padding: 15px; font: 600 9px "IBM Plex Mono", monospace; letter-spacing: .14em; }

.counter { min-width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--coral); color: white; font: 500 10px "IBM Plex Mono", monospace; }
.annotation-thread { border-bottom: 1px solid var(--line); }
.annotation-card { display: grid; grid-template-columns: 48px 1fr auto; gap: 14px; padding: 20px 0; border-top: 1px solid var(--line); }
.annotation-card:first-child { border-top: 0; }
.annotation-symbol { width: 44px; height: 44px; display: grid; place-items: center; background: var(--navy); color: var(--turquoise); font: 400 25px "Instrument Serif", serif; }
.annotation-card[data-kind="question"] .annotation-symbol, .annotation-card[data-kind="anya"] .annotation-symbol { color: var(--coral); }
.annotation-card.has-response { grid-template-columns: 48px minmax(0, 1fr) auto; }
.annotation-tools { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.annotation-tools button { padding: 8px 10px; border: 1px solid var(--navy); color: var(--navy); background: transparent; font: 600 8px "IBM Plex Mono", monospace; letter-spacing: .08em; }
.annotation-tools button:hover { color: white; background: var(--navy); }
.annotation-response { margin-top: 15px; padding: clamp(16px, 3vw, 24px); border-left: 4px solid var(--turquoise); background: #f3f0e9; }
.annotation-response-head { display: grid; gap: 6px; margin-bottom: 12px; }
.annotation-response-head span, .response-formulation b, .response-takeaway b, .response-sources b { color: var(--coral); font: 600 8px "IBM Plex Mono", monospace; letter-spacing: .11em; text-transform: uppercase; }
.annotation-response-head strong { color: var(--navy); font: 400 25px/1 "Instrument Serif", serif; }
.annotation-response p { color: #343645; line-height: 1.62; white-space: pre-wrap; }
.response-formulation, .response-takeaway { display: grid; gap: 7px; margin-top: 14px; padding-top: 13px; border-top: 1px solid rgba(27,33,63,.14); }
.response-formulation span, .response-takeaway span { line-height: 1.55; }
.response-feedback { display: grid; gap: 10px; margin-top: 18px; padding-top: 15px; border-top: 1px solid rgba(27,33,63,.18); }
.response-feedback > span { color: var(--navy); font: 600 8px "IBM Plex Mono", monospace; letter-spacing: .12em; }
.response-feedback-actions { display: grid; grid-template-columns: .7fr 1fr 1.35fr; gap: 6px; }
.response-feedback-actions button { min-height: 38px; padding: 8px 10px; border: 1px solid rgba(27,33,63,.24); color: var(--navy); background: transparent; font: 600 8px "IBM Plex Mono", monospace; letter-spacing: .08em; }
.response-feedback-actions button:hover, .response-feedback-actions button:focus-visible { border-color: var(--navy); }
.response-feedback-actions button[data-rate-response="useful"].active { border-color: var(--turquoise); background: var(--turquoise); }
.response-feedback-actions button[data-rate-response="partial"].active { border-color: #e0ad24; background: #f4ce63; }
.response-feedback-actions button[data-rate-response="missed"].active { border-color: var(--coral); color: white; background: var(--coral); }
.feedback-state { margin: 0; color: var(--muted) !important; font-size: 11px; }
.feedback-detail { display: grid; gap: 7px; }
.feedback-detail textarea { width: 100%; resize: vertical; border: 1px solid rgba(27,33,63,.24); border-radius: 0; padding: 11px; color: var(--navy); background: white; font: 12px/1.5 "Inter", sans-serif; }
.feedback-detail button { justify-self: start; padding: 10px 13px; border: 1px solid var(--navy); color: var(--navy); background: transparent; font: 600 8px "IBM Plex Mono", monospace; letter-spacing: .1em; }
.response-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 15px; }
.response-sources a { padding: 7px 9px; border: 1px solid rgba(27,33,63,.18); color: var(--navy); font: 500 8px "IBM Plex Mono", monospace; text-decoration: none; }
.annotation-body p { margin: 0; white-space: pre-wrap; line-height: 1.55; }
.annotation-body small { display: block; margin-top: 8px; color: var(--muted); font: 8px "IBM Plex Mono", monospace; }
.delete-note { align-self: start; border: 0; background: transparent; color: #aaa; font-size: 18px; }
.empty-state { padding: 28px 0; color: var(--muted); line-height: 1.6; }
.finish-action { width: 100%; margin-top: 24px; padding: 19px; color: var(--white); background: var(--coral); }

.archive-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.secondary-action { padding: 13px 15px; color: var(--navy); border: 1px solid var(--navy); background: transparent; }
.advanced-backup { border: 1px solid var(--line); background: rgba(255,255,255,.45); }
.advanced-backup summary { padding: 13px 15px; color: var(--muted); cursor: pointer; font: 600 9px "IBM Plex Mono", monospace; letter-spacing: .1em; }
.advanced-backup > div { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 10px 10px; }
.archive-books { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 16px; }
.archive-book { padding: 22px; background: var(--white); }
.archive-book .book-lane { color: var(--coral); font: 500 8px "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: .12em; }
.archive-book h3 { margin: 13px 0 5px; color: var(--navy); font: 400 28px/1 "Instrument Serif", serif; }
.book-title-link { display: block; width: 100%; padding: 0; border: 0; color: inherit; background: transparent; font: inherit; text-align: left; text-decoration: underline; text-decoration-color: var(--turquoise); text-decoration-thickness: 1px; text-underline-offset: 5px; cursor: pointer; }
.book-title-link:hover, .book-title-link:focus-visible { color: var(--coral); text-decoration-color: var(--coral); }
.archive-book p { color: var(--muted); font-size: 12px; }
.book-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 18px; }
.book-controls input, .book-controls select { min-width: 0; border: 1px solid var(--line); background: var(--paper); padding: 9px; font-size: 11px; }
.session-history { margin-top: 8px; }
.history-row { display: grid; grid-template-columns: 94px 1fr auto; gap: 15px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.history-row time { color: var(--coral); font: 500 8px "IBM Plex Mono", monospace; }
.history-row strong { display: block; color: var(--navy); font-size: 13px; }
.history-row p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.history-row span { color: var(--navy); font: 500 9px "IBM Plex Mono", monospace; white-space: nowrap; }

.back-section { margin-bottom: 24px; padding: 10px 0; border: 0; border-bottom: 1px solid var(--navy); color: var(--navy); background: transparent; font: 600 8px "IBM Plex Mono", monospace; letter-spacing: .12em; }
.book-detail-header { margin-bottom: 22px; padding: clamp(28px, 6vw, 60px); color: white; background: var(--navy); border-bottom: 6px solid var(--turquoise); }
.book-detail-header .book-lane { color: var(--coral); font: 600 9px "IBM Plex Mono", monospace; letter-spacing: .15em; text-transform: uppercase; }
.book-detail-header h1 { max-width: 900px; margin: 17px 0 7px; color: white; font: 400 clamp(52px, 9vw, 105px)/.88 "Instrument Serif", serif; }
.book-detail-header > p { color: rgba(255,255,255,.62); font-size: 15px; }
.book-detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.book-detail-meta span { padding: 8px 10px; border: 1px solid rgba(255,255,255,.18); color: var(--turquoise); font: 500 8px "IBM Plex Mono", monospace; letter-spacing: .08em; }
.book-resume-panel { display: grid; grid-template-columns: minmax(160px, .65fr) minmax(280px, 1.6fr) auto; gap: 1px; margin: -10px 0 22px; border: 1px solid var(--line); background: var(--line); }
.book-resume-panel > div { padding: clamp(18px, 4vw, 30px); background: var(--white); }
.resume-location { display: grid; align-content: start; }
.resume-location strong { margin: 11px 0 4px; color: var(--navy); font: 400 44px/1 "Instrument Serif", serif; }
.resume-location small { color: var(--muted); font: 500 8px "IBM Plex Mono", monospace; }
.resume-memory p { margin: 10px 0 0; line-height: 1.55; }
.resume-memory ul { margin: 13px 0 0; padding-left: 18px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.resume-actions { display: grid; align-content: center; gap: 8px; min-width: 190px; }
.resume-actions .primary-action, .resume-actions .secondary-action { width: 100%; margin: 0; }
.book-session-history { margin-top: 14px; }
.book-session { margin-bottom: 14px; padding: clamp(19px, 4vw, 32px); border: 1px solid var(--line); background: var(--white); }
.book-session.is-focused { border-color: var(--turquoise); box-shadow: 0 0 0 2px rgba(37,189,192,.14); }
.book-session-head { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.book-session-head h3 { margin: 8px 0 0; color: var(--navy); font: 400 31px/1 "Instrument Serif", serif; }
.book-session-tools { display: grid; justify-items: end; gap: 9px; }
.book-session-tools span { color: var(--navy); font: 600 8px "IBM Plex Mono", monospace; white-space: nowrap; }
.book-session-tools button { padding: 8px 10px; border: 1px solid var(--navy); color: var(--navy); background: transparent; font: 600 7px "IBM Plex Mono", monospace; letter-spacing: .08em; }
.book-harvest { margin: 18px 0; padding: 14px 16px; background: var(--paper); border-left: 4px solid var(--coral); line-height: 1.55; }
.focused-session-banner { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 12px; padding: 13px 15px; color: white; background: var(--navy); font: 600 8px "IBM Plex Mono", monospace; letter-spacing: .08em; }
.focused-session-banner button { padding: 9px 11px; border: 1px solid var(--turquoise); color: var(--turquoise); background: transparent; font: inherit; }
.book-cut-history { display: grid; gap: 8px; margin-top: 14px; }
.cut-history-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 15px; width: 100%; padding: 18px; border: 1px solid var(--line); color: var(--navy); background: var(--white); text-align: left; }
.cut-history-row span { color: var(--coral); font: 600 8px "IBM Plex Mono", monospace; letter-spacing: .1em; }
.cut-history-row strong { font-size: 12px; }
.cut-history-row em { color: var(--muted); font: normal 8px "IBM Plex Mono", monospace; }

.distill-command { position: relative; overflow: hidden; padding: clamp(26px, 6vw, 56px); color: white; background: var(--navy); }
.distill-command::after { content: "◎"; position: absolute; right: 25px; top: -40px; color: rgba(255,255,255,.05); font: 190px "Instrument Serif", serif; }
.distill-command h2 { position: relative; z-index: 1; margin: 18px 0 14px; color: white; font: 400 clamp(38px, 7vw, 70px)/.92 "Instrument Serif", serif; }
.distill-command p { position: relative; z-index: 1; max-width: 620px; color: rgba(255,255,255,.62); line-height: 1.6; }
.distill-command .primary-action { position: relative; z-index: 1; margin-top: 12px; }
.distill-book-label { position: relative; z-index: 1; display: block; max-width: 620px; margin-top: 24px; color: var(--turquoise); font: 600 8px "IBM Plex Mono", monospace; letter-spacing: .12em; }
.distill-book-label select { display: block; width: 100%; margin-top: 8px; padding: 13px; border: 1px solid rgba(255,255,255,.28); color: white; background: rgba(255,255,255,.06); font: 500 12px "DM Sans", sans-serif; }
.distill-book-label option { color: var(--ink); background: white; }
.distill-scope-summary { position: relative; z-index: 1; display: grid; gap: 5px; max-width: 620px; margin: 12px 0 5px; padding: 14px; border-left: 4px solid var(--turquoise); background: rgba(255,255,255,.06); }
.distill-scope-summary strong { color: white; font: 600 9px "IBM Plex Mono", monospace; letter-spacing: .09em; }
.distill-scope-summary span { color: rgba(255,255,255,.62); font-size: 11px; line-height: 1.5; }
.distill-heading { align-items: end; }
.cut-select { max-width: min(100%, 360px); padding: 10px; border: 1px solid var(--line); color: var(--navy); background: var(--white); font-size: 11px; }
.cut-export-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.review-panel { margin-top: 16px; border: 1px solid var(--line); background: var(--white); padding: clamp(22px, 5vw, 38px); }
.review-group { margin-bottom: 24px; }
.review-group:last-child { margin-bottom: 0; }
.review-group h3 { color: var(--coral); font: 500 9px "IBM Plex Mono", monospace; letter-spacing: .15em; text-transform: uppercase; }
.review-group ol { margin: 0; padding-left: 22px; }
.review-group li, .review-group p { margin-bottom: 8px; line-height: 1.55; }
.review-group.cross-book { padding: 16px; border-left: 4px solid var(--turquoise); background: var(--paper); }
.companion-export-actions { margin-top: 12px; }
.companion-responses { display: grid; gap: 18px; }
.companion-response { padding: clamp(18px, 4vw, 28px); border: 1px solid var(--line); background: var(--paper); }
.companion-response blockquote { margin: 0 0 16px; padding: 13px 16px; border-left: 4px solid var(--coral); background: white; color: #555763; font-style: italic; line-height: 1.55; }
.companion-response > span { color: var(--coral); font: 600 8px "IBM Plex Mono", monospace; letter-spacing: .12em; text-transform: uppercase; }
.companion-response h4 { margin: 8px 0 10px; color: var(--navy); font: 400 30px/1 "Instrument Serif", serif; }
.companion-response > p { color: #383a47; line-height: 1.65; white-space: pre-wrap; }
.review-highlight { padding: 20px; border-left: 5px solid var(--turquoise); background: rgba(37,189,192,.09); }
.historical-review-notice { margin-bottom: 26px; padding: 20px; border: 1px solid var(--coral); background: rgba(255,107,87,.08); }
.historical-review-notice strong { color: var(--coral); font: 600 9px "IBM Plex Mono", monospace; letter-spacing: .12em; }
.historical-review-notice p { line-height: 1.55; }
.small-action { padding: 9px 11px; color: var(--navy); border: 1px solid var(--navy); background: transparent; }
.candidate-list { display: grid; gap: 12px; margin-top: 16px; }
.candidate-card { padding: 23px; border: 1px solid var(--line); background: var(--white); border-left: 5px solid var(--coral); }
.candidate-card.approved_for_vault { border-left-color: var(--turquoise); }
.candidate-card.discarded { opacity: .48; border-left-color: #999; }
.candidate-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font: 500 8px "IBM Plex Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
.candidate-card h3 { margin: 15px 0 9px; color: var(--navy); font: 400 30px/1 "Instrument Serif", serif; }
.candidate-card p { color: #4e4e58; line-height: 1.55; }
.evidence-list { margin: 14px 0; padding: 13px; background: var(--paper); color: var(--muted); font-size: 11px; }
.candidate-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.candidate-actions button { padding: 10px 12px; border: 1px solid var(--line); background: transparent; color: var(--navy); font: 500 8px "IBM Plex Mono", monospace; }
.candidate-actions .approve { color: var(--navy); border-color: var(--turquoise); background: rgba(37,189,192,.13); }

.bottom-nav {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 24px), 620px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px;
  background: rgba(27,33,63,.96);
  backdrop-filter: blur(20px);
  box-shadow: 0 14px 50px rgba(0,0,0,.25);
}
.bottom-nav button { border: 0; color: rgba(255,255,255,.5); background: transparent; padding: 9px 3px; font: 500 7px "IBM Plex Mono", monospace; letter-spacing: .06em; }
.bottom-nav button span { display: block; margin-bottom: 4px; font-size: 16px; }
.bottom-nav button.active { color: var(--white); background: rgba(255,255,255,.08); }
.bottom-nav button.active span { color: var(--turquoise); }

.modal { width: min(calc(100% - 26px), 580px); max-height: 90dvh; overflow-y: auto; border: 0; border-top: 6px solid var(--coral); background: var(--white); color: var(--ink); padding: clamp(24px, 6vw, 46px); box-shadow: 0 30px 100px rgba(0,0,0,.38); }
.modal::backdrop { background: rgba(20,24,44,.76); backdrop-filter: blur(5px); }
.modal h2 { margin: 14px 0 25px; font: 400 50px/1 "Instrument Serif", serif; }
.modal label { display: block; margin-top: 14px; color: var(--muted); font: 500 9px "IBM Plex Mono", monospace; line-height: 2; letter-spacing: .06em; }
.modal-close { float: right; border: 0; background: transparent; color: var(--muted); font-size: 27px; }
.secondary-action.full { width: 100%; }
.dictionary-modal { width: min(calc(100% - 20px), 680px); border-top-color: var(--turquoise); }
.dictionary-modal h2 { margin-bottom: 12px; }
.dictionary-intro { margin: 0 0 20px; color: var(--muted); line-height: 1.65; }
.dictionary-modal label span { opacity: .65; }
.dictionary-book { margin: 0 0 18px; padding: 12px 14px; border-left: 4px solid var(--turquoise); color: var(--navy); background: var(--paper); font: 500 8px/1.6 "IBM Plex Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
.dictionary-result { margin-top: 20px; padding: clamp(18px, 4vw, 28px); border: 1px solid var(--line); background: var(--paper); }
.dictionary-wordline { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 14px; }
.dictionary-wordline h3 { margin: 0; color: var(--navy); font: 400 clamp(34px, 8vw, 55px)/.95 "Instrument Serif", serif; }
.dictionary-wordline span { color: var(--coral); font: 600 8px "IBM Plex Mono", monospace; letter-spacing: .11em; text-transform: uppercase; }
.dictionary-definition { margin: 18px 0 0; color: var(--navy); font-size: 16px; font-weight: 600; line-height: 1.5; }
.dictionary-plain { margin: 9px 0 0; color: #454958; line-height: 1.65; white-space: pre-wrap; }
.dictionary-context { margin-top: 18px; padding: 14px 16px; border-left: 4px solid var(--coral); background: white; }
.dictionary-context b, .dictionary-list b, .dictionary-example b, .dictionary-sources b { display: block; margin-bottom: 6px; color: var(--coral); font: 600 8px "IBM Plex Mono", monospace; letter-spacing: .1em; text-transform: uppercase; }
.dictionary-context p, .dictionary-example p { margin: 0; line-height: 1.6; }
.dictionary-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.dictionary-list > div { min-width: 0; padding: 13px; border: 1px solid var(--line); background: white; }
.dictionary-list span { line-height: 1.55; }
.dictionary-example { margin-top: 16px; }
.dictionary-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--line); }
.dictionary-sources b { width: 100%; }
.dictionary-sources a { padding: 7px 9px; border: 1px solid var(--line); color: var(--navy); font: 500 7px "IBM Plex Mono", monospace; text-decoration: none; }
#dictionaryToMargin { margin-top: 9px; }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.mode-grid button { min-height: 165px; border: 1px solid var(--line); color: var(--navy); background: var(--paper); }
.mode-grid button:first-child { color: white; background: var(--navy); }
.mode-grid strong { display: block; font: 400 54px "Instrument Serif", serif; }
.mode-grid span { display: block; margin-top: -8px; font: 400 20px "Instrument Serif", serif; }
.mode-grid em { display: block; margin-top: 20px; font: normal 500 7px "IBM Plex Mono", monospace; letter-spacing: .1em; }
.finish-time-summary { margin: -8px 0 22px; padding: 13px 15px; color: var(--navy); background: var(--paper); border-left: 4px solid var(--turquoise); font: 500 8px/1.6 "IBM Plex Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
.edit-annotations-heading { margin: 28px 0 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.edit-annotations-heading p { color: var(--muted); font-size: 11px; line-height: 1.5; }
.edit-annotations { display: grid; gap: 10px; margin-bottom: 20px; }
.edit-annotation { padding: 13px; border: 1px solid var(--line); background: var(--paper); }
.edit-annotation-meta { display: grid; grid-template-columns: auto 1fr minmax(80px, .6fr); align-items: center; gap: 8px; margin-bottom: 8px; }
.edit-annotation-meta > span { color: var(--coral); font: 600 8px "IBM Plex Mono", monospace; }
.edit-annotation select, .edit-annotation input, .edit-annotation textarea { width: 100%; border: 1px solid var(--line); border-radius: 0; background: white; padding: 10px; }
.edit-annotation textarea { resize: vertical; line-height: 1.5; }
.danger-action { width: 100%; margin-top: 10px; padding: 14px; border: 1px solid var(--coral); color: var(--coral); background: transparent; font: 600 8px "IBM Plex Mono", monospace; letter-spacing: .1em; }

.toast { position: fixed; z-index: 60; left: 50%; bottom: 104px; transform: translate(-50%, 20px); width: min(calc(100% - 32px), 520px); padding: 14px 18px; color: white; background: var(--navy); border-left: 4px solid var(--turquoise); opacity: 0; pointer-events: none; transition: .22s ease; box-shadow: var(--shadow); font-size: 12px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-left-color: var(--coral); }

@media (max-width: 700px) {
  .app-header { height: 62px; grid-template-columns: auto 1fr auto; gap: 8px; padding-inline: 13px; }
  .wordmark-name { font-size: 17px; }
  .wordmark-sub { display: none; }
  .sync-pill span { display: none; }
  .sync-pill { width: 32px; height: 32px; justify-content: center; }
  .header-actions { gap: 5px; }
  .header-logout { width: 32px; height: 32px; overflow: hidden; padding: 0; font-size: 0; }
  .header-logout::before { content: "↗"; font-size: 14px; }
  .view { padding-top: 34px; }
  .today-card { min-height: 330px; }
  .metric-grid article { padding: 17px 12px; }
  .compact-item { grid-template-columns: 68px 1fr auto; gap: 9px; }
  .book-strip { grid-template-columns: repeat(2, 1fr); }
  .book-mini { min-height: 140px; }
  .capture-line { grid-template-columns: 82px 1fr 1fr; }
  .dictionary-launch { align-items: flex-start; flex-direction: column; }
  .dictionary-list { grid-template-columns: 1fr; }
  .utility-button { padding-inline: 4px; font-size: 7px; }
  .archive-books { grid-template-columns: 1fr; }
  .history-row { grid-template-columns: 72px 1fr; }
  .history-row span { grid-column: 2; }
  .book-resume-panel { grid-template-columns: 1fr; }
  .resume-actions { min-width: 0; }
  .book-session-head { display: grid; }
  .book-session-tools { justify-items: start; }
  .response-feedback-actions { grid-template-columns: 1fr; }
  .focused-session-banner { align-items: stretch; flex-direction: column; }
  .cut-history-row { grid-template-columns: 1fr; gap: 6px; }
  .distill-heading { align-items: stretch; flex-direction: column; }
  .cut-select { width: 100%; max-width: 100%; }
  .mode-grid button { min-height: 145px; }
}

@media (min-width: 860px) {
  .bottom-nav { top: 90px; bottom: auto; left: 20px; transform: none; width: 96px; grid-template-columns: 1fr; }
  .bottom-nav button { padding: 15px 4px; }
  .app-main { padding-left: 80px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
