:root {
  color-scheme: light dark;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --bg: #faf9f6;
  --pane: #ffffff;
  --line: #e4e1da;
  --accent: #7a5c3e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e8e6e1; --muted: #9a9a9a; --bg: #191918;
    --pane: #201f1e; --line: #33312e; --accent: #c9a880;
  }
}
/* An explicit choice in Settings beats the device preference either way. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --fg: #e8e6e1; --muted: #9a9a9a; --bg: #191918;
  --pane: #201f1e; --line: #33312e; --accent: #c9a880;
}
:root[data-theme="light"] {
  color-scheme: light;
  --fg: #1a1a1a; --muted: #6b6b6b; --bg: #faf9f6;
  --pane: #ffffff; --line: #e4e1da; --accent: #7a5c3e;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--fg);
  background: var(--bg);
  height: 100vh;
  display: flex;
  flex-direction: column;
}
header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
h1 { font-size: 1.4rem; font-weight: normal; letter-spacing: 0.02em; }
header .whoami {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40vw;
}
header .whoami:hover { color: var(--accent); }

/* Hidden until the layout collapses to one column. */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--pane);
  cursor: pointer;
}
.hamburger span {
  display: block;
  height: 2px;
  background: var(--fg);
  border-radius: 1px;
}
h2 {
  font-size: 0.85rem;
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0.9rem 1rem 0.5rem;
}
.muted { color: var(--muted); }
.error { color: #b4432f; }

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: var(--w-menu, 150px) var(--w-side, 380px) 6px 1fr;
  min-height: 0;
}
/* The side slot takes no column until something is in it. Driven by the
   pane's own content rather than a class some script has to remember to
   set — that indirection was a bug once already.

   Two columns, not four with zeros in them. `#pane-side:empty` and the
   splitter below are both `display: none`, so they stop being grid items
   altogether — and auto-placement then walks the *declared* columns in
   order, dropping #content into the second one. When that second column was
   `0`, content was zero-width: a deep link to any pane that doesn't fill the
   side slot (Analysis, Account, Recordings…) rendered a blank screen, and
   only "fixed itself" when you opened a day, because that put something in
   #pane-side and restored all four items to all four columns. Keep the count
   of declared columns equal to the count of visible children. */
.layout:has(> #pane-side:empty) { grid-template-columns: var(--w-menu, 150px) 1fr; }
#pane-menu {
  border-right: 1px solid var(--line);
  background: var(--pane);
  overflow-y: auto;
}
#pane-side {
  border-right: 1px solid var(--line);
  background: var(--pane);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}
#pane-side:empty { display: none; }
.layout:has(> #pane-side:empty) > .splitter { display: none; }

.sideclose {
  float: right;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0.15rem;
}
.sideclose:hover { color: var(--accent); }
.sideexpand { margin-right: 0.35rem; font-size: 1.05rem; }
.sideexpand[aria-pressed="true"] { color: var(--accent); }
/* Scrolls for the panes that render straight into it (Configuration,
   Account, search results…); the .panes grid fills 100% height and keeps
   scrolling inside its own columns, so it never triggers this. */
#content { min-height: 0; overflow-y: auto; }

.panes {
  height: 100%;
  display: grid;
  grid-template-columns: var(--w-dates, 180px) 6px var(--w-files, 260px) 6px 1fr;
  min-height: 0;
}
.panes-library { grid-template-columns: var(--w-liblist, 260px) 6px 1fr; }
.panes > * {
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--pane);
}
.panes > article { border-right: none; }
.panes > * > p.muted { padding: 1rem; font-style: italic; }

/* Drag handles between panes (the 6px grid tracks). */
.splitter {
  overflow: visible;
  background: none;
  border-right: none;
  cursor: col-resize;
  touch-action: none;
  margin-left: -1px; /* sit on the pane's border line */
}
.splitter:hover, .splitter.dragging {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
}

ul { list-style: none; }
.row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.row:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.row.active {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}
.state-done { color: var(--accent); }
.state-working { color: var(--muted); }
.state-pending { color: var(--line); }

.file-row {
  display: grid;
  grid-template-columns: 3.6rem 1fr 3.4rem;
  grid-template-areas:
    "title title title"
    "when  wave  state";
  align-items: center;
  gap: 0.15rem 0.6rem;
}
.file-row .rowtitle {
  grid-area: title;
  min-width: 0;
  font-size: 0.82rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-row .when { grid-area: when; font-size: 0.85rem; line-height: 1.25; }
.file-row .when .muted { font-size: 0.72rem; }
.file-row .wave { grid-area: wave; color: var(--muted); min-height: 20px; }
.file-row .wave .wavesvg { width: 100%; height: 20px; display: block; opacity: 0.75; }
.file-row.active .wave, .file-row:hover .wave { color: var(--accent); }
.file-row .state {
  grid-area: state;
  text-align: right;
  font-size: 0.82rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.file-row .state .unit { font-size: 0.62rem; color: var(--muted); }

#pane-transcript { overflow: hidden; display: flex; flex-direction: column; }
#pane-transcript > p.muted { padding: 1rem; }
.transcriptwrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.transcriptbody { flex: 1; overflow-y: auto; padding-bottom: 1rem; }
.transcriptbody .meta { padding: 0 1rem 0.4rem; font-size: 0.9rem; }

.playerbar {
  flex: none;
  /* Stacked, not one row: the player keeps the full width so the scrub bar
     stays big enough to aim at, and the buttons sit under it. */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--line);
  background: var(--pane);
}
.playerbar.active {
  border-top: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, var(--pane));
}
.playerbar audio { width: 100%; min-width: 0; height: 2.2rem; }
.playeractions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
}
.playerbar .autoscroll {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  cursor: pointer;
}
.playerbar .rerun {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.playerbar .rerun:hover { color: var(--accent); border-color: var(--accent); }
.playerbar .hint { font-size: 0.72rem; white-space: nowrap; }

.segment.playing {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 4px;
}
.segment .ts { cursor: pointer; }
.segment .ts:hover { color: var(--accent); }

.archivecard audio { width: 100%; margin: 0.4rem 0; height: 2rem; }
.archivecard .rerun {
  font: inherit; font-size: 0.8rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--line); border-radius: 4px;
  background: none; color: var(--muted); cursor: pointer;
}

#pane-library-view { padding: 0 1rem 1rem; display: flex; flex-direction: column; }
#pane-library-view .pdfview { flex: 1; width: 100%; min-height: 0; border: none; }
#pane-library-view .imgview { max-width: 100%; height: auto; }
#pane-library-view .textview {
  overflow: auto;
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre-wrap;
  font-family: ui-monospace, monospace;
}
.libname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.segments { padding: 0 1.25rem; max-width: 46rem; }
.segment { margin-bottom: 0.65rem; line-height: 1.55; }
.segment .ts {
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  margin-right: 0.5rem;
}
.segment .speaker { color: var(--accent); margin-right: 0.3rem; }
.menusearch, .datefilter { padding: 0.5rem 0.75rem 0.25rem; }
.menusearch input, .datefilter input[type="search"] {
  width: 100%;
  padding: 0.3rem 0.5rem;
  font: inherit;
  font-size: 0.85rem;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.menulist .kwentry { justify-content: flex-start; gap: 0.5rem; }
.menulist .kwentry .swatch { width: 0.7rem; height: 0.7rem; }
.menulist .kwentry .kwname {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.results .resultcard {
  display: block;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--pane);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.results .resultcard:hover {
  background: color-mix(in srgb, var(--accent) 8%, var(--pane));
}
.results .resultcard .meta { display: block; font-size: 0.75rem; margin-bottom: 0.25rem; }
.results .resultcard .resulttext { line-height: 1.5; }
/* A keyword's clip with its "not applicable" beside it, under the card's
   foot so the card keeps the full width on a phone. */
.results .clipcard { margin-bottom: 0.6rem; }
.results .clipcard .resultcard { margin-bottom: 0.15rem; }
.results .clipdismiss { text-align: right; font-size: 0.78rem; }
.results .clipsdismissed { margin-top: 1rem; }
.results .clipsdismissed summary { cursor: pointer; font-size: 0.85rem; margin-bottom: 0.5rem; }
.results .clipcard.dismissed .resultcard { opacity: 0.6; }
.results h2 .swatch { display: inline-block; vertical-align: baseline; margin-right: 0.3rem; }
.results { max-width: 46rem; }

.sortbar {
  padding: 0 1rem 0.4rem;
  font-size: 0.75rem;
  display: flex;
  gap: 0.75rem;
}
.sortbar a { color: inherit; cursor: pointer; text-decoration: none; }
.sortbar a.sorton { color: var(--accent); }

.segment mark { border-radius: 2px; padding: 0 2px; color: inherit; }

.configpage { padding: 0 1.25rem 2rem; max-width: 34rem; }
.configpage h2 { padding-left: 0; }
.configsection h3 {
  font-size: 0.95rem;
  font-weight: normal;
  margin: 0.5rem 0 0.25rem;
}
.configsection > .muted { font-size: 0.85rem; margin-bottom: 0.75rem; }
.kwform { display: flex; gap: 0.5rem; margin-bottom: 1rem; align-items: center; }
.kwform input[name="phrase"] {
  flex: 1;
  padding: 0.35rem 0.5rem;
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.kwform input[type="color"] {
  width: 2.2rem;
  height: 2rem;
  padding: 0.1rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  cursor: pointer;
}
.kwform button {
  font: inherit;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--pane);
  color: var(--accent);
  cursor: pointer;
}
.kwlist { list-style: none; }
.kwlist li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--line);
}
.swatch {
  width: 1rem;
  height: 1rem;
  border-radius: 3px;
  flex-shrink: 0;
}
.kwphrase { flex: 1; }
.kwremind { display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.85rem; color: var(--muted); white-space: nowrap; cursor: pointer; }
.kwform { flex-wrap: wrap; }
.kwscope { font: inherit; font-size: 0.85rem; padding: 0.1rem 0.25rem;
  color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; }
.kwlist li { flex-wrap: wrap; }
/* The row's controls stay together: on a phone they drop below the phrase as
   one line rather than leaving the × stranded on a line of its own. */
.kwctl { display: inline-flex; align-items: center; gap: 0.6rem; margin-left: auto; }
.kwdelete {
  font: inherit;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0.4rem;
}
.kwdelete:hover { color: #b4432f; }

.timeedit {
  font: inherit;
  font-size: 0.75rem;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0.2rem;
}
.timeedit:hover { color: var(--accent); }
.timesource { font-size: 0.78rem; font-style: italic; cursor: help; }
.timeform form { display: inline-flex; gap: 0.4rem; align-items: center; }
.timeform input[type="datetime-local"] {
  font: inherit;
  font-size: 0.85rem;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.15rem 0.35rem;
}
.timeform button {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--pane);
  color: var(--accent);
  cursor: pointer;
}

/* A recording's title sits above its filename at the head of the transcript.
   Readable case and weight, unlike the muted uppercase section headers. */
.rectitle { padding: 0.75rem 1rem 0.3rem; }
.rectitle h2 {
  padding: 0;
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: inherit;
}
.rectitle h2.untitled { color: var(--muted); font-weight: 500; font-style: italic; }
.rectitle .filename {
  margin: 0.15rem 0 0;
  padding: 0;
  font-size: 0.78rem;
  word-break: break-all;
}
.titleedit {
  font: inherit;
  font-size: 0.8rem;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0.25rem;
  vertical-align: middle;
}
.titleedit:hover { color: var(--accent); }
.titleform form { display: flex; gap: 0.4rem; align-items: center; }
.titleform input[type="text"] {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 1rem;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.2rem 0.4rem;
}
.titleform button {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--pane);
  color: var(--accent);
  cursor: pointer;
}

.importpage { padding: 0 1.25rem 2rem; max-width: 34rem; }
.importpage h2 { padding-left: 0; }
.importpage > .muted { font-size: 0.85rem; margin-bottom: 0.75rem; }
.importform { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.importform input[type="file"] { font: inherit; font-size: 0.85rem; }
.importform button {
  font: inherit;
  padding: 0.3rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--pane);
  color: var(--accent);
  cursor: pointer;
}
.importform .importprogress { width: 100%; }
#importform { flex-direction: column; align-items: stretch; }
/* The list's × and "clear the list" are quiet links, not buttons. */
#importform button.linky { border: none; background: none; padding: 0;
  color: var(--muted); font-size: 0.85rem; }
#importform button.linky:hover { color: var(--accent); }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
  padding: 1.6rem 1rem; text-align: center; cursor: pointer;
  border: 2px dashed var(--line); border-radius: 8px; background: var(--bg);
  transition: border-color 0.12s ease, background 0.12s ease;
}
.dropzone:hover, .dropzone:focus-within { border-color: var(--accent); }
.dropzone.dragging {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--bg));
}
.dropzone .dropicon { font-size: 1.6rem; color: var(--accent); line-height: 1; }
.dropzone .droptext { font-size: 0.95rem; }
.dropzone .dropnote { font-size: 0.78rem; }
.pendingfiles { font-size: 0.88rem; border: 1px solid var(--line); border-radius: 6px; }
.pendingfiles li {
  display: flex; align-items: baseline; gap: 0.6rem;
  padding: 0.3rem 0.6rem; border-bottom: 1px solid var(--line);
}
.pendingfiles li:last-child { border-bottom: none; }
.pendingfiles .pfname { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pendingfiles .pfsize { font-size: 0.78rem; white-space: nowrap; }
.pendingfiles .pfdrop { font-size: 0.95rem; line-height: 1; }
.importfoot { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.importform button:disabled { opacity: 0.5; cursor: default; }
@media (prefers-reduced-motion: reduce) { .dropzone { transition: none; } }
.importresults { margin-top: 1rem; font-size: 0.9rem; }
#import-results { margin-top: 1rem; }
#import-results .importresults { margin-top: 0; }
.importnow { font-size: 0.85rem; margin: 0; }
.importresults li { padding: 0.25rem 0; }
.importresults li.ok { color: inherit; }
.importhead { margin: 2rem 0 0.4rem; font-size: 1rem; }
.podcastform .podcastq { flex: 1 1 16rem; min-width: 0; padding: 0.35rem 0.5rem;
  font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--line); border-radius: 4px; }
.podcastform input[type="date"] { font: inherit; color: inherit;
  background: var(--bg); border: 1px solid var(--line); border-radius: 4px;
  padding: 0.25rem 0.35rem; }
.importpage .privacynote { font-size: 0.78rem; margin-top: 0.5rem; }
.podcastjobs li { overflow-wrap: anywhere; }
.podcastjobs a, .podnotes summary a { color: var(--accent); }
.podcastjobs li.error .jobstate { color: var(--accent); }
.podcastjobs li.working .jobstate { color: var(--muted); }
.podcastjobs progress { display: block; width: 100%; margin-top: 0.2rem; }
.docimportform { display: flex; flex-direction: column; gap: 0.6rem; align-items: stretch; }
.docimportform input[type="file"] { font: inherit; font-size: 0.88rem; max-width: 100%; }
.docimportform input[type="date"] { font: inherit; color: inherit;
  background: var(--bg); border: 1px solid var(--line); border-radius: 4px;
  padding: 0.25rem 0.35rem; }
.docmodes { border: 1px solid var(--line); border-radius: 6px; padding: 0.5rem 0.75rem;
  margin: 0; display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.9rem; }
.docmodes legend { font-size: 0.78rem; padding: 0 0.3rem; }
.docmodes label { display: flex; gap: 0.5rem; align-items: baseline; line-height: 1.4; }
.docmodes label > span { flex: 1; }
.docdatenote { font-size: 0.78rem; }
.formerror { font-size: 0.88rem; margin: 0; }
.dochisthead { margin: 1rem 0 0.3rem; font-size: 0.88rem; }
.dochistory { font-size: 0.85rem; }
.dochistory li { padding: 0.2rem 0; overflow-wrap: anywhere; }
.dochistory li.undone .jobtitle { text-decoration: line-through; opacity: 0.7; }

/* An imported podcast's show notes, above its transcript. */
.podnotes { margin: 0.5rem 0 1rem; padding: 0.5rem 0.75rem;
  border: 1px solid var(--line); border-radius: 6px; background: var(--pane); }
.podnotes summary { cursor: pointer; }
.podnotes .notestext { margin-top: 0.5rem; font-size: 0.9rem;
  max-height: 22rem; overflow-y: auto; overflow-wrap: anywhere; }
.podnotes .noteline { margin: 0; line-height: 1.45; }
.podnotes .noteline.blank { height: 0.6rem; }
.podnotes .chapter { font: inherit; color: var(--accent); background: none;
  border: 0; padding: 0; text-align: left; cursor: pointer; }
.podnotes .chapter:hover { text-decoration: underline; }

.speakerrename { display: flex; gap: 0.5rem; align-items: center; flex: 1; }
.speakerrename input {
  flex: 1;
  padding: 0.3rem 0.5rem;
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.speakerrename .muted { font-size: 0.78rem; white-space: nowrap; }
.speakerrename button {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--pane);
  color: var(--accent);
  cursor: pointer;
}

.progressbar {
  margin: 0.5rem 1.25rem 1rem;
  max-width: 46rem;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.progressbar > div {
  height: 100%;
  background: var(--accent);
  transition: width 0.5s ease;
}
.workerbox {
  padding: 0.9rem 1rem;
  font-size: 0.8rem;
  border-top: 1px solid var(--line);
  margin-top: 0.75rem;
}

/* --- the journal: date list ---------------------------------------------- */

.adddate {
  display: flex;
  gap: 0.4rem;
  padding: 0 0.75rem 0.4rem;
}
.adddate input[type="date"] {
  flex: 1;
  min-width: 0;
  padding: 0.25rem 0.4rem;
  font: inherit;
  font-size: 0.8rem;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.adddate button {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--pane);
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}
.adddate button:hover { border-color: var(--accent); }

.daylist .day-row { align-items: baseline; }
.dayname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dayname .daydate { font-size: 0.72rem; margin-left: 0.3rem; }
.daymarks {
  display: flex;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}
.day-row.active .daymarks, .day-row:hover .daymarks { color: var(--accent); }
.mark-wait { font-style: italic; opacity: 0.8; }
/* Something unsaved in the box: a small flag, in the accent so it isn't
   mistaken for one more count. */
.mark-draft {
  font-style: italic;
  color: var(--accent);
  border: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 0.6rem;
  padding: 0 0.35rem;
}
.emptynote { padding: 0.75rem 1rem; font-style: italic; line-height: 1.5; }

/* --- the journal: one day ------------------------------------------------ */

#pane-day { overflow-y: auto; }
.daypage { padding: 0 1.25rem 2rem; max-width: 44rem; }
.dayhead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--pane);
  padding-top: 0.9rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.9rem;
}
.dayhead h2 { padding: 0 0 0.5rem; }
.daybuttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.daybtn {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--pane);
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}
.daybtn:hover { border-color: var(--accent); }
.daybtn.recording {
  color: #b4432f;
  border-color: #b4432f;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) {
  .daybtn.recording { animation: none; }
}
.recstate { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.75rem; }

.entryform { margin-bottom: 1rem; }
.entryform textarea {
  width: 100%;
  resize: vertical;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.6;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.6rem;
}
.entryform textarea:focus {
  outline: 1px solid var(--accent);
}
.entryfoot {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.4rem;
  font-size: 0.8rem;
}
.entryfoot button[type="submit"] {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.25rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--pane);
  color: var(--accent);
  cursor: pointer;
}
.entryfoot button[type="submit"]:hover { border-color: var(--accent); }
.entryfoot .hint { margin-left: auto; font-size: 0.72rem; }
.entryfoot .draftstate { font-size: 0.72rem; font-style: italic; }
.linky {
  font: inherit;
  font-size: 0.8rem;
  border: none;
  background: none;
  padding: 0;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
}
.linky:hover { color: var(--accent); }

.daysection { margin-bottom: 1.5rem; }
.daysection h3 {
  font-size: 0.8rem;
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.dayrec {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}
.dayrectitle {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  margin-bottom: 0.2rem;
}
.dayrectitle:hover { color: var(--accent); }
.dayrecmeta {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
}
.dayrecmeta .when { font-variant-numeric: tabular-nums; }
.dayrec audio { width: 100%; height: 2rem; }
.dayfiles li {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  justify-content: space-between;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

/* --- menu footer --------------------------------------------------------- */

.menufoot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
}
.menufoot a {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  text-decoration: none;
}
.menufoot a:hover { color: var(--accent); }

/* --- menu icons and the rail --------------------------------------------- */

/* Icons are <use> references into the sprite in _icons.html. Everything about
   how they look lives here rather than on the paths, so an icon takes the
   color of the row it sits in — muted in the footer, accent when active. */
.mi {
  flex: none;
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.spritedefs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Smaller than body text: the menu is read at a glance, and at full size the
   labels crowded the narrow column.
   Icons follow in em so they stay in proportion; the row padding is left
   alone so a phone's tap targets don't shrink with the type. */
.menulist .row { align-items: center; gap: 0.55rem; }
.menulist .row { font-size: 0.88rem; }
.menulist .mi { width: 1.15em; height: 1.15em; }
.menulist .row .mlabel { flex: 1; }
.menuhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.railtoggle, .railsearch {
  display: grid;
  place-items: center;
  padding: 0.15rem;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.railtoggle:hover, .railsearch:hover { color: var(--accent); }
.railsearch { display: none; }  /* only the rail needs it */

/* The rail: the menu shrunk to a column of icons. Phones get the menu as a
   drawer instead — there is no strip of screen to reclaim there — so none of
   this applies below the drawer's breakpoint. */
@media (min-width: 821px) {
  body.menu-rail { --w-menu: 3.1rem; }
  /* Clipped, not removed: the label is what a screen reader reads out, and
     the title attribute is what a hover shows. */
  body.menu-rail .mlabel {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  body.menu-rail .menusearch,
  body.menu-rail .menusection,
  body.menu-rail .mcount,
  body.menu-rail .journaltoggle .toggleicon { display: none; }
  body.menu-rail .railsearch { display: grid; }
  body.menu-rail .railtoggle { transform: rotate(180deg); }
  body.menu-rail .menuhead { justify-content: center; padding: 0.6rem 0 0.3rem; }
  body.menu-rail .menulist .row,
  body.menu-rail .menufoot a,
  body.menu-rail .railsearch {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }
  body.menu-rail .menulist .row { position: relative; }
  /* A count nobody can read in 3rem becomes a dot that says "something's
     waiting" — the number is a hover and a click away. */
  body.menu-rail .menulist .badge {
    position: absolute;
    top: 0.3rem;
    right: 0.5rem;
    min-width: 0.45rem;
    width: 0.45rem;
    height: 0.45rem;
    padding: 0;
    font-size: 0;
  }
  body.menu-rail .menukw { border-top: 1px solid var(--line); padding-top: 0.4rem; }
  body.menu-rail .menufoot {
    flex-direction: column;
    gap: 0.7rem;
    padding: 0.75rem 0;
  }
}

/* --- account + forms ----------------------------------------------------- */

.accountline { font-size: 0.85rem; margin-bottom: 1rem; line-height: 1.6; }
.stackform { display: flex; flex-direction: column; gap: 0.6rem; max-width: 26rem; }
.stackform label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.stackform input, .stackform select {
  font: inherit;
  font-size: 0.95rem;
  padding: 0.4rem 0.5rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.stackform input:focus, .stackform select:focus { outline: 1px solid var(--accent); }
.stackform .checkline {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  color: var(--fg);
}
.stackform .checkline input { width: auto; }
/* A setting's explanation goes on its own line under the label, not beside
   it -- beside it, a phone squeezed the label into a one-word column. */
.stackform .checkline { flex-wrap: wrap; }
.stackform .checkline > .muted { flex-basis: 100%; padding-left: 1.6rem;
  font-size: 0.85rem; margin-top: -0.2rem; }
.formfoot {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  padding-top: 0.25rem;
}
.formfoot button {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--pane);
  color: var(--accent);
  cursor: pointer;
}
.formfoot button:hover { border-color: var(--accent); }
.configsection.danger { border-top: 1px solid var(--line); padding-top: 1rem; }
.dangerbtn { color: #b4432f !important; }
.dangerbtn:hover { border-color: #b4432f !important; }

.passkeymeta { font-size: 0.75rem; }
.passkeyadd { padding-top: 0.5rem; }
.userlist li {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.userlist .username { flex: 1; }
.newpassword {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.5;
}
.passwordvalue {
  display: block;
  margin: 0.4rem 0;
  padding: 0.4rem 0.6rem;
  font-family: ui-monospace, monospace;
  font-size: 1.05rem;
  background: var(--bg);
  border-radius: 4px;
  user-select: all;
  word-break: break-all;
}

/* --- sign in ------------------------------------------------------------- */

.loginbody { display: grid; place-items: center; padding: 1.5rem; }
.loginbox {
  width: min(23rem, 100%);
  padding: 1.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--pane);
  text-align: center;
}
.loginmark { display: block; margin: 0 auto 0.5rem; color: var(--accent); }
.loginbox h1 { margin-bottom: 1.25rem; }
.loginerror { margin-bottom: 0.75rem; font-size: 0.9rem; }
.loginform { display: flex; flex-direction: column; gap: 0.7rem; text-align: left; }
.loginform label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.loginform input {
  font: inherit;
  font-size: 1rem;
  padding: 0.5rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.loginform input:focus { outline: 1px solid var(--accent); }
.loginform button, .loginalt button {
  font: inherit;
  font-size: 0.95rem;
  padding: 0.5rem 1rem;
  margin-top: 0.3rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  color: var(--accent);
  cursor: pointer;
}
.loginform button:hover, .loginalt button:hover { border-color: var(--accent); }
.loginalt { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.4rem; }
.passkeynote { font-size: 0.78rem; line-height: 1.5; margin-top: 0.75rem; }

/* --- phones and narrow windows ------------------------------------------- */
/* The three regions stop being columns and become: menu behind a hamburger,
   the open day (if one is) pinned at the top, content filling the rest.
   Inside content the panes stay side by side but become a swipeable row, so
   a day and its transcript are one flick apart rather than stacked out of
   sight. */

@media (max-width: 820px) {
  body { height: 100dvh; }
  .hamburger { display: flex; }
  header { padding: 0.5rem 0.9rem; }
  h1 { font-size: 1.2rem; }

  .layout {
    display: flex;
    flex-direction: column;
    position: relative;
  }
  .layout > .splitter { display: none; }

  /* The menu is a drawer here, not a column, so there is no strip of screen
     for a rail to reclaim — and the button that makes one would do nothing. */
  .railtoggle { display: none; }

  #pane-menu {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    width: min(17rem, 82vw);
    transform: translateX(-102%);
    transition: transform 0.18s ease;
    border-right: 1px solid var(--line);
    box-shadow: 0 0 2rem rgba(0, 0, 0, 0.25);
    padding-top: 0.5rem;
  }
  body.menu-open #pane-menu { transform: none; }
  #menu-scrim {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(0, 0, 0, 0.35);
  }
  @media (prefers-reduced-motion: reduce) {
    #pane-menu { transition: none; }
  }

  /* The side slot sits above the content it belongs to, and takes at most
     half the screen so the list underneath stays reachable. */
  #pane-side {
    flex: none;
    border-right: none;
    border-bottom: 1px solid var(--line);
    max-height: 55vh;
  }

  #content { flex: 1; min-height: 0; }

  /* Composing on a phone: the day is the screen. Guarded on the pane holding
     something, as the wide layout's rule is — see the compose section. */
  body.compose .layout:has(> #pane-side:not(:empty)) > #pane-side {
    max-height: none;
    flex: 1;
    border-bottom: none;
  }
  body.compose .layout:has(> #pane-side:not(:empty)) > #content { display: none; }

  /* Panes keep their left-to-right order; the row scrolls and snaps. */
  .panes, .panes-library {
    display: flex;
    grid-template-columns: none;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }
  .panes > *, .panes-library > * {
    flex: 0 0 86%;
    scroll-snap-align: start;
    overflow-y: auto;
  }
  .panes > .splitter { display: none; }
  .daypage { padding: 0 0.9rem 2rem; }
  .dayhead { padding-top: 0.7rem; }

  .configpage, .importpage { padding: 0 0.9rem 2rem; }
  .segments { padding: 0 0.9rem; }
}

/* Very narrow: one pane fills the screen, still swipeable. */
@media (max-width: 480px) {
  .panes > *, .panes-library > * { flex: 0 0 94%; }
  header .whoami { max-width: 30vw; }
}

/* Last-resort status surface when the pane has no .recstate of its own. */
#record-toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  z-index: 60;
  max-width: min(28rem, 92vw);
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--pane);
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.25);
  font-size: 0.85rem;
  line-height: 1.45;
}
#record-toast.error { border-color: #b4432f; color: #b4432f; }

/* --- the full-screen recorder (the Record menu page) ---------------------- */
/* One column of oversized targets: whichever buttons the state shows share
   the leftover height, so on a phone they are the screen. app.js sets
   data-state on #fsrec; these rules show the controls each state owns. */

.recordpage {
  height: 100%;
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1rem 1.25rem 1.25rem;
}
.recordpage .fsclock {
  font-size: clamp(2.5rem, 12vw, 4rem);
  line-height: 1.1;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.recordpage .fswave {
  flex: none;
  width: 100%;
  height: 72px;
}
.recordpage .fsnote { font-size: 0.85rem; text-align: center; }
.recordpage .fssaved { text-align: center; font-size: 1.1rem; color: var(--accent); }
.recordpage .fsbtn {
  font: inherit;
  font-size: 1.6rem;
  flex: 1;
  width: 100%;
  min-height: 4.5rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--pane);
  color: var(--accent);
  cursor: pointer;
  touch-action: manipulation;
}
.recordpage .fsbtn-record, .recordpage .fsbtn-new {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.recordpage .fsbtn-stop { color: #b4432f; border-color: #b4432f; }
.recordpage .fsbtn-delete { color: #b4432f; }
.recordpage .fsbtn-save { border-color: var(--accent); }
.recordpage .fsbtn-journal {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
/* Journal-only asks for a deletion, so it doesn't compete with the filled
   button above it: outlined, shorter, and its longer label in a smaller face. */
.recordpage .fsbtn-journalonly {
  flex: none;
  font-size: 1.05rem;
  min-height: 3.4rem;
  border-color: var(--accent);
}
.recordpage .fsrow { flex: 1; display: flex; gap: 0.9rem; }
.recordpage .fsrow .fsbtn { min-width: 0; }
/* The device-recorder handoff is a <label>, so it centers its text itself. */
.recordpage label.fsbtn { display: grid; place-items: center; }

#fsrec .fsclock, #fsrec .fswave, #fsrec .fssaved,
#fsrec > .fsbtn, #fsrec .fsrow { display: none; }
#fsrec[data-state="idle"] .fsbtn-record { display: block; }
#fsrec[data-state="recording"] .fsclock,
#fsrec[data-state="review"] .fsclock,
#fsrec[data-state="saving"] .fsclock,
#fsrec[data-state="done"] .fsclock { display: block; }
#fsrec[data-state="recording"] .fswave { display: block; }
#fsrec[data-state="recording"] .fsbtn-stop { display: block; }
#fsrec[data-state="review"] .fsrow { display: flex; }
#fsrec[data-state="review"] .fsbtn-journal { display: block; }
#fsrec[data-state="review"] .fsbtn-journalonly { display: block; }
#fsrec[data-state="done"] .fssaved { display: block; }
#fsrec[data-state="done"] .fsbtn-new { display: block; }
#fsrec[data-state="recording"] .fsbtn-stop { animation: pulse 1.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  #fsrec[data-state="recording"] .fsbtn-stop { animation: none; }
}

/* --- feedback, and the privacy page -------------------------------------- */

.privacynote {
  font-size: 0.85rem;
  line-height: 1.55;
  padding: 0.6rem 0.75rem;
  margin-bottom: 1rem;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border-radius: 0 4px 4px 0;
}
.fbform { max-width: 34rem; }
.fbform textarea {
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.55;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.6rem;
  resize: vertical;
}
.fbform textarea:focus { outline: 1px solid var(--accent); }
.fbthanks { color: var(--accent); margin-bottom: 1rem; }

.fbrecord { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.fbrecord .fbclip { display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; }
/* One control at a time: offer, in progress, or attached. */
.fbrecord [data-fb="stop"], .fbrecord .fbclip { display: none; }
.fbrecord[data-state="recording"] [data-fb="start"] { display: none; }
.fbrecord[data-state="recording"] [data-fb="stop"] { display: inline-block; }
.fbrecord[data-state="clip"] [data-fb="start"] { display: none; }
.fbrecord[data-state="clip"] .fbclip { display: flex; }

.fblist { margin-top: 0.5rem; }
.fblist li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  line-height: 1.5;
}
.fblist .fbwhen, .fblist .fbstate { font-size: 0.78rem; margin-right: 0.6rem; }
.fblist .fbtext { white-space: pre-wrap; margin: 0.25rem 0; }
.fblist .fbaudio { font-size: 0.78rem; }
.fblist audio { width: 100%; max-width: 24rem; height: 2rem; margin: 0.3rem 0; }
.fblist.admin .fbhead { display: flex; gap: 0.6rem; align-items: baseline; flex-wrap: wrap; }
.fblist .fbitem.is-done { opacity: 0.6; }
.resetnote { font-size: 0.85rem; margin-top: 0.6rem; line-height: 1.5; }

.privacypage { max-width: 38rem; }
.privacypage .lede { font-size: 1rem; line-height: 1.6; margin-bottom: 0.5rem; }
.privacypage .configsection > .muted { font-size: 0.9rem; line-height: 1.65; }
.privacypage .privacyfoot { font-size: 0.85rem; padding-top: 0.5rem; }
.menufoot .privacylink { cursor: pointer; }

/* --- journal list in the main pane --------------------------------------- */

.journalpage { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.journalhead { flex: none; }
.journalhead h2 { padding-bottom: 0.25rem; }
.journalpage .daylist { flex: 1; overflow-y: auto; }
.journalpage .day-row,
.journalpage .adddate,
.journalpage .datefilter { max-width: 34rem; }

/* --- deleting, and the native recorder handoff --------------------------- */

.recactions { display: flex; gap: 0.9rem; padding-top: 0.35rem; }
.recactions .injournal { font-size: 0.8rem; }
.linky.danger:hover, .rerun.danger:hover { color: #b4432f; border-color: #b4432f; }
.audiogone { font-size: 0.85rem; font-style: italic; }
.recnote { font-size: 0.75rem; line-height: 1.45; padding: 0.35rem 0.75rem 0; }

/* A file input styled as a button: the device-recorder handoff. */
.nativerec { display: inline-block; }
.nativerec label { cursor: pointer; display: inline-block; }
.nativerec.alt { margin-top: 0.5rem; }

.libentry { display: flex; align-items: center; }
.libentry .row { flex: 1; min-width: 0; }
.dayfiles .filename { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* --- entries in read mode, and the day's keyword mentions ---------------- */

.entrystream {
  padding: 0.2rem 0.1rem;
  line-height: 1.65;
  font-size: 0.95rem;
}
.streamline {
  white-space: pre-wrap;
  margin-bottom: 0.5rem;
}
.streamline .ts {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  margin-right: 0.25rem;  /* a real space follows it in the markup */
  vertical-align: 0.08em;
}
.entrystream mark { border-radius: 2px; padding: 0 2px; color: inherit; }
/* The box's last autosave, shown where it would land in the stream. Dashed
   and set off from the margin, so it never passes for something saved. */
.streamline.draft {
  padding-left: 0.6rem;
  border-left: 3px dashed color-mix(in srgb, var(--accent) 60%, transparent);
}
.streamline .draftmark, .streamline .importmark {
  display: block;
  white-space: normal;  /* the stream is pre-wrap; this note isn't the entry */
  font-size: 0.72rem;
  font-style: italic;
  margin-top: 0.15rem;
}
.draftnote { font-size: 0.85rem; font-style: italic; line-height: 1.5; margin-bottom: 1rem; }
.daysection h3 .linky { margin-left: 0.6rem; text-transform: none; letter-spacing: 0; }

.daymentions li {
  padding: 0.4rem 0 0.4rem 0.6rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.5;
}
.daymentions .meta { display: block; font-size: 0.75rem; }

/* --- naming a voice ------------------------------------------------------ */

.speakerlink {
  font: inherit;
  border: none;
  background: none;
  padding: 0;
  margin-right: 0.3rem;
  color: var(--accent);
  cursor: pointer;
  border-bottom: 1px dotted currentColor;
}
.speakerlink:hover { border-bottom-style: solid; }
.speakerbox, .voiceconflict {
  margin: 0 1.25rem 0.75rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 6%, var(--pane));
  font-size: 0.9rem;
  line-height: 1.5;
}
.speakerbox .speakerrename { flex-wrap: wrap; }
.speakerbox label { font-size: 0.8rem; }
.voiceconflict { list-style: none; }
.conflictchoices {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0.6rem 0;
  align-items: center;
}
.conflictchoices form { display: flex; gap: 0.4rem; align-items: center; }
.conflictchoices button {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--pane);
  color: var(--accent);
  cursor: pointer;
}
.conflictchoices button:hover { border-color: var(--accent); }
.conflictchoices input {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.25rem 0.4rem;
  width: 9rem;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.speakerrename .saved { font-size: 0.75rem; }
.speakerrename .meBtn { font-weight: 600; color: var(--bg); background: var(--accent);
  border-color: var(--accent); }
.speakerdone { padding: 0.5rem 1.25rem; }

/* --- video recordings ---------------------------------------------------- */

.dayvideo {
  width: 100%;
  max-height: 15rem;
  background: #000;
  border-radius: 4px;
}
.playerbar .playervideo {
  width: 100%;
  min-width: 0;
  /* Full width now that it has its own row, but never so tall that it
     crowds out the transcript on a short screen. */
  max-height: min(11rem, 30vh);
  background: #000;
  border-radius: 4px;
}

/* --- grouped search results ---------------------------------------------- */

.results .resultgroup {
  font-size: 0.75rem;
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 1.1rem 0 0.5rem;
}
.results .resultgroup:first-of-type { margin-top: 0.6rem; }

/* --- usage metrics (admin) ------------------------------------------------ */

.statrow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  list-style: none;
  margin: 0.9rem 0 1.2rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.statrow li { display: flex; flex-direction: column; gap: 0.1rem; }
.statrow .statnum {
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  line-height: 1.1;
}
.statrow .muted { font-size: 0.78rem; }

/* The table is the one wide thing in the pane; let it scroll on its own
   rather than pushing the whole layout sideways on a phone. */
.tablewrap { overflow-x: auto; }
table.metrics {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  white-space: nowrap;
}
table.metrics th,
table.metrics td {
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
table.metrics th {
  font-weight: normal;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
table.metrics .num { text-align: right; font-variant-numeric: tabular-nums; }
table.metrics tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
table.metrics tfoot td {
  border-top: 1px solid var(--line);
  border-bottom: none;
  color: var(--muted);
}
table.metrics .pend { font-size: 0.78rem; }

/* --- reminders ---------------------------------------------------------- */

/* The alert bar sits between the header and the layout. It's absent from the
   DOM when nothing is due, so it costs no height on an ordinary day. */
.alertbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1.25rem;
  background: color-mix(in srgb, #c2410c 14%, var(--bg));
  border-bottom: 1px solid color-mix(in srgb, #c2410c 35%, var(--line));
  font-size: 0.9rem;
}
.alertbar .alerticon {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: #c2410c;
  color: #fff;
  font-weight: bold;
  font-size: 0.8rem;
  display: grid;
  place-items: center;
}
.alertbar .alerttext { flex: 1; min-width: 0; }
.alertbar .alertopen {
  flex: none;
  cursor: pointer;
  color: var(--accent);
  text-decoration: underline;
}

.reminderadd {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.75rem 0;
}
.reminderadd input[name="text"] { flex: 1 1 18rem; }
.notifyline { display: flex; gap: 0.5rem; align-items: center; min-height: 1.4rem; }

.reminderlist { list-style: none; padding: 0; margin: 0.5rem 0; }
.reminder {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--line);
}
.reminder .rbody { flex: 1; min-width: 0; }
.reminder .rtext { display: block; overflow-wrap: anywhere; }
.reminder.done .rtext { text-decoration: line-through; color: var(--muted); }

/* A round empty box that fills in when you check it. */
.tickbox {
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.1rem;
  border: 1.5px solid var(--muted);
  border-radius: 50%;
  background: none;
  cursor: pointer;
  color: var(--pane);
  font-size: 0.75rem;
  line-height: 1;
  padding: 0;
}
.tickbox:hover { border-color: var(--accent); }
.tickbox.ticked { background: var(--accent); border-color: var(--accent); }

.rtags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.2rem; }
.rtags .tag {
  font-size: 0.72rem;
  padding: 0.05rem 0.4rem;
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.rtags .tag.bad {
  color: #c2410c;
  border-color: color-mix(in srgb, #c2410c 45%, var(--line));
}
.rtags .tag.warn {
  color: #a16207;
  border-color: color-mix(in srgb, #a16207 45%, var(--line));
}
.rtags .tag.ok { color: var(--muted); }
.rtags a.tag { cursor: pointer; }
.rtags a.tag:hover { border-color: var(--accent); color: var(--accent); }
.rtags button.tag { background: none; font: inherit; font-size: 0.72rem; cursor: pointer; }
.rtags button.tag:hover { border-color: var(--accent); color: var(--accent); }
.reminder .gmatch { display: block; font-size: 0.78rem; margin-top: 0.2rem; }
.reminder .gmatch button.linky { color: var(--accent); }
.googleline .warn { color: #a16207; }

.reminder .rdeadline input { font-size: 0.75rem; padding: 0.1rem 0.25rem; }
.reminder .rdelete { flex: none; font-size: 1.1rem; line-height: 1; color: var(--muted); }
.reminder .rdelete:hover { color: #c2410c; }
.reminder.overdue { background: color-mix(in srgb, #c2410c 6%, transparent); }
.reminder.duetoday { background: color-mix(in srgb, #a16207 6%, transparent); }

/* The line the completed ones live below. */
.completedline {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 1.5rem 0 0.25rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.completedline::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.menulist .badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.3rem;
  border-radius: 0.6rem;
  background: #c2410c;
  color: #fff;
  font-size: 0.7rem;
}

.fieldhint { display: block; font-size: 0.75rem; margin-top: 0.15rem; }

/* --- archive ------------------------------------------------------------ */

.archiveall { margin: 0.75rem 0; }
.archiveactions { display: flex; gap: 0.75rem; align-items: center; margin-top: 0.4rem; }
.archivedel { color: var(--muted); }
.archivedel:hover { color: #c2410c; }
.formnote { margin: 0.5rem 0; }

/* --- analysis ------------------------------------------------------------ */

/* `.configpage` caps at 34rem, which suits a settings form and starves a
   chat: a 13rem conversation list beside it left ~17rem for the conversation
   itself. These two pages are the width of whatever pane they're in. */
.analysispage, .modelspage { max-width: none; }

.analysiswrap { display: flex; gap: 1rem; align-items: flex-start; }
.convolist { flex: 0 0 13rem; min-width: 0; }
.convolist ul { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.convolist li {
  display: flex; align-items: center; gap: 0.3rem;
  padding: 0.3rem 0.4rem; border-radius: 0.3rem; font-size: 0.85rem;
}
.convolist li.active { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.convolist li a {
  flex: 1; cursor: pointer; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.convolist .convodel { color: var(--muted); }
.newconvo { width: 100%; }

/* Wide enough to read comfortably, capped so a long answer doesn't stretch
   into a single line across a big monitor. */
.chatpane { flex: 1; min-width: 0; max-width: 56rem; display: flex; flex-direction: column; }
.chatlog {
  min-height: 12rem; max-height: 60vh; overflow-y: auto;
  padding: 0.5rem; border: 1px solid var(--line); border-radius: 0.4rem;
  background: var(--pane);
}
.bubble { margin: 0.5rem 0; padding: 0.5rem 0.7rem; border-radius: 0.5rem; }
.bubble.user { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.bubble.assistant { background: color-mix(in srgb, var(--fg) 4%, transparent); }
.bubble.error .bubbletext { color: #c2410c; }
.bubbletext { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.thinking .bubbletext { color: var(--muted); }

.sources { margin-top: 0.4rem; font-size: 0.8rem; }
.sources summary { cursor: pointer; color: var(--muted); }
.sources ol { margin: 0.3rem 0 0; padding-left: 1.2rem; }
.sources li { margin: 0.2rem 0; }
.sources a { cursor: pointer; color: var(--accent); }

.askform { margin-top: 0.6rem; display: flex; flex-direction: column; gap: 0.4rem; }
.askform textarea { width: 100%; resize: vertical; }
.askfoot { display: flex; align-items: center; gap: 0.75rem; }
.askfoot button { margin-left: auto; }
.weblabel { font-size: 0.85rem; }
.tinynote { font-size: 0.78rem; }
.webnote { margin-top: 0.3rem; }
.analysismeta .warn { color: #a16207; }

.modelspage .toobig td { opacity: 0.55; }
.modelspage .tag { font-size: 0.72rem; padding: 0.05rem 0.4rem; border-radius: 0.75rem;
                   border: 1px solid var(--line); }
.modelspage .tag.ok { color: var(--accent); border-color: var(--accent); }
.modelspage .tag.bad { color: #c2410c; border-color: #c2410c; }
.modelspage .tag.warn { color: #a16207; border-color: #a16207; }

/* Each installed model expands to a plain-language description, built from its
   own metadata. Keep the numeric columns aligned to the summary line whether
   a row is open or closed. */
.modelspage table.metrics td { vertical-align: top; }
.modelspage .modelinfo summary { cursor: pointer; width: fit-content; }
.modelspage .modelinfo summary:hover { color: var(--accent); }
.modelspage .modeldesc {
  white-space: normal;      /* the table sets nowrap; let prose wrap */
  max-width: 34rem;
  margin: 0.35rem 0 0.1rem;
  padding-left: 1.15rem;    /* line up under the summary text, past the marker */
  font-size: 0.8rem;
  line-height: 1.5;
}

@media (max-width: 45rem) {
  .analysiswrap { flex-direction: column; }
  .convolist { flex: none; width: 100%; }
}

/* --- the journal toggle --------------------------------------------------- */

/* A <button> in a list of <a>s: strip the control chrome so it sits in the
   menu like everything else, then add back what marks it as a toggle. */
.menulist button.row {
  width: 100%;
  font: inherit;
  font-size: 0.88rem;  /* after the reset, or Journal and Write stay body-size */
  text-align: left;
  border: none;
  cursor: pointer;
}
.journaltoggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent) !important;
  border-radius: 0.3rem;
}
.journaltoggle:hover {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
/* Open is unmistakable: the row fills solid in the accent — nothing else in
   the menu is ever filled — its text and icons go light, and the label grows
   an "open" tag. A tint and a tiny triangle used to carry this, and didn't. */
.journaltoggle.open,
.journaltoggle.open:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent) !important;
}
.journaltoggle.open .togglelabel::after {
  content: "open";
  float: right;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.85;
  padding-top: 0.15rem;
}

/* The arrow: a chevron, heavier than the other icons. Points right when shut
   — "there's a pane over there" — and swings down when the pane is showing,
   the way a disclosure triangle does. */
.journaltoggle .toggleicon {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.1rem;
  height: 1.1rem;
  color: var(--accent);
  transition: transform 0.15s ease;
}
.journaltoggle .toggleicon .mi { width: 1.1rem; height: 1.1rem; stroke-width: 2.8; }
.journaltoggle.open .toggleicon { transform: rotate(90deg); color: inherit; }
@media (prefers-reduced-motion: reduce) {
  .journaltoggle .toggleicon { transition: none; }
}
.journaltoggle .togglelabel { flex: 1; }

/* --- copy buttons --------------------------------------------------------- */

/* One behavior everywhere a long block of text lives (app.js): the button
   names the block, the block's text goes to the clipboard, the button says
   so for a moment. While the text is being read the block's own controls
   and notes step aside — innerText follows display — so they don't come
   along with it. */
.copybtn.copied { color: var(--accent); }
.copying .draftmark, .copying .copybtn, .copying .copy-skip { display: none !important; }
.bubble .bubblecopy { display: block; margin-top: 0.3rem; font-size: 0.75rem; }
.bubble .bubblemeta { font-size: 0.72rem; font-style: italic; margin-top: 0.3rem; }
.askfoot .engineselect { font: inherit; font-size: 0.85rem; color: inherit;
  background: var(--bg); border: 1px solid var(--line); border-radius: 4px;
  padding: 0.15rem 0.3rem; max-width: 100%; }
.enginenote { margin-top: 0.3rem; }
.notesactions, .viewactions { margin: 0.35rem 0; }
.viewactions { padding: 0 0.1rem; }

/* --- compose: the day pane fills the screen ------------------------------ */

/* `compose` on <body> hands the content's column to the side pane, for
   writing something longer than a line. Guarded on the pane holding
   something, for the same reason the collapsed layout above is: with nothing
   in #pane-side the content is the only pane there is, and hiding it would
   leave a blank screen. app.js drops the class when the pane closes. */
body.compose .layout:has(> #pane-side:not(:empty)) {
  grid-template-columns: var(--w-menu, 150px) 1fr;
}
body.compose .layout:has(> #pane-side:not(:empty)) > #content,
body.compose .layout:has(> #pane-side:not(:empty)) > .splitter { display: none; }
body.compose .daypage { max-width: 62rem; width: 100%; margin: 0 auto; }
body.compose .entryform textarea { min-height: 55vh; font-size: 1.05rem; }

/* --- transcript: hiding times and speakers -------------------------------- */

/* display:none rather than visibility or a color — hidden text must not end
   up in a copy, which is the whole reason these switches exist. */
.transcriptwrap.hide-ts .ts { display: none; }
.transcriptwrap.hide-speakers .speaker,
.transcriptwrap.hide-speakers .segment .speakerlink { display: none; }
.showtoggle { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.showtoggle input { vertical-align: middle; }

/* The bar that appears under a selection in a transcript. */
#selbar {
  position: absolute;
  z-index: 60;
  display: flex;
  gap: 0.35rem;
  padding: 0.25rem;
  background: var(--pane);
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}
#selbar button {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.25rem;
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  white-space: nowrap;
}
#selbar button:hover { border-color: var(--accent); color: var(--accent); }
#selbar button.primary { color: var(--accent); border-color: var(--accent); }
#selbar button:disabled { opacity: 0.6; cursor: default; }

/* --- the docked recorder -------------------------------------------------- */

/* Absent entirely on a wide screen: there the Record page has room to be a
   page. app.js reads this computed display rather than repeating the
   breakpoint. */
#recdock { display: none; }

@media (max-width: 820px) {
  #recdock {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    background: var(--pane);
    border-top: 1px solid var(--line);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.16);
    /* Clears the home indicator on a phone without eating space elsewhere. */
    padding-bottom: env(safe-area-inset-bottom, 0);
    transition: transform 0.18s ease;
  }
  .recdock-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.9rem;
    min-height: 3rem;
  }
  .recdock-quick {
    flex: 1;
    font: inherit;
    font-size: 0.95rem;
    padding: 0.45rem 0.9rem;
    border: 1px solid var(--accent);
    border-radius: 0.35rem;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent);
    cursor: pointer;
  }
  .recdock-toggle {
    flex: none;
    font: inherit;
    width: 2.4rem;
    height: 2.2rem;
    border: 1px solid var(--line);
    border-radius: 0.35rem;
    background: var(--bg);
    color: var(--muted);
    cursor: pointer;
  }
  .recdock-toggle:hover { color: var(--accent); border-color: var(--accent); }

  .recdock-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.18s ease;
  }
  #recdock.open .recdock-body {
    max-height: 70vh;
    overflow-y: auto;
    border-top: 1px solid var(--line);
  }
  /* Recording is in progress: the quick button would be a second, conflicting
     control, so the tab becomes just the minimize arrow. */
  #recdock.open .recdock-quick { display: none; }
  #recdock .recordpage { padding: 0.75rem 0.9rem 1rem; }

  /* Keep the last line of any pane reachable above the docked bar. */
  #content, #pane-side { padding-bottom: 3.5rem; }

  @media (prefers-reduced-motion: reduce) {
    #recdock, .recdock-body { transition: none; }
  }
}

/* --- heard times to check (timecheck.py) ---------------------------------- */
.reddot {
  display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%;
  background: #c62828; vertical-align: middle; flex: none;
}
.menulist .row .reddot { margin-left: auto; }
.file-row.timeq { background: color-mix(in srgb, #c62828 9%, transparent); }
.file-row.timeq.active { background: color-mix(in srgb, #c62828 18%, transparent); }
.timeqlist { margin: 0.25rem 0.5rem 0.5rem; padding: 0.4rem 0.5rem;
  border: 1px solid color-mix(in srgb, #c62828 40%, var(--line)); border-radius: 4px;
  font-size: 0.85rem; }
.timeqlist .row { padding: 0.25rem 0.25rem; display: block; }
.timeqbox { margin: 0.5rem 0 1rem; padding: 0.6rem 0.75rem;
  border: 1px solid color-mix(in srgb, #c62828 45%, var(--line));
  background: color-mix(in srgb, #c62828 6%, var(--pane)); border-radius: 4px; }
.timeqbox p { margin-bottom: 0.4rem; }
.timeqactions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.timeqactions button:not(.linky) { font: inherit; font-size: 0.9rem; padding: 0.3rem 0.7rem;
  border: 1px solid var(--line); border-radius: 4px; background: var(--pane);
  color: var(--accent); cursor: pointer; }
.timeqactions button.primary { border-color: var(--accent); font-weight: bold; }

/* --- the local model's summary atop a transcript (summaries.py) ---------- */
.recsummary { margin: 0.5rem 0 1rem; padding: 0.6rem 0.75rem;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, var(--pane)); border-radius: 0 4px 4px 0; }
.recsummary > summary { cursor: pointer; margin-bottom: 0.3rem; }
.recsummary p { margin-bottom: 0.4rem; }
.recsummary ul { list-style: disc; margin: 0 0 0.4rem 1.2rem; }
.recsummary li { margin-bottom: 0.2rem; }
.recsummary-pending { font-style: italic; margin: 0.3rem 0 0.8rem; }
