/* public/styles/base.css — tokens, reset, typography, layout, shared components (SPEC §6).
   Owned by the skeleton. View-specific CSS lives in styles/<view>.css. */

/* ============================================================
   Tokens
   ============================================================ */
:root {
  --bg: #f6f4ee;            /* warm paper */
  --surface: #ffffff;
  --ink: #1f2a22;
  --muted: #6b7468;
  --line: #e3dfd3;
  --accent: #2f6b45;        /* deep green */
  --accent-soft: #dcebdf;
  --accent-ink: #1f4a30;
  --warn: #b8572b;
  --warn-soft: #f6e3d8;
  --cell-grey: #d9d6cc;     /* showcase: not owned / dead */
  --cell-nophoto: #e9e1c8;  /* showcase: owned, no photo */
  --placeholder: #a9b0a6;   /* empty field text */

  --radius: 10px;
  --radius-sm: 7px;
  --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(31, 42, 34, 0.06), 0 6px 18px rgba(31, 42, 34, 0.06);
  --shadow-lg: 0 10px 40px rgba(31, 42, 34, 0.18);

  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --nav-h: 56px;
  --touch: 40px;            /* minimum touch target */
  --container: 1100px;
  --gap: 16px;
}

/* ============================================================
   Reset
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 12px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; opacity: 0.55; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--font-mono); font-size: 0.9em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft); }

/* ============================================================
   Typography
   ============================================================ */
h1, h2, h3, h4, .serif { font-family: var(--font-serif); font-weight: 600; line-height: 1.2; margin: 0; color: var(--ink); letter-spacing: -0.005em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }
p { margin: 0 0 0.8em; }
small, .text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.15rem; }
.muted { color: var(--muted); }
.warn { color: var(--warn); }
.accent { color: var(--accent); }
.sci, .scientific { font-style: italic; }
.nickname { font-weight: 400; color: var(--muted); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.mono { font-family: var(--font-mono); }
.label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }

/* ============================================================
   Layout
   ============================================================ */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 16px; }
.page { padding: 16px 0 40px; min-height: calc(100vh - var(--nav-h) - 60px); }
.page > .container:first-child { padding-top: 4px; }
.page-spinner { padding: 60px 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-nowrap { flex-wrap: nowrap; }
.row-between { justify-content: space-between; }
.row-end { justify-content: flex-end; }
.row-center { justify-content: center; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack-sm { gap: 6px; }
.stack-lg { gap: 20px; }
.spacer { flex: 1 1 auto; }
.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.grid-auto-sm { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.grid-auto-lg { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; } .mb-4 { margin-bottom: 32px; }
.hide-mobile { }
.show-mobile { display: none; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Boot splash (replaced when app.js renders) */
.boot { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; gap: 10px; color: var(--muted); }
.boot-leaf { font-size: 40px; }

/* ============================================================
   Nav + footer
   ============================================================ */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(160%) blur(10px); backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
  height: var(--nav-h);
  padding-top: env(safe-area-inset-top);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: var(--nav-h); gap: 16px; }
.nav-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-family: var(--font-serif); font-size: 1.15rem; font-weight: 600; min-height: var(--touch); }
.nav-brand:hover { text-decoration: none; }
.nav-brand-icon { display: inline-flex; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); align-items: center; justify-content: center; }
.nav-links { display: flex; gap: 4px; }
.nav-link { display: inline-flex; align-items: center; min-height: var(--touch); padding: 0 14px; border-radius: var(--radius-pill); color: var(--muted); font-weight: 500; }
.nav-link:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.nav-link.is-active { background: var(--accent-soft); color: var(--accent-ink); }
.footer { padding: 24px 16px 40px; font-size: 0.8rem; text-align: center; }
.footer code { background: var(--surface); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); }

/* ============================================================
   Cards, sections, tabs
   ============================================================ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.card.is-clickable { cursor: pointer; transition: transform 0.12s ease, box-shadow 0.12s ease; }
.card.is-clickable:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(31,42,34,0.06), 0 10px 24px rgba(31,42,34,0.10); }
.card-flat { box-shadow: none; }
.card-pad-sm { padding: 10px 12px; }
.section { margin-top: 28px; }
.section-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 0 0 12px; flex-wrap: wrap; }
.section-title { display: flex; align-items: center; gap: 8px; }
.section-icon { font-size: 0.95em; }
.section-subtitle { font-size: 0.85rem; margin-top: 2px; }
.section-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.tabs { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 14px; border-radius: var(--radius-pill); color: var(--muted); font-weight: 500; white-space: nowrap; font-size: 0.92rem; }
.tab:hover { color: var(--ink); }
.tab.is-active { background: var(--accent-soft); color: var(--accent-ink); }
.tabs-sm .tab { min-height: 30px; padding: 0 10px; font-size: 0.85rem; }
.tabs-sticky { position: sticky; top: calc(var(--nav-h) + 8px); z-index: 10; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: var(--touch); padding: 0 16px; border-radius: var(--radius-pill);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 500; font-size: 0.95rem; line-height: 1; white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.06s ease;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent-ink); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-danger { background: transparent; border-color: var(--line); color: var(--warn); }
.btn-danger:hover { background: var(--warn-soft); border-color: var(--warn); }
.btn-link { background: none; border: 0; color: var(--accent); padding: 0 4px; min-height: 32px; }
.btn-link:hover { text-decoration: underline; background: none; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 0.85rem; gap: 5px; }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn.is-busy { opacity: 0.75; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--touch); height: var(--touch); border-radius: 50%;
  border: 1px solid transparent; color: var(--muted); background: transparent; flex: 0 0 auto;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent-ink); }
.icon-btn.is-active { background: var(--accent-soft); color: var(--accent-ink); }
.icon-btn.btn-danger:hover { background: var(--warn-soft); color: var(--warn); }
.icon-btn.btn-default { border-color: var(--line); background: var(--surface); }
.icon-btn-sm { width: 32px; height: 32px; }
.icon-btn-lg { width: 48px; height: 48px; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ============================================================
   Chips, radio chips, toggles, checkbox
   ============================================================ */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 26px; padding: 2px 10px; border-radius: var(--radius-pill);
  background: var(--bg); border: 1px solid var(--line); color: var(--muted);
  font-size: 0.78rem; font-weight: 500; line-height: 1.2; white-space: nowrap;
}
.chip-accent { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.chip-warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.chip-muted { background: transparent; border-color: var(--line); }
.chip-grey { background: var(--cell-grey); border-color: transparent; color: var(--ink); }
.chip.is-clickable, .chip-radio { cursor: pointer; min-height: 34px; padding: 4px 14px; font-size: 0.88rem; color: var(--ink); background: var(--surface); }
.chip.is-clickable:hover, .chip-radio:hover { border-color: var(--accent); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-icon { font-size: 1em; line-height: 1; }
.chip-hint { color: inherit; opacity: 0.7; font-weight: 400; font-size: 0.85em; }
.radio-group { display: flex; flex-wrap: wrap; gap: 6px; }
.radio-group-sm .chip-radio { min-height: 30px; padding: 2px 11px; font-size: 0.82rem; }

.toggle { display: inline-flex; align-items: center; gap: 8px; min-height: var(--touch); }
.toggle-track { position: relative; width: 42px; height: 24px; border-radius: 12px; background: var(--cell-grey); transition: background 0.15s ease; flex: 0 0 auto; }
.toggle-thumb { position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 0.15s ease; }
.toggle.is-on .toggle-track { background: var(--accent); }
.toggle.is-on .toggle-thumb { transform: translateX(18px); }
.toggle-warn.is-on .toggle-track { background: var(--warn); }
.toggle-label { font-size: 0.95rem; font-weight: 500; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; min-height: var(--touch); cursor: pointer; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ============================================================
   Inline-editable Field + inputs
   ============================================================ */
.field {
  display: inline-block; min-height: 1.5em; max-width: 100%;
  padding: 2px 4px; margin: -2px -4px; border-radius: 6px;
  border-bottom: 1px solid var(--line); cursor: text; white-space: pre-wrap; overflow-wrap: anywhere;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.field:hover { background: var(--accent-soft); border-bottom-color: var(--accent); }
.field-empty { color: var(--placeholder); font-style: normal; }
.field-multiline { display: block; white-space: pre-wrap; }
.field.is-busy { opacity: 0.6; }
.field.is-disabled { cursor: default; border-bottom-color: transparent; }
.field.is-disabled:hover { background: transparent; }
.field-affix { color: var(--muted); font-size: 0.85em; margin: 0 3px; }
.field-input, .input, .select, textarea.textarea {
  width: 100%; max-width: 100%; min-height: var(--touch);
  padding: 8px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; line-height: 1.3;
}
.field-input { min-width: 8ch; width: auto; max-width: 100%; }
.field-textarea { width: 100%; display: block; resize: vertical; }
.field-input:focus, .input:focus, .select:focus, textarea.textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder, .field-input::placeholder, textarea::placeholder { color: var(--placeholder); }
.input-sm, .select-sm { min-height: 32px; padding: 4px 8px; font-size: 0.88rem; }
.select { -webkit-appearance: none; appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7468' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.select.is-empty { color: var(--placeholder); }
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-label { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.labeled { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-height: var(--touch); }
.labeled > .labeled-key { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.labeled > .labeled-key::after { content: " —"; }
.search-input { padding-left: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236b7468' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.5 17a6.5 6.5 0 1 0 0-13 6.5 6.5 0 0 0 0 13zM20 20l-4.5-4.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 11px center; }

/* Date input */
.date-input { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.date-input .date-year { width: 5.5ch; min-width: 5.5ch; }
.date-input .date-month { width: auto; min-width: 7.5rem; }
.date-input .date-day { width: auto; min-width: 5.5rem; }
.date-input input, .date-input select { min-height: 36px; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-size: 0.92rem; }
.date-input select { -webkit-appearance: none; appearance: none; padding-right: 24px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7468' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 7px center; }
.date-input input:focus, .date-input select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.date-input-sm input, .date-input-sm select { min-height: 32px; font-size: 0.85rem; }
.date-field-editor { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ============================================================
   Photo tiles + badges
   ============================================================ */
.photo-tile-wrap { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.photo-tile {
  position: relative; aspect-ratio: 1 / 1; width: 100%; overflow: hidden;
  border-radius: var(--radius); background: var(--cell-nophoto); border: 1px solid var(--line);
}
.photo-tile-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tile.is-clickable { cursor: pointer; transition: transform 0.12s ease, box-shadow 0.12s ease; }
.photo-tile.is-clickable:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.photo-tile.is-selected { outline: 3px solid var(--accent); outline-offset: -1px; }
.photo-tile-label { font-size: 0.8rem; color: var(--ink); text-align: center; line-height: 1.2; }
.photo-tile-sublabel { font-size: 0.72rem; text-align: center; }
.photo-tile-placeholder-text { position: absolute; inset: auto 0 8px; text-align: center; font-size: 0.75rem; color: var(--muted); }
.photo-tile-corner { position: absolute; left: 5px; bottom: 5px; display: inline-flex; gap: 2px; font-size: 0.85rem; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.4)); }
.leaf-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); background: var(--cell-nophoto); }
.badge {
  position: absolute; top: 6px; right: 6px;
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: var(--radius-pill); background: rgba(31, 42, 34, 0.78); color: #fff; font-size: 0.72rem; font-weight: 600; line-height: 1;
}
.badge-static { position: static; }
.badge-accent { background: var(--accent); }
.badge-warn { background: var(--warn); }
.square { aspect-ratio: 1 / 1; object-fit: cover; }
.thumb-sm { width: 56px; height: 56px; border-radius: var(--radius-sm); object-fit: cover; }
.thumb-md { width: 80px; height: 80px; border-radius: var(--radius-sm); object-fit: cover; }

/* ============================================================
   Toasts
   ============================================================ */
.toast-stack {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center; z-index: 200; pointer-events: none; max-width: calc(100vw - 32px);
}
.toast {
  pointer-events: auto; padding: 10px 16px; border-radius: var(--radius-pill);
  background: var(--ink); color: #fff; font-size: 0.9rem; font-weight: 500; box-shadow: var(--shadow-lg);
  animation: toast-in 0.18s ease-out; cursor: pointer; max-width: 100%; text-align: center;
}
.toast-ok { background: var(--accent); }
.toast-error { background: var(--warn); }
.toast-info { background: var(--ink); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============================================================
   Modal
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(31, 42, 34, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.modal {
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; overflow: hidden;
  animation: modal-in 0.16s ease-out;
}
.modal-wide { max-width: 900px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.modal-title { font-size: 1.15rem; }
.modal-body { padding: 16px; overflow: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-width: 100%; border-radius: 14px 14px 0 0; max-height: 92vh; padding-bottom: env(safe-area-inset-bottom); }
}

/* ============================================================
   Spinner, empty state
   ============================================================ */
.spinner { display: inline-block; width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
.spinner-sm { width: 14px; height: 14px; border-width: 2px; }
.spinner-wrap { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); padding: 20px; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-icon { font-size: 40px; line-height: 1; }
.empty-title { font-family: var(--font-serif); font-size: 1.25rem; color: var(--ink); }
.empty-body { max-width: 420px; }
.empty-action { margin-top: 8px; }

/* ============================================================
   Markdown
   ============================================================ */
.md { line-height: 1.55; overflow-wrap: anywhere; }
.md h1, .md h2, .md h3, .md h4 { margin: 1em 0 0.4em; }
.md h1 { font-size: 1.3rem; } .md h2 { font-size: 1.15rem; } .md h3 { font-size: 1.02rem; } .md h4 { font-size: 0.95rem; }
.md > :first-child { margin-top: 0; }
.md p { margin: 0 0 0.7em; }
.md ul, .md ol { margin: 0 0 0.7em; padding-left: 1.4em; }
.md li { margin: 0.15em 0; }
.md blockquote { margin: 0 0 0.7em; padding: 4px 12px; border-left: 3px solid var(--accent-soft); color: var(--muted); }
.md code { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.md pre { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; overflow-x: auto; }
.md pre code { background: none; border: 0; padding: 0; }
.md hr { margin: 14px 0; }
.md a { text-decoration: underline; }

/* ============================================================
   Misc shared bits
   ============================================================ */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; align-items: baseline; }
.kv-key { color: var(--muted); font-size: 0.88rem; }
.divider { border-top: 1px solid var(--line); margin: 14px 0; }
.pill-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); font-size: 0.72rem; font-weight: 600; }
.sticky-top { position: sticky; top: calc(var(--nav-h) + 8px); z-index: 5; }
.cell-grey { background: var(--cell-grey); }
.cell-nophoto { background: var(--cell-nophoto); }
.event-icon { font-size: 0.9rem; line-height: 1; cursor: default; }
.file-input-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.placeholder-note { color: var(--placeholder); font-style: italic; }
.coming-soon { border: 1px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted); background: rgba(255,255,255,0.5); }
.coming-soon strong { display: block; font-family: var(--font-serif); font-size: 1.2rem; color: var(--ink); margin-bottom: 4px; }
.danger-zone { color: var(--warn); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  h1 { font-size: 1.55rem; }
  h2 { font-size: 1.2rem; }
  .container { padding: 0 12px; }
  .grid { gap: 10px; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-auto { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .grid-auto-lg { grid-template-columns: 1fr; }
  .hide-mobile { display: none !important; }
  .show-mobile { display: initial; }
  .nav-brand-text { font-size: 1.05rem; }
  .nav-link { padding: 0 12px; }
  .btn { padding: 0 14px; }
  .card { padding: 12px; }
}
@media (min-width: 641px) {
  .show-mobile { display: none !important; }
}
@media (hover: none) {
  .card.is-clickable:hover, .photo-tile.is-clickable:hover { transform: none; }
}
/* Touch devices (iPhone/iPad): the small variants of chips, tabs, buttons and date pickers grow to the
   40px target (SPEC §6). Desktop keeps the compact sizes. Only heights change, so nothing reflows sideways. */
@media (hover: none) and (pointer: coarse) {
  .chip.is-clickable, .chip-radio, .radio-group-sm .chip-radio { min-height: var(--touch); }
  .tab, .tabs-sm .tab { min-height: var(--touch); }
  .btn-sm, .btn-link { min-height: var(--touch); }
  .icon-btn-sm { width: var(--touch); height: var(--touch); }
  .input-sm, .select-sm, .date-input input, .date-input select, .date-input-sm input, .date-input-sm select { min-height: var(--touch); }
}
@media print {
  .nav, .footer, .toast-stack, .btn, .icon-btn { display: none !important; }
}
