/* TMF — app styles. Started from TrackingMyTravel so the trackingmy apps
   feel like one family, with the palette moved to a vault green. Single
   file on purpose: shared hosts cache badly and one ?v= bump beats chasing
   three.

   NOTE: this file still carries TMTR blocks (the trip book, packing, the
   weather strip, the map) that TMF does not use. They are dead weight, not
   a bug: one cached file, and pruning them blind is how a shared button
   loses its padding. Prune in a pass of its own, against the rendered
   screens. */

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --line: #dde3ea;
  --ink: #17202b;
  --ink-soft: #5c6774;
  --accent: #2f6b4f;
  --accent-soft: #e4efe8;
  --good: #1e6f4e;
  --warn: #8a5a00;
  --bad: #b0332a;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ------------------------------------------------------------- chrome */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 20px; background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.brand-mark { font-weight: 700; letter-spacing: -.01em; }
.brand-club { color: var(--ink-soft); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.avatar {
  display: inline-grid; place-items: center; width: 32px; height: 32px;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  font-size: 12px; font-weight: 700;
}
.role-chip {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-soft); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 9px;
}
.env-badge {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  background: #fff4d6; color: #7a5200; border: 1px solid #f0dca6;
  border-radius: 4px; padding: 2px 7px;
}

.tabs {
  display: flex; gap: 2px; padding: 0 12px; background: var(--surface);
  border-bottom: 1px solid var(--line); overflow-x: auto;
}
.tab {
  border: 0; background: none; padding: 12px 14px; cursor: pointer;
  color: var(--ink-soft); font: inherit; font-size: 14px;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab[hidden] { display: none; }

.view { padding: 22px; max-width: 1180px; margin: 0 auto; }

/* --------------------------------------------------------------- bits */

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 26px 0 10px; }
h3 { margin: 0 0 8px; font-size: 18px; }
.eyebrow { margin: 0 0 3px; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.muted { color: var(--ink-soft); }
.sub { color: var(--ink-soft); margin: 0 0 18px; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.memory-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.memory-card { min-height: 190px; padding: 18px; border: 1px solid #d7cbbd; border-radius: var(--radius); background: linear-gradient(145deg, #fffaf2, #f4eadf); box-shadow: var(--shadow); }
.memory-card-kicker { margin-bottom: 18px; color: #9b6842; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.memory-card p { min-height: 62px; margin: 0 0 16px; color: var(--ink-soft); white-space: pre-line; }
.memory-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.photo-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.photo-tile { display: block; overflow: hidden; position: relative; aspect-ratio: 1; border-radius: var(--radius); background: #d8d0c5; color: #fff; text-decoration: none; box-shadow: var(--shadow); }
.photo-tile > a { display: block; width: 100%; height: 100%; color: inherit; text-decoration: none; }
.photo-delete { position: absolute; top: 8px; right: 8px; z-index: 2; width: 28px; height: 28px; border: 0; border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }
.photo-tile img { width: 100%; height: 100%; display: block; object-fit: cover; }
.photo-tile span { position: absolute; right: 0; bottom: 0; left: 0; padding: 28px 10px 9px; background: linear-gradient(transparent, rgba(0,0,0,.7)); font-size: 12px; }
.album-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.album-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.album-card-art { display: grid; place-items: end start; aspect-ratio: 16 / 9; padding: 12px; background: linear-gradient(135deg, #d8b38a, #789b91); background-position: center; background-size: cover; color: #fff; }
.album-count, .album-empty { padding: 4px 8px; border-radius: 999px; background: rgba(0,0,0,.45); font-size: 12px; }
.album-card-body { padding: 16px; }
.album-card-body h3 { margin-bottom: 5px; }
.album-card-body p { min-height: 42px; margin: 0 0 13px; color: var(--ink-soft); }
.storybook-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.storybook { display: grid; grid-template-columns: 1fr 1fr; min-height: 520px; overflow: hidden; border: 1px solid #d8cbbd; border-radius: 12px; background: #f7efe4; box-shadow: 0 12px 30px rgba(72, 52, 35, .16); }
.storybook-page { display: grid; grid-template-columns: 1fr; gap: 14px; align-content: center; padding: 22px; background: #fffaf3; }
.storybook-page-left { border-right: 1px solid #decfbe; transform: rotate(-.4deg); }
.storybook-page-right { transform: rotate(.4deg); }
.storybook-photo { position: relative; margin: 0; padding: 8px 8px 24px; background: #fff; box-shadow: 0 3px 10px rgba(72, 52, 35, .14); }
.storybook-photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #ddd; }
.storybook-photo figcaption { position: absolute; right: 8px; bottom: 4px; left: 8px; overflow: hidden; color: #665849; font: 13px/1.2 Georgia, serif; text-overflow: ellipsis; white-space: nowrap; }
.storybook-controls { display: flex; justify-content: center; gap: 10px; padding: 16px 0 4px; }
.tree-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.tree-person { display: flex; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.tree-person h3 { margin-bottom: 2px; }
.tree-person p { margin: 0; }
.tree-links { margin: 8px 0 0; padding-left: 18px; color: var(--ink-soft); font-size: 13px; }
.tree-initials { display: grid; place-items: center; flex: 0 0 48px; width: 48px; height: 48px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.tree-next { margin-top: 18px; }

.stat { text-align: left; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--ink-soft); font-size: 13px; margin-top: 4px; }
.stat.alert .stat-value { color: var(--bad); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); font-weight: 600; }
tbody tr:hover { background: #f7fafc; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

.btn {
  display: inline-block; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); border-radius: 7px; padding: 8px 14px; font: inherit;
  font-size: 14px; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: #c9ced6; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: #25563f; }
.btn-ghost { border-color: transparent; color: var(--ink-soft); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 4px; }
input, select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line);
  border-radius: 7px; font: inherit; font-size: 14px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
/* The hidden attribute wins over any display a class sets — a flex row that is hidden is not there. */
[hidden] { display: none !important; }
.field-row > div { flex: 1 1 180px; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }

.pill {
  display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink-soft); white-space: nowrap;
}
.pill-good { background: #e3f0e9; color: var(--good); border-color: #bfdccc; }
.pill-warn { background: #fcf1c9; color: var(--warn); border-color: #efd98f; }
.pill-bad  { background: #fbe8e5; color: var(--bad);  border-color: #f0c4bf; }

.alert { border-radius: 8px; padding: 11px 13px; margin: 0 0 14px; font-size: 14px; }
.alert-error { background: #fbe8e5; color: var(--bad); border: 1px solid #f0c4bf; }
.alert-warn  { background: #fcf1c9; color: var(--warn); border: 1px solid #efd98f; }
.alert-info  { background: var(--accent-soft); color: #1d4a37; border: 1px solid #c6dccf; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: #182420; color: #fff; padding: 11px 18px; border-radius: 8px;
  font-size: 14px; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.22);
}

/* --------------------------------------------------------------- auth */

.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.auth-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; padding: 30px;
  box-shadow: var(--shadow);
}
.auth-title { font-size: 21px; margin: 0; }
.auth-sub { color: var(--ink-soft); margin: 4px 0 18px; font-size: 14px; }
.auth-card .btn-block { margin-top: 20px; }
.auth-foot { margin: 16px 0 0; font-size: 13px; text-align: center; }
.auth-foot a { color: var(--ink-soft); }

@media (max-width: 620px) {
  .view { padding: 16px; }
  .topbar { flex-wrap: wrap; }
}

/* On a phone the travellers table becomes a stack of cards: name, then
   access · status · share on one line, then the buttons. The sticky
   action column would otherwise sit on top of the middle columns. */
@media (max-width: 640px) {
  .people-table thead { display: none; }
  .people-table, .people-table tbody, .people-table tr, .people-table td { display: block; }
  .people-table tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .people-table tr:last-child { border-bottom: 0; }
  .people-table td { border: 0; padding: 0; }
  .people-table td.p-meta { display: inline; font-size: 13px; color: var(--ink-soft); }
  .people-table td.p-meta + td.p-meta::before { content: ' · '; }
  .people-table td.p-meta .pill { vertical-align: middle; }
  .people-table td.col-actions { position: static; box-shadow: none; width: auto; white-space: normal; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
  .people-table td.col-actions .btn { margin: 0; }
}

/* ------------------------------------------------------------ profile */
/* Same bones as the TMC profile modal: accent top border, compact
   upper-case field labels, name and address rows on a grid. */

button.avatar { border: 0; cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; }
button.avatar:hover, button.avatar:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 20, 40, .5); z-index: 40;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow: hidden;
}
/* The page is pinned while a dialog is open; the dialog does its own scrolling. */
body.modal-open { position: fixed; width: 100%; overflow: hidden; }
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--surface); border-radius: 12px; border-top: 4px solid var(--accent);
  box-shadow: 0 4px 16px rgba(24, 36, 32, .12), 0 16px 48px rgba(0, 0, 0, .18);
  width: 100%; max-width: 620px; max-height: 88vh; overflow-y: auto; padding: 22px 24px 24px;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y;
}
.modal h2 { font-size: 15px; font-weight: 700; color: var(--accent); margin: 0 0 4px; }

.modal-section { background: var(--bg); border-radius: 8px; padding: 12px 14px; margin: 6px 0 10px; }
.modal-section-title {
  font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase;
  letter-spacing: .06em; margin-bottom: 8px;
}
.modal-msg { font-size: 11px; margin: 2px 0 6px; min-height: 14px; }
/* The item form in sections: a heading each, a rule between, and the parts
   most people skip folded away behind a summary line. */
.fs { margin: 14px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
.fs:first-of-type { margin-top: 6px; padding-top: 0; border-top: 0; }
.fs-title { font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.fs .field-row + .field-row, .fs .field-row + label, .fs .field-row + .check-row { margin-top: 2px; }
details.fs-more > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 8px; padding: 2px 0; user-select: none; }
details.fs-more > summary::-webkit-details-marker { display: none; }
details.fs-more > summary::before { content: '▸'; color: var(--ink-soft); font-size: 12px; }
details.fs-more[open] > summary::before { content: '▾'; }
details.fs-sub { margin-top: 8px; }
details.fs-sub > summary { font-size: 13px; color: var(--accent); }
.form-compact .who-row { padding-top: 8px; }
.modal-msg.ok { color: var(--good); }
.modal-msg.bad { color: var(--bad); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
/* The item form is long enough to scroll inside the dialog, so Save stays
   put at the bottom rather than being something you have to go and find. */
.modal .modal-actions {
  position: sticky; bottom: -24px; z-index: 1;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 12px 0; margin-bottom: -24px;
}

/* ------------------------------------------------------- members etc */

.auth-card-wide { max-width: 560px; }
.auth-section { font-size: 12px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; margin: 18px 0 0; }
.auth-hint { font-size: 12px; color: var(--ink-soft); margin: 6px 0 0; }

.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 8px 0; }
.check-row input[type="checkbox"], .check-row input[type="radio"] { width: auto; margin: 0; flex: 0 0 auto; }
.seg { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 4px 0 8px; }
.seg .check-row { margin: 2px 0; }
.share-row { display: grid; grid-template-columns: 1fr 130px; gap: 8px; align-items: center; padding: 2px 0; }
.share-row .check-row { margin: 0; }
.share-row .share-in { margin: 0; }
.share-row .share-in[hidden] { display: none; }
.pay-row { display: grid; grid-template-columns: 1fr 130px; gap: 8px; align-items: center; padding: 2px 0; }
.pay-row .check-row { margin: 0; }
.pay-row .pay-in { margin: 0; }
.auth-hint.good { color: var(--good); font-weight: 600; }
.auth-hint.bad { color: var(--bad); font-weight: 600; }

/* find a place, in the item form */
.place-find { position: relative; margin-top: 6px; }
.place-find input { font-size: 13px; background: var(--bg); }
.place-results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(16, 24, 40, .14); max-height: 240px; overflow-y: auto; }
.place-hit { display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; font: inherit; cursor: pointer; border-bottom: 1px solid var(--line); }
.place-hit:last-child { border-bottom: 0; }
.place-hit:hover, .place-hit:focus-visible { background: var(--accent-soft); outline: none; }
.place-name { font-weight: 600; font-size: 14px; }
.place-addr { font-size: 12px; color: var(--ink-soft); }
.place-none { padding: 8px 10px; }
.place-menu { position: fixed; z-index: 100000; left: 0; top: 0; }

/* plan with AI */
.btn-ai { background: linear-gradient(135deg, #f3ecff, #e6f0ff); border-color: #c9b8f2; }
.btn-ai:hover { border-color: #8b6fd6; }
.ai-list { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; max-height: 52vh; overflow-y: auto; }
.ai-row { display: grid; grid-template-columns: 22px 130px 1fr auto; gap: 8px; align-items: start; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 13px; }
.ai-row:hover { background: var(--bg); }
.ai-row input { width: auto; margin: 3px 0 0; }
.ai-when { font-variant-numeric: tabular-nums; color: var(--ink-soft); font-size: 12px; padding-top: 2px; }
.ai-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ai-cost { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
/* On a phone: tick box, then when and cost on the first line, then the
   title and details across the full width underneath. */
@media (max-width: 640px) {
  .ai-row { grid-template-columns: 22px 1fr auto; }
  .ai-when { grid-column: 2; grid-row: 1; }
  .ai-cost { grid-column: 3; grid-row: 1; }
  .ai-main { grid-column: 2 / 4; grid-row: 2; }
}

/* versions */
.ver-card { margin-top: 14px; }
.ver-itinerary { border-left: 4px solid var(--accent); }
.ver-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.ver-head .grow { flex: 1; min-width: 200px; }
.ver-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ver-body { margin-top: 10px; }
.ver-list { display: flex; flex-direction: column; gap: 4px; }
.ver-day { font-size: 12px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; margin: 8px 0 2px; }
.ver-row.picked { background: var(--accent-soft); border-color: var(--accent); }
.build-bar { position: sticky; top: 6px; z-index: 5; margin-top: 12px; border: 1px solid var(--accent); background: var(--accent-soft); }
.build-bar .inline-form { align-items: center; }
.build-bar input { min-width: 200px; }
.build-bar select { max-width: 100%; }
.q-item.selectable { grid-template-columns: 22px 50px 1fr auto; }
.q-item.selectable .q-sub { grid-column: 3 / 5; }
.who-pill { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .04em; color: var(--accent); background: var(--accent-soft); border: 1px solid #c6dccf; border-radius: 6px; padding: 1px 5px; vertical-align: 1px; white-space: nowrap; }
.qdur { color: var(--ink-soft); }
.route-link { font-size: 11px; white-space: nowrap; color: var(--accent); text-decoration: none; border: 1px solid #c6dccf; border-radius: 6px; padding: 0 5px; margin-left: 4px; }
.route-link:hover { background: var(--accent-soft); }
.item-pp { display: block; font-size: 11px; font-weight: 400; color: var(--ink-soft); white-space: nowrap; text-align: right; }
.who-row { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 6px 0 2px; }
.ports-rows { display: flex; flex-direction: column; gap: 4px; max-height: 40vh; overflow-y: auto; margin-bottom: 8px; }
.port-row { display: grid; grid-template-columns: 110px 1fr; gap: 8px; align-items: center; }
.port-row input { margin: 0; }
.port-day { font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
.flight-lookup { flex: 0 0 auto; display: flex; flex-direction: column; }
.zone-row > div { flex: 1 1 200px; min-width: 0; }
.zone-row select { min-width: 0; max-width: 100%; }
#flight-row > div { flex: 1 1 110px; min-width: 0; }
#flight-row > div:first-child { flex: 2 1 170px; }
#flight-row input, #flight-row select { min-width: 0; }
.flight-lookup label { visibility: hidden; }
.who-box { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; margin: 0; }
.who-box input { width: auto; margin: 0; }
.q-item .sel, .note .sel { width: auto; margin: 3px 0 0; }
.note.selectable { display: grid; grid-template-columns: 22px 1fr; gap: 6px; align-items: start; }
.note.selectable .qd { grid-column: 2; }
@media (max-width: 640px) { .q-item.selectable { grid-template-columns: 22px 44px 1fr; } .q-item.selectable .qr { grid-column: 2 / 4; } }
/* the item form, tightened: smaller labels and inputs, three-up rows, the
   rarely-needed fields folded away */
.form-compact label { margin: 8px 0 3px; font-size: 12px; }
.form-compact input, .form-compact select, .form-compact textarea { padding: 7px 9px; font-size: 14px; }
.form-compact .field-row { gap: 10px; }
.form-compact .field-row > div { flex: 1 1 150px; }
.form-compact .money-row { gap: 8px; }
.form-compact .money-row > div { flex: 1 1 96px; min-width: 0; }
.form-compact .money-row input, .form-compact .money-row select { min-width: 0; width: 100%; }
.form-compact .split-row { gap: 8px; }
.form-compact .split-row > div { flex: 1 1 120px; min-width: 0; }
.form-compact .split-row select { min-width: 0; width: 100%; }
.form-compact .auth-hint { margin: 4px 0 0; }
.form-compact .check-row { margin: 0; min-height: 34px; }
.form-compact .allday-row { margin: 4px 0 0 2px; min-height: 0; font-size: 12px; color: var(--ink-soft); }
.form-compact .more-details { margin: 10px 0 0; border-top: 1px dashed var(--line); padding-top: 6px; }
.form-compact .more-details > summary { margin: 0 0 4px; }
.form-compact .place-find { margin-top: 0; }
.form-compact .place-find input { background: var(--surface); }
.form-compact textarea { min-height: 54px; }
.place-hit.hi { background: var(--accent-soft); }

/* ------------------------------------------------------------- join */

/* --------------------------------------------------------- club menu */

.club-menu { position: relative; }
.club-menu > summary { list-style: none; cursor: pointer; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 4px; }
.club-menu > summary::-webkit-details-marker { display: none; }
.club-menu > summary .caret { font-size: 11px; }
.club-menu[open] > summary { color: var(--ink); }
.club-menu-list {
  position: absolute; left: 0; top: calc(100% + 8px); z-index: 30; min-width: 260px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(16, 24, 40, .14); padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.club-menu-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%;
  padding: 8px 10px; border: 0; background: none; border-radius: 6px; font: inherit; font-size: 14px;
  color: var(--ink); text-decoration: none; cursor: pointer; text-align: left;
}
.club-menu-item:hover { background: var(--accent-soft); }
.club-menu-item.current { font-weight: 700; }
.club-menu-item small { color: var(--ink-soft); font-size: 12px; }
a.club-menu-item { color: var(--accent); border-top: 1px solid var(--line); border-radius: 0; margin-top: 2px; padding-top: 10px; }
a.club-menu-item + a.club-menu-item { border-top: 0; margin-top: 0; padding-top: 8px; }
/* ------------------------------------------------------------ landing */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.auth-home { color: inherit; text-decoration: none; }

body.lp { background: var(--surface); }
.lp-top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 24px; max-width: 1080px; margin: 0 auto;
}
.lp-brand { font-weight: 700; font-size: 18px; letter-spacing: -.01em; color: var(--ink); text-decoration: none; }
.lp-nav { display: flex; align-items: center; gap: 18px; }
.lp-nav a { color: var(--ink-soft); text-decoration: none; font-size: 14px; }
.lp-nav a:hover { color: var(--ink); }
.lp-nav .btn { color: var(--ink); }
.lp-nav .btn-primary, .lp-nav .btn-primary:hover { color: #fff; }

.lp-hero {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 40px; align-items: center;
  max-width: 1080px; margin: 0 auto; padding: 48px 24px 64px;
}
.lp-hero h1 { font-size: 40px; line-height: 1.12; letter-spacing: -.02em; margin: 0 0 16px; }
.lp-hero-text p { font-size: 17px; color: var(--ink-soft); margin: 0 0 12px; max-width: 520px; }

.lp-doors { display: grid; gap: 16px; }
.lp-door {
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 22px 22px 18px;
}
.lp-door h2 { margin: 0 0 6px; font-size: 20px; }
.lp-door > p { margin: 0 0 14px; color: var(--ink-soft); font-size: 14px; }
.lp-fine { font-size: 12px; color: var(--ink-soft); margin: 10px 0 0 !important; }
.lp-fine a { color: var(--accent); }
.lp-code-form { display: flex; gap: 8px; }
.lp-code-form .code-input { flex: 1; min-width: 0; }
.lp-code-form .btn { flex: 0 0 auto; }

.lp-section { max-width: 1080px; margin: 0 auto; padding: 56px 24px; }
.lp-section > h2 { font-size: 28px; letter-spacing: -.01em; margin: 0 0 28px; }
.lp-alt { max-width: none; background: var(--bg); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.lp-alt .lp-features { max-width: 1032px; margin: 0 auto; }

.lp-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.lp-steps li { position: relative; padding-top: 44px; }
.lp-step-n {
  position: absolute; top: 0; left: 0; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700; display: grid; place-items: center;
}
.lp-steps h3, .lp-feature h3, .lp-role h3 { margin: 0 0 6px; font-size: 17px; }
.lp-steps p, .lp-feature p, .lp-role p { margin: 0; color: var(--ink-soft); font-size: 15px; }

.lp-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px 28px; }
.lp-feature { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }

.lp-cta { display: flex; gap: 10px; justify-content: center; margin-top: 40px; flex-wrap: wrap; }

.lp-foot {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  max-width: 1080px; margin: 0 auto; padding: 24px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--ink-soft);
}
.lp-foot a { color: var(--ink-soft); }

@media (max-width: 900px) {
  .lp-hero { grid-template-columns: 1fr; padding-top: 24px; }
  .lp-hero h1 { font-size: 32px; }
  .lp-steps, .lp-features { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .lp-nav a:not(.btn) { display: none; }
  .lp-code-form { flex-direction: column; }
}
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }

/* --------------------------------------------------------------- logo */

.brand-icon { width: 26px; height: 26px; vertical-align: -7px; margin-right: 8px; }
a.brand-mark { color: inherit; text-decoration: none; display: inline-flex; align-items: center; }
a.brand-mark .brand-icon { vertical-align: middle; }
.lp-brand .brand-icon { width: 28px; height: 28px; vertical-align: -8px; }
.lp-logo { width: 360px; max-width: 100%; height: auto; margin: 0 0 18px -4px; display: block; }
.auth-logo { display: block; margin: -4px 0 14px; }
.auth-logo img { width: 300px; max-width: 100%; height: auto; display: block; }

tr.current td { background: var(--accent-soft); }

details[open] > summary .chev { transform: rotate(45deg); }

.btn-danger:hover { color: var(--bad); border-color: var(--bad); }

/* the action icons stay visible when a wide table scrolls sideways */
.col-actions { position: sticky; right: 0; background: var(--surface); box-shadow: -8px 0 8px -8px rgba(0,0,0,.18); width: 1%; white-space: nowrap; }
thead .col-actions { background: var(--bg); }

/* -------------------------------------------------------------- print */

.print-head { display: none; }

@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  .topbar, .tabs, .toast, .modal-backdrop, .no-print, .col-actions, .btn, .sub, .trip-bar { display: none !important; }
  .print-head { display: block; font-size: 14pt; font-weight: 700; margin: 0 0 4pt; }
  .print-only { display: block !important; color: #444; margin-bottom: 8pt; }
  .view { padding: 0; max-width: none; }
  h1 { font-size: 18pt; margin: 0 0 6pt; }
  h2 { font-size: 13pt; margin: 12pt 0 4pt; }
  .table-wrap { overflow: visible; border: 0; box-shadow: none; }
  table { width: 100%; border-collapse: collapse; page-break-inside: auto; }
  tr { page-break-inside: avoid; }
  th, td { border-bottom: 1px solid #bbb; padding: 4pt 6pt; font-size: 10pt; vertical-align: top; }
  th { background: #f0f0f0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pill, .date-chip { border: 1px solid #999; background: none !important; color: #000 !important; }
  .dot { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: #000; text-decoration: none; }
  @page { margin: 14mm; }
}
.link-btn { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-btn:hover { color: var(--ink); }

th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--ink); }
th.sorted { color: var(--accent); }

.modal { position: relative; }
.modal-x { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 24px; line-height: 1; color: var(--ink-soft); cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.modal-x:hover, .modal-x:focus-visible { color: var(--ink); background: var(--bg); outline: none; }
.modal h2 { padding-right: 32px; }
.modal h2.draggable { cursor: move; user-select: none; touch-action: none; }
.modal-grip { display: flex; align-items: center; gap: 8px; margin: -22px -24px 12px; padding: 6px 44px 6px 14px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600;
  cursor: move; user-select: none; touch-action: none; border-bottom: 1px solid #c6dccf; }
.modal-grip .grip-dots { font-size: 14px; letter-spacing: -2px; opacity: .8; }
.modal-grip .muted { font-weight: 400; }
.modal { transition: none; }

/* password show/hide */
.pw-wrap { position: relative; display: block; }
.pw-wrap > input { width: 100%; padding-right: 40px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--ink-soft); cursor: pointer; padding: 4px; border-radius: 6px; line-height: 0; }
.pw-eye:hover, .pw-eye:focus-visible { color: var(--accent); background: var(--accent-soft); outline: none; }

/* The pinned action column is sticky, so each cell is its own layer; lift the one being hovered above the rows below. */
td.col-actions:hover, td.col-actions:focus-within { z-index: 30; }

/* =====================================================================
   TMTR — trips, itinerary, budget
   ===================================================================== */

.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.section { margin: 26px 0 10px; font-size: 16px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.good, .good { color: var(--good); }
td.bad, .bad, .over { color: var(--bad); }
.small { font-size: 12px; }

.empty { text-align: center; padding: 34px 22px; }
.empty h2 { margin: 0 0 6px; }
.empty p { max-width: 46ch; margin: 0 auto 16px; }

/* the strip under the tabs naming the open trip */
.trip-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; padding: 5px 16px;
  background: var(--surface);
}
.trip-bar-main, .trip-bar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.trip-bar-name { font-size: 15px; }
.trip-tabs { margin-left: auto; display: flex; gap: 2px; }
.tab.tab-act { color: var(--ink-soft); }
a.tab { text-decoration: none; display: inline-block; }

/* trip cards */
.trip-card {
  display: block; text-align: left; padding: 0; overflow: hidden;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  border-radius: var(--radius); box-shadow: var(--shadow); font: inherit; color: inherit;
}
.trip-card:hover { border-color: var(--accent); }
.trip-card-top { display: block; height: 6px; }
.trip-card-body { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 16px; }
.trip-card-name { font-weight: 700; font-size: 16px; }
.trip-card-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.pill-soon { color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.trip-card-foot {
  display: flex; justify-content: space-between; gap: 10px;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12px;
}

.meter { display: block; height: 6px; border-radius: 999px; background: var(--bg); overflow: hidden; margin-top: 8px; }
.meter-fill { display: block; height: 100%; background: var(--accent); }
.meter-fill.over { background: var(--bad); }

.item-cost { font-variant-numeric: tabular-nums; font-weight: 600; }
.item-cost b, .ai-cost b { font-weight: 700; }
.btn-pay { padding: 1px 8px; font-size: 11px; min-height: 24px; border-radius: 999px; }
.btn-pay.is-set { background: #e3f0e9; border-color: #bfdccc; color: var(--good); }
.btn-pay.is-set:hover { border-color: var(--good); }
.pay-choices { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 4px; }
.pay-choices .btn { text-align: left; }
.import-map td, .import-map th { vertical-align: top; }
.import-map td:first-child { font-variant-numeric: tabular-nums; }
.import-map select { min-width: 160px; }
.form-error { color: var(--bad); font-weight: 600; }

/* settling up */
.settle-list { margin: 6px 0 0; padding-left: 18px; }
.settle-list li { margin: 4px 0; }
.share-list { list-style: none; margin: 0 0 10px; padding: 0; }
.share-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--line); }
.share-list code { font-size: 12px; background: var(--bg); padding: 2px 6px; border-radius: 4px; }

.split-row { align-items: center; }
.split-row > div:first-child { padding-top: 6px; }
details.fine > summary { cursor: pointer; color: var(--ink-soft); font-size: 13px; margin: 6px 0; }

/* =====================================================================
   print.php and plan.php — the printed trip plan
   ===================================================================== */

.doc { max-width: 800px; margin: 0 auto; padding: 24px; }
.doc-cover { border-bottom: 3px double var(--ink); padding-bottom: 14px; margin-bottom: 18px; }
.doc-cover h1 { margin: 0 0 4px; font-size: 26px; }
.doc-meta { display: flex; gap: 18px; flex-wrap: wrap; color: var(--ink-soft); font-size: 13px; }
.doc h2 { border-bottom: 1px solid var(--line); padding-bottom: 3px; margin: 22px 0 8px; font-size: 16px; }
.doc-day { page-break-inside: avoid; margin-bottom: 14px; }
.doc-day h3 { margin: 14px 0 6px; font-size: 14px; background: var(--bg); padding: 4px 8px; }
.doc-item { display: grid; grid-template-columns: 62px 1fr auto; gap: 10px; padding: 5px 8px; border-bottom: 1px solid var(--line); }
.doc-item:last-child { border-bottom: 0; }
.doc-item .t { font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.doc-item .d { font-size: 12px; color: var(--ink-soft); }
.doc-item .c { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc-foot { margin-top: 26px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 11px; color: var(--ink-soft); }

.doc-serif { font-family: Georgia, "Times New Roman", serif; }
.doc-serif h1, .doc-serif h2, .doc-serif h3 { font-family: Georgia, "Times New Roman", serif; }

@media print {
  .doc { max-width: none; padding: 0; }
  .doc-day h3 { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .trip-card { display: none !important; }
  .doc-item { border-bottom: 1px solid #ccc; }
}

/* the trip book */
.book-cover { padding: 36px 0 26px; margin-bottom: 26px; border-bottom: 3px double var(--ink); }
.book-band { height: 14px; background: var(--accent); border-radius: 3px; margin-bottom: 28px; }
.book-label { text-transform: uppercase; letter-spacing: .18em; font-size: 11px; color: var(--ink-soft); margin: 0 0 8px; }
.book-cover h1 { font-size: 34px; line-height: 1.1; margin: 0 0 8px; }
.book-cover .doc-sub { font-size: 18px; color: var(--ink-soft); margin: 0 0 16px; }
.book-dates { font-size: 15px; margin: 0 0 4px; }
.book-people { color: var(--ink-soft); margin: 0 0 14px; }
.book-summary { max-width: 62ch; }
.book-fine { font-size: 12px; color: var(--ink-soft); margin-top: 18px; }
.book h3 { font-size: 14px; margin: 18px 0 6px; }
.book-glance table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 10px; }
.book-glance th, .book-glance td { text-align: left; vertical-align: top; padding: 5px 6px; border-bottom: 1px solid var(--line); }
.book-glance th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); font-weight: 600; }
.daynum { display: inline-block; background: var(--ink); color: #fff; font-size: 11px; padding: 1px 8px; border-radius: 999px; margin-right: 6px; vertical-align: middle; }
.daycost { float: right; font-weight: 400; }
.doc-night .d { font-style: italic; }
.doc-notes { font-size: 12px; margin-top: 3px; color: var(--ink); }
.doc-item.cancelled strong { text-decoration: line-through; }
.export-options { margin: 6px 0 12px 22px; }

/* the trips table: fits the page on a desktop; on a phone each trip is a
   labelled block, so nothing ever scrolls sideways */
.trips-wrap { overflow: visible; }
.trips-table { table-layout: fixed; width: 100%; font-size: 13px; }
.trips-table th, .trips-table td { padding: 8px 6px; white-space: normal; overflow-wrap: anywhere; }
.trips-table th { font-size: 11px; letter-spacing: .02em; }
.trips-table th.num { text-align: right; }
.trips-table td .num { text-align: right; display: block; }
.trips-table td { vertical-align: top; }
.trips-table th:first-child, .trips-table td.trip-cell { width: 26%; }
.trips-table .trip-cell strong { font-size: 14px; }
.trips-table .trip-card-pills { margin-top: 4px; }
@media (max-width: 900px) {
  .trips-wrap { border: 0; background: none; }
  .trips-table thead { display: none; }
  .trips-table, .trips-table tbody { display: block; }
  .trips-table tr { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px 10px; padding: 12px 14px; margin-bottom: 10px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
  .trips-table td { display: block; border: 0; padding: 0; width: auto; }
  .trips-table td.trip-cell { grid-column: 1 / -1; width: auto; margin-bottom: 4px; }
  .trips-table td[data-label]::before { content: attr(data-label); display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
  .trips-table td .num { text-align: left; }
  .trip-row:hover td { background: none; }
}
@media (max-width: 480px) {
  .trips-table tr { grid-template-columns: repeat(2, 1fr); }
}
.trip-row { cursor: pointer; }
.trip-row:hover td { background: var(--accent-soft); }
.trip-row.current td { background: var(--accent-soft); }
.trip-row.current td:first-child { box-shadow: inset 4px 0 0 var(--accent); }
.trip-row.current .trip-cell strong { color: var(--accent); }
.trip-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.trip-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }

@media print {
  .book-cover { border-bottom: 0; padding-top: 34mm; break-after: page; page-break-after: always; }
  .book-band { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .book-glance { break-after: page; page-break-after: always; }
  .book-money { break-before: page; page-break-before: always; }
  .daynum { background: #000 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* itinerary day blocks: four corners and the notes underneath */
.day-block { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin: 0 0 10px; box-shadow: var(--shadow); overflow: hidden; }
.day-block { scroll-margin-top: 58px; }
.day-go { position: sticky; top: 0; z-index: 4; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0 8px; margin: 0 0 6px; background: var(--bg); }
.day-go-pick { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; }
.day-go-pick label { white-space: nowrap; }
/* The list is as wide as its longest day, which can be a long way; cap it and let the rest scroll off. */
.day-go-pick select { max-width: 460px; min-width: 0; text-overflow: ellipsis; }
.day-go-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.btn-expense { border-color: #bfdccc; background: #e3f0e9; color: var(--good); font-weight: 600; }
.kind-row { cursor: pointer; }
.kind-row:hover td { background: var(--accent-soft); }
.kind-row.on td { background: #e3f0e9; }
.kind-row .pill { margin-left: 6px; vertical-align: 1px; }
.expense-filter { margin: 0 0 12px; padding: 10px 16px 6px; }
.expense-filter .field-row > div { flex: 1 1 140px; }
.expense-filter label { margin-top: 4px; }
.expense-filter p { margin: 8px 0 4px; }
.expense-row { cursor: pointer; }
.fx-row { align-items: flex-end; margin-bottom: 4px; }
.fx-row > div { flex: 1 1 120px; }
.fx-eq { display: flex; align-items: center; gap: 6px; flex: 2 1 200px; }
.fx-eq input { width: auto; flex: 1 1 100px; }
.fx-x { flex: 0 0 auto; }
.fx-amount { display: flex; gap: 6px; }
.fx-amount input { flex: 1 1 100px; }
.fx-amount select { width: auto; flex: 0 0 auto; }
.expense-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--accent); }
th.sortable.on { color: var(--accent); }
.btn-expense:hover { background: #d3e8dc; }
/* On the itinerary the tick-box bar sits under the sticky day row; on Versions it is the top thing. */
.day-go ~ .build-bar { top: calc(var(--tabs-h, 48px) + 52px); }
.day-go label { margin: 0; font-size: 13px; color: var(--ink-soft); }
.day-go select { width: auto; max-width: 100%; min-height: 34px; padding: 4px 28px 4px 10px; font-size: 13px; }
.day-block-head { --day: var(--accent); display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 10px; color: var(--ink); line-height: 1.2;
  background: color-mix(in srgb, var(--day) 11%, var(--surface)); border-bottom: 1px solid var(--line); box-shadow: inset 4px 0 0 var(--day); }
.day-block-head .dnum { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--day); background: color-mix(in srgb, var(--day) 16%, var(--surface)); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.day-block-head .dname { font-size: 14px; font-weight: 700; white-space: nowrap; }
.day-block-head { cursor: pointer; }
.day-block-head .dfold { background: none; border: 0; padding: 0 2px; margin: 0 -2px 0 -4px; font: inherit; color: var(--ink-soft); cursor: pointer; line-height: 1; }
.day-block-head .dfold .chev { display: inline-block; font-size: 18px; transform: rotate(90deg); transition: transform .15s; }
.day-block.folded .day-block-head .dfold .chev { transform: rotate(0deg); }
.day-block.folded .day-grid, .day-block.folded .day-notes, .day-block.folded .day-empty { display: none; }
.day-go-pick .link-btn.small { font-size: 12px; margin-left: 8px; white-space: nowrap; }
.day-go { margin-top: 6px; }
@media (max-width: 640px) {
  .day-go { flex-wrap: wrap; }
  .day-go-pick { flex: 1 1 100%; }
  .day-go-pick select { flex: 1 1 auto; min-width: 0; }
  .day-go-actions { flex: 1 1 100%; justify-content: flex-end; }
}
.day-block-head .dloc { font-size: 13px; color: var(--ink-soft); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-block-head .dloc::before { content: "·"; margin-right: 8px; opacity: .7; }
.day-block-head .dloc-edit { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; color: var(--ink-soft); cursor: pointer; text-align: left; }
.day-block-head .dloc-edit:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.day-block-head .dloc-edit.empty { font-style: italic; opacity: .7; }
.day-block-head .darrow { opacity: .7; margin: 0 2px; }
.day-block-head .dcost { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; background: var(--surface); border: 1px solid var(--line); padding: 2px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.day-block-head .dpp { font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.day-block-head .dpp-one { white-space: nowrap; }
.day-block-head .btn { min-height: 28px; padding: 3px 9px; font-size: 12px; }
.day-block-head .dcost + .btn, .day-block-head .dpp + .btn { margin-left: 0; }
@media (max-width: 900px) { .day-block-head .dpp { white-space: normal; } }
.day-block-head .dloc + .btn, .day-block-head .dname + .btn { margin-left: auto; }
/* Left half: the day in time order (journeys and things to do), spanning
   both rows. Right half: the stay above the meals. */
.day-grid { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; }
.quad { padding: 6px 10px 8px; border-top: 1px solid var(--line); border-left: 4px solid var(--q); min-height: 0; }
.quad-day { grid-row: 1 / 3; border-right: 1px solid var(--line); }
.quad-stay   { --q: #6d5bd0; --q-soft: #f3f0fb; }
.quad-day    { --q: #1f78c1; --q-soft: #eaf3fb; }
.quad-meals  { --q: #d98324; --q-soft: #fdf3e6; }
/* Inside the day column, a thing to do keeps its own green, so the eye
   still tells a hike from a train at a glance. */
.quad-day .q-item.k-activity .qe, .quad-day .q-item.k-other .qe { filter: none; }
.quad-day .q-item.k-activity:hover, .quad-day .q-item.k-other:hover { background: #e9f6ef; }
.q-head { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--q); margin-bottom: 2px; }
.q-head .cnt { margin-left: auto; font-weight: 600; color: var(--ink-soft); letter-spacing: 0; background: var(--q-soft); padding: 0 7px; border-radius: 999px; }
.q-empty { color: var(--ink-soft); font-size: 12px; font-style: italic; padding: 1px 6px 2px; }
.q-item { display: grid; grid-template-columns: 46px 1fr auto; gap: 6px; align-items: start; padding: 3px 6px; border-radius: 6px; cursor: pointer; font-size: 13px; line-height: 1.3; }
.q-item + .q-item { border-top: 1px dashed var(--line); border-radius: 0 0 8px 8px; }
.q-item:hover { background: var(--q-soft); }
.q-item:focus-visible { outline: 2px solid var(--q); outline-offset: 1px; }
.q-item .qt { font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; padding-top: 1px; }
.q-item .qe { font-size: 15px; }
.q-item .qm { min-width: 0; }
.q-item .qtitle { font-weight: 600; }
.q-item .qd { font-size: 12px; color: var(--ink-soft); }
.q-item .qr { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; }
.q-item .q-sub { grid-column: 2 / 4; font-size: 11px; color: var(--ink-soft); font-variant-numeric: tabular-nums; margin-top: -2px; }
.q-item.cancelled .qtitle { text-decoration: line-through; opacity: .6; }
.q-tag { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--q); font-weight: 700; margin-right: 2px; }
.day-notes { border-top: 1px solid var(--line); padding: 6px 10px 8px; background: #fbf9f2; }
.day-notes .q-head { color: #7a6a2f; }
.day-notes .note { padding: 3px 6px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.day-notes .note + .note { border-top: 1px dashed #e6e0c8; }
.day-notes .note:hover { background: rgba(0,0,0,.04); }
.day-notes .note .qd { font-size: 12px; color: var(--ink-soft); white-space: pre-line; margin-top: 2px; }
.day-block.empty .day-block-head { padding: 5px 14px; opacity: .9; }
.day-empty { padding: 4px 14px 6px; color: var(--ink-soft); font-size: 12px; }
@media (max-width: 720px) {
  .day-grid { grid-template-columns: 1fr; }
  .quad:nth-child(odd) { border-right: 0; }
  .q-item { grid-template-columns: 44px 1fr; }
  .q-item .qr { grid-column: 2; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .q-item .q-sub { grid-column: 2; }
  .day-block-head .dname { font-size: 18px; }
}

/* =====================================================================
   Polish, and phones
   ===================================================================== */

html { -webkit-text-size-adjust: 100%; overscroll-behavior-x: none; }
body { overscroll-behavior-x: none; }
.modal { overscroll-behavior-x: none; }
.tabs { position: sticky; top: 0; z-index: 20; scrollbar-width: none; }
.day-go { top: var(--tabs-h, 48px); }
.day-block { scroll-margin-top: calc(var(--tabs-h, 48px) + 62px); }
.tabs::-webkit-scrollbar { display: none; }
.btn { min-height: 38px; line-height: 1.3; }
.btn-sm { min-height: 32px; }
.brand-club { max-width: 32vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trip-bar-actions { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.trip-bar-actions::-webkit-scrollbar { display: none; }
.trip-bar-actions .btn { white-space: nowrap; flex: 0 0 auto; }
.card + .card { margin-top: 14px; }
/* Cards laid out by a grid keep to the grid: no stacking margin, equal heights. */
.grid > .card { margin-top: 0; height: 100%; box-sizing: border-box; }
.stat { display: flex; flex-direction: column; justify-content: center; min-height: 96px; }
/* Book & files: three columns — the two forms stretched to the same
   height with their buttons at the foot, and the two short cards stacked
   in the third column so the page has no hole in it. */
.files-head { margin-bottom: 14px; }
.files-head .muted { flex: 1 1 auto; }
.files-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.files-grid .card { margin: 0; display: flex; flex-direction: column; }
.files-grid .card > form { display: flex; flex-direction: column; flex: 1 1 auto; }
.files-col { display: flex; flex-direction: column; gap: 16px; }
.files-col .card { flex: 0 0 auto; }
.files-grid h3 { margin: 0 0 4px; font-size: 16px; }
.files-grid .lead { margin: 0 0 6px; }
.files-grid .group { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin: 14px 0 4px; }
.files-grid .ck-desc { display: block; color: var(--ink-soft); font-size: 12px; line-height: 1.3; }
.files-grid .export-options { margin: 2px 0 6px 24px; padding-left: 10px; border-left: 2px solid var(--line); }
.files-grid .export-options .group { margin-top: 6px; }
.files-sub + .files-sub { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.files-sub .modal-actions { margin-top: 8px; padding-top: 0; }
@media (max-width: 960px) {
  .files-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .files-col { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
  .files-col .card { flex: 1 1 280px; }
}
@media (max-width: 640px) {
  .files-grid { grid-template-columns: 1fr; }
  .files-col { flex-direction: column; }
  .files-col .card { flex: 0 0 auto; }
}
.page-head.sub { margin-top: 18px; }
.page-head.sub h2 { margin: 0; font-size: 18px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; font-size: 14px; }
.facts dt { color: var(--ink-soft); }
.facts dd { margin: 0; }
.files-grid .modal-actions { position: static; margin-top: auto; padding-top: 14px; }
.files-grid .check-row { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 0 8px; align-items: start; margin: 7px 0; font-size: 13px; line-height: 1.3; }
.files-grid .check-row input { margin: 2px 0 0; }

@media (max-width: 640px) {
  .view { padding: 14px 12px 40px; }
  .card { padding: 14px; }
  h1 { font-size: 20px; }
  h2 { font-size: 16px; margin-top: 20px; }

  /* top bar: the mark, the workspace, you */
  .topbar { flex-wrap: nowrap; gap: 8px; padding: 10px 12px; }
  .brand { gap: 8px; flex-wrap: nowrap; min-width: 0; }
  .brand-text { display: none; }
  .brand-icon { margin-right: 0; }
  .brand-club { max-width: 42vw; }
  .env-badge { display: none; }
  .topbar-right { gap: 6px; flex: 0 0 auto; }
  .role-chip { display: none; }
  .topbar-right .btn-ghost { padding: 6px 8px; font-size: 13px; min-height: 0; }
  .club-menu-list { min-width: 220px; max-width: calc(100vw - 24px); }

  .tab { padding: 12px 12px; font-size: 14px; }

  /* the trip strip: name on one line, the buttons scroll sideways under it */
  .trip-bar { padding: 8px 12px; gap: 6px; }
  .trip-bar-main { width: 100%; gap: 8px; }
  .trip-bar-name { font-size: 15px; }
  .trip-bar-main > .muted { display: none; }
  .trip-bar-actions { width: 100%; justify-content: flex-start; gap: 6px; padding-bottom: 2px; }
  .trip-bar-actions > .muted { display: none; }

  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .btn { width: 100%; text-align: center; min-height: 42px; }

  table { font-size: 13px; }
  th, td { padding: 8px; }
  .stat-value { font-size: 24px; }
  .grid { gap: 10px; }
  .empty { padding: 24px 14px; }

  /* forms: one field per row, and 16px text so iOS does not zoom in */
  input, select, textarea { font-size: 16px; }
  .field-row { gap: 8px; }
  .field-row > div { flex-basis: 100%; }
  label { margin-top: 10px; }

  /* dialogs slide up from the bottom and keep Save in reach */
  /* On a phone the dialog fills the screen from the top. A sheet pinned to
     the bottom rides up when the keyboard opens and the field you tapped
     is no longer under your finger; a top-anchored one stays put. */
  .modal-backdrop { padding: 0; align-items: stretch; }
  .modal {
    max-width: none; max-height: none; height: 100%; border-radius: 0; border-top-width: 3px;
    padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
  }
  .modal .modal-actions {
    bottom: calc(-16px - env(safe-area-inset-bottom));
    margin-bottom: calc(-16px - env(safe-area-inset-bottom));
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  .modal-actions .btn { flex: 1 1 auto; text-align: center; }
  .pay-choices .btn { min-height: 44px; }
  .toast { left: 12px; right: 12px; transform: none; bottom: calc(12px + env(safe-area-inset-bottom)); text-align: center; }

  /* day blocks */
  .day-block { border-radius: 12px; margin-bottom: 14px; }
  .day-block-head { flex-wrap: wrap; gap: 6px 10px; padding: 7px 12px; }
  .day-block-head .dloc { flex-basis: 100%; white-space: normal; }
  .day-block-head .dloc::before { content: none; }
  .quad { padding: 10px 12px 12px; min-height: 0; }
  .day-notes { padding: 8px 12px 10px; }
}

@media (max-width: 380px) {
  .tab { padding: 12px 10px; font-size: 13px; }
  .brand-club { max-width: 36vw; }
}

.expense-table td, .expense-table th { white-space: nowrap; }
.expense-table td:nth-child(2) { white-space: normal; min-width: 160px; }
.expense-table td:last-child { white-space: normal; min-width: 160px; }
.expense-table tfoot .settle-final { white-space: normal; font-weight: 600; }

/* Dragging an item to another day. */
.q-item[draggable="true"], .note[draggable="true"] { cursor: grab; }
.q-item.dragging, .note.dragging { opacity: .45; }
body.dragging-item .day-block { transition: box-shadow .1s; }
.day-block.drop-target { box-shadow: 0 0 0 2px var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.day-block.drop-target .day-block-head { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }

/* The day count beside the trip's name. */
.trip-bar-days { display: inline-block; font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 1px 8px; border-radius: 999px; margin-left: 6px; vertical-align: 2px; white-space: nowrap; }

/* The row's ⋯ menu, and the toast's one action. */
.q-menu { background: none; border: 1px solid transparent; border-radius: 6px; color: var(--ink-soft); font: inherit; font-size: 15px; line-height: 1; padding: 0 5px; cursor: pointer; }
.q-menu:hover, .q-menu:focus-visible { border-color: var(--line); background: var(--surface); color: var(--ink); }
.row-menu { position: fixed; z-index: 45; min-width: 190px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(16, 24, 40, .16); padding: 4px; }
.row-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 6px; padding: 8px 10px; font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; }
.row-menu button:hover, .row-menu button:focus-visible { background: var(--accent-soft); outline: none; }
.row-menu button.danger { color: var(--bad); }
.q-item.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.toast .toast-act { margin-left: 14px; background: none; border: 1px solid rgba(255, 255, 255, .55); color: #fff; border-radius: 6px; padding: 3px 10px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.toast .toast-act:hover { background: rgba(255, 255, 255, .12); }
/* Files on an item. */
.attach { margin-top: 12px; }
.attach-list { list-style: none; margin: 4px 0 8px; padding: 0; font-size: 13px; }
.attach-list li { padding: 5px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.attach-list li a:first-child { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.attach-add { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.attach-btn { margin: 0; font-weight: 500; cursor: pointer; }
.attach-btn.busy { opacity: .6; cursor: progress; }
.link-btn.small { font-size: 12px; }
.qclip { font-size: 11px; color: var(--ink-soft); white-space: nowrap; }
/* The trip map. */
.trip-map { height: 70vh; min-height: 420px; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); background: #e9eef3; z-index: 0; }
.map-pin-wrap { background: none; border: 0; }
.map-pin { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 12px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
.map-pop { font: 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.map-pop strong { display: block; margin-bottom: 4px; }
.map-pop-item { padding: 4px 0; border-top: 1px dashed var(--line); }
.map-pop-item .link-btn { font-size: 13px; text-decoration: none; }
.map-pop-item .link-btn:hover { text-decoration: underline; }
.map-unplaced { padding-left: 18px; margin: 0; }
.map-unplaced li { margin: 4px 0; }
.leaflet-popup-content { margin: 10px 12px; }.leaflet-top.leaflet-right .map-zoom { margin: 10px; background: var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.3); }

/* Select mode on the Trips page. */
.trips-bar { margin: 0 0 12px; }
.trips-bar select { width: auto; min-width: 160px; }
.trip-cell .trip-sel { width: auto; margin: 0 8px 0 0; vertical-align: -1px; }
.trip-row.selectable { cursor: pointer; }
#trips-select.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
/* Sort and filter on the Trips page. */
.trips-tools { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 0 0 12px; font-size: 13px; color: var(--ink-soft); }
.trips-tools label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; }
.trips-tools select { width: auto; padding: 5px 8px; font-size: 13px; }.q-free { font-size: 11px; color: var(--ink-soft); border: 1px dashed var(--line); border-radius: 999px; padding: 1px 8px; }

/* =====================================================================
   Phones, second pass: less chrome, more screen
   ===================================================================== */

/* Buttons that say less on a small screen carry both labels. */
.l-short { display: none; }
.signout-link { display: none; }

@media (max-width: 640px) {
  /* The top bar: sign out lives in the profile dialog instead. */
  .topbar-right .btn-ghost { display: none; }
  .signout-link { display: inline-block; margin-right: auto; }

  /* The tab row: tighter, and a fade on the right while more tabs are off screen. */
  .tab { padding: 12px 10px; font-size: 13px; }
  .tabs.more-right {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent);
  }

  /* The sticky row on the itinerary: the day list on one line, four short
     buttons sharing the next. Fold all / Open all are in the day list. */
  .day-go { padding: 4px 0 6px; gap: 6px; }
  .day-go-pick .link-btn.small { display: none; }
  .day-go-pick label { font-size: 13px; white-space: nowrap; }
  .day-go-actions { gap: 6px; }
  .day-go-actions .btn { flex: 1 1 0; padding: 0 6px; min-height: 36px; font-size: 13px; white-space: nowrap; }
  .l-full { display: none; }
  .l-short { display: inline; }

  /* Page-head buttons sit side by side rather than one per line. */
  .page-head > span { display: flex; gap: 6px; flex-wrap: wrap; }
  .page-head > span .btn { flex: 1 1 auto; width: auto; }
}

/* Touch screens: the small controls get a thumb-sized target. */
@media (pointer: coarse) {
  .q-menu { min-width: 36px; min-height: 36px; font-size: 18px; }
  .btn-pay { min-height: 32px; }
  .link-btn { padding: 4px 0; }
  .day-block-head .dfold { min-width: 36px; min-height: 36px; }
}

/* ------------------------------------------------------------- today */

.today-head { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.today-head .btn-sm { flex: 0 0 auto; min-width: 40px; min-height: 40px; font-size: 20px; padding: 0; }
.today-title { flex: 1 1 auto; min-width: 0; }
.today-title h1 { margin: 0; }
.today-kicker { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 700; margin-bottom: 6px; }
.today-big { cursor: pointer; }
.today-big:hover { border-color: var(--accent); }
.tb-time { font-size: 15px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.tb-title { font-size: 22px; font-weight: 700; line-height: 1.2; margin: 2px 0 8px; }
.tb-line { margin: 4px 0; font-size: 15px; }
.tb-notes { white-space: pre-line; }
.tb-conf {
  display: inline-block; margin: 8px 0 4px; padding: 8px 14px; border-radius: 8px;
  background: var(--accent-soft); color: var(--ink);
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 22px; letter-spacing: .08em;
}
.tb-conf small { display: block; font-family: inherit; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 2px; }
.tb-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }
.tb-actions .btn { flex: 1 1 auto; text-align: center; min-height: 44px; }
.today-list { padding-top: 4px; padding-bottom: 4px; }
.today-row { display: grid; grid-template-columns: 56px 1fr; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.today-row:last-child { border-bottom: 0; }
.today-row .tr-time { color: var(--ink-soft); font-variant-numeric: tabular-nums; font-size: 14px; padding-top: 1px; }
.today-row .tr-title { font-weight: 600; }
.today-row .tr-sub { color: var(--ink-soft); font-size: 13px; margin-top: 2px; }
.today-row.done { opacity: .55; }
.today-actions { display: flex; gap: 8px; margin: 16px 0 0; }
.today-actions .btn { flex: 1 1 0; text-align: center; min-height: 44px; }
@media (min-width: 900px) {
  .today-head, .today-big, .today-list, .today-actions, .view > .alert { max-width: 640px; }
}

/* ------------------------------------------------- budget on a phone */

.x-phone { display: none; }
details.expense-filter > summary { list-style: none; cursor: pointer; font-weight: 600; font-size: 14px; padding: 2px 0 6px; }
details.expense-filter > summary::-webkit-details-marker { display: none; }
@media (min-width: 641px) {
  details.expense-filter > summary { display: none; }
}
@media (max-width: 640px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .stat { min-height: 0; }
  .stat-value { font-size: 22px; }
  /* Each person's column goes; the line under the title says who paid and who owes. */
  .p-col { display: none; }
  .x-phone { display: block; margin-top: 2px; }
  details.expense-filter > summary::after { content: ' ▾'; color: var(--ink-soft); }
  details.expense-filter[open] > summary::after { content: ' ▴'; }
  .expense-filter .field-row > div { flex-basis: 47%; }
  .expense-filter .field-row > div[style] { flex-basis: 100% !important; }
  .expense-table td:first-child, .expense-table th:first-child { white-space: normal; width: 64px; font-size: 12px; }
}

/* ---------------------------------------------- phones, third pass */

.attach-photo { display: none; }
@media (pointer: coarse) { .attach-photo { display: inline-block; } }
button.dcost { font-family: inherit; line-height: inherit; cursor: default; }
.leaflet-top.leaflet-right .map-me { display: block; }
@media (max-width: 640px) {
  /* the per-person figures show on a tap of the day's total */
  .day-block-head .dpp { display: none; flex-basis: 100%; white-space: normal; }
  .day-block-head.pp-open .dpp { display: block; }
  button.dcost { cursor: pointer; }
}

/* =====================================================================
   Dark mode: follows the phone's own setting. The colour tokens change
   and the few tinted backgrounds that are not tokens are restated. The
   book, the budget sheet and the shared plan carry class="paper" on
   <html> and stay light, because they are for printing.
   ===================================================================== */

:root { color-scheme: light; }
@media (prefers-color-scheme: dark) {
  html:not(.paper) { color-scheme: dark; --bg: #101418; --surface: #181e25; --line: #2a333d; --ink: #e6ebf0; --ink-soft: #9aa6b2; --accent: #79c2a0; --accent-soft: #1b322a; --good: #6ccb9a; --warn: #e6b45a; --bad: #f08a80; --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 1px 3px rgba(0, 0, 0, .5); }
  html:not(.paper) input, html:not(.paper) select, html:not(.paper) textarea { background: #0f1317; color: var(--ink); }
  html:not(.paper) tbody tr:hover { background: #1d242c; }
  html:not(.paper) .btn:hover { border-color: #3d4854; }
  html:not(.paper) .btn-primary { color: #0b1620; }
  html:not(.paper) .btn-primary:hover { background: #9ad6b9; }
  html:not(.paper) .pill-good, html:not(.paper) .btn-pay.is-set, html:not(.paper) .btn-expense, html:not(.paper) .kind-row.on td { background: #16302a; border-color: #2c5a48; color: var(--good); }
  html:not(.paper) .btn-expense:hover { background: #1c3d34; }
  html:not(.paper) .pill-warn, html:not(.paper) .alert-warn, html:not(.paper) .env-badge { background: #3a2d10; border-color: #6b5218; color: var(--warn); }
  html:not(.paper) .pill-bad, html:not(.paper) .alert-error { background: #3d1e1b; border-color: #6e3630; color: var(--bad); }
  html:not(.paper) .alert-info { color: #c0e3d0; border-color: #2c5a48; }
  html:not(.paper) .btn-ai { background: linear-gradient(135deg, #2b2340, #1e2a3f); border-color: #5b4a99; color: var(--ink); }
  html:not(.paper) .btn-ai:hover { border-color: #8b6fd6; }
  html:not(.paper) .who-pill, html:not(.paper) .route-link { border-color: #2c5a48; }
  html:not(.paper) .quad-stay { --q: #a596f0; --q-soft: #221e33; }
  html:not(.paper) .quad-day { --q: #6fb1e6; --q-soft: #172634; }
  html:not(.paper) .quad-meals { --q: #f0a54d; --q-soft: #33261a; }
  html:not(.paper) .quad-day .q-item.k-activity:hover, html:not(.paper) .quad-day .q-item.k-other:hover { background: #16302a; }
  html:not(.paper) .day-notes { background: #23211a; }
  html:not(.paper) .day-notes .q-head { color: #c8b872; }
  html:not(.paper) .day-notes .note + .note { border-top-color: #3d3a2a; }
  html:not(.paper) .trip-map { background: #1d242c; }
  html:not(.paper) .toast { background: #e6ebf0; color: #101418; }
  html:not(.paper) .toast .toast-act { border-color: rgba(0, 0, 0, .35); color: #101418; }
  html:not(.paper) .leaflet-popup-content-wrapper, html:not(.paper) .leaflet-popup-tip { background: var(--surface); color: var(--ink); }
  html:not(.paper) .leaflet-bar a { background: var(--surface); color: var(--ink); border-bottom-color: var(--line); }
  html:not(.paper) .leaflet-control-attribution { background: rgba(24, 30, 37, .85); color: var(--ink-soft); }
  html:not(.paper) .map-pin { border-color: #181e25; }
  html:not(.paper) .daynum { background: var(--ink-soft); color: #101418; }
  html:not(.paper) .lp-top, html:not(.paper) body.lp { background: var(--surface); }
  html:not(.paper) .tabs.more-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent); }
}

/* the short add form: day and time side by side even on a phone */
.qa-when > div { flex: 1 1 120px !important; }
.qa-when { flex-wrap: nowrap; }

/* Expense sits in the Today header, beside the day arrows */
.today-head .today-exp { min-width: 0; font-size: 13px; padding: 0 10px; white-space: nowrap; }

/* ------------------------------------------- conversations with AI */

.chat-list { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 14px; }
.chat-card { display: flex; flex-direction: column; gap: 2px; text-align: left; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.chat-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.chat-card .chat-sum { white-space: normal; }
.chat-tools { font-size: 13px; color: var(--ink-soft); margin: -4px 0 10px; }
.chat-log { display: flex; flex-direction: column; gap: 10px; margin: 0 0 12px; }
.chat-user, .chat-ai { border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.chat-user { align-self: flex-end; max-width: 88%; background: var(--accent-soft); color: var(--ink); white-space: pre-line; }
.chat-ai { align-self: stretch; background: var(--bg); border: 1px solid var(--line); }
.chat-ai p { margin: 0 0 6px; }
.chat-who { display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 4px; }
.ai-turn > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent); }
.ai-turn .ai-list { max-height: none; }
.chat-added { margin: 0 0 10px; padding-left: 18px; }
#ai-accept .inline-form { align-items: stretch; }
#ai-accept .inline-form select { flex: 1 1 200px; min-width: 0; }
#ai-more { margin-top: 12px; }
#ai-more .inline-form input { flex: 1 1 200px; min-width: 0; }

/* ------------------------------------------------- help and the tour */

.help-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-soft); font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; line-height: 1;
}
.help-btn:hover, .help-btn:focus-visible { color: var(--accent); border-color: var(--accent); outline: none; }
.help-top { display: flex; gap: 8px; align-items: center; margin: 0 0 10px; }
.help-top input { flex: 1 1 auto; min-width: 0; }
.help-top .btn { flex: 0 0 auto; }
.help-list { display: flex; flex-direction: column; gap: 6px; }
.help-sec { border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; background: var(--surface); }
.help-sec > summary { cursor: pointer; font-weight: 700; padding: 10px 0; list-style: none; }
.help-sec > summary::-webkit-details-marker { display: none; }
.help-sec > summary::before { content: '›'; display: inline-block; width: 16px; color: var(--ink-soft); transition: transform .12s; }
.help-sec[open] > summary::before { transform: rotate(90deg); }
.help-body { padding: 0 0 10px; font-size: 14px; }
.help-body ol { margin: 0; padding-left: 22px; }
.help-body li { margin: 0 0 8px; }
.help-body em { font-style: normal; color: var(--accent); }

.tour-nudge {
  background: var(--accent-soft); color: var(--ink); border-bottom: 1px solid var(--line);
  padding: 8px 20px; font-size: 14px; text-align: center;
}
.tour-block { position: fixed; inset: 0; z-index: 60; }
.tour-dim { position: absolute; background: rgba(10, 20, 40, .55); }
.tour-spot {
  position: fixed; z-index: 61; border-radius: 10px; pointer-events: none;
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 4px rgba(255, 255, 255, .6);
  transition: top .15s, left .15s, width .15s, height .15s;
}
.tour-spot[hidden] { display: none; }
.tour-card {
  position: fixed; z-index: 62; left: 50%; transform: translateX(-50%); width: min(420px, calc(100vw - 24px));
  background: var(--surface); color: var(--ink); border-radius: 12px; border-top: 4px solid var(--accent);
  box-shadow: 0 16px 48px rgba(0, 0, 0, .3); padding: 14px 16px 12px; bottom: 16px;
}
.tour-card h3 { margin: 2px 0 6px; font-size: 16px; }
.tour-card p { margin: 0 0 12px; font-size: 14px; }
.tour-actions { display: flex; gap: 8px; align-items: center; }
.tour-actions .grow { flex: 1 1 auto; }
@media (max-width: 640px) {
  .help-btn { width: 30px; height: 30px; }
  .tour-nudge { padding: 8px 12px; font-size: 13px; }
}

/* =====================================================================
   The trip book, designed for paper: the trip's colour throughout, a
   cover with a map, a contents page, an essentials page, a running head
   and page numbers, a page per day, and nothing split across a page.
   ===================================================================== */

.book { --book: var(--accent); }
.book-run { display: none; }
.book-cover { border-bottom: 0; padding: 0 0 20px; margin-bottom: 20px; }
.book-band { height: 18px; background: var(--book); border-radius: 0 0 6px 6px; margin: 0 0 34px; }
.book-cover h1 { font-size: 40px; letter-spacing: -.01em; margin: 0 0 6px; }
.book-cover .doc-sub { font-size: 20px; margin: 0 0 6px; }
.book-dates { font-size: 15px; margin: 0 0 18px; color: var(--ink); }
.book-map { position: relative; margin: 6px 0 16px; border: 1px solid #d8dde3; border-radius: 6px; overflow: hidden; background: #e9eef3; }
.book-map img { display: block; width: 100%; height: auto; }
.book-map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.book-map-credit { position: absolute; right: 6px; bottom: 4px; font-size: 9px; color: #555; background: rgba(255, 255, 255, .78); padding: 1px 5px; border-radius: 3px; font-family: Helvetica, Arial, sans-serif; }
.book h2 { border-bottom: 2px solid var(--book); color: var(--ink); font-size: 20px; padding-bottom: 4px; margin: 26px 0 12px; }
.book h3 { font-size: 14px; margin: 18px 0 6px; }
.book-glance th, .book-ess th { color: var(--book); border-bottom: 1px solid var(--book); }
.book-ess table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.book-ess th, .book-ess td { text-align: left; vertical-align: top; padding: 5px 6px; border-bottom: 1px solid var(--line); }
.book-ess th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.book .conf { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; letter-spacing: .04em; white-space: nowrap; }
.book-emerg { margin-top: 14px; padding: 10px 12px; border: 1px solid var(--line); border-left: 4px solid var(--book); font-size: 13px; }
.toc { list-style: none; margin: 0; padding: 0; font-size: 15px; }
.toc > li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.toc > li > span:first-child { font-weight: 700; display: inline-block; min-width: 140px; }
.toc .d { font-size: 13px; color: var(--ink-soft); }
.toc-days { list-style: none; margin: 8px 0 0; padding: 0 0 0 140px; columns: 2; column-gap: 24px; font-size: 13px; }
.toc-days li { padding: 2px 0; break-inside: avoid; }
.toc-n { display: inline-block; min-width: 52px; font-weight: 700; color: var(--book); }
.book .daynum { background: var(--book); }
.book .doc-day h3 { background: none; border-bottom: 2px solid var(--book); padding: 6px 0; font-size: 16px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.book .doc-day h3 .dayplace { color: var(--ink-soft); font-weight: 400; font-size: 14px; }
.book .doc-day h3 .dayplace::before { content: '· '; }
.book .doc-day h3 .daycost { margin-left: auto; float: none; font-weight: 400; color: var(--ink-soft); }
.book .doc-item .est { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.book .doc-item .t { font-size: 13px; }
@media (max-width: 640px) { .toc-days { columns: 1; padding-left: 0; } .toc > li > span:first-child { display: block; } }

@media print {
  @page {
    margin: 18mm 14mm 18mm;
    @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 9pt Georgia, "Times New Roman", serif; color: #666; }
  }
  .book { padding-top: 9mm; }
  .book-run {
    display: flex; justify-content: space-between; position: fixed; top: 0; left: 0; right: 0;
    font-size: 9pt; color: #666; border-bottom: 1px solid #ddd; padding-bottom: 1.5mm; background: #fff;
  }
  .book-cover { break-after: page; page-break-after: always; padding-top: 0; }
  .book-band { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .book-toc { break-after: page; page-break-after: always; }
  .book-ess { break-before: page; page-break-before: always; }
  .book.daypages .doc-day + .doc-day { break-before: page; page-break-before: always; }
  .doc-day { break-inside: auto; page-break-inside: auto; }
  .doc-item, .book-map { break-inside: avoid; page-break-inside: avoid; }
  .book h2, .book h3 { break-after: avoid; page-break-after: avoid; }
  .book .daynum { background: var(--book) !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .book .doc-day h3 { background: none !important; }
  .book-glance th, .book-ess th, .book h2, .book-emerg, .toc-n { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .book-map-credit { background: #fff; }
}

/* The book, quieter: ink rules and grey heads; the trip's colour only on
   the cover band and the map pins stay a neutral dark. */
.book h2 { border-bottom: 1px solid #1f2937; font-size: 19px; letter-spacing: -.01em; margin: 30px 0 12px; }
.book h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: #374151; margin: 18px 0 6px; }
.book table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 12px; }
.book th, .book td { text-align: left; vertical-align: top; padding: 5px 6px; border-bottom: 1px solid #e5e7eb; }
.book th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: #6b7280; font-weight: 600; border-bottom: 1px solid #1f2937; }
.book tfoot th { color: #1f2937; border-top: 1px solid #1f2937; border-bottom: 0; font-size: 12.5px; text-transform: none; letter-spacing: 0; }
.book .nowrap { white-space: nowrap; }
.book .num { text-align: right; font-variant-numeric: tabular-nums; }
.book .d { font-size: 11.5px; color: #6b7280; }
.book .daynum { background: #1f2937; color: #fff; }
.book .doc-day h3 { text-transform: none; letter-spacing: 0; color: var(--ink); border-bottom: 1px solid #1f2937; font-size: 16px; }
.book .doc-day h3 .dayplace { color: #6b7280; }
.book .doc-day h3 .daycost { color: #374151; }
.book-glance th, .book-ess th { color: #6b7280; border-bottom-color: #1f2937; }
.toc-n { color: #1f2937; }
.book-emerg { border-left-color: #1f2937; }
.book-totals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 6px 0 16px; }
.book-totals > div { border: 1px solid #e5e7eb; border-radius: 6px; padding: 10px 12px; }
.book-totals .k { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: #6b7280; }
.book-totals .v { display: block; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.book .settle { margin: 4px 0 0; padding-left: 20px; font-size: 13.5px; }
.book-band { height: 14px; border-radius: 0 0 4px 4px; }
.book-cover h1 { font-size: 38px; }
@media print {
  .book-transport, .book-stays, .book-money, .book-people-sec { break-before: page; page-break-before: always; }
  .book-transport table, .book-stays table, .book-money table { break-inside: auto; }
  .book tr { break-inside: avoid; page-break-inside: avoid; }
  .book .daynum { background: #1f2937 !important; }
  .book h2, .book th, .book tfoot th, .book-totals > div { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* stays in the book: one block each, dates down the side */
.book .book-stay { grid-template-columns: 96px 1fr auto; padding: 9px 4px; }
.book .book-stay .t { color: var(--ink); font-size: 13px; line-height: 1.35; }
.book .book-stay .c { color: #6b7280; font-size: 12.5px; }
.book .book-stay strong { font-size: 15px; }

/* the book's sections: a list to tick and drag */
.book-order { list-style: none; margin: 4px 0 8px; padding: 0; }
.book-sec { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px; margin: 4px 0; background: var(--surface); }
.book-sec .check-row { flex: 1 1 auto; margin: 0; }
.book-sec .grip { cursor: grab; color: var(--ink-soft); font-size: 14px; letter-spacing: -3px; user-select: none; padding: 0 2px; }
.book-sec.dragging { opacity: .45; }
.book-sec .ud { display: flex; flex-direction: column; gap: 0; }
.book-sec .ud .link-btn { font-size: 10px; text-decoration: none; line-height: 1.2; padding: 1px 4px; color: var(--ink-soft); }
.book-sec .ud .link-btn:hover { color: var(--accent); }
@media (pointer: coarse) { .book-sec .ud .link-btn { font-size: 14px; padding: 4px 8px; } }
@media print { .book-restaurants { break-before: page; page-break-before: always; } }

/* the money card: what it costs, who paid, who's in, what each owes */
.cost-kind { margin: 2px 0 6px; }
.owed-block { margin-top: 8px; }
.owed-block .who-row { padding-top: 4px; }
.owe-rows { margin: 2px 0 4px; }
.owed-preview { min-height: 18px; margin: 2px 0 0; }
.owed-preview.good { color: var(--good); }
.owed-preview.bad { color: var(--bad); }
#lbl-who .link-btn { font-weight: 400; margin-left: 6px; }

.who-block { margin-top: 6px; }

/* ------------------------------------------------------------ weather */
.wx-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: thin; }
.wx-day { flex: 0 0 104px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 8px; text-align: center; box-shadow: var(--shadow); }
.wx-day.wx-avg { border-style: dashed; }
.wx-date { font-size: 12px; font-weight: 700; white-space: nowrap; }
.wx-icon { font-size: 28px; line-height: 1.2; margin: 4px 0; }
.wx-temp { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wx-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pack-list { margin: 2px 0 12px; padding-left: 20px; }
.pack-list li { margin: 3px 0; }
#weather-pack h3 { margin: 10px 0 4px; font-size: 14px; }
@media (max-width: 640px) { .wx-day { flex-basis: 92px; padding: 8px 6px; } }

/* the weather, condensed: one line per day, several to a row */
.wx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 2px 18px; padding: 8px 14px; }
.wx-row { display: grid; grid-template-columns: 92px 26px 74px 1fr; align-items: center; gap: 6px; padding: 3px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.wx-row .wx-date { font-weight: 600; white-space: nowrap; font-size: 12.5px; }
.wx-row .wx-icon { font-size: 16px; line-height: 1; text-align: center; }
.wx-row .wx-temp { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wx-row .wx-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wx-row.wx-avg .wx-date { color: var(--ink-soft); font-style: italic; }
.wx-stays { margin: -6px 0 6px; }
.page-head.sub + .wx-stays { margin-top: -8px; }
@media (max-width: 640px) { .wx-grid { grid-template-columns: 1fr; padding: 6px 12px; } }

.book-weather table { font-size: 12px; }
.book-weather .pack-title { margin: 8px 0 2px; }
@media print { .book-weather { break-before: page; page-break-before: always; } }

/* the packing list: big rows to tick with a thumb */
.pack-progress { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; }
.pack-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; max-width: 320px; }
.pack-bar span { display: block; height: 100%; background: var(--good, #2e7d32); border-radius: 4px; transition: width .2s; }
.pack-group h3 { margin: 0 0 6px; font-size: 15px; }
.pack-row { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); }
.pack-row:first-of-type { border-top: 0; }
.pack-main { display: flex; align-items: center; gap: 10px; flex: 1; min-height: 44px; padding: 6px 0; margin: 0; cursor: pointer; font-size: 14.5px; }
.pack-main input[type="checkbox"] { width: 20px; height: 20px; margin: 0; flex: 0 0 auto; }
.pack-name { flex: 0 1 auto; }
.pack-for { font-size: 11px; padding: 1px 7px; }
.pack-why { flex: 1 1 auto; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pack-row.packed .pack-name { text-decoration: line-through; color: var(--ink-soft); }
.pack-edit { flex: 0 0 auto; font-size: 13px; }
#pack-show { width: auto; max-width: 260px; display: inline-block; }
@media (max-width: 640px) { .pack-why { display: none; } #pack-show { width: 100%; max-width: none; } }
/* in the book: boxes to tick on paper, two to a row */
.book-packing .pack-print { list-style: none; padding-left: 0; columns: 2; column-gap: 24px; margin: 2px 0 10px; font-size: 13.5px; }
.book-packing .pack-print li { break-inside: avoid; margin: 3px 0; }
.book-packing .pack-title { margin: 8px 0 2px; }

/* settling up: a payment recorded, and the pace of the spending */
.settle-h { margin: 14px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
.settle-list.settled li { color: var(--ink-soft); }
.settle-record { margin-left: 8px; vertical-align: middle; font-weight: 500; }
.pace-col .small { font-weight: 400; white-space: nowrap; }
.pace-line { margin: -4px 0 0; }
@media (max-width: 640px) { .pace-col .small { white-space: normal; } }

/* press-and-hold dragging on a phone: the ghost follows the finger */
.touch-ghost { position: fixed; z-index: 70; pointer-events: none; opacity: .92; background: var(--surface); box-shadow: 0 10px 28px rgba(0, 0, 0, .28); border-radius: 10px; transform: rotate(1.5deg); }
@media (pointer: coarse) {
  .q-item[data-drag] { -webkit-touch-callout: none; }
  body.dragging-item, body.dragging-item * { -webkit-user-select: none; user-select: none; }
}
/* the documents on the trip */
#docs-card h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.docs-day-head { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); margin: 10px 0 2px; }
.doc-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.doc-row .doc-name { font-weight: 600; text-decoration: none; }
.doc-row .doc-on { flex: 1 1 auto; }
.doc-kept { font-size: 11px; }

/* the day's weather on the banner and on Today; typical weather is dashed */
.day-block-head .dwx { font-size: 12px; white-space: nowrap; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; font-variant-numeric: tabular-nums; }
.day-block-head .dwx.wx-avg { border-style: dashed; }
.today-wx-line:empty { display: none; }
.today-wx { display: inline-block; margin-top: 4px; font-size: 14px; font-variant-numeric: tabular-nums; }
.today-wx.wx-avg { border-bottom: 1px dashed var(--line); }
@media (max-width: 640px) { .day-block-head .dwx { padding: 1px 6px; } }

/* the paperclip is a button: the files without opening the item */
button.qclip { background: none; border: 0; padding: 0 2px; font: inherit; cursor: pointer; color: inherit; min-height: 0; line-height: inherit; }
button.qclip:hover { text-decoration: underline; text-underline-offset: 2px; }
.today-row button.qclip { margin-left: 4px; }
.files-sheet { list-style: none; padding: 0; margin: 4px 0 8px; }
.files-sheet li { padding: 8px 0; border-top: 1px solid var(--line); }
.files-sheet li a:first-child { font-weight: 600; text-decoration: none; }

.aday { font-weight: 400; white-space: nowrap; }
tfoot .aday, tfoot .pace-col .small { text-transform: none; letter-spacing: 0; }

/* the book's budget table: the per-day line under each figure, as on the tab */
.book .num .aday { display: block; font-weight: 400; font-size: 10.5px; white-space: nowrap; }
.book .num .aday.over { color: #b91c1c; }
.book tfoot th .aday { text-transform: none; letter-spacing: 0; }

/* who is on an item, above the money that says who owes for it */
.who-block + .who-block { margin-top: 10px; }
#item-on-block .auth-hint { margin: 2px 0 0; }

.who-box-off { opacity: .55; }

/* --------------------------------------------------------------- cover */
/* The front of the family book. Warm paper, a few soft colour blobs, the
   family's name big, the faces in a row, and recent photographs stacked
   like polaroids on a kitchen table. Cream on purpose in both schemes:
   it is a page in a book, not a panel in an app. */
.cover {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; align-items: center;
  position: relative; overflow: hidden; margin-bottom: 8px; padding: 34px 36px;
  border: 1px solid #e6d3bf; border-radius: 18px; color: #3a2e24;
  background:
    radial-gradient(420px 260px at 8% 0%, rgba(255, 196, 140, .45), transparent 70%),
    radial-gradient(360px 240px at 100% 100%, rgba(150, 196, 170, .45), transparent 70%),
    radial-gradient(280px 200px at 70% 10%, rgba(255, 226, 120, .35), transparent 70%),
    linear-gradient(150deg, #fff8ee, #fbeedd);
  box-shadow: 0 12px 30px rgba(96, 66, 36, .12);
}
.cover-text { position: relative; min-width: 0; }
.cover-hello { margin: 0 0 6px; color: #9b6842; font-size: 15px; font-weight: 600; }
.cover-title { margin: 0 0 10px; font: 700 clamp(30px, 4.6vw, 48px)/1.05 Georgia, "Times New Roman", serif; letter-spacing: -.01em; color: #2f241b; overflow-wrap: anywhere; }
.cover-line { margin: 0 0 18px; max-width: 46ch; font-size: 16px; color: #6b5a4a; }
.cover-faces { display: flex; flex-wrap: wrap; margin: 0 0 14px; padding-left: 6px; }
.cover-face {
  display: inline-grid; place-items: center; width: 44px; height: 44px; margin-left: -8px;
  border: 3px solid #fff8ee; border-radius: 50%; font-size: 14px; font-weight: 700; color: #3a2e24;
  box-shadow: 0 2px 6px rgba(96, 66, 36, .18); transition: transform .15s;
}
.cover-face:hover { transform: translateY(-4px) rotate(-6deg); z-index: 1; }
.cover-face.f0 { background: #ffd2a8; } .cover-face.f1 { background: #bfe0c9; } .cover-face.f2 { background: #ffe58a; }
.cover-face.f3 { background: #bcd9f5; } .cover-face.f4 { background: #e2c6f0; } .cover-face.f5 { background: #ffb8b0; }
.cover-face.more { background: #fff; color: #9b6842; font-size: 13px; }
.cover-cake { display: inline-block; margin: 0 0 18px; padding: 7px 13px; border-radius: 999px; background: #fff; border: 1px dashed #e0b48c; font-size: 14px; font-weight: 600; color: #7a4a22; }
.cover-cake .muted { color: #9b6842; font-weight: 400; }
.cover-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cover-actions .btn { background: #fff; }
.cover-actions .btn-primary { background: #2f6b4f; color: #fff; }

.cover-pile { position: relative; height: 270px; }
.cover-polaroid {
  position: absolute; width: 58%; max-width: 230px; margin: 0; padding: 9px 9px 30px; background: #fff;
  box-shadow: 0 8px 18px rgba(72, 52, 35, .22); transition: transform .2s;
}
.cover-polaroid::before {
  content: ""; position: absolute; top: -10px; left: 50%; width: 70px; height: 20px; transform: translateX(-50%) rotate(-2deg);
  background: rgba(255, 224, 130, .75); box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
}
.cover-polaroid img, .cover-blank { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #efe6da; }
.cover-blank { display: grid; place-items: center; font-size: 44px; }
.cover-polaroid figcaption { position: absolute; right: 9px; bottom: 7px; left: 9px; overflow: hidden; font: 13px/1.2 Georgia, serif; color: #665849; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.cover-polaroid.p0 { left: 2%; top: 18px; transform: rotate(-7deg); z-index: 1; }
.cover-polaroid.p1 { right: 2%; top: 4px; transform: rotate(5deg); z-index: 2; }
.cover-polaroid.p2 { left: 26%; bottom: 0; transform: rotate(-1deg); z-index: 3; }
.cover-polaroid:hover { transform: rotate(0) scale(1.04); z-index: 5; }
@media (max-width: 760px) {
  .cover { grid-template-columns: 1fr; padding: 24px 18px; gap: 18px; }
  .cover-pile { height: 220px; order: -1; }
  .cover-polaroid { width: 52%; }
  .cover-actions .btn { flex: 1 1 auto; text-align: center; min-height: 42px; }
}
@media (prefers-color-scheme: dark) {
  html:not(.paper) .cover { border-color: #5a4838; box-shadow: 0 12px 30px rgba(0, 0, 0, .45); }
}

/* ---------------------------------------------------------- family tree */
/* Generations top to bottom, couples side by side, the lines drawn by the
   list nesting: each <ul> is a row of children, each <li> one family unit.
   Cream cards like the cover; it is a page in the family book. */
.tree { overflow-x: auto; padding: 8px 4px 22px; -webkit-overflow-scrolling: touch; }
.tree ul { display: flex; justify-content: center; position: relative; margin: 0; padding: 28px 0 0; list-style: none; }
.tree > ul { padding-top: 0; min-width: max-content; margin: 0 auto; }
.tree ul ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 28px; border-left: 2px solid #d3b995; }
.tree li { display: flex; flex-direction: column; align-items: center; position: relative; padding: 28px 10px 0; }
.tree > ul > li { padding: 0 18px; }
.tree li::before, .tree li::after { content: ""; position: absolute; top: 0; right: 50%; width: 50%; height: 28px; border-top: 2px solid #d3b995; }
.tree li::after { right: auto; left: 50%; border-left: 2px solid #d3b995; }
.tree li:only-child::before, .tree li:only-child::after { display: none; }
.tree li:only-child { padding-top: 0; }
.tree li:first-child::before, .tree li:last-child::after { border: 0 none; }
.tree li:last-child::before { border-right: 2px solid #d3b995; border-radius: 0 8px 0 0; }
.tree li:first-child::after { border-radius: 8px 0 0 0; }
.tree > ul > li::before, .tree > ul > li::after { display: none; }
.tree-unit { display: flex; align-items: center; gap: 4px; position: relative; z-index: 1; }
.tree-ring { color: #d4736a; font-size: 15px; padding: 0 2px; }
.tree-card {
  display: flex; flex-direction: column; align-items: center; width: 148px; padding: 12px 10px 11px;
  border: 1px solid #e6d3bf; border-radius: 14px; background: linear-gradient(160deg, #fffaf2, #f9eedf);
  color: #2f241b; text-align: center; box-shadow: 0 3px 10px rgba(96, 66, 36, .12);
}
.tree-card[role="button"] { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.tree-card[role="button"]:hover, .tree-card[role="button"]:focus-visible { transform: translateY(-3px); box-shadow: 0 8px 18px rgba(96, 66, 36, .2); outline: none; }
.tree-card strong { margin-top: 7px; font-size: 14px; line-height: 1.25; overflow-wrap: anywhere; }
.tree-card-line { margin-top: 2px; font-size: 12px; color: #9b6842; }
.tree-card-born { margin-top: 1px; font-size: 11px; color: #8a7a6a; }
.tree-avatar {
  display: inline-grid; place-items: center; flex: 0 0 auto; width: 46px; height: 46px; border-radius: 50%;
  border: 3px solid #fff; font-size: 14px; font-weight: 700; color: #3a2e24; box-shadow: 0 2px 6px rgba(96, 66, 36, .18);
}
.tree-avatar.f0 { background: #ffd2a8; } .tree-avatar.f1 { background: #bfe0c9; } .tree-avatar.f2 { background: #ffe58a; }
.tree-avatar.f3 { background: #bcd9f5; } .tree-avatar.f4 { background: #e2c6f0; } .tree-avatar.f5 { background: #ffb8b0; }
.tree-hint { margin: 0 0 6px; }
.tree-loose { display: flex; flex-wrap: wrap; gap: 8px; }
.tree-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border: 1px solid #e6d3bf; border-radius: 999px; background: #fffaf2; color: #2f241b; font-size: 14px; }
.tree-chip .tree-avatar { width: 32px; height: 32px; border-width: 2px; font-size: 11px; }
@media (max-width: 640px) {
  .tree-card { width: 118px; padding: 9px 6px 8px; }
  .tree-avatar { width: 38px; height: 38px; font-size: 12px; }
  .tree li { padding: 22px 5px 0; }
  .tree ul { padding-top: 22px; }
  .tree ul ul::before, .tree li::before, .tree li::after { height: 22px; }
}
@media (prefers-color-scheme: dark) {
  html:not(.paper) .tree ul ul::before, html:not(.paper) .tree li::before, html:not(.paper) .tree li::after { border-color: #6b563f; }
  html:not(.paper) .tree-card, html:not(.paper) .tree-chip { border-color: #5a4838; }
}
/* Step relationships: dashed line down to a child of only one partner, and
   the card names whose child they are. */
.tree li.tree-step::before, .tree li.tree-step::after, .tree ul.tree-step-only::before { border-style: dashed; }
.tree-card-step { margin-top: 2px; padding: 1px 8px; border-radius: 999px; background: #fff; border: 1px dashed #d3b995; font-size: 11px; color: #7a4a22; }
/* The viewer's own card, and what the family calls somebody. */
.tree-card.is-me { border-color: #2f6b4f; box-shadow: 0 0 0 3px rgba(47, 107, 79, .18), 0 3px 10px rgba(96, 66, 36, .12); }
.tree-card-me { margin-top: 3px; padding: 1px 9px; border-radius: 999px; background: #2f6b4f; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.tree-card-called { margin-top: 1px; font-size: 12px; font-style: italic; color: #6b5a4a; }
/* The plain list of connections under the tree, where a wrong one is removed. */
.tree-links-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.tree-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 8px 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 14px; }
.tree-link .rel { color: var(--ink-soft); font-size: 12px; text-transform: lowercase; }
/* Rows of children under one couple: one row for the children they have
   together, one row per partner for that partner's own. Rows sit side by
   side and never move; alignTreeStems() gives each a short elbow from its
   stem across to the right card (or the couple's middle) above. */
.tree-kids { display: flex; justify-content: center; align-items: flex-start; }
.tree-kids > ul + ul { margin-left: 18px; }
.tree > ul { padding-left: 24px; padding-right: 24px; }
.tree .tree-kids > ul.bridged { padding-top: 40px; }
.tree .tree-kids > ul.bridged::before { top: 14px; height: 26px; }
.tree .tree-kids > ul.bridged::after { content: ""; position: absolute; top: 0; height: 14px; width: var(--bw); border-bottom: 2px solid #d3b995; }
.tree .tree-kids > ul.bridged.bridge-left::after { left: calc(50% - var(--bw)); border-left: 2px solid #d3b995; border-radius: 6px 0 0 0; }
.tree .tree-kids > ul.bridged.bridge-right::after { left: 50%; border-right: 2px solid #d3b995; border-radius: 0 6px 0 0; }
.tree .tree-kids > ul.bridged.tree-step-only::after { border-style: dashed; }
@media (max-width: 640px) {
  .tree .tree-kids > ul.bridged { padding-top: 34px; }
  .tree .tree-kids > ul.bridged::before { top: 12px; height: 22px; }
  .tree .tree-kids > ul.bridged::after { height: 12px; }
}
@media (prefers-color-scheme: dark) {
  html:not(.paper) .tree .tree-kids > ul.bridged::after { border-color: #6b563f; }
}
/* Stand-in for parents who are not on the tree, so siblings still hang together. */
.tree-unit-ghost { justify-content: center; }
.tree-ghost { display: inline-block; padding: 6px 14px; border: 1px dashed #d3b995; border-radius: 999px; background: #fffaf2; color: #9b6842; font-size: 12px; font-weight: 600; }
/* An album card is the album: click opens, double click edits. */
.album-card.is-clickable { cursor: pointer; user-select: none; transition: transform .15s, box-shadow .15s; }
.album-card.is-clickable:hover, .album-card.is-clickable:focus-visible { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(16, 24, 40, .14); outline: none; }
.album-card.is-clickable:focus-visible { box-shadow: 0 0 0 3px rgba(47, 107, 79, .35), 0 8px 18px rgba(16, 24, 40, .14); }
/* One Back for every screen that has somewhere to go. */
.backbar { margin: -6px 0 10px; }
.back-btn { border: 0; background: none; padding: 4px 0; font: inherit; font-size: 14px; color: var(--accent); cursor: pointer; }
.back-btn:hover { text-decoration: underline; }
/* Faces: a photo where there is one, initials where there is not. */
img.has-photo { object-fit: cover; padding: 0; }
.avatar.has-photo { width: 32px; height: 32px; border-radius: 50%; }
.topbar .avatar img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.topbar .avatar { padding: 0; overflow: hidden; }
.photo-current { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; }
.photo-current img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
/* Pinned photographs on Family home. */
.photo-pin { position: absolute; top: 8px; right: 8px; z-index: 2; width: 30px; height: 30px; border: 0; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 15px; line-height: 1; cursor: pointer; opacity: .75; }
.photo-pin:hover, .photo-tile.is-pinned .photo-pin { opacity: 1; }
.photo-tile.is-pinned { box-shadow: 0 0 0 3px #e0b48c, var(--shadow); }
/* Birthdays this week, on the cover. */
.cover-cakes { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.cover-cakes .cover-cake { margin: 0; }
/* Activity, folded under Settings. */
.activity-fold > summary { cursor: pointer; font-weight: 600; list-style: none; }
.activity-fold > summary::-webkit-details-marker { display: none; }
.activity-fold > summary::before { content: "\25B8  "; color: var(--accent); }
.activity-fold[open] > summary::before { content: "\25BE  "; }
.activity-fold[open] > summary { margin-bottom: 6px; }
/* Tick everyone a document or photograph is about. */
.tag-people { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.tag-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 5px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; font-size: 14px; user-select: none; }
.tag-chip input { margin: 0 0 0 2px; }
.tag-chip.on, .tag-chip:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); }
.tag-avatar { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 0; font-size: 10px; font-weight: 700; color: #3a2e24; }
.tag-avatar.f0 { background: #ffd2a8; } .tag-avatar.f1 { background: #bfe0c9; } .tag-avatar.f2 { background: #ffe58a; }
.tag-avatar.f3 { background: #bcd9f5; } .tag-avatar.f4 { background: #e2c6f0; } .tag-avatar.f5 { background: #ffb8b0; }
/* Small icon actions that sit beside a name, in view without scrolling. */
.row-icons { display: inline-flex; gap: 2px; margin-left: 8px; vertical-align: middle; }
.icon-btn { border: 0; background: none; padding: 2px 6px; border-radius: 6px; color: var(--ink-soft); font: inherit; font-size: 15px; line-height: 1; cursor: pointer; }
.icon-btn:hover, .icon-btn:focus-visible { background: var(--accent-soft); color: var(--accent); outline: none; }
.icon-btn.icon-danger:hover, .icon-btn.icon-danger:focus-visible { background: #fdecea; color: var(--bad); }
/* The lightbox: a photograph, video or clip shown large in place. */
.modal:has(.lightbox) { max-width: min(96vw, 1100px); }
.lightbox-media { display: grid; place-items: center; margin: 0 0 12px; border-radius: 10px; background: #111; }
.lightbox-media img, .lightbox-media video { display: block; max-width: 100%; max-height: 70vh; border-radius: 10px; }
.lightbox-media audio { width: 100%; padding: 30px 16px; box-sizing: border-box; }
.lightbox h2 { margin: 0 0 4px; }
.tile-link { display: block; width: 100%; height: 100%; color: inherit; text-decoration: none; }
.tile-media { display: grid; place-items: center; width: 100%; height: 100%; font-size: 44px; background: linear-gradient(135deg, #d8b38a, #789b91); }
/* Who is in it: a token field with a list that filters as you type. */
.picker { position: relative; margin: 0 0 12px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.picker:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 107, 79, .15); }
.picker-tokens { display: flex; flex-wrap: wrap; gap: 6px; }
.picker-token { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px; border: 1px solid var(--accent); border-radius: 999px; background: var(--accent-soft); font-size: 14px; }
.picker-x { border: 0; background: none; padding: 0 4px; color: var(--accent); font-size: 17px; line-height: 1; cursor: pointer; }
.picker input.picker-input { width: 100%; margin: 2px 0 0; padding: 6px 4px; border: 0; outline: none; background: transparent; color: var(--ink); font: inherit; box-shadow: none; }
.picker-menu { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; margin-top: 4px; max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 10px 24px rgba(0, 0, 0, .14); }
.picker-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.picker-row:hover, .picker-row:focus-visible { background: var(--accent-soft); outline: none; }
.picker-row .muted { margin-left: auto; }
.picker-empty { padding: 8px 10px; }
/* Drop zones light up while a file is over them. */
#view.is-dropping { outline: 3px dashed var(--accent); outline-offset: -8px; background: var(--accent-soft); border-radius: 14px; }
.album-card.is-dropping { outline: 3px dashed var(--accent); outline-offset: -3px; background: var(--accent-soft); transform: scale(1.02); }
.drop-hint { margin: -8px 0 14px; }
/* The board: pinned photographs as polaroids on cork, each tilted by id. */
.pinboard {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 8px 4px;
  margin: 0 0 10px; padding: 28px 22px 32px; border-radius: 16px; border: 6px solid #a9784f;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, .16), transparent 42%),
    repeating-linear-gradient(45deg, rgba(0, 0, 0, .035) 0 2px, transparent 2px 6px),
    #d9b98f;
  box-shadow: inset 0 0 48px rgba(90, 60, 20, .28), var(--shadow);
}
.pin-polaroid { position: relative; margin: 8px -6px 4px; padding: 8px 8px 4px; background: #fff; box-shadow: 0 6px 16px rgba(60, 40, 20, .32); transition: transform .18s, box-shadow .18s; }
.pin-polaroid.s0 { width: 170px; } .pin-polaroid.s1 { width: 210px; } .pin-polaroid.s2 { width: 152px; }
.pin-polaroid.r0 { transform: rotate(-6deg); } .pin-polaroid.r1 { transform: rotate(3deg); } .pin-polaroid.r2 { transform: rotate(-2deg); }
.pin-polaroid.r3 { transform: rotate(5deg); } .pin-polaroid.r4 { transform: rotate(-4deg); } .pin-polaroid.r5 { transform: rotate(1.5deg); } .pin-polaroid.r6 { transform: rotate(7deg); }
.pin-polaroid:hover { transform: rotate(0) scale(1.06); z-index: 4; box-shadow: 0 14px 28px rgba(60, 40, 20, .4); }
.pin-polaroid .tile-link img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #efe6da; }
.pin-polaroid .tile-link .tile-media { aspect-ratio: 1; height: auto; }
.pin-polaroid .tile-link > span { display: block; padding: 8px 2px 4px; overflow: hidden; color: #4a3b2c; font: 15px/1.2 "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.pushpin { position: absolute; top: -10px; left: 50%; z-index: 2; width: 18px; height: 18px; margin-left: -9px; padding: 0; border: 0; border-radius: 50%; box-shadow: 0 2px 3px rgba(0, 0, 0, .35), inset -3px -3px 4px rgba(0, 0, 0, .25); }
.pushpin::after { content: ""; position: absolute; left: 50%; top: 15px; width: 2px; height: 9px; margin-left: -1px; background: #8a8a8a; }
.pushpin.c0 { background: #e2544a; } .pushpin.c1 { background: #3d8bd6; } .pushpin.c2 { background: #f2b632; } .pushpin.c3 { background: #3aa66a; }
button.pushpin { cursor: pointer; transition: transform .15s; }
button.pushpin:hover, button.pushpin:focus-visible { transform: scale(1.3); outline: none; }
@media (max-width: 640px) {
  .pinboard { padding: 20px 8px 22px; border-width: 4px; }
  .pin-polaroid.s0 { width: 132px; } .pin-polaroid.s1 { width: 150px; } .pin-polaroid.s2 { width: 120px; }
}
/* Family stories: sheets of parchment pinned to the cork. */
.storyboard { align-items: flex-start; }
.parchment {
  position: relative; width: 250px; margin: 10px 4px 6px; padding: 26px 20px 18px; cursor: pointer;
  color: #3f2f1c; font-family: Georgia, "Times New Roman", serif;
  border: 1px solid rgba(120, 80, 30, .3); border-radius: 4px 14px 6px 12px / 12px 6px 14px 4px;
  background:
    radial-gradient(ellipse at 15% 10%, rgba(120, 80, 30, .16), transparent 45%),
    radial-gradient(ellipse at 85% 90%, rgba(120, 80, 30, .18), transparent 40%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .05) 0 1px, transparent 1px 3px),
    linear-gradient(170deg, #f5e7c9, #e8d3a8);
  box-shadow: 0 6px 14px rgba(60, 40, 20, .32), inset 0 0 34px rgba(120, 80, 30, .16);
  transition: transform .18s, box-shadow .18s;
}
.parchment.r0 { transform: rotate(-3deg); } .parchment.r1 { transform: rotate(2deg); } .parchment.r2 { transform: rotate(-1.5deg); }
.parchment.r3 { transform: rotate(3.5deg); } .parchment.r4 { transform: rotate(-2.5deg); } .parchment.r5 { transform: rotate(1deg); } .parchment.r6 { transform: rotate(4deg); }
.parchment:hover, .parchment:focus-visible { transform: rotate(0) scale(1.04); z-index: 4; box-shadow: 0 14px 28px rgba(60, 40, 20, .4), inset 0 0 34px rgba(120, 80, 30, .16); outline: none; }
.parchment h3 { margin: 0 0 8px; font: 700 19px/1.15 Georgia, "Times New Roman", serif; color: #2f241b; }
.parchment p { margin: 0 0 10px; font-size: 14px; line-height: 1.45; color: #4a3b2c; white-space: pre-line; }
.parchment-more { font-size: 13px; font-style: italic; color: #7a4a22; }
@media (max-width: 640px) { .parchment { width: calc(50% - 12px); min-width: 140px; padding: 22px 12px 14px; } }
/* A story or note read on its own: parchment in the popup, on cork. */
.modal:has(.paper) { padding: 26px; border-top: 0; border: 6px solid #a9784f; border-radius: 16px;
  background: radial-gradient(circle at 20% 30%, rgba(255, 255, 255, .16), transparent 42%), repeating-linear-gradient(45deg, rgba(0, 0, 0, .035) 0 2px, transparent 2px 6px), #d9b98f; }
.paper { position: relative; padding: 34px 34px 22px; color: #3f2f1c; font-family: Georgia, "Times New Roman", serif;
  border: 1px solid rgba(120, 80, 30, .3); border-radius: 4px 14px 6px 12px / 12px 6px 14px 4px;
  background: radial-gradient(ellipse at 15% 10%, rgba(120, 80, 30, .16), transparent 45%), radial-gradient(ellipse at 85% 90%, rgba(120, 80, 30, .18), transparent 40%), repeating-linear-gradient(0deg, rgba(255, 255, 255, .05) 0 1px, transparent 1px 3px), linear-gradient(170deg, #f5e7c9, #e8d3a8);
  box-shadow: 0 10px 24px rgba(60, 40, 20, .35), inset 0 0 34px rgba(120, 80, 30, .16); transform: rotate(-.6deg); }
.paper h2 { margin: 0 0 14px; font: 700 24px/1.15 Georgia, "Times New Roman", serif; color: #2f241b; }
.paper-body { font-size: 16px; line-height: 1.6; white-space: pre-line; color: #3f2f1c; }
.paper-meta { margin: 18px 0 0; font-size: 13px; font-style: italic; color: #7a4a22; }
.paper .modal-actions { position: static; margin: 16px 0 0; padding: 12px 0 0; border-top: 1px dashed rgba(120, 80, 30, .35); background: transparent; }
.paper .pushpin { top: -12px; }
/* Any card that opens on a click. */
[data-note].is-clickable { cursor: pointer; user-select: none; transition: transform .15s, box-shadow .15s; }
[data-note].is-clickable:hover, [data-note].is-clickable:focus-visible { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(16, 24, 40, .14); outline: none; }
@media (max-width: 640px) { .modal:has(.paper) { padding: 12px; border-width: 4px; } .paper { padding: 26px 18px 16px; } }
/* Loose snapshots on the board: a glossy print held on with two bits of
   tape, and a faint grey pin that pins it for good. */
.pin-polaroid.is-loose { padding: 4px 4px 4px; background: #fbfbf8; }
.pin-polaroid.is-loose .tile-link > span { padding: 5px 2px 2px; font-size: 13px; }
.pin-polaroid.is-loose::before, .pin-polaroid.is-loose::after {
  content: ""; position: absolute; top: -9px; width: 54px; height: 18px; z-index: 3;
  background: rgba(255, 236, 170, .72); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); transform: rotate(-4deg);
}
.pin-polaroid.is-loose::before { left: -14px; }
.pin-polaroid.is-loose::after { right: -14px; left: auto; transform: rotate(5deg); }
.pushpin.ghost { background: #c9c3b8; opacity: .45; }
.pushpin.ghost:hover, .pushpin.ghost:focus-visible { opacity: 1; background: #e2544a; }
.pin-polaroid.is-loose .pushpin { top: -8px; left: auto; right: 14px; margin-left: 0; }
/* Memories: pinned sheets a shade brighter; the grey pin is just a pin. */
.parchment.is-pinned { background: radial-gradient(ellipse at 15% 10%, rgba(120, 80, 30, .12), transparent 45%), radial-gradient(ellipse at 85% 90%, rgba(120, 80, 30, .14), transparent 40%), repeating-linear-gradient(0deg, rgba(255, 255, 255, .05) 0 1px, transparent 1px 3px), linear-gradient(170deg, #f9edd2, #eddab2); }
.parchment-meta { display: block; margin: 0 0 6px; font-size: 12px; font-style: italic; color: #8a6a4a; }
span.pushpin.ghost:hover { opacity: .45; background: #c9c3b8; }
/* The important flag: a small flag at the top-right corner of a sheet, a
   red ribbon down the edge once it is set. */
.flag { position: absolute; top: 6px; right: 10px; z-index: 3; border: 0; background: none; padding: 2px 4px; color: rgba(90, 60, 20, .35); font-size: 18px; line-height: 1; cursor: pointer; transition: color .15s, transform .15s; }
.flag:hover, .flag:focus-visible { color: #b0332a; transform: scale(1.2); outline: none; }
.flag.on, span.flag { color: #b0332a; cursor: default; }
button.flag.on { cursor: pointer; }
.parchment.is-important::before { content: ""; position: absolute; top: -4px; right: 22px; width: 12px; height: 46px; background: #c8443a; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%); box-shadow: 0 2px 3px rgba(0, 0, 0, .25); z-index: 2; }
.parchment.is-important .flag { top: 50px; right: 18px; }
/* List or calendar. */
.seg { display: inline-flex; overflow: hidden; margin-left: 12px; border: 1px solid var(--line); border-radius: 999px; vertical-align: middle; }
.seg-btn { border: 0; background: var(--surface); padding: 5px 12px; color: var(--ink-soft); font: inherit; font-size: 13px; cursor: pointer; }
.seg-btn.on { background: var(--accent); color: #fff; }
.page-head-l { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.page-head-l h1 { margin: 0; }
/* The month grid. */
.cal { margin-top: 10px; }
.cal-head { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.cal-head h2 { flex: 1 1 auto; margin: 0; font-size: 18px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { padding: 4px 0; color: var(--ink-soft); font-size: 12px; text-align: center; }
.cal-cell { min-height: 96px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); min-width: 0; }
.cal-cell.is-blank { background: transparent; border-color: transparent; }
.cal-cell.is-today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-day { margin-bottom: 4px; color: var(--ink-soft); font-size: 12px; font-weight: 600; }
.is-today .cal-day { color: var(--accent); }
.cal-chip { display: block; width: 100%; margin: 2px 0; padding: 3px 6px; border: 0; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font: inherit; font-size: 12px; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip.cake { background: #fff1dd; color: #7a4a22; }
.cal-chip:hover, .cal-chip:focus-visible { filter: brightness(.95); outline: none; }
@media (max-width: 640px) {
  .cal-grid { gap: 2px; }
  .cal-cell { min-height: 64px; padding: 3px; }
  .cal-chip { padding: 2px 4px; font-size: 10px; }
}
/* A section that folds away. */
.fold { margin-top: 22px; }
.fold > summary { cursor: pointer; list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before { content: "\25B8  "; color: var(--accent); }
.fold[open] > summary::before { content: "\25BE  "; }
.fold > summary .section { display: inline; margin: 0; font-size: 16px; font-weight: 600; }
.fold[open] > summary { margin-bottom: 10px; }
/* The tree scales to fit; the zoom bar goes closer. */
.tree-zoom { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin: 0 0 6px; }
.tree-zoom [data-tree-zoom-label] { min-width: 4.5em; text-align: center; }
.tree > ul { will-change: transform; }
@media (max-width: 640px) { .tree { padding: 4px 0 14px; } .tree > ul { padding-left: 8px; padding-right: 8px; } }
/* People as business cards. */
.bizcard { position: relative; display: flex; flex-direction: column; gap: 10px; overflow: hidden; padding: 16px 18px 14px 24px; border: 1px solid #e0d4c2; border-radius: 6px; color: #2f241b; background: linear-gradient(135deg, #fffdf8, #f6efe3); box-shadow: 0 1px 2px rgba(60, 40, 20, .08), 0 8px 18px rgba(60, 40, 20, .10); }
.bizcard::after { content: ""; position: absolute; inset: 5px; border: 1px solid rgba(120, 80, 30, .16); border-radius: 3px; pointer-events: none; }
.bizcard-stripe { position: absolute; top: 0; bottom: 0; left: 0; width: 7px; background: var(--accent); }
.bizcard.k-medical .bizcard-stripe { background: #d6604d; } .bizcard.k-legal .bizcard-stripe { background: #5b4a99; } .bizcard.k-financial .bizcard-stripe { background: #c99a2e; }
.bizcard.k-emergency .bizcard-stripe { background: #b0332a; } .bizcard.k-service .bizcard-stripe { background: #3d8bd6; } .bizcard.k-other .bizcard-stripe { background: #8a8a8a; }
.bizcard-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bizcard-face { display: inline-grid; place-items: center; flex: 0 0 auto; width: 54px; height: 54px; border: 2px solid #fff; border-radius: 50%; font-size: 16px; font-weight: 700; color: #3a2e24; box-shadow: 0 2px 6px rgba(96, 66, 36, .2); background: #efe6da; }
.bizcard-face.f0 { background: #ffd2a8; } .bizcard-face.f1 { background: #bfe0c9; } .bizcard-face.f2 { background: #ffe58a; } .bizcard-face.f3 { background: #bcd9f5; } .bizcard-face.f4 { background: #e2c6f0; } .bizcard-face.f5 { background: #ffb8b0; }
.bizcard-id { min-width: 0; }
.bizcard-id h3 { margin: 0; font: 700 18px/1.15 Georgia, "Times New Roman", serif; overflow-wrap: anywhere; }
.bizcard-role { margin-top: 3px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #7a4a22; }
.bizcard-org { display: block; margin-top: 1px; font-size: 12px; letter-spacing: 0; text-transform: none; color: #6b5a4a; }
.bizcard-id .pill { margin-top: 5px; }
.bizcard-lines { display: grid; gap: 3px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.bizcard-lines li { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.bizcard-lines .ico { flex: 0 0 auto; width: 1.3em; text-align: center; color: #9b6842; }
.bizcard-lines .v { min-width: 0; overflow-wrap: anywhere; }
.bizcard-lines a { color: inherit; text-decoration: none; border-bottom: 1px dotted #c9b8a0; }
.bizcard-lines a:hover { border-bottom-style: solid; color: var(--accent); }
.bizcard-notes { margin: 0; font-size: 13px; font-style: italic; color: #6b5a4a; white-space: pre-line; }
.bizcard-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 10px; border-top: 1px dashed rgba(120, 80, 30, .25); }
.grid > .bizcard { height: 100%; box-sizing: border-box; margin-top: 0; }
@media (prefers-color-scheme: dark) { html:not(.paper) .bizcard { border-color: #5a4838; } }
/* Icons on the card footer, pushed to the right edge. */
.bizcard-icons { margin-left: auto; }
.bizcard-actions .icon-btn { font-size: 17px; padding: 3px 7px; }
/* An album's contents as prints on a table. */
.print-wall { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px 18px; padding: 18px 6px 26px; }
.print { position: relative; width: 224px; margin: 0; padding: 9px 9px 6px; background: #fff; box-shadow: 0 6px 16px rgba(60, 40, 20, .28); transition: transform .18s, box-shadow .18s; }
.print.r0 { transform: rotate(-2deg); } .print.r1 { transform: rotate(1.5deg); } .print.r2 { transform: rotate(-1deg); } .print.r3 { transform: rotate(2.5deg); } .print.r4 { transform: rotate(.5deg); }
.print:hover { transform: rotate(0) scale(1.04); z-index: 3; box-shadow: 0 14px 28px rgba(60, 40, 20, .36); }
.print .tile-link { display: block; }
.print .tile-link img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #efe6da; }
.print .tile-link > span:not(.tile-media) { display: block; padding: 8px 2px 2px; overflow: hidden; color: #4a3b2c; font: 14px/1.25 "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.print .tile-media { display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; height: auto; font-size: 40px; }
/* A frame of film: black stock, sprocket holes top and bottom, a play mark. */
.print.kind-video { padding: 22px 10px 6px; background: #1b1b1b; }
.print.kind-video::before, .print.kind-video::after { content: ""; position: absolute; left: 8px; right: 8px; height: 10px; background: repeating-linear-gradient(90deg, #f2efe6 0 12px, transparent 12px 22px); border-radius: 2px; }
.print.kind-video::before { top: 6px; }
.print.kind-video::after { bottom: 30px; }
.print.kind-video .tile-media { background: radial-gradient(circle at 50% 45%, #3a3a3a, #111); color: #fff; }
.print.kind-video .tile-link > span:not(.tile-media) { color: #f2efe6; padding-top: 26px; font-size: 13px; }
/* A clip of tape. */
.print.kind-audio { background: linear-gradient(180deg, #8a5a3a, #6e4630); padding-bottom: 8px; }
.print.kind-audio .tile-media { background: radial-gradient(circle at 30% 50%, #2b2b2b 18%, #444 19%, #444 22%, #2b2b2b 23%), radial-gradient(circle at 70% 50%, #2b2b2b 18%, #444 19%, #444 22%, #2b2b2b 23%), #333; color: #f5e7c9; }
.print.kind-audio .tile-link > span:not(.tile-media) { color: #f5e7c9; }
/* The delete cross on the frame's corner. */
/* A print with a recording on it wears a small cassette on its corner. */
.print.has-audio::before { content: "\1F4FC"; position: absolute; top: -10px; left: -10px; z-index: 4; display: grid; place-items: center; width: 26px; height: 26px; border: 2px solid #fff; border-radius: 50%; background: #6b4e3d; font-size: 13px; line-height: 1; box-shadow: 0 2px 5px rgba(0, 0, 0, .3); }
.print.kind-video.has-audio::before, .print.kind-audio.has-audio::before { display: none; }
.lightbox-audio { margin: 12px 0 4px; padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.lightbox-audio > p { margin: 0 0 8px; }
.lightbox-audio .tape + .tape { margin-top: 12px; }
.picker-token .tag-mark, .picker-row .tag-mark { font-size: 15px; line-height: 1; }
.print-x { position: absolute; top: -9px; right: -9px; z-index: 4; width: 24px; height: 24px; border: 2px solid #fff; border-radius: 50%; background: #b0332a; color: #fff; font-size: 12px; line-height: 1; cursor: pointer; box-shadow: 0 2px 5px rgba(0, 0, 0, .3); opacity: .85; }
.print-x:hover, .print-x:focus-visible { opacity: 1; transform: scale(1.15); outline: none; }
@media (max-width: 640px) { .print { width: calc(50% - 14px); min-width: 140px; padding: 6px 6px 4px; } .print-wall { gap: 16px 10px; padding: 10px 0 18px; } .print.kind-video { padding-top: 18px; } }
/* The buttons at the right of a page head keep a gap at every width. */
.page-head > span { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* Placing a face: the crop stage under the photo input. */
.crop { display: grid; justify-items: center; gap: 8px; margin: 8px 0 12px; padding: 12px; border: 1px dashed #d3b995; border-radius: 12px; background: #fffaf2; }
.crop-canvas { width: 280px; max-width: 100%; height: auto; border-radius: 10px; background: #efe6da; cursor: grab; touch-action: none; user-select: none; }
.crop-canvas:active { cursor: grabbing; }
.crop-zoom { display: flex; align-items: center; gap: 8px; width: 280px; max-width: 100%; margin: 0; font-size: 13px; color: var(--ink-soft); }
.crop-zoom input[type=range] { flex: 1 1 auto; margin: 0; }
/* Breathing room between a page head and whatever comes next. */
.page-head { margin-bottom: 14px; }
.trips-tools { margin-top: 4px; }
/* Albums as bound books. */
.album-book { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 16px 22px 14px 28px; border: 0; border-radius: 4px 12px 12px 4px; color: #2f241b; overflow: visible;
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .06) 0 2px, transparent 2px 5px), repeating-linear-gradient(-45deg, rgba(0, 0, 0, .05) 0 2px, transparent 2px 5px), var(--book, #6b4e3d);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18), inset 2px 0 6px rgba(0, 0, 0, .25), 0 10px 22px rgba(60, 40, 20, .3); }
.album-book.c0 { --book: #6b4e3d; } .album-book.c1 { --book: #3f5d4c; } .album-book.c2 { --book: #4a4f78; } .album-book.c3 { --book: #8a3e3a; } .album-book.c4 { --book: #7a6a3a; }
.album-spine { position: absolute; top: 0; bottom: 0; left: 0; width: 14px; border-radius: 4px 0 0 4px; background: linear-gradient(90deg, rgba(0, 0, 0, .35), rgba(0, 0, 0, .05) 60%, rgba(255, 255, 255, .12)); }
.album-spine::before, .album-spine::after { content: ""; position: absolute; left: 3px; right: 3px; height: 2px; background: rgba(255, 220, 160, .55); }
.album-spine::before { top: 22px; } .album-spine::after { bottom: 22px; }
.album-pages { position: absolute; top: 6px; bottom: 6px; right: -7px; width: 9px; border-radius: 0 3px 3px 0; background: repeating-linear-gradient(180deg, #fbf7ee 0 2px, #e4dccb 2px 3px); box-shadow: 2px 0 3px rgba(0, 0, 0, .25); }
.album-cover { display: grid; gap: 10px; }
.album-window { aspect-ratio: 4 / 3; border: 6px solid #fbf7ee; outline: 1px solid rgba(0, 0, 0, .3); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2), 0 3px 8px rgba(0, 0, 0, .35); background: #d8d0c5 center / cover no-repeat; }
.album-window.is-blank { display: grid; place-items: center; font-size: 40px; background: linear-gradient(135deg, #d8b38a, #789b91); }
.album-plate { padding: 8px 12px; border: 1px solid rgba(255, 230, 180, .6); border-radius: 4px; background: linear-gradient(180deg, #f3e6c8, #e2cf9f); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 2px 4px rgba(0, 0, 0, .3); text-align: center; }
.album-plate h3 { margin: 0; font: 700 17px/1.2 Georgia, "Times New Roman", serif; color: #3b2a14; letter-spacing: .02em; overflow-wrap: anywhere; }
.album-plate-line { display: block; margin-top: 2px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #7a5a2a; }
.album-blurb { margin: 0; min-height: 0; font-size: 13px; color: rgba(255, 245, 225, .85); font-style: italic; }
.album-icons { align-self: flex-end; }
.album-icons .icon-btn { color: rgba(255, 245, 225, .8); }
.album-icons .icon-btn:hover, .album-icons .icon-btn:focus-visible { background: rgba(255, 255, 255, .18); color: #fff; }
.album-grid { gap: 22px 26px; padding-right: 8px; }
.album-book.is-clickable:hover, .album-book.is-clickable:focus-visible { transform: translateY(-3px) rotate(-.4deg); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18), inset 2px 0 6px rgba(0, 0, 0, .25), 0 18px 32px rgba(60, 40, 20, .38); }
.album-book.is-dropping { outline: 3px dashed #fff; outline-offset: -8px; background: var(--book, #6b4e3d); }
/* People on a map. */
.people-map { height: 540px; margin: 0 0 16px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; z-index: 0; background: #e9e4dc; }
.map-pin { position: relative; width: 40px; height: 40px; padding: 3px; border-radius: 50% 50% 50% 0; background: var(--accent); box-shadow: 0 3px 8px rgba(0, 0, 0, .35); transform: rotate(-45deg); }
.map-pin .map-face { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #fff; color: #3a2e24; font-size: 12px; font-weight: 700; transform: rotate(45deg); object-fit: cover; }
.map-pin.k-medical { background: #d6604d; } .map-pin.k-legal { background: #5b4a99; } .map-pin.k-financial { background: #c99a2e; }
.map-pin.k-emergency { background: #b0332a; } .map-pin.k-service { background: #3d8bd6; } .map-pin.k-other { background: #8a8a8a; }
.map-pin-wrap { background: none; border: 0; }
.map-popup { font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: #17202b; }
.map-missing { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.map-missing li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
@media (max-width: 640px) { .people-map { height: 70vh; } }
/* The signed-out page wears the same cork and cream as the app. */
.lp-hero-warm { border-radius: 18px; padding: 28px; border: 1px solid #e6d3bf;
  background: radial-gradient(420px 260px at 8% 0%, rgba(255, 196, 140, .45), transparent 70%), radial-gradient(360px 240px at 100% 100%, rgba(150, 196, 170, .45), transparent 70%), radial-gradient(280px 200px at 70% 10%, rgba(255, 226, 120, .35), transparent 70%), linear-gradient(150deg, #fff8ee, #fbeedd);
  box-shadow: 0 12px 30px rgba(96, 66, 36, .12); }
.lp-hero-warm h1 { font-family: Georgia, "Times New Roman", serif; color: #2f241b; }
.lp-hero-warm .lp-hero-text p { color: #5c4a3a; }
.lp-alt .lp-feature { border: 1px solid #e6d3bf; border-radius: 12px; padding: 16px; background: linear-gradient(160deg, #fffaf2, #f9eedf); color: #2f241b; }
.lp-alt .lp-feature h3 { font-family: Georgia, "Times New Roman", serif; color: #2f241b; }
.lp-alt .lp-feature p { color: #5c4a3a; }
/* Selecting photographs in an album. */
.sel-bar { position: sticky; top: 8px; z-index: 6; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 8px 18px rgba(16, 24, 40, .14); }
.sel-bar-gap { flex: 1 1 auto; }
.print-wall.is-selecting .print { cursor: pointer; }
.print-wall.is-selecting .print:hover { transform: rotate(0) scale(1.02); }
.print.is-selected { outline: 4px solid var(--accent); outline-offset: 2px; }
.sel-box { position: absolute; top: -10px; left: -10px; z-index: 5; width: 28px; height: 28px; border: 2px solid var(--accent); border-radius: 50%; background: #fff; color: #fff; font-size: 16px; font-weight: 700; line-height: 1; cursor: pointer; box-shadow: 0 2px 5px rgba(0, 0, 0, .3); }
.print.is-selected .sel-box { background: var(--accent); }
/* The sheet for the printer. */
.print-sheet h1 { margin: 0 0 14px; font: 700 22px/1.2 Georgia, "Times New Roman", serif; }
.print-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.print-grid figure { margin: 0; padding: 8px 8px 10px; background: #fff; border: 1px solid var(--line); break-inside: avoid; page-break-inside: avoid; }
.print-grid img { display: block; width: 100%; height: auto; }
.print-grid figcaption { padding: 8px 2px 0; font: 14px/1.3 Georgia, "Times New Roman", serif; text-align: center; }
@media print {
  .backbar, .sel-bar, .tree-zoom { display: none !important; }
  .print-sheet { padding: 0; }
  .print-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .print-grid figure { border: 0; }
}
/* Selecting people. */
.bizcard.is-selectable { overflow: visible; cursor: pointer; }
.bizcard.is-selected { outline: 4px solid var(--accent); outline-offset: 2px; }
.bizcard .sel-box { top: -12px; left: -12px; }
/* The contact sheet for the printer. */
.contact-sheet { display: grid; gap: 0; border-top: 1px solid var(--line); }
.contact-row { display: grid; grid-template-columns: 1.2fr 1fr 1.4fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; break-inside: avoid; page-break-inside: avoid; }
.print-foot { margin-top: 14px; }
@media (max-width: 640px) { .contact-row { grid-template-columns: 1fr; gap: 4px; } }
@media print { .contact-row { grid-template-columns: 1.2fr 1fr 1.4fr; } }
/* The wall calendar. */
.wallcal { position: relative; margin-top: 22px; padding: 0 0 14px; border-radius: 6px 6px 14px 14px; background: linear-gradient(180deg, #fffdf8, #f6efe3); border: 1px solid #e0d4c2; box-shadow: 0 14px 30px rgba(60, 40, 20, .22); }
.wallcal-rings { position: absolute; top: -14px; left: 0; right: 0; height: 28px; z-index: 3; pointer-events: none;
  background: radial-gradient(circle at 50% 50%, #9a9a9a 0 5px, #6d6d6d 5px 7px, transparent 7px) 0 0 / 40px 28px repeat-x; }
.wallcal-pic { position: relative; height: 260px; margin: 0; border-radius: 6px 6px 0 0; background: #d8d0c5 center / cover no-repeat; box-shadow: inset 0 -40px 40px -30px rgba(0, 0, 0, .35); }
.wallcal-pic::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 14px; background: repeating-linear-gradient(90deg, transparent 0 16px, #fffdf8 16px 24px, transparent 24px 40px); }
.wallcal-pic.is-blank { display: grid; place-items: center; background: linear-gradient(135deg, #ffd2a8, #bfe0c9 60%, #bcd9f5); }
.wallcal-pic-empty { font-size: 96px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .2)); }
.wallcal-pic-cap { position: absolute; right: 14px; bottom: 10px; padding: 3px 10px; border-radius: 999px; background: rgba(0, 0, 0, .45); color: #fff; font: 12px/1.4 "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive; }
.wallcal-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 6px; }
.wallcal-head h2 { flex: 1 1 auto; margin: 0; font: 700 30px/1.1 Georgia, "Times New Roman", serif; color: #2f241b; text-align: center; letter-spacing: .02em; }
.wallcal-year { font-weight: 400; color: #9b6842; }
.wallcal-season { font-size: 24px; vertical-align: -3px; }
.wallcal-grid { padding: 6px 12px 0; gap: 3px; }
.wallcal-grid .cal-dow { font: 600 12px/1 Georgia, "Times New Roman", serif; letter-spacing: .08em; text-transform: uppercase; color: #7a5a3a; padding: 6px 0; }
.wallcal-grid .cal-dow.is-weekend { color: #b0332a; }
.wallcal-grid .cal-cell { min-height: 92px; border: 1px solid #e6d3bf; border-radius: 4px; background: #fffdf8 repeating-linear-gradient(0deg, transparent 0 17px, rgba(120, 80, 30, .06) 17px 18px); }
.wallcal-grid .cal-cell.is-weekend { background-color: #fbf3e6; }
.wallcal-grid .cal-cell.is-blank { background: transparent; border-color: transparent; }
.wallcal-grid .cal-day { font: 700 13px/1 Georgia, "Times New Roman", serif; color: #6b5a4a; margin-bottom: 6px; }
.wallcal-grid .cal-cell.is-today { border-color: #e6d3bf; box-shadow: none; }
.wallcal-grid .cal-cell.is-today .cal-day { display: inline-grid; place-items: center; width: 26px; height: 26px; margin: -4px 0 4px -4px; border: 2.5px solid #c8443a; border-radius: 50% 48% 52% 50% / 52% 50% 50% 48%; color: #c8443a; transform: rotate(-6deg); }
.wallcal-grid .cal-cell.has-cake { background-image: radial-gradient(circle, #ffb8b0 0 2px, transparent 2.5px), radial-gradient(circle, #ffe58a 0 2px, transparent 2.5px), radial-gradient(circle, #bfe0c9 0 2px, transparent 2.5px), radial-gradient(circle, #bcd9f5 0 2px, transparent 2.5px), repeating-linear-gradient(0deg, transparent 0 17px, rgba(120, 80, 30, .06) 17px 18px); background-size: 37px 41px, 53px 29px, 31px 47px, 43px 37px, auto; background-position: 3px 5px, 11px 17px, 19px 9px, 27px 23px, 0 0; }
.wallcal-grid .cal-chip { background: #fff3d6; color: #5a3b1a; border-left: 3px solid #e0b48c; border-radius: 3px; font: 12px/1.3 "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive; }
.wallcal-grid .cal-chip.cake { background: #ffe9ee; border-left-color: #e2544a; }
@media (max-width: 640px) {
  .wallcal-pic { height: 150px; }
  .wallcal-head h2 { font-size: 22px; }
  .wallcal-grid { padding: 4px 4px 0; gap: 2px; }
  .wallcal-grid .cal-cell { min-height: 62px; }
}
@media (prefers-color-scheme: dark) { html:not(.paper) .wallcal { border-color: #5a4838; } }
/* The calendar's picture: the whole photograph, on a blurred copy of itself. */
.wallcal-pic { height: clamp(220px, 40vw, 440px); overflow: hidden; background: #2b2420; }
.wallcal-pic-blur { position: absolute; inset: -20px; background: center / cover no-repeat; filter: blur(16px) brightness(.7) saturate(1.1); }
.wallcal-pic-img { position: relative; display: block; width: 100%; height: 100%; object-fit: contain; }
.wallcal-pic::before { z-index: 2; }
.wallcal-pic-cap { z-index: 2; }
@media (max-width: 640px) { .wallcal-pic { height: clamp(160px, 48vw, 260px); } }
/* Which public calendars, in Settings; and how a holiday looks on the wall. */
.cal-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 16px; margin: 0 0 6px; }
.cal-pick { margin: 4px 0; }
.wallcal-grid .cal-chip.holiday { background: #e8eef7; color: #3a4a66; border-left-color: #7c93bd; cursor: default; font-style: italic; }
.cal-chip.holiday { background: #e8eef7; color: #3a4a66; cursor: default; }
/* The person form's folding sections. */
.form-fold { margin: 12px 0 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.form-fold > summary { padding: 9px 12px; cursor: pointer; font-weight: 600; list-style: none; }
.form-fold > summary::-webkit-details-marker { display: none; }
.form-fold > summary::before { content: "\25B8  "; color: var(--accent); }
.form-fold[open] > summary::before { content: "\25BE  "; }
.form-fold-body { padding: 0 12px 12px; }
.form-fold-body > label:first-child, .form-fold-body > .field-row:first-child > div > label { margin-top: 4px; }
/* A folded section of Settings: the heading carries the current choice. */
.settings-fold { margin: 18px 0 0; box-shadow: var(--shadow); }
.settings-fold > summary { padding: 14px 16px; font: 700 17px/1.2 Georgia, "Times New Roman", serif; }
.settings-fold > summary .muted { font: 400 14px/1.2 inherit; font-family: inherit; }
.settings-fold .form-fold-body { padding: 0 16px 14px; }
.choice-row { display: flex; justify-content: flex-start; align-items: flex-start; gap: 12px; margin: 0 0 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-weight: 400; }
.choice-row:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice-row > input { flex: 0 0 auto; width: auto; margin: 4px 0 0; }
.choice-row > span { flex: 1 1 auto; min-width: 0; text-align: left; }
.choice-row > span > strong { display: block; }
.choice-row > span > .muted { display: block; }
.modal-actions .btn-danger { margin-right: auto; }
/* Anniversaries on the wall calendar. */
.wallcal-grid .cal-chip.rings { background: #fff0f5; border-left-color: #d46a9a; }
.cal-chip.rings { background: #fff0f5; color: #7a3a5a; }
/* The calendar without its picture: room under the wire for the heading. */
.wallcal-plain { padding-top: 18px; }
/* The guest chip in the top bar. */
.guest-chip { background: #fff4d6; border-color: #f0dca6; color: #7a5200; text-transform: none; font-size: 12px; letter-spacing: 0; }
/* "When it is from" on the album form: three small boxes on one row. */
.when-row > div > label.small { margin: 0 0 2px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.when-row { margin-bottom: 4px; }
.album-icons .icon-danger { margin-left: 2px; }
/* In a popup the picker's list sits in the flow, so the popup grows to fit it instead of clipping it. */
.modal .picker-menu { position: static; margin-top: 6px; max-height: 220px; box-shadow: none; }
.modal:has(.picker) { overflow-y: auto; }
/* Chapters inside an album. */
.chapter { margin: 6px 0 18px; }
.chapter-head { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 4px; padding: 10px 14px; border-left: 4px solid #a9784f; border-radius: 0 10px 10px 0; background: linear-gradient(90deg, #f6ecdc, transparent 80%); }
.chapter-n { display: inline-grid; place-items: center; flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; background: #a9784f; color: #fff; font: 700 14px/1 Georgia, "Times New Roman", serif; }
.chapter-title { flex: 1 1 auto; min-width: 0; }
.chapter-title h2 { margin: 0; font: 700 20px/1.2 Georgia, "Times New Roman", serif; color: #2f241b; }
.chapter-title p { margin: 2px 0 0; font-size: 14px; }
.chapter-head .row-icons { margin: 2px 0 0; }
.chapter-empty { margin: 8px 14px 0; }
/* Chapters fold; the heading is the handle, and a drop zone. */
details.chapter > summary { list-style: none; cursor: pointer; }
details.chapter > summary::-webkit-details-marker { display: none; }
details.chapter > summary .chapter-n::after { content: ""; }
details.chapter > summary::after { content: "\25BE"; margin-left: auto; align-self: center; color: #a9784f; font-size: 14px; }
details.chapter:not([open]) > summary::after { content: "\25B8"; }
details.chapter > summary .row-icons { margin-right: 8px; }
.chapter-count { margin-top: 3px !important; }
details.chapter.is-dropping { outline: 3px dashed var(--accent); outline-offset: 4px; border-radius: 12px; background: var(--accent-soft); }
.print[draggable="true"] { cursor: grab; }
.print[draggable="true"]:active { cursor: grabbing; }
/* Where a dragged print will land: a bar down the side of the print it is held over. */
.print.is-drop-before, .print.is-drop-after { transform: rotate(0); z-index: 3; }
.print.is-drop-before::after, .print.is-drop-after::after { content: ""; position: absolute; top: -6px; bottom: -6px; width: 5px; border-radius: 3px; background: var(--accent); box-shadow: 0 0 0 2px #fff; pointer-events: none; }
.print.is-drop-before::after { left: -13px; }
.print.is-drop-after::after { right: -13px; }
/* A chapter's divider page in the storybook: a title page, the facing page left blank. */
.storybook-divider { justify-items: center; text-align: center; align-content: center; gap: 8px; }
.storybook-divider-n { margin: 0; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: #9b6842; }
.storybook-divider h2 { margin: 0; font: 700 32px/1.15 Georgia, "Times New Roman", serif; color: #2f241b; }
.storybook-divider-line { margin: 0; max-width: 34ch; font: italic 16px/1.5 Georgia, "Times New Roman", serif; color: #5c4a3a; }
.storybook-divider-count { margin: 10px 0 0; font-size: 13px; color: #9b6842; }
.storybook-divider-count::before, .storybook-divider-count::after { content: " \2014 "; color: #d3b995; }
.storybook-blank { background: linear-gradient(90deg, #f3ebdf, #fffaf3 18%); }
/* Tighter chrome, so the boards start higher on the screen. */
.topbar { padding: 7px 16px; }
.tab { padding: 8px 12px; }
.view { padding: 12px 18px 22px; }
.page-head { margin-bottom: 8px; }
.page-head h1, h1 { font-size: 20px; }
.sub { margin: 0 0 10px; }
.section, h2 { margin-top: 18px; }
.pinboard { margin-top: 0; }
.wallcal { margin-top: 16px; }
@media (max-width: 640px) { .view { padding: 8px 10px 18px; } .topbar { padding: 6px 10px; } }
/* "Which card is you?" for a login not yet linked to a card. */
.whoami { margin: 0 0 12px; padding: 10px 14px; border: 1px dashed #d3b995; border-radius: 10px; background: #fffaf2; color: #5c4a3a; font-size: 14px; }
.whoami .link-btn { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
/* Calendar notes wrap rather than cut off. */
.wallcal-grid .cal-chip { white-space: normal; overflow-wrap: anywhere; line-height: 1.25; }

/* A file the browser cannot play: say so in the lightbox, and offer the download. */
.lightbox-note { max-width: 28rem; padding: 1.5rem; background: #fff; color: #333; border-radius: 6px; text-align: center; }
.lightbox-note p { margin: 0 0 1rem; line-height: 1.5; }
.lightbox-note .btn { margin: 4px 2px 0; }
.lightbox-note button[disabled] { opacity: .8; cursor: progress; }

/* The cassette. An audio clip in the lightbox plays on a tape: the reels turn
   while it plays and the tape winds from the left spool to the right as it
   goes (--p is progress, 0 to 1, set by the player). */
.tape { width: min(100%, 420px); padding: 18px 18px 14px; box-sizing: border-box; }
.tape audio { display: none; }
.tape-shell { position: relative; background: linear-gradient(#f3ead6, #e2d4b8); border-radius: 10px; padding: 12px 14px 10px;
  box-shadow: inset 0 0 0 2px #c9b592, 0 10px 24px rgba(0, 0, 0, .45); }
.tape-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 12px; border-radius: 4px;
  background: #f8f3e8; border-top: 5px solid #e9807a; border-bottom: 5px solid #7aa8a1; color: #3a2a1c;
  font: 18px/1.25 "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive; }
.tape-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tape-side { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #3a2a1c; display: grid; place-items: center; font: bold 13px/1 Georgia, serif; }
.tape-window { position: relative; margin: 10px auto 0; width: 80%; height: 88px; border-radius: 44px; background: #2b2118;
  display: flex; align-items: center; justify-content: space-between; padding: 0 16px; box-sizing: border-box; box-shadow: inset 0 2px 6px rgba(0, 0, 0, .6); }
.tape .reel { position: relative; flex: none; width: 40px; height: 40px; border-radius: 50%; background: #f3ead6;
  box-shadow: 0 0 0 3px #9c8a6a, 0 0 0 calc(4px + 16px * (1 - var(--p, 0))) #4a3626; }
.tape .reel:last-child { box-shadow: 0 0 0 3px #9c8a6a, 0 0 0 calc(4px + 16px * var(--p, 0)) #4a3626; }
.tape .reel i { position: absolute; left: 50%; top: 50%; width: 5px; height: 28px; margin: -14px 0 0 -2.5px; background: #2b2118; border-radius: 3px; }
.tape .reel i:nth-child(2) { transform: rotate(60deg); }
.tape .reel i:nth-child(3) { transform: rotate(120deg); }
.tape-gap { position: absolute; left: 60px; right: 60px; bottom: 12px; height: 4px; background: #4a3626; }
.tape-foot { display: flex; justify-content: center; gap: 28px; margin-top: 12px; }
.tape-foot i { width: 8px; height: 8px; border-radius: 50%; background: #2b2118; }
@keyframes reel-spin { to { transform: rotate(360deg); } }
.tape.is-playing .reel { animation: reel-spin 1.6s linear infinite; }
.tape-deck { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 16px 0 6px; }
.tape-btn { width: 44px; height: 38px; border: 0; border-radius: 8px; background: linear-gradient(#5a5a5a, #2f2f2f); color: #eee; font-size: 13px; cursor: pointer; box-shadow: 0 3px 0 #111; }
.tape-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #111; }
.tape-play { width: 64px; height: 46px; font-size: 20px; background: linear-gradient(#e9807a, #c9574f); }
.tape-time { color: #ddd; font: 13px/1 ui-monospace, Menlo, Consolas, monospace; margin-left: 6px; }
.tape-seek { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 6px; margin: 6px 0 0; padding: 0; border: 0; border-radius: 3px; background: #555; box-shadow: none; }
.tape-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #f3ead6; border: 2px solid #c9574f; cursor: pointer; }
.tape-seek::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #f3ead6; border: 2px solid #c9574f; cursor: pointer; }
/* The same cassette, small, on an album tile. Its reels turn on hover. */
.mini-tape { position: relative; display: inline-flex; align-items: flex-end; justify-content: space-between; width: 64%; aspect-ratio: 1.6; padding: 0 9% 9%; box-sizing: border-box;
  border-radius: 8px; background: linear-gradient(#f3ead6, #e2d4b8); box-shadow: inset 0 0 0 2px #c9b592, 0 4px 10px rgba(0, 0, 0, .25); }
.mini-tape::before { content: ""; position: absolute; left: 9%; right: 9%; top: 10%; height: 24%; border-radius: 3px; background: #f8f3e8; box-sizing: border-box; border-top: 3px solid #e9807a; border-bottom: 3px solid #7aa8a1; }
.mini-tape i { width: 28%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(#f3ead6 0 28%, #2b2118 30% 40%, #4a3626 42% 100%); }
.tile-link:hover .mini-tape i { animation: reel-spin 1.6s linear infinite; }
@media (prefers-reduced-motion: reduce) { .tape.is-playing .reel, .tile-link:hover .mini-tape i { animation: none; } }
.tree-link-acts { display: inline-flex; gap: 6px; flex: none; }

/* Formerly a couple: an open ring in a quiet colour, so the tree says it was, not is. */
.tree-ring-former { color: #a89b8c; }

/* The name row on a card: a short title and suffix beside the long fields. */
.name-row .name-title { flex: 0 0 5.5rem; }
.name-row .name-suffix { flex: 0 0 5.5rem; }
.bizcard-former { font: italic 13px/1.3 Georgia, "Times New Roman", serif; color: #6b5a48; margin: -2px 0 3px; }

/* Lines to a second set of parents, drawn over the tree after layout. */
.tree > ul { position: relative; }
.tree-links { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; z-index: 0; }
.tree-links path { fill: none; stroke: #d3b995; stroke-width: 2; }
html:not(.paper) .tree-links path { stroke: #6b563f; }

/* Files held over somewhere that is not an album: the whole screen says it will take them. */
body.drop-anywhere #view { outline: 3px dashed var(--accent); outline-offset: -8px; border-radius: 14px; }
.drop-list { margin: 0 0 12px; padding-left: 18px; font-size: 14px; color: var(--muted); }

/* A note that goes somewhere: a suitcase stamp on the parchment, and a chip to open it. */
.parchment-stamp { position: absolute; right: 14px; top: 10px; font-size: 22px; transform: rotate(8deg); opacity: .85; }
.trip-chip { display: inline-block; margin: 6px 0 4px; padding: 3px 10px; border-radius: 999px; background: #eadfc9; color: #3f2f1c; font: 13px/1.4 "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive; text-decoration: none; border: 1px solid #cdb890; }
.trip-chip:hover, .trip-chip:focus-visible { background: #e2d2b3; }
.trip-btn { display: inline-block; margin: 10px 0 0; }

/* Edit and delete as icons in a popup's action row, sized to sit beside the buttons. */
.modal-actions .paper-icons { display: inline-flex; align-items: center; gap: 4px; margin-right: auto; }
.modal-actions .paper-icons .icon-btn { font-size: 20px; padding: 4px 9px; }

/* The important flag as an icon in a popup, and a ghost pin that can be pressed. */
.icon-btn.flag-ib { color: #a89b8c; }
.icon-btn.flag-ib.on { color: #b0332a; }
.pushpin.ghost { background: #d9d1c4; opacity: .55; }
button.pushpin.ghost:hover, button.pushpin.ghost:focus-visible { opacity: 1; background: #c9bfae; }

/* About you — the one block, the same in every TrackingMy app: Teams' look. */
.about .fg { margin: 0 0 10px; min-width: 0; }
.about .fg label { display: block; font-size: 11px; font-weight: 500; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 3px; }
.about .fg label .hint { text-transform: none; letter-spacing: 0; font-size: 10px; opacity: .8; }
.about .fg input { width: 100%; box-sizing: border-box; font-size: 13px; padding: 7px 10px; border-radius: 8px; margin: 0; }
.about .fr { display: grid; gap: 10px; }
.about .about-name { grid-template-columns: .7fr 1.3fr 1fr 1.3fr .7fr; }
.about .about-when { grid-template-columns: 1fr 1fr 1fr; }
.about .about-where { grid-template-columns: 1.6fr .9fr .9fr 1.4fr; }
.about .auth-hint, .about .about-hint { font-size: 12px; color: var(--ink-soft); margin: 0 0 10px; }
@media (max-width: 560px) { .about .about-name, .about .about-when, .about .about-where { grid-template-columns: 1fr 1fr; } }

/* The question sheet: small, over everything, with its × like every other sheet. */
.ask-sheet { max-width: 440px; }
.ask-text { white-space: pre-line; }
.ask-copy { display: flex; gap: 6px; margin: 8px 0 4px; }
.ask-copy input { flex: 1 1 auto; min-width: 0; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }

/* The tile face: only the tiles the family made, and the door to make
   one. Board or tiles is the switch above either; the route remembers
   which. */
.home-switch { display: flex; justify-content: flex-end; margin: 0 0 10px; }
.home-switch .seg { margin-left: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); grid-auto-rows: 168px; grid-auto-flow: dense; gap: 14px; margin: 0 0 14px; }
.tile {
  --tint: var(--surface);
  position: relative; display: flex; flex-direction: column; min-width: 0; margin: 0; padding: 14px 16px; overflow: hidden; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: 16px; color: var(--ink); font: inherit; text-align: left;
  background: linear-gradient(160deg, var(--surface) 20%, var(--tint)); box-shadow: var(--shadow); cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.tile:hover, .tile:focus-visible { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(16, 24, 40, .14); outline: none; z-index: 1; }
.tile.is-wide { grid-column: span 2; }
.tile.is-tall { grid-row: span 2; }
.tile.is-big { grid-column: span 2; grid-row: span 2; }
/* The mosaic: a little lean on every third and fifth tile, straightened
   on hover; the bigger the tile the bigger its name and its picture. */
.tiles > .t-custom:nth-child(3n+1) { transform: rotate(-.7deg); }
.tiles > .t-custom:nth-child(5n+2) { transform: rotate(.6deg); }
.tiles > .t-custom:hover, .tiles > .t-custom:focus-visible { transform: translateY(-3px) rotate(0); }
.tile.is-big, .tile.is-tall { padding: 18px 20px; }
.tile.is-big .tile-ico { font-size: 44px; }
.tile.is-big h3 { font-size: 26px; }
.tile.is-wide h3, .tile.is-tall h3 { font-size: 20px; }
.tile.is-big .tile-line, .tile.is-wide .tile-line { font-size: 14px; }
.tile.is-big .tile-line { white-space: normal; }
/* The head never squashes to make room: the list of links is what gives way. */
.tile .tile-ico, .tile h3, .tile .tile-line, .tile .tile-faces { flex-shrink: 0; }
.tile .tile-links { flex: 0 1 auto; min-height: 0; padding-bottom: 16px; -webkit-mask-image: linear-gradient(#000 calc(100% - 16px), transparent); mask-image: linear-gradient(#000 calc(100% - 16px), transparent); }
.tile.is-big .tile-links, .tile.is-wide .tile-links { grid-template-columns: 1fr 1fr; column-gap: 14px; }
.tile.is-big .tile-links { font-size: 14px; }
.tile.is-big .tile-faces .cover-face { width: 44px; height: 44px; font-size: 15px; margin-left: -10px; }
/* A tile wearing a photograph: the picture behind, a shade, white words at the foot. */
.tile.has-cover { color: #fff; justify-content: flex-end; background: #2a2622; }
.tile.has-cover .tile-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile.has-cover .tile-cover-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .05) 25%, rgba(0, 0, 0, .55) 60%, rgba(0, 0, 0, .82)); }
.tile.has-cover .tile-cover-top { flex: 1 1 auto; }
.tile.has-cover > :not(.tile-cover):not(.tile-cover-shade) { position: relative; z-index: 1; }
.tile.has-cover .tile-ico { display: none; }
.tile.has-cover h3 { color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.tile.has-cover .tile-line, .tile.has-cover .tile-more { color: rgba(255, 255, 255, .85); }
.tile.has-cover .tile-links { color: rgba(255, 255, 255, .92); }
.tile.has-cover .tile-go:hover .tile-list-t, .tile.has-cover .tile-go:focus-visible .tile-list-t { color: #fff; }
.tile.has-cover.is-square .tile-links, .tile.has-cover.is-wide .tile-links { display: none; }
.tile.has-cover .tile-faces .cover-face { border-color: rgba(255, 255, 255, .9); box-shadow: 0 2px 6px rgba(0, 0, 0, .5); }
/* The cover picker in the editor: the picture chosen, and the search beneath. */
.cover-pick { margin: 0 0 12px; }
.cover-pick-now { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; }
.cover-pick-now img { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.cover-grid { max-height: 300px; overflow-y: auto; margin: 0 0 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.cover-grid-head { margin: 6px 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.cover-cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin: 0 0 8px; }
.cover-cell { padding: 0; border: 2px solid transparent; border-radius: 8px; background: #efe6da; overflow: hidden; cursor: pointer; aspect-ratio: 4 / 3; }
.cover-cell img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cover-cell:hover, .cover-cell:focus-visible { border-color: var(--accent); outline: none; }
.cover-cell.is-on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.picker-row-pic img { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; background: #efe6da; flex: 0 0 auto; }
.picker-row-pic > span:first-of-type { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile h3 { margin: 6px 0 2px; font: 700 17px/1.15 Georgia, "Times New Roman", serif; overflow-wrap: anywhere; }
.tile-ico { font-size: 26px; line-height: 1; }
.tile-line { margin: 0; overflow: hidden; font-size: 13px; color: var(--ink-soft); text-overflow: ellipsis; white-space: nowrap; }
.tile-list { display: grid; gap: 4px; margin: 8px 0 0; padding: 0; list-style: none; font-size: 13px; overflow: hidden; }
.tile-list li { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.tile-list-t { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The door for making a tile: dashed, a big plus. */
.t-act { align-items: center; justify-content: center; gap: 4px; border-style: dashed; border-color: #c9b8a0; background: transparent; color: var(--accent); font-weight: 600; font-size: 14px; text-align: center; }
.t-act:hover, .t-act:focus-visible { background: var(--accent-soft); }
.tile-plus { font-size: 34px; line-height: 1; font-weight: 400; }
.tiles-empty { margin: 0 0 14px; }
@media (max-width: 640px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(150px, auto); gap: 8px; }
  .tile { padding: 12px 13px; border-radius: 14px; }
  .tile.is-big, .tile.is-tall { padding: 12px 13px; }
  .tile.is-wide .tile-links { grid-template-columns: 1fr; }
  .tile.is-big h3 { font-size: 21px; }
  .tile.is-big .tile-ico { font-size: 34px; }
  .tiles > .t-custom:nth-child(3n+1), .tiles > .t-custom:nth-child(5n+2) { transform: none; }
}
@media (prefers-color-scheme: dark) {
  html:not(.paper) .tile:hover, html:not(.paper) .tile:focus-visible { box-shadow: 0 10px 22px rgba(0, 0, 0, .5); }
  html:not(.paper) .t-act { border-color: #3d4854; }
}

/* The family's own tiles: a landing spot of links, in the colour they chose. */
.tint-cream { --tint: #fbeedd; } .tint-peach { --tint: #ffe3cc; } .tint-mint { --tint: #d6ecdc; } .tint-sky { --tint: #d8e8f7; }
.tint-lilac { --tint: #e5dcf3; } .tint-straw { --tint: #fff0c2; } .tint-rose { --tint: #fde0dc; } .tint-slate { --tint: #e4e8ec; }
.tile-links { gap: 3px; }
.tile-go { display: flex; align-items: baseline; gap: 6px; width: 100%; min-width: 0; margin: 0; padding: 2px 0; border: 0; background: none; color: inherit; font: inherit; font-size: 13px; text-align: left; text-decoration: none; cursor: pointer; }
.tile-go:hover .tile-list-t, .tile-go:focus-visible .tile-list-t { color: var(--accent); text-decoration: underline; }
.tile-go:focus-visible { outline: none; }
.tile-more { font-size: 12px; font-style: italic; color: var(--ink-soft); }
/* The tile opened as a sheet: its head in its own tint, the links as cards. */
.modal:has(.tile-sheet) { max-width: 780px; padding-top: 0; border-top: 0; }
.tile-sheet-head { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; margin: 0 -24px 16px; padding: 22px 24px 18px; background: linear-gradient(160deg, var(--surface) 10%, var(--tint)); border-bottom: 1px solid var(--line); }
.tile-sheet-title { flex: 1 1 240px; min-width: 0; }
/* The sheet's head wearing the tile's cover photograph. */
.tile-sheet-head.has-cover { min-height: 200px; align-items: flex-end; background-size: cover; background-position: center; color: #fff; box-shadow: inset 0 -140px 120px -60px rgba(0, 0, 0, .78); }
.tile-sheet-head.has-cover h2, .tile-sheet-head.has-cover .tile-sheet-blurb { color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.tile-sheet-head.has-cover .tile-sheet-ico { background: rgba(255, 255, 255, .85); }
/* The people on the tile, as faces across its banner. */
.tile-face-btn { margin: 0; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%; }
.tile-face-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile-face-btn:hover .cover-face { transform: translateY(-3px); }
.tile-face-btn .cover-face { transition: transform .15s; }
.tile-sheet-faces { flex: 0 1 auto; margin: 0; padding-left: 10px; }
.tile-sheet-faces .cover-face { width: 52px; height: 52px; font-size: 17px; margin-left: -10px; }
.tile-faces { margin: 6px 0 2px; padding-left: 8px; }
.tile-faces .cover-face { width: 34px; height: 34px; font-size: 12px; margin-left: -8px; box-shadow: 0 0 0 2px #fff; }
.tile-faces .cover-face.more { font-size: 11px; }
.tile-section { margin: 14px 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.tile-section:first-of-type { margin-top: 0; }
.tile-sheet-ico { flex: 0 0 auto; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; background: rgba(255, 255, 255, .7); box-shadow: var(--shadow); font-size: 36px; line-height: 1; }
.tile-sheet-head h2 { margin: 0; font: 700 clamp(22px, 3vw, 28px)/1.1 Georgia, "Times New Roman", serif; color: var(--ink); overflow-wrap: anywhere; }
.tile-sheet-blurb { margin: 4px 0 0; font-size: 14px; color: var(--ink-soft); }
.tile-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); grid-auto-flow: dense; gap: 12px; margin: 0 0 4px; }
.tile-card { display: flex; flex-direction: column; min-width: 0; margin: 0; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: inherit; font: inherit; text-align: left; text-decoration: none; box-shadow: var(--shadow); cursor: pointer; transition: transform .15s, box-shadow .15s; }
.tile-card:hover, .tile-card:focus-visible { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(16, 24, 40, .14); outline: none; }
.tile-card.is-wide { grid-column: span 2; flex-direction: row; }
.tile-card-pic { display: grid; place-items: center; flex: 0 0 auto; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; background: linear-gradient(160deg, var(--surface) 10%, var(--tint)); }
.tile-card.is-wide .tile-card-pic { width: 84px; aspect-ratio: auto; align-self: stretch; }
.tile-card-pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tile-card-ico { font-size: 40px; line-height: 1; }
.tile-card.is-wide .tile-card-ico { font-size: 30px; }
.tile-card-face { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; font: 700 26px/1 Georgia, "Times New Roman", serif; color: #3a2e24; box-shadow: 0 0 0 4px rgba(255, 255, 255, .8); }
img.tile-card-face { object-fit: cover; }
.tile-card-face.f0 { background: #ffd2a8; } .tile-card-face.f1 { background: #bfe0c9; } .tile-card-face.f2 { background: #ffe58a; }
.tile-card-face.f3 { background: #bcd9f5; } .tile-card-face.f4 { background: #e2c6f0; } .tile-card-face.f5 { background: #ffb8b0; }
.tile-card-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 10px 12px 12px; }
.tile-card-kind { font-size: 12px; line-height: 1; }
.tile-card-title { font: 700 15px/1.2 Georgia, "Times New Roman", serif; overflow-wrap: anywhere; }
.tile-card:hover .tile-card-title, .tile-card:focus-visible .tile-card-title { color: var(--accent); }
.tile-card-line { font-size: 12px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-card-snippet { margin: 4px 0 0; font: italic 14px/1.4 Georgia, "Times New Roman", serif; color: #3f2f1c; }
/* An album on a tile is the same bound book as on the Albums shelf, smaller. */
.tile-card.album-book { display: flex; flex-direction: column; justify-content: flex-start; gap: 0; margin: 0 7px 0 0; padding: 10px 12px 10px 18px; border: 0; border-radius: 4px 10px 10px 4px; overflow: visible; color: #2f241b;
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .06) 0 2px, transparent 2px 5px), repeating-linear-gradient(-45deg, rgba(0, 0, 0, .05) 0 2px, transparent 2px 5px), var(--book, #6b4e3d);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18), inset 2px 0 6px rgba(0, 0, 0, .25), 0 8px 18px rgba(60, 40, 20, .3); }
.tile-card.album-book:hover, .tile-card.album-book:focus-visible { transform: translateY(-3px) rotate(-.4deg); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18), inset 2px 0 6px rgba(0, 0, 0, .25), 0 16px 28px rgba(60, 40, 20, .38); }
.tile-card.album-book .album-spine { width: 10px; }
.tile-card.album-book .album-spine::before { top: 14px; }
.tile-card.album-book .album-spine::after { bottom: 14px; }
.tile-card.album-book .album-cover { display: grid; gap: 8px; width: 100%; }
.tile-card.album-book .album-window { display: block; overflow: hidden; border-width: 4px; }
.tile-card.album-book .album-window img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tile-card.album-book .album-window.is-blank { display: grid; font-size: 30px; }
.tile-card.album-book .album-plate { display: block; padding: 5px 8px; }
.tile-card.album-book .tile-card-title { display: block; font-size: 14px; color: #3b2a14; letter-spacing: .02em; }
.tile-card.album-book:hover .tile-card-title, .tile-card.album-book:focus-visible .tile-card-title { color: #3b2a14; }
.tile-card.album-book .album-plate-line { font-size: 10px; }
@media (max-width: 640px) {
  .tile-sheet-head { gap: 12px; margin: 0 -16px 12px; padding: 16px 16px 14px; }
  .tile-sheet-ico { width: 52px; height: 52px; font-size: 28px; }
  .tile-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}
@media (prefers-color-scheme: dark) {
  html:not(.paper) .tile-sheet-ico { background: rgba(255, 255, 255, .12); }
  html:not(.paper) .tile-card:hover, html:not(.paper) .tile-card:focus-visible { box-shadow: 0 10px 22px rgba(0, 0, 0, .5); }
  html:not(.paper) .tile-card-face { box-shadow: 0 0 0 4px rgba(255, 255, 255, .15); }
  html:not(.paper) .tile-card-snippet { color: var(--ink); }
}
.tile-person .bizcard { margin: 0 0 4px; }
/* Making one: a row per link, the picker swapping with the kind. */
.tile-links-head { align-items: baseline; justify-content: space-between; }
.tile-links-head label { margin: 0; }
.tile-sort { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-soft); }
.tile-sort select { margin: 0; font-size: 12px; }
.tile-link-row { display: grid; grid-template-columns: auto 150px minmax(0, 1fr) minmax(0, 1fr) auto auto; gap: 6px; align-items: center; margin: 0 0 6px; }
.tile-link-row.is-dragging { opacity: .4; }
.tile-link-grip { padding: 4px 2px; color: var(--ink-soft); font-size: 14px; letter-spacing: -3px; cursor: grab; user-select: none; }
.tile-link-grip:active { cursor: grabbing; }
.tile-link-moves { display: inline-flex; gap: 0; }
.tile-link-moves .icon-btn { padding: 2px 4px; font-size: 10px; }
.tile-link-row select, .tile-link-row input { margin: 0; min-width: 0; }
[data-links] { margin: 0 0 8px; }
.emoji-input { font-size: 20px; }
.emoji-picks { display: flex; flex-direction: column; gap: 1px; margin: 0 0 12px; }
.emoji-row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.emoji-row-name { flex: 0 0 62px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.emoji-picks button { border: 1px solid transparent; border-radius: 8px; background: none; padding: 2px 4px; font-size: 20px; line-height: 1; cursor: pointer; }
.emoji-picks button:hover, .emoji-picks button:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
@media (max-width: 640px) {
  .tile-link-row { grid-template-columns: 1fr auto; }
  .tile-link-row [data-target], .tile-link-row input { grid-column: 1 / -1; }
}
@media (prefers-color-scheme: dark) {
  html:not(.paper) .tint-cream { --tint: #3a2e24; } html:not(.paper) .tint-peach { --tint: #3a2a1c; } html:not(.paper) .tint-mint { --tint: #1b322a; } html:not(.paper) .tint-sky { --tint: #172634; }
  html:not(.paper) .tint-lilac { --tint: #2a2340; } html:not(.paper) .tint-straw { --tint: #3a2d10; } html:not(.paper) .tint-rose { --tint: #3d1e1b; } html:not(.paper) .tint-slate { --tint: #232a31; }
}
