/* Travel Diary – calm, mobile-first styles. No external fonts: system fonts only. */

:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #efebe3;
  --text: #1f2421;
  --muted: #6a716d;
  --border: #e3ded4;
  --accent: #2f6f6a;
  --accent-strong: #245955;
  --accent-ink: #ffffff;
  --accent-soft: #e0eeeb;
  --danger: #b4452f;
  --danger-soft: #f7e4df;
  --note: #fbf1dc;
  --shadow: 0 1px 2px rgba(40, 35, 20, 0.06), 0 6px 18px rgba(40, 35, 20, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --tabbar-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151817;
    --surface: #1e2221;
    --surface-2: #272c2a;
    --text: #e8ebe9;
    --muted: #9aa29e;
    --border: #323835;
    --accent: #72b5ad;
    --accent-strong: #9fd0c9;
    --accent-ink: #0f1413;
    --accent-soft: #223d39;
    --danger: #e3826b;
    --danger-soft: #3d2620;
    --note: #3a3322;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px); }
body.no-scroll { overflow: hidden; }
[hidden] { display: none !important; }
#app { max-width: 680px; margin: 0 auto; min-height: 100vh; }
img { max-width: 100%; display: block; }
a { color: var(--accent); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.page { padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 12px; align-items: flex-end; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 140px; min-width: 0; }

.i { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i.sm { width: 16px; height: 16px; vertical-align: -3px; }

.loading { display: grid; place-items: center; min-height: 50vh; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 96px 1fr 96px; align-items: center;
  min-height: calc(56px + var(--safe-top));
  padding: var(--safe-top) 6px 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
}
.topbar h1 { font-size: 1.0625rem; font-weight: 650; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-side { display: flex; align-items: center; }
.topbar-side.end { justify-content: flex-end; }
.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center;
  border: 0; border-radius: 50%; background: none; color: var(--text); text-decoration: none;
}
.icon-btn:active { background: var(--surface-2); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text);
  font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: transform 0.1s, background 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn .i { width: 19px; height: 19px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 0.875rem; }
.btn.block { width: 100%; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-outline { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: transparent; }
.btn:disabled { opacity: 0.55; pointer-events: none; }
.link-btn { border: 0; background: none; color: var(--accent); padding: 6px; font-weight: 600; }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: block; min-width: 0; }
.field > span { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--muted); margin: 0 0 6px 2px; }
input, select, textarea {
  width: 100%; min-height: 48px; padding: 11px 12px;
  font: inherit; font-size: 16px; /* 16px stops iPhone from zooming in */
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
input[type="date"], input[type="time"] { min-width: 0; -webkit-appearance: none; appearance: none; }
.time-field { flex: 0 0 120px; }
textarea { resize: vertical; min-height: 140px; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.form-section {
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.form-section h2 { font-size: 0.9375rem; font-weight: 650; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 10px 12px; border-radius: var(--radius-sm); }
.form-actions {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; gap: 12px;
  padding: 16px 0 calc(12px + var(--safe-bottom));
  background: linear-gradient(transparent, var(--bg) 35%);
}
.form-actions .btn { flex: 1; }
.danger-zone { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.cover-preview img { border-radius: var(--radius-sm); aspect-ratio: 16 / 9; width: 100%; object-fit: cover; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; }
.login-logo { width: 64px; height: 64px; border-radius: 20px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; margin-bottom: 18px; }
.login-logo .i { width: 32px; height: 32px; }
.login h1 { font-family: var(--font-serif); font-size: 2.125rem; font-weight: 600; }
.login .muted { margin: 4px 0 24px; }

/* ---------- trips (home: compact list by year) ---------- */
.year-group + .year-group { margin-top: 18px; }
.year-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  min-height: 44px; padding: 0 4px; border: 0; background: none; text-align: left;
}
.year-head .year { font-size: 1.125rem; font-weight: 700; color: var(--accent); }
.year-head .muted { margin-left: auto; }
.year-chevron { width: 18px; height: 18px; color: var(--muted); transition: transform 0.15s; }
.year-head[aria-expanded="true"] .year-chevron { transform: rotate(90deg); }
.trip-rows { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.trip-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; color: inherit; text-decoration: none; }
.trip-row + .trip-row { border-top: 1px solid var(--border); }
.trip-row:active { background: var(--surface-2); }
.trip-thumb { width: 52px; height: 52px; flex: none; border-radius: 12px; overflow: hidden; background: var(--accent-soft); }
.trip-thumb img { width: 100%; height: 100%; object-fit: cover; }
.trip-thumb .cover-placeholder .i { width: 24px; height: 24px; }
.trip-row-body { flex: 1; min-width: 0; }
.trip-row-body h3 { font-size: 1rem; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trip-row-body p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.trip-row .chevron { width: 18px; height: 18px; color: var(--muted); }

.trip-cover img, .hero-cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-placeholder { height: 100%; display: grid; place-items: center; color: var(--accent); }
.cover-placeholder .i { width: 44px; height: 44px; stroke-width: 1.4; }
.trip-meta { color: var(--muted); font-size: 0.9375rem; margin-top: 4px; }
.stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.stat { font-size: 0.8125rem; background: var(--surface-2); color: var(--muted); padding: 4px 10px; border-radius: 999px; }

.hero { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.hero-cover { aspect-ratio: 16 / 10; background: var(--accent-soft); }
.hero-body { padding: 14px 16px 16px; }
.hero h1 { font-family: var(--font-serif); font-size: 1.75rem; font-weight: 600; }
.description { margin-top: 12px; white-space: pre-wrap; }

.tabs {
  position: sticky; top: calc(56px + var(--safe-top)); z-index: 10;
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  margin: 12px -16px 0; padding: 0 16px;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.tabs::-webkit-scrollbar { display: none; }
.tab-link { padding: 12px 14px; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab-link.active { color: var(--text); border-color: var(--accent); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 16px 0 4px; }

/* ---------- journal ---------- */
.day { margin-top: 20px; }
.day-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: 0.875rem; font-weight: 600; margin: 0 2px 10px; }
.day-n { color: var(--accent); font-weight: 750; }
.entry-list { display: grid; gap: 10px; }
.entry-card { display: flex; gap: 12px; padding: 12px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; text-decoration: none; }
.entry-card:active { transform: scale(0.99); }
.entry-thumb { width: 84px; height: 84px; flex: none; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-2); }
.entry-card-body { min-width: 0; flex: 1; }
.entry-card h4 { font-size: 1rem; font-weight: 650; }
.snippet { margin-top: 3px; color: var(--muted); font-size: 0.9rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.entry-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; font-size: 0.8125rem; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; border: 1px solid transparent;
  font-size: 0.8125rem; font-weight: 600;
  color: var(--c, var(--accent-strong));
  background: color-mix(in srgb, var(--c, var(--accent)) 14%, transparent);
}
.tag-highlight { --c: #b7791f; }
.tag-mishap { --c: #c0503a; }
.tag-food { --c: #c46a1c; }
.tag-people { --c: #3b6fb6; }
.tag-funny { --c: #8a4fb0; }
@media (prefers-color-scheme: dark) {
  .tag-highlight { --c: #e6b35a; } .tag-mishap { --c: #ee8a74; } .tag-food { --c: #eda061; }
  .tag-people { --c: #84aee8; } .tag-funny { --c: #c59ae2; }
}
.chip-toggle { min-height: 38px; padding: 0 14px; font-size: 0.875rem; background: transparent; border-color: var(--border); color: var(--muted); }
.chip-toggle[aria-pressed="true"] { color: var(--c, var(--accent-strong)); background: color-mix(in srgb, var(--c, var(--accent)) 16%, transparent); border-color: color-mix(in srgb, var(--c, var(--accent)) 45%, transparent); }

/* ---------- entry page ---------- */
.eyebrow { font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); }
.entry-title { font-family: var(--font-serif); font-size: 1.875rem; font-weight: 600; margin-top: 6px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; color: var(--muted); }
.meta { display: inline-flex; align-items: center; gap: 5px; }
.entry .chips { margin-top: 12px; }
.entry-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 18px -16px 0; }
.entry-photos.single { grid-template-columns: 1fr; }
.entry-photos.single .photo-tile { aspect-ratio: auto; max-height: 75vh; }
.entry-photos.odd .photo-tile:first-child { grid-column: span 2; aspect-ratio: 16 / 10; }
@media (min-width: 680px) { .entry-photos { margin: 18px 0 0; border-radius: var(--radius); overflow: hidden; } }
.entry-text { margin-top: 20px; font-family: var(--font-serif); font-size: 1.125rem; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.coords { margin-top: 16px; }

/* ---------- photos ---------- */
.photo-tile { display: block; width: 100%; padding: 0; border: 0; aspect-ratio: 1; overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; margin: 0 -16px; }
@media (min-width: 680px) { .gallery { grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0; } .gallery .photo-tile { border-radius: 8px; } }

.photo-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
.photo-strip:empty { display: none; }
.strip-item { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.strip-item img { width: 100%; height: 100%; object-fit: cover; }
.strip-remove { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.55); color: #fff; }
.strip-remove .i { width: 16px; height: 16px; }

.suggestion { display: flex; flex-direction: column; gap: 6px; padding: 12px; background: var(--note); border-radius: var(--radius-sm); font-size: 0.9375rem; }
.suggestion-actions { display: flex; gap: 8px; margin-top: 4px; }
.location { display: flex; align-items: center; gap: 6px; font-size: 0.9375rem; color: var(--muted); }

.mood-picker { display: flex; gap: 8px; }
.mood-btn { flex: 1; height: 52px; font-size: 1.6rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); filter: grayscale(1); opacity: 0.55; }
.mood-btn[aria-pressed="true"] { filter: none; opacity: 1; border-color: var(--accent); background: var(--accent-soft); }

/* ---------- full-screen photo viewer ---------- */
.lightbox { position: fixed; inset: 0; z-index: 100; display: flex; background: #000; color: #fff; touch-action: none; }
.lb-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; align-items: center; gap: 4px;
  padding: calc(var(--safe-top) + 6px) 6px 24px 16px;
  background: linear-gradient(rgba(0, 0, 0, 0.65), transparent);
  transition: opacity 0.2s;
}
.lb-info { flex: 1; display: flex; flex-direction: column; font-size: 0.875rem; line-height: 1.3; }
.lb-date { opacity: 0.75; }
.lb-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: #fff; }
.lb-btn:active { background: rgba(255, 255, 255, 0.15); }
.lb-stage { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.lb-img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; transition: transform 0.2s; }
.lb-img.dragging { transition: none; }
.lb-nav { position: absolute; top: 50%; translate: 0 -50%; width: 48px; height: 48px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.12); color: #fff; }
.lb-nav.prev { left: 12px; }
.lb-nav.next { right: 12px; }
@media (hover: none) { .lb-nav { display: none; } }
.lightbox.chrome-hidden .lb-top, .lightbox.chrome-hidden .lb-nav { opacity: 0; pointer-events: none; }

/* ---------- bottom tab bar ---------- */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around; align-items: center;
  height: calc(var(--tabbar-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.tab { flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: 0.6875rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.tab.active { color: var(--accent); }
.tab-plus {
  width: 58px; height: 58px; margin-top: -20px;
  display: grid; place-items: center; border: 0; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent);
}
.tab-plus .i { width: 28px; height: 28px; stroke-width: 2.2; }
.tab-plus:active { transform: scale(0.95); }

/* ---------- bottom sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 90; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, 0); transition: background 0.2s; }
.sheet-backdrop.open { background: rgba(0, 0, 0, 0.38); }
.sheet {
  width: 100%; max-width: 520px;
  padding: 6px 12px calc(14px + var(--safe-bottom));
  background: var(--surface); border-radius: 22px 22px 0 0;
  transform: translateY(100%); transition: transform 0.2s ease-out;
}
.sheet-backdrop.open .sheet { transform: none; }
.sheet-handle { width: 40px; height: 4px; margin: 4px auto 10px; border-radius: 2px; background: var(--border); }
.sheet-title { padding: 2px 0 8px; font-size: 0.875rem; font-weight: 600; color: var(--muted); text-align: center; }
.sheet-msg { padding: 6px 8px 18px; text-align: center; font-size: 1.0625rem; }
.sheet-item { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 8px 14px; border: 0; border-radius: 12px; background: none; font-size: 1.0625rem; text-align: left; }
.sheet-item .i { color: var(--accent); }
.sheet-item:active, .sheet-item:hover { background: var(--surface-2); }
.sheet-item span { display: flex; flex-direction: column; gap: 2px; }
.sheet-hint { color: var(--muted); font-size: 0.8125rem; line-height: 1.3; }
.sheet-item.cancel { justify-content: center; margin-top: 6px; color: var(--muted); }

/* ---------- misc ---------- */
.empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.empty > .i { width: 48px; height: 48px; margin: 0 auto 12px; color: var(--accent); stroke-width: 1.4; }
.empty p { margin-bottom: 18px; }
.card-section { margin-bottom: 16px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-section h2 { display: flex; align-items: center; gap: 6px; font-size: 1rem; margin-bottom: 10px; }

.update-banner {
  position: sticky; top: 0; z-index: 60;
  padding: 10px 16px; background: var(--danger); color: #fff;
  font-size: 0.9rem; line-height: 1.35; text-align: center;
}

/* documents (PDF) row */
.docs-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 16px; }
.docs-label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.875rem; font-weight: 600; margin-right: 2px; }
.doc-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  min-height: 38px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 0.875rem; text-decoration: none; cursor: pointer;
}
.doc-chip .doc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; font-weight: 600; }
.doc-chip .doc-where { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.doc-chip.add { position: relative; border-style: dashed; color: var(--accent); font-weight: 700; }
.doc-chip.add input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.doc-chip.ghost { padding: 6px 10px; color: var(--muted); }
.doc-chip.removing { border-color: var(--danger); color: var(--danger); }
.doc-chip.done { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }

.edit-fab {
  position: fixed; z-index: 50;
  right: max(16px, calc((100vw - 680px) / 2 + 16px));
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 52px; padding: 0 20px 0 16px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; text-decoration: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
}
.edit-fab:active { transform: scale(0.97); }
.has-fab { padding-bottom: 84px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px); z-index: 200;
  max-width: calc(100% - 32px); padding: 10px 18px; border-radius: 999px;
  background: var(--text); color: var(--bg); font-size: 0.9375rem;
  opacity: 0; transform: translate(-50%, 16px); transition: opacity 0.2s, transform 0.2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 0.01ms !important; }
}

/* ---------- home: years / groups switch, favourites ---------- */
.segmented { display: flex; padding: 3px; margin-bottom: 14px; background: var(--surface-2); border-radius: 999px; }
.segmented button { flex: 1; min-height: 38px; border: 0; border-radius: 999px; background: none; color: var(--muted); font-weight: 600; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.year-head .year.small-title { display: inline-flex; align-items: center; gap: 6px; font-size: 1rem; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.year-head .muted { flex: none; }
.star-mark { display: inline-flex; margin-right: 5px; vertical-align: -2px; color: #c98a1b; }
.star-mark .i { width: 16px; height: 16px; fill: currentColor; }
.star-btn[aria-pressed="true"] { color: #c98a1b; }
.star-btn[aria-pressed="true"] .i { fill: currentColor; }
.group-label { text-decoration: none; display: inline-flex; align-items: center; gap: 5px; margin-bottom: 4px; font-size: 0.8125rem; font-weight: 700; color: var(--accent); }
.field-hint { display: block; margin: 6px 2px 0; font-size: 0.8125rem; }

/* ---------- search ---------- */
.search-box { position: relative; margin-bottom: 8px; }
.search-box > .i { position: absolute; left: 14px; top: 50%; translate: 0 -50%; color: var(--muted); pointer-events: none; }
.search-box input { padding-left: 44px; border-radius: 999px; }
.section-title { margin: 20px 2px 10px; font-size: 0.875rem; font-weight: 700; color: var(--muted); }
mark { background: color-mix(in srgb, #f2c14e 45%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------- calendar ---------- */
.month-nav { display: flex; align-items: center; justify-content: space-between; }
.month-nav h2 { font-family: var(--font-serif); font-size: 1.375rem; font-weight: 600; text-transform: capitalize; }
.month-tools { display: flex; gap: 10px; align-items: center; margin: 6px 0 12px; }
.month-tools select { flex: 1; min-height: 38px; padding: 6px 10px; font-size: 15px; border-radius: 999px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal-weekday { text-align: center; font-size: 0.75rem; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-day {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  aspect-ratio: 1; min-height: 42px; padding: 0; border: 2px solid transparent; border-radius: 10px;
  background: var(--surface); font-size: 0.9375rem;
}
.cal-day.outside { opacity: 0.4; }
.cal-day.today .cal-num { color: var(--accent); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.cal-day[aria-pressed="true"] { border-color: var(--text); }
.cal-dots { position: absolute; bottom: 2px; font-size: 0.75rem; line-height: 1; letter-spacing: 1px; color: var(--text); }
.trip-c0 { background: color-mix(in srgb, #2f8f86 24%, var(--surface)); }
.trip-c1 { background: color-mix(in srgb, #d9774f 26%, var(--surface)); }
.trip-c2 { background: color-mix(in srgb, #4f7fd9 24%, var(--surface)); }
.trip-c3 { background: color-mix(in srgb, #c9a227 30%, var(--surface)); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 0.875rem; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--text); text-decoration: none; }
.legend-swatch { width: 14px; height: 14px; border-radius: 4px; }
.day-details { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.day-details:empty { display: none; }
.details-date { font-size: 1.0625rem; text-transform: capitalize; }
.details-trip { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; text-decoration: none; }
.day-details .btn { align-self: flex-start; }
.entry-thumb.small-thumb { width: 56px; height: 56px; }

/* ---------- groups view: cards with a photo collage ---------- */
.group-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .group-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.group-card { display: block; overflow: hidden; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; text-decoration: none; }
.group-card:active { transform: scale(0.98); }
.collage { display: grid; gap: 2px; aspect-ratio: 4 / 3; background: var(--accent-soft); }
.collage img { width: 100%; height: 100%; object-fit: cover; min-height: 0; }
.collage.n2 { grid-template-columns: 1fr 1fr; }
.collage.n3 { grid-template-columns: 3fr 2fr; grid-template-rows: 1fr 1fr; }
.collage.n3 img:first-child { grid-row: span 2; }
.hero-collage { aspect-ratio: 16 / 9; }
.group-card-body { padding: 10px 12px 12px; }
.group-card-body h3 { font-size: 0.9375rem; font-weight: 650; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.group-card-body p { margin-top: 2px; }
.groups-hint { margin-top: 18px; padding: 0 12px; }
.group-trips { margin-top: 16px; }

/* ---------- calendar: year overview ---------- */
.year-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 4px; }
.year-chips::-webkit-scrollbar { display: none; }
.year-chip { flex: none; min-height: 38px; padding: 8px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-weight: 650; }
.year-chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.year-summary { margin: 10px 2px 12px; }
.year-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .year-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.mini-month { display: block; padding: 8px 8px 10px; background: var(--surface); border-radius: 12px; color: inherit; text-decoration: none; border: 1px solid transparent; }
.mini-month:active { transform: scale(0.97); }
.mini-month.busy { border-color: var(--border); box-shadow: var(--shadow); }
.mini-name { display: block; margin-bottom: 5px; font-size: 0.8125rem; font-weight: 700; text-transform: capitalize; }
.mini-month:not(.busy) .mini-name { color: var(--muted); font-weight: 600; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mini-grid i { position: relative; aspect-ratio: 1; border-radius: 2px; background: var(--surface-2); }
.mini-grid i.mini-blank { background: none; }
.mini-grid i.trip-c0 { background: #2f8f86; }
.mini-grid i.trip-c1 { background: #d9774f; }
.mini-grid i.trip-c2 { background: #4f7fd9; }
.mini-grid i.trip-c3 { background: #c9a227; }
.mini-grid i.has-entry::after { content: ""; position: absolute; inset: 30%; border-radius: 50%; background: #fff; }
.mini-grid i.is-today { outline: 2px solid var(--text); outline-offset: -1px; }
.year-legend { margin-top: 16px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.legend-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; color: inherit; text-decoration: none; }
.legend-row + .legend-row { border-top: 1px solid var(--border); }
.legend-row .legend-swatch { flex: none; }
.legend-name { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend-row .chevron { width: 16px; height: 16px; color: var(--muted); }
.legend-swatch.trip-c0 { background: #2f8f86; } .legend-swatch.trip-c1 { background: #d9774f; }
.legend-swatch.trip-c2 { background: #4f7fd9; } .legend-swatch.trip-c3 { background: #c9a227; }
.year-hint { margin-top: 14px; }

/* ---------- search results: summary + photo strip ---------- */
.result-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.result-chip { min-height: 36px; padding: 0 12px; border: 0; font-size: 0.875rem; }
.photo-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; scroll-snap-type: x mandatory; }
.photo-row::-webkit-scrollbar { display: none; }
.photo-row .photo-tile { flex: none; width: 104px; border-radius: 10px; scroll-snap-align: start; }
section[id^="sr-"] { scroll-margin-top: 70px; }

/* ---------- hotels and places ---------- */
.info-note { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent-strong); font-size: 0.875rem; }
.suggested { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; padding: 0 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 0.6875rem; font-weight: 700; vertical-align: 1px; }
.suggested .i { width: 12px; height: 12px; }
.nights-line { margin: -6px 2px 0; font-weight: 600; color: var(--accent); }
.currency-field { flex: 0 0 96px; }
.currency-field input { text-transform: uppercase; }
.money { display: flex; flex-direction: column; gap: 12px; }
.rating-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.star-input { display: flex; gap: 2px; }
.star-input button { width: 40px; height: 40px; border: 0; background: none; font-size: 1.6rem; line-height: 1; color: var(--border); }
.star-input button[aria-pressed="true"] { color: #e0a52a; }
.stars { color: #d9991c; letter-spacing: 1px; }
.small-seg { margin: 0; min-width: 150px; }
.small-seg button { min-height: 34px; font-size: 0.875rem; }
.type-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.type-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font-size: 0.8125rem; font-weight: 600; color: var(--muted); }
.type-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.row-amount { flex: none; font-weight: 700; font-size: 0.9375rem; white-space: nowrap; }
.metric-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 8px 0 14px; }
.metric { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.metric span { font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.metric strong { font-size: 1.0625rem; }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 4px; }
.filter-row select:last-child { grid-column: span 2; }
.filter-row select { min-height: 42px; padding: 8px 10px; font-size: 15px; }
.filter-chips { margin: 0 0 12px; }
.tab-count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); font-size: 0.75rem; text-align: center; color: var(--muted); }
.fact-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.fact { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.fact strong { font-size: 1.25rem; }
.ratings-box { margin-top: 12px; padding: 6px 14px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.rating-line { display: flex; justify-content: space-between; padding: 6px 0; }
.rating-line + .rating-line { border-top: 1px solid var(--border); }
.info-line { display: flex; gap: 6px; align-items: flex-start; margin-top: 12px; }
.day-extras { margin-top: 24px; }
.link-list { display: flex; flex-direction: column; gap: 6px; }
.link-row { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); color: var(--text); text-decoration: none; font-weight: 600; }
.link-row.big { box-shadow: none; padding: 4px 0; background: none; }
.link-row .chevron { margin-left: auto; width: 18px; height: 18px; color: var(--muted); }
.add-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.booking-buttons { margin: 0 0 12px; }
.link-box { margin: 0 0 18px; padding: 14px; border: 1.5px dashed var(--border); border-radius: 14px; background: var(--surface); }
.link-box .field { margin-bottom: 6px; }
.link-box p { margin: 0 0 10px; }
.day-details .link-row { align-self: stretch; }

/* Backup page */
.backup-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.backup-row { display: flex; align-items: center; gap: 8px; }
.backup-when { flex: 1; display: flex; flex-direction: column; font-weight: 600; white-space: nowrap; }
.backup-when small { font-weight: 400; }
