:root {
  --gold: #B8922A;
  --champagne: #C6AF7A;
  --teal: #0090A8;
  --ink: #1A1A1A;
  --deep-ink: #14161A;
  --paper: #FAF8F4;
  --warm-gray: #C6BEB4;
  --muted: #4A4640;
  --surface: #FFFFFF;
  --danger: #9E3527;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); color-scheme: light; }
body { margin: 0; font-family: "Jost", "Avenir Next", Avenir, "Segoe UI", sans-serif; font-size: 16px; line-height: 1.45; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
button, input, textarea { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
button { min-height: 44px; border: 1px solid var(--gold); border-radius: 10px; padding: 9px 14px; background: var(--gold); color: var(--deep-ink); font-weight: 650; cursor: pointer; }
button:hover { background: var(--deep-ink); border-color: var(--deep-ink); color: #fff; }
button:disabled { cursor: not-allowed; background: #E7E2DA; border-color: var(--warm-gray); color: var(--muted); }
input, textarea { width: 100%; border: 1px solid #81796F; border-radius: 9px; background: var(--surface); color: var(--ink); padding: 11px 12px; }
textarea { resize: vertical; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
.skip-link { position: fixed; z-index: 100; top: -100px; left: 12px; padding: 12px; border-radius: 8px; background: var(--deep-ink); color: #fff; }
.skip-link:focus { top: 12px; }
.sr-only, .visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

.app-header { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px max(16px, env(safe-area-inset-left)); background: var(--deep-ink); color: #fff; }
.wordmark { color: inherit; text-decoration: none; font-size: 11px; letter-spacing: .15em; font-weight: 600; }
.wordmark span { font-weight: 300; }
.app-header p { margin: 0; font-size: 11px; letter-spacing: .14em; color: #E8E1D3; }
.truth { position: sticky; top: 0; z-index: 20; display: grid; gap: 3px; padding: 11px max(16px, env(safe-area-inset-left)); border-bottom: 1px solid var(--champagne); background: #F2EBDD; font-size: 12px; line-height: 1.35; }
.truth span { color: var(--muted); }
main { width: min(100%, 680px); margin: 0 auto; padding: 18px 16px 28px; }
.screen-heading, .visit-title-row, .visit-bar, .section-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.screen-heading { margin-bottom: 12px; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; font-weight: 650; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.8rem, 9vw, 2.5rem); font-weight: 500; letter-spacing: -.035em; line-height: 1; }
h2 { font-size: 1rem; font-weight: 700; }
.icon-button { width: 48px; min-width: 48px; padding: 0; border-radius: 50%; font-size: 30px; font-weight: 300; line-height: 1; }
.icon-button.small { width: auto; min-width: 0; min-height: 36px; border-radius: 999px; padding: 6px 11px; font-size: 13px; font-weight: 650; }
.storage, .muted, .helper { margin: 0; color: var(--muted); font-size: 13px; }
.status { min-height: 1.45em; margin: 0 0 12px; color: var(--teal); font-size: 13px; font-weight: 650; }
.status.is-error { color: var(--danger); }
.visit-list, .task-list, .note-list, .media-grid, .audio-list { padding: 0; margin: 18px 0 0; list-style: none; }
.visit-list { display: grid; gap: 10px; }
.visit-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 14px; border: 1px solid var(--champagne); border-radius: var(--radius); background: var(--surface); }
.visit-card h2 { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.visit-card p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.visit-card button { min-height: 40px; }
.empty-state { margin-top: 22px; padding: 22px 18px; border: 1px dashed var(--warm-gray); border-radius: var(--radius); color: var(--muted); }
.empty-state h2 { color: var(--ink); margin-bottom: 8px; }
.empty-state p { margin: 0; }

.visit-bar { margin-bottom: 22px; }
.text-button { min-height: 32px; padding: 3px 0; border: 0; border-radius: 0; background: transparent; color: var(--ink); font-size: 13px; text-decoration: underline; text-underline-offset: 4px; }
.text-button:hover { background: transparent; color: var(--teal); }
.danger { color: var(--danger); }
.visit-title-row { align-items: end; }
.visit-title-row .icon-button { margin-bottom: 1px; }
.visit-title-row + .muted { margin-top: 9px; }
.capture-section { padding: 21px 0; border-bottom: 1px solid var(--champagne); }
.section-label h2 { margin: 0; }
.section-label span { color: var(--muted); font-size: 12px; }
.inline-form, .note-form { display: grid; gap: 8px; margin-top: 13px; }
.inline-form { grid-template-columns: minmax(0, 1fr) auto; }
.inline-form button { min-width: 56px; }
.task-list { display: grid; gap: 1px; }
.task-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid #E8E2D9; }
.task-row input { width: 22px; height: 22px; padding: 0; accent-color: var(--teal); }
.task-row label { overflow-wrap: anywhere; cursor: pointer; }
.task-row.is-done label { color: var(--muted); text-decoration: line-through; }
.note-form button { justify-self: end; }
.note-list { display: grid; gap: 10px; }
.note-list li { padding: 13px; border-left: 3px solid var(--teal); background: #F0F3F2; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-list time { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; white-space: normal; }
.helper { margin-top: 9px; line-height: 1.45; }
.file-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; margin-top: 13px; padding: 9px 14px; border: 1px solid var(--warm-gray); border-radius: 10px; background: var(--surface); color: var(--ink); font-weight: 650; cursor: pointer; }
.secondary-file-button { margin-left: 6px; }
.file-button:hover, .secondary-button:hover { border-color: var(--deep-ink); background: var(--deep-ink); color: #fff; }
.media-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.media-card { overflow: hidden; border: 1px solid var(--warm-gray); border-radius: 10px; background: var(--surface); }
.media-card img { display: block; width: 100%; aspect-ratio: 1 / .8; object-fit: cover; background: #E8E2D9; }
.media-card p { margin: 0; padding: 8px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.voice-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.record-button { background: var(--teal); border-color: var(--teal); color: #fff; }
.record-button:hover { background: var(--deep-ink); border-color: var(--deep-ink); }
.record-button.is-recording { background: var(--danger); border-color: var(--danger); }
.audio-list { display: grid; gap: 9px; }
.audio-list li { padding: 10px; border: 1px solid var(--warm-gray); border-radius: 10px; background: var(--surface); }
.audio-list audio { display: block; width: 100%; }
.audio-list p { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.export-section p { margin: 8px 0 0; color: var(--muted); font-size: 13px; }

.action-dock { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; padding: 8px max(8px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom)); background: var(--deep-ink); box-shadow: 0 -8px 24px rgba(20, 22, 26, .18); }
.action-dock button { min-width: 0; min-height: 46px; border: 0; border-radius: 8px; padding: 7px 5px; background: transparent; color: #fff; font-size: 12px; }
.action-dock button:hover { background: #34373C; }
dialog { width: min(calc(100% - 32px), 420px); padding: 0; border: 1px solid var(--champagne); border-radius: var(--radius); background: var(--paper); color: var(--ink); box-shadow: 0 18px 48px rgba(20, 22, 26, .28); }
dialog::backdrop { background: rgba(20, 22, 26, .5); }
dialog form { padding: 20px; }
dialog h2 { margin-bottom: 17px; font-size: 1.35rem; }
dialog label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 650; }
.dialog-actions { display: flex; justify-content: end; gap: 8px; margin-top: 18px; }
.dialog-actions .secondary-button { margin: 0; }

@media (min-width: 720px) { body { padding-bottom: 30px; } .action-dock { left: 50%; right: auto; bottom: 20px; width: min(500px, calc(100% - 32px)); transform: translateX(-50%); border-radius: 14px; } }
@media (max-width: 374px) { main { padding-inline: 12px; } .truth { padding-inline: 12px; } .action-dock { padding-inline: 5px; } .action-dock button { font-size: 11px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
