@font-face {
  font-family: 'Fraunces';
  src: url('/fonts/fraunces-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('/fonts/fraunces-latin-wght-italic.woff2') format('woff2');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --paper: #faf6ef;
  --paper-deep: #f3ecdf;
  --card: #fffdf9;
  --ink: #2a2520;
  --ink-2: #6a5f54;
  --ink-3: #8f8375;
  --line: #e9e0d1;
  --line-strong: #d9cdb9;
  --accent: #b9502f;
  --accent-ink: #9c3f22;
  --accent-soft: #f8e6dc;
  --on-accent: #fff9f3;
  --sage: #4f7a5e;
  --sage-soft: #e3eee4;
  --amber: #a26a12;
  --amber-soft: #f8ecd2;
  --danger: #b0352c;
  --danger-soft: #f9e2df;
  --shadow-sm: 0 1px 2px rgb(70 50 30 / 6%);
  --shadow-md: 0 1px 2px rgb(70 50 30 / 5%), 0 8px 24px -10px rgb(70 50 30 / 14%);
  --shadow-lg: 0 2px 6px rgb(40 28 16 / 8%), 0 24px 60px -16px rgb(40 28 16 / 30%);
  --avatar-s: 62%;
  --avatar-l: 86%;
  --avatar-ink-l: 30%;
  --serif: 'Fraunces', ui-serif, Georgia, serif;
  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b1815;
    --paper-deep: #151310;
    --card: #24201c;
    --ink: #f1eae0;
    --ink-2: #b8ac9d;
    --ink-3: #91867a;
    --line: #342e28;
    --line-strong: #463e36;
    --accent: #e0805f;
    --accent-ink: #eb9a7d;
    --accent-soft: #3f2a21;
    --on-accent: #241209;
    --sage: #8cb898;
    --sage-soft: #24332a;
    --amber: #dcae5b;
    --amber-soft: #3a2e17;
    --danger: #ec8a80;
    --danger-soft: #3d221f;
    --shadow-sm: none;
    --shadow-md: 0 8px 24px -12px rgb(0 0 0 / 50%);
    --shadow-lg: 0 24px 60px -16px rgb(0 0 0 / 70%);
    --avatar-s: 34%;
    --avatar-l: 26%;
    --avatar-ink-l: 84%;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.012em; margin: 0; }
h1 { font-size: 2.15rem; line-height: 1.12; }
h2 { font-size: 1.16rem; line-height: 1.3; }
h3 { font-size: 1rem; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
a.link { color: var(--accent-ink); }
a.link:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 0.86rem; }
.xsmall { font-size: 0.78rem; }
.serif { font-family: var(--serif); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- shell ---- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
  padding: 20px 14px;
  background: var(--paper-deep);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 16px; font-family: var(--serif); font-size: 1.4rem; font-weight: 500; letter-spacing: -0.02em; }
.brand img { width: 28px; height: 28px; }
.search-trigger {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; margin-bottom: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink-3); cursor: pointer; text-align: left; font-size: 0.88rem;
}
.search-trigger:hover { border-color: var(--line-strong); color: var(--ink-2); }
.search-trigger svg { width: 16px; height: 16px; flex: none; }
.search-trigger span { white-space: nowrap; }
.search-trigger kbd { margin-left: auto; }
kbd { font: 500 0.72rem var(--sans); padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--ink-2); background: var(--paper); }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 10px;
  color: var(--ink-2); font-weight: 500; font-size: 0.93rem;
}
.nav-link:hover { background: rgb(128 100 70 / 9%); color: var(--ink); }
.nav-link.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.nav-link svg { width: 18px; height: 18px; flex: none; }
.nav-count { margin-left: auto; background: var(--accent); color: var(--on-accent); font-size: 0.72rem; font-weight: 600; padding: 0 7px; border-radius: 99px; line-height: 1.5; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.main { padding: 36px 44px 96px; min-width: 0; }
.page { max-width: 1040px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; animation: rise 0.22s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }

.mobile-bar { display: none; }
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .main { padding: 20px 16px 120px; }
  h1 { font-size: 1.75rem; }
  .mobile-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--paper-deep); border-top: 1px solid var(--line);
  }
  .mobile-bar .nav-link { flex-direction: column; gap: 2px; padding: 4px 8px; font-size: 0.68rem; position: relative; }
  .mobile-bar .nav-count { position: absolute; top: 0; right: 2px; margin: 0; }
}

/* Clear the notch and home bar when installed on a phone's home screen. */
@media (max-width: 820px) { .main { padding-top: calc(20px + env(safe-area-inset-top)); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); } }

/* ---- sign-in page ---- */
.sign-in { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.sign-in .card { width: min(380px, 100%); }
.sign-in-brand { justify-content: center; }
.danger-text { color: var(--danger, #b3402a); }
[hidden] { display: none !important; }

/* ---- primitives ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 7px 13px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--card); color: var(--ink); font-weight: 500; font-size: 0.89rem;
  cursor: pointer; white-space: nowrap; transition: background 0.12s, border-color 0.12s, transform 0.06s;
}
.btn:hover { background: var(--paper-deep); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.07); background: var(--accent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: rgb(128 100 70 / 10%); color: var(--ink); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 4px 9px; font-size: 0.8rem; border-radius: 8px; }
.btn.icon { padding: 5px; }
.btn.add-recording { background: var(--accent); border-color: transparent; color: var(--on-accent); width: 100%; padding: 10px; font-weight: 600; }
.btn.add-recording:hover { filter: brightness(1.07); background: var(--accent); }
/* Uploading is done from a computer: long files need more memory than a phone browser has to spare. */
@media (hover: none) and (pointer: coarse) { .computer-only { display: none !important; } }
.drop-zone { display: block; position: relative; padding: 22px 14px; text-align: center; border: 1.5px dashed var(--line-strong); border-radius: 10px; cursor: pointer; color: var(--ink-2); overflow-wrap: anywhere; }
.drop-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop-zone.over, .drop-zone:focus-within { border-color: var(--accent); }
.drop-zone.chosen { border-style: solid; font-weight: 500; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; min-height: 28px; }
.card-head .btn { flex: none; }
.empty-line { color: var(--ink-3); font-size: 0.9rem; }

.avatar {
  --size: 40px;
  width: var(--size); height: var(--size); border-radius: 50%;
  flex: none; display: inline-grid; place-items: center; overflow: hidden;
  background: hsl(var(--h, 20) var(--avatar-s) var(--avatar-l));
  color: hsl(var(--h, 20) 55% var(--avatar-ink-l));
  font-family: var(--serif); font-weight: 500; font-size: calc(var(--size) * 0.38); letter-spacing: -0.01em;
  user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.xs { --size: 24px; }
.avatar.sm { --size: 32px; }
.avatar.lg { --size: 92px; }

.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; font-size: 0.74rem; font-weight: 500; background: var(--paper-deep); color: var(--ink-2); white-space: nowrap; }
.tag.accent { background: var(--accent-soft); color: var(--accent-ink); }
.tag.sage { background: var(--sage-soft); color: var(--sage); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag svg { width: 12px; height: 12px; }

.banner { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: 12px; background: var(--amber-soft); color: var(--amber); font-size: 0.9rem; }
.banner.danger { background: var(--danger-soft); color: var(--danger); }
.banner.accent { background: var(--accent-soft); color: var(--accent-ink); }
.banner svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.banner .grow { color: var(--ink); }
.banner b { color: inherit; }

/* ---- home ---- */
.hello { font-size: 2.5rem; font-weight: 400; }
.hello em { color: var(--accent-ink); font-style: italic; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1040px) { .home-grid { grid-template-columns: minmax(0, 1fr); } }
.list-row { display: flex; align-items: center; gap: 12px; padding: 9px 8px; margin: 0 -8px; border-radius: 10px; }
a.list-row:hover { background: var(--paper-deep); }
.when-pill { font-size: 0.78rem; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.when-pill.soon { color: var(--accent-ink); }
.inbox-cta { display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: var(--accent-soft); border-radius: var(--radius); }
.inbox-cta svg { width: 22px; height: 22px; color: var(--accent-ink); flex: none; }

/* ---- people ---- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.input, .field input, .field select, .field textarea {
  width: 100%; padding: 8px 11px; background: var(--card); border: 1px solid var(--line-strong); border-radius: 10px; outline: none;
}
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.person-card { display: flex; gap: 14px; align-items: center; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s; }
.person-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.person-card .name { font-family: var(--serif); font-size: 1.06rem; font-weight: 500; }
.star { color: var(--accent); }
.star svg { width: 14px; height: 14px; vertical-align: -2px; }

/* ---- person record ---- */
.hero { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.hero-text { flex: 1; min-width: 240px; }
.hero h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nick { font-size: 1.1rem; color: var(--ink-3); font-style: italic; font-weight: 400; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; color: var(--ink-2); font-size: 0.92rem; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-button { background: none; border: 0; padding: 0; border-radius: 50%; cursor: pointer; position: relative; }
.photo-button:hover .avatar { filter: brightness(0.94); }
.record-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1040px) { .record-grid { grid-template-columns: minmax(0, 1fr); } }
.col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.last-talk { background: linear-gradient(180deg, var(--accent-soft), transparent 70%), var(--card); border-color: var(--line-strong); }
.eyebrow { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--accent-ink); }
.last-talk .summary { font-family: var(--serif); font-size: 1.15rem; line-height: 1.5; margin-top: 8px; }
.last-talk h2 { margin-top: 2px; }

.member { display: flex; align-items: center; gap: 11px; padding: 7px 8px; margin: 0 -8px; border-radius: 10px; }
.member:hover { background: var(--paper-deep); }
.member .rm { opacity: 0; margin-left: auto; }
.member:hover .rm, .member .rm:focus-visible { opacity: 1; }
.member-link { display: flex; align-items: center; gap: 11px; min-width: 0; flex: 1; }
.member-name { font-weight: 500; }
.group-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; color: var(--ink-3); margin: 10px 0 2px; }
.group-label:first-child { margin-top: 0; }
.pet-emoji { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--sage-soft); color: var(--sage); flex: none; }
.pet-emoji svg { width: 17px; height: 17px; }

.date-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.date-badge { width: 42px; flex: none; text-align: center; border-radius: 10px; border: 1px solid var(--line); overflow: hidden; background: var(--paper); }
.date-badge .m { display: block; font-size: 0.62rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--on-accent); background: var(--accent); padding: 1px 0; }
.date-badge .d { display: block; font-family: var(--serif); font-size: 1.05rem; line-height: 1.5; }
.date-badge .d.year { font-size: 0.82rem; line-height: 1.92; }

.kv { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 5px 12px; font-size: 0.92rem; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.fact-group { margin-bottom: 12px; }
.fact-group:last-child { margin-bottom: 0; }
.fact { position: relative; display: flex; gap: 8px; align-items: flex-start; padding: 3px 0; }
.sortable { position: relative; }
.sex-mark { display: inline-block; margin-left: 5px; line-height: 1; }
.sex-mark svg { width: 0.82em; height: 0.82em; vertical-align: -0.06em; stroke-width: 2.4; }
.sex-mark.female { color: #c2577f; }
.sex-mark.male { color: #4d7fb5; }
.sortable .sort-grip { position: absolute; left: -20px; top: 3px; width: 20px; height: 24px; padding: 0; justify-content: center; opacity: 0; color: var(--ink-3); cursor: grab; touch-action: none; }
.member.sortable .sort-grip { left: -12px; top: calc(50% - 12px); }
.sortable:hover .sort-grip, .sortable .sort-grip:focus-visible, .sortable.dragging .sort-grip { opacity: 1; }
.sortable.dragging { background: var(--paper); border-radius: 6px; box-shadow: var(--shadow-sm); }
.dragging-note, .dragging-note * { cursor: grabbing !important; -webkit-user-select: none; user-select: none; }
@media (hover: none) { .sortable .sort-grip { opacity: 0.6; } .fact .rm { opacity: 1; } }
.fact .grow { line-height: 1.45; }
.fact .rm { opacity: 0; }
.fact:hover .rm, .fact .rm:focus-visible { opacity: 1; }

.task { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; }
.check { appearance: none; width: 18px; height: 18px; border: 1.5px solid var(--line-strong); border-radius: 6px; background: var(--card); flex: none; cursor: pointer; margin: 2px 0 0; }
.check:hover { border-color: var(--accent); }
.check:checked { background: var(--accent); border-color: var(--accent); }

.timeline { display: flex; flex-direction: column; }
.tl-item { display: grid; grid-template-columns: 76px 16px minmax(0, 1fr); gap: 0 10px; }
.tl-date { font-size: 0.78rem; color: var(--ink-3); text-align: right; padding-top: 3px; line-height: 1.3; }
.tl-rail { position: relative; }
.tl-rail::before { content: ''; position: absolute; left: 7px; top: 12px; bottom: -6px; width: 2px; background: var(--line); }
.tl-item:last-child .tl-rail::before { display: none; }
.tl-rail::after { content: ''; position: absolute; left: 3px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--card); border: 2px solid var(--line-strong); }
.tl-item:first-child .tl-rail::after { background: var(--accent); border-color: var(--accent); }
.tl-body { display: block; padding: 1px 8px 12px; border-radius: 10px; }
.tl-body:hover .tl-title { color: var(--accent-ink); }
.tl-title { font-weight: 500; }

/* ---- conversations ---- */
.conv-row { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.conv-row:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.conv-icon { width: 36px; height: 36px; border-radius: 11px; background: var(--paper-deep); color: var(--ink-2); display: grid; place-items: center; flex: none; }
.conv-icon svg { width: 18px; height: 18px; }
.avatars { display: flex; }
.avatars .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--card); }
.avatars .avatar:first-child { margin-left: 0; }

/* ---- who's speaking ---- */
.speakers-card { border-color: var(--line-strong); }
.speaker-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.speaker-row:first-of-type { border-top: 0; }
.voice-dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 600; font-size: 0.72rem; background: hsl(var(--h) var(--avatar-s) var(--avatar-l)); color: hsl(var(--h) 55% var(--avatar-ink-l)); }
.speaker-quote { font-size: 0.84rem; color: var(--ink-2); font-style: italic; }
.conf { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; }

.transcript { display: flex; flex-direction: column; gap: 2px; }
.turn { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 12px; padding: 7px 8px; margin: 0 -8px; border-radius: 10px; }
.turn:hover { background: var(--paper-deep); }
.turn-who { font-weight: 600; font-size: 0.85rem; color: hsl(var(--h) 48% var(--speaker-l, 36%)); overflow-wrap: anywhere; line-height: 1.35; padding-top: 2px; }
@media (prefers-color-scheme: dark) { .turn-who { --speaker-l: 74%; } }
.turn-who.unknown { color: var(--amber); }
.turn-time { display: block; font-weight: 400; font-size: 0.72rem; color: var(--ink-3); background: none; border: 0; padding: 0; cursor: pointer; }
.turn-time:hover { color: var(--accent-ink); text-decoration: underline; }
.part-break { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 0.74rem; margin: 10px 0 6px; text-transform: uppercase; letter-spacing: 0.06em; }
.part-break::before, .part-break::after { content: ''; flex: 1; height: 1px; background: var(--line); }
@media (max-width: 620px) { .turn { grid-template-columns: minmax(0, 1fr); gap: 0; } }

.progress-steps { display: flex; flex-direction: column; gap: 10px; }
.step { display: flex; align-items: center; gap: 10px; color: var(--ink-3); }
.step.now { color: var(--ink); font-weight: 500; }
.step.done { color: var(--sage); }
.step-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; flex: none; }
.step.now .step-dot { border-color: var(--accent); border-top-color: transparent; animation: spin 0.9s linear infinite; }
.step.done .step-dot { background: var(--sage); border-color: var(--sage); color: var(--card); }
.step-dot svg { width: 12px; height: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- inbox ---- */
.staged-person { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.staged-person:first-of-type { border-top: 0; padding-top: 0; margin-top: 4px; }
.staged-item { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; margin: 6px -4px 0; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); }
.staged-kind { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent-ink); }
.staged-kind svg { width: 16px; height: 16px; }
.staged-main { font-weight: 500; }
.staged-quote { font-size: 0.84rem; color: var(--ink-2); margin-top: 2px; font-style: italic; font-family: var(--serif); }
.staged-actions { display: flex; gap: 4px; flex: none; }
.diff-old { color: var(--ink-3); text-decoration: line-through; }
@media (max-width: 620px) { .staged-item { flex-wrap: wrap; } .staged-actions { width: 100%; justify-content: flex-end; } }

/* ---- dialogs ---- */
dialog {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 18px; padding: 0; width: min(500px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgb(35 25 15 / 38%); backdrop-filter: blur(2px); }
.dialog-form { display: flex; flex-direction: column; max-height: calc(100vh - 50px); }
.dialog-head { padding: 18px 22px 2px; }
.dialog-body { padding: 14px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 13px; }
.dialog-foot { padding: 12px 22px 18px; display: flex; justify-content: flex-end; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label, .field > .label { font-size: 0.82rem; font-weight: 500; color: var(--ink-2); }
.field .hint { font-size: 0.78rem; color: var(--ink-3); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 11px; }
.date-parts { display: grid; grid-template-columns: 1.5fr 0.8fr 1fr; gap: 8px; }
.check-line { display: flex; gap: 9px; align-items: flex-start; font-size: 0.9rem; cursor: pointer; }
textarea { resize: vertical; min-height: 84px; }

.picker-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 4px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-ink); font-size: 0.86rem; font-weight: 500; border: 0; cursor: pointer; }
.chip svg { width: 12px; height: 12px; }
.suggest { border: 1px solid var(--line); border-radius: 10px; margin-top: 4px; max-height: 170px; overflow-y: auto; }
.suggest button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 10px; background: none; border: 0; text-align: left; cursor: pointer; }
.suggest button:hover, .suggest button:focus-visible { background: var(--paper-deep); }

/* ---- palette ---- */
dialog.palette { width: min(580px, calc(100vw - 32px)); margin-top: 11vh; overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.palette-input svg { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.palette-input input { flex: 1; border: 0; background: none; outline: none; font-size: 1.06rem; min-width: 0; }
.palette-results { max-height: 52vh; overflow-y: auto; padding: 6px; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 10px; width: 100%; }
.palette-item.sel, .palette-item:hover { background: var(--paper-deep); }
.palette-hint { padding: 14px 18px; color: var(--ink-3); font-size: 0.88rem; }


.meter { height: 8px; border-radius: 99px; background: var(--paper-deep); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.08s linear; }
.read-this { font-family: var(--serif); font-size: 1.08rem; line-height: 1.55; padding: 12px 16px; border-radius: 12px; background: var(--paper-deep); }

/* ---- toast ---- */
#toasts { position: fixed; top: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--ink); color: var(--paper); padding: 9px 14px; border-radius: 10px; font-size: 0.89rem; box-shadow: var(--shadow-lg); animation: rise 0.18s ease-out; max-width: 380px; }
.toast.err { background: var(--danger); color: #fff; }

.empty { text-align: center; padding: 56px 24px; }
.empty svg { width: 42px; height: 42px; color: var(--line-strong); }
.empty h2 { margin: 10px 0 4px; font-size: 1.3rem; }
.empty .btn { margin-top: 14px; }

.settings-grid { display: flex; flex-direction: column; gap: 20px; max-width: 680px; }
details > summary { cursor: pointer; font-weight: 500; }
audio { width: 100%; height: 36px; }

/* ---- touch screens ---- */
code { overflow-wrap: anywhere; }
/* A long option's text otherwise widens the page in WebKit, even though the box itself fits. */
.field select { max-width: 100%; min-width: 0; contain: paint; text-overflow: ellipsis; }
.list-row > .grow { min-width: 0; }
@media (hover: none) and (pointer: coarse) {
  /* iPhones zoom the whole page when a focused field's text is under 16px. */
  .input, .field input, .field select, .field textarea, .palette-input input { font-size: 16px; }
  select.input, .field select, input.input, .field input:not([type=checkbox]):not([type=radio]):not([type=file]) { min-height: 40px; }
  input.check { width: 24px; height: 24px; }
  .btn.sm { min-height: 34px; }
  .turn-time { padding-block: 6px; }
}
