:root {
  --ink: #17322f;
  --muted: #687a76;
  --paper: #f7f5ef;
  --surface: #ffffff;
  --forest: #123f3a;
  --accent: #e76f51;
  --sand: #e9dfcb;
  --line: #dce2de;
  --shadow: 0 12px 34px rgba(18, 63, 58, 0.09);
  --radius: 20px;
  --mobile-travel-bar-height: 68px;
  --card-camera-inset: 14px;
}

/* Explicit whole-Trip offline packages.  These colors stay on shared tokens so
   custom Theme Pack surfaces remain readable. */
.offline-mode-indicator {
  position: fixed;
  z-index: 120;
  top: 66px;
  right: 14px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  font-size: .74rem;
  font-weight: 850;
}
.offline-package-card,
.offline-boundary-card,
.offline-fallback-card {
  margin-top: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}
.offline-package-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.offline-package-summary h2 { margin: 4px 0 6px; }
.offline-package-summary p:last-child { margin: 0; color: var(--muted); }
.offline-status-pill {
  flex: 0 0 auto;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--surface-soft, var(--mist));
  color: var(--muted);
  font-size: .74rem;
  font-weight: 850;
}
.offline-status-pill.is-ready { background: color-mix(in srgb, var(--forest) 14%, var(--paper)); color: var(--forest); }
.offline-status-pill.is-working { background: color-mix(in srgb, var(--gold) 22%, var(--paper)); color: var(--ink); }
.offline-status-pill.is-failed { background: color-mix(in srgb, var(--coral) 14%, var(--paper)); color: var(--coral-dark, var(--ink)); }
.offline-package-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0;
}
.offline-package-meta > div {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line-soft, var(--line));
  border-radius: 14px;
  background: var(--surface-soft, var(--mist));
}
.offline-package-meta dt { color: var(--muted); font-size: .72rem; font-weight: 800; }
.offline-package-meta dd { margin: 5px 0 0; font-weight: 800; overflow-wrap: anywhere; }
.offline-progress { margin: 18px 0; }
.offline-progress > div { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.offline-progress progress { width: 100%; accent-color: var(--forest); }
.offline-package-error { color: var(--danger, #a43f52); font-weight: 750; }
.offline-package-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.offline-privacy-note { margin: 16px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.55; }
.offline-boundary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.offline-boundary-grid > div { padding: 15px; border-radius: 14px; background: var(--surface-soft, var(--mist)); }
.offline-boundary-grid p { margin: 7px 0 0; color: var(--muted); line-height: 1.55; }
.offline-fallback-card { max-width: 620px; margin: 16vh auto 0; }
.offline-action-message {
  position: fixed;
  z-index: 140;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 28px);
  margin: 0;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow);
  font-size: .82rem;
  font-weight: 800;
}
body.is-offline form button:not([data-offline-download]),
body.is-offline [data-network-required],
body.is-offline [data-parking-open] { cursor: not-allowed; }

@media (max-width: 700px) {
  .offline-page-heading { padding-inline: 2px; }
  .offline-package-card,
  .offline-boundary-card { padding: 17px; }
  .offline-package-summary { display: grid; grid-template-columns: minmax(0, 1fr); }
  .offline-status-pill { width: max-content; }
  .offline-package-meta,
  .offline-boundary-grid { grid-template-columns: minmax(0, 1fr); }
  .offline-package-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .offline-package-actions button { width: 100%; min-height: 46px; }
  .offline-mode-indicator { top: 58px; right: 9px; }
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: clip;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; }
.site-header {
  height: 64px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(247, 245, 239, 0.94);
  border-bottom: 1px solid rgba(23, 50, 47, 0.08);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.02em; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 11px; color: white; background: var(--forest); }
.header-nav { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 0.78rem; font-weight: 750; }
.header-nav a:hover { color: var(--forest); }
.header-nav-primary { margin-left: auto; }
.header-more-menu { position: relative; flex: 0 0 auto; }
.header-more-menu > summary { min-height: 38px; padding: 8px 10px; display: flex; align-items: center; border-radius: 10px; color: var(--muted); font-size: .76rem; font-weight: 800; cursor: pointer; list-style: none; }
.header-more-menu > summary::-webkit-details-marker { display: none; }
.header-more-menu > summary::after { content: "⌄"; margin-left: 5px; }
.header-more-menu > summary.is-active { color: var(--forest); background: var(--paper); }
.header-more-panel { position: absolute; z-index: 60; top: calc(100% + 9px); right: 0; width: min(230px, calc(100vw - 24px)); padding: 8px; display: grid; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 14px 34px rgba(40,30,33,.18); }
.header-more-panel a, .header-more-panel button { min-height: 42px; padding: 9px 11px; display: flex; align-items: center; border: 0; border-radius: 9px; color: var(--ink); background: transparent; font-size: .78rem; font-weight: 800; }
.header-more-panel a:hover, .header-more-panel a.is-active { background: var(--paper); color: var(--forest); }
.header-more-panel p { margin: 4px 10px; color: var(--muted); font-size: .68rem; overflow-wrap: anywhere; }
.current-user { color: var(--ink); }
.logout-form { margin: 0; }
.logout-form button { padding: 0; border: 0; color: var(--muted); background: transparent; font: inherit; font-weight: inherit; cursor: pointer; }
.logout-form button:hover { color: var(--forest); }
.page-shell { width: min(1120px, 100%); margin: 0 auto; padding: 30px 18px 80px; }
.page-heading { margin: 8px 0 26px; max-width: 620px; }
.page-heading h1, .trip-hero h1 { margin: 4px 0 6px; font-size: clamp(2rem, 7vw, 3.7rem); line-height: 1.05; letter-spacing: -0.045em; }
.page-heading > p:last-child, .trip-hero > p:last-child { color: var(--muted); }
.eyebrow { margin: 0; color: var(--accent); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }
.trip-grid { display: grid; gap: 18px; }
.trip-card { overflow: hidden; background: var(--surface); border: 1px solid rgba(23, 50, 47, 0.08); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform 160ms ease; }
.trip-card:hover { transform: translateY(-3px); }
.trip-card-main { display: block; }
.trip-card-art { min-height: 150px; padding: 22px; display: flex; align-items: end; background: linear-gradient(135deg, #174f49, #6a9285 55%, #e7cba4); color: white; font-size: 2rem; font-weight: 800; letter-spacing: -0.04em; }
.trip-city-route { max-width: 100%; overflow-wrap: anywhere; line-height: 1.12; }
.trip-card-body { padding: 20px; }
.trip-card-body h2 { margin: 4px 0; font-size: 1.35rem; }
.trip-card-body > p { margin: 0; color: var(--muted); }
.trip-card-body .trip-dates { color: var(--accent); font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.trip-lifecycle-section { margin-top: 38px; }
.trip-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 15px; }
.trip-section-heading h2 { margin: 2px 0 0; font-size: 1.55rem; }
.trip-section-heading > span, .trip-section-empty { color: var(--muted); font-size: .78rem; }
.trip-section-empty { margin: 0; padding: 18px 20px; border: 1px dashed var(--line); border-radius: 14px; background: rgba(255,255,255,.48); }
.trip-card-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 0 20px 18px; }
.trip-card-actions form { margin: 0; }
.trip-card-actions a, .trip-card-actions button { min-height: 38px; padding: 8px 11px; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; color: var(--forest); background: var(--paper); font-size: .75rem; font-weight: 800; cursor: pointer; }
.trip-card.is-deleted { opacity: .82; }
.trips-page-heading .heading-actions { display: flex; align-items: center; gap: 10px; }
.trips-page-heading .heading-actions h1 { margin-block: 0; }
.compact-create-button, .compact-icon-button { width: 42px; height: 42px; padding: 0; display: inline-grid; place-items: center; flex: 0 0 42px; border: 1px solid var(--line); border-radius: 50%; color: white; background: var(--forest); box-shadow: 0 6px 14px rgba(18,63,58,.16); font-size: 1.25rem; font-weight: 850; cursor: pointer; }
.trip-route-edit.compact-icon-button { width: 34px; height: 34px; min-height: 34px; flex-basis: 34px; padding: 0; font-size: .86rem; box-shadow: 0 3px 9px rgba(18,63,58,.12); }
.trip-card.is-deleted .trip-card-art { filter: saturate(.55); }
.trip-cities-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.trip-cities-heading h2 { margin: 2px 0 0; font-size: 1.4rem; }
.city-manager { width: min(680px, calc(100% - 32px)); max-height: min(760px, calc(100dvh - 48px)); margin: auto; padding: 0; overflow: hidden; border: 0; border-radius: 20px; color: var(--ink); background: transparent; box-shadow: 0 24px 70px rgba(23,50,47,.28); }
.city-manager::backdrop { background: rgba(35,31,31,.48); backdrop-filter: blur(3px); }
.city-manager-panel { max-height: min(760px, calc(100dvh - 48px)); padding: 20px; display: flex; flex-direction: column; background: var(--paper); }
.city-manager-toolbar { margin-bottom: 14px; }
.city-manager-toolbar .primary-button { min-height: 42px; padding: 9px 12px; display: inline-flex; align-items: center; font-size: .76rem; }
.city-manager-close { width: 44px; height: 44px; flex: 0 0 44px; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: var(--surface); font-size: 1.45rem; cursor: pointer; }
.city-manager-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 1px 3px 4px 1px; }
body.has-open-dialog { overflow: hidden; }
.trip-city-list { display: grid; gap: 10px; }
.trip-city-card { display: grid; grid-template-columns: 32px minmax(0,1fr); gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.trip-city-card.is-primary { border-color: #d7b77a; box-shadow: 0 5px 16px rgba(129,85,27,.08); }
.trip-city-order { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--forest); font-size: .75rem; font-weight: 850; }
.trip-city-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.trip-city-title h3, .trip-city-content p { margin: 0; }
.trip-city-content > p, .trip-city-content > small { color: var(--muted); }
.trip-city-dates { font-size: .78rem; font-weight: 750; }
.trip-city-actions { grid-column: 2; display: flex; flex-wrap: wrap; gap: 7px; }
.trip-city-actions form { display: inline-flex; gap: 5px; margin: 0; }
.trip-city-actions a, .trip-city-actions button { min-height: 34px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--forest); background: var(--paper); font-size: .7rem; font-weight: 800; cursor: pointer; }
.trip-city-actions button:disabled { opacity: .35; cursor: default; }
.timeline-city { display: inline-block; margin-top: 4px; color: var(--accent); font-weight: 800; }
.inbox-hero { margin-bottom: 22px; }
.inbox-hero h1 { margin: 3px 0; font-size: clamp(2rem, 9vw, 3.7rem); letter-spacing: -.045em; }
.inbox-hero > p:last-child { color: var(--muted); }
.inbox-city-route { margin: 5px 0; color: var(--accent); font-size: clamp(1rem, 4vw, 1.4rem); font-weight: 850; overflow-wrap: anywhere; }
.inbox-upload { display: grid; gap: 14px; margin-bottom: 28px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.inbox-drop-zone { min-height: 190px; padding: 24px 18px; display: grid; place-items: center; align-content: center; gap: 5px; text-align: center; border: 2px dashed #9eb6ad; border-radius: 17px; color: var(--forest); background: #f2f7f4; cursor: pointer; transition: border-color 150ms ease, background 150ms ease; }
.inbox-drop-zone.is-dragging { border-color: var(--accent); background: #fff1eb; }
.inbox-drop-zone > span, .inbox-drop-zone > small { color: var(--muted); }
.inbox-upload-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; color: white !important; background: var(--forest); font-size: 1.8rem; }
.inbox-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.inbox-submit { width: 100%; min-height: 52px; font-size: 1rem; }
.inbox-filters { display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 14px; scrollbar-width: none; }
.inbox-filters a { flex: none; padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--surface); font-size: .74rem; font-weight: 800; }
.inbox-filters a.is-active { color: white; border-color: var(--forest); background: var(--forest); }
.inbox-filters span { flex: 0 0 1px; background: var(--line); }
.inbox-items { display: grid; gap: 12px; }
.inbox-item { min-width: 0; padding: 12px; display: grid; grid-template-columns: 82px minmax(0,1fr); gap: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.inbox-preview { width: 82px; height: 82px; display: grid; place-items: center; overflow: hidden; border-radius: 12px; color: var(--forest); background: var(--sand); font-size: 1rem; font-weight: 900; }
.inbox-preview img { width: 100%; height: 100%; object-fit: cover; }
.inbox-item-main { min-width: 0; }
.inbox-item-main h2 { margin: 5px 0 2px; font-size: .98rem; overflow-wrap: anywhere; }
.inbox-item-main > p { margin: 0; color: var(--muted); font-size: .72rem; }
.inbox-item-status { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.inbox-item-status small { color: var(--muted); }
.inbox-item-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.inbox-item-actions form { margin: 0; }
.inbox-item-actions a, .inbox-item-actions button { min-height: 38px; padding: 8px 10px; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; color: var(--forest); background: var(--paper); font-size: .72rem; font-weight: 800; cursor: pointer; }
.place-library-filters { margin: 0 0 18px; padding: 14px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.place-library-filters label { min-width: 0; display: grid; gap: 4px; color: var(--muted); font-size: .72rem; font-weight: 800; }
.place-library-filters input, .place-library-filters select { width: 100%; min-height: 42px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.place-library-grid, .place-candidate-list { display: grid; gap: 12px; }
.place-library-card { padding: 12px; display: grid; grid-template-columns: 92px minmax(0,1fr); gap: 13px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: var(--shadow); }
.place-library-preview { width: 92px; height: 112px; overflow: hidden; border-radius: 12px; background: var(--sand); }
.place-library-preview img { width: 100%; height: 100%; object-fit: cover; }
.place-library-card h2, .place-library-card p { margin: 4px 0; }
.place-library-card h2 { font-size: 1.05rem; }
.place-library-card p, .place-library-card small { color: var(--muted); font-size: .75rem; }
.place-library-actions { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 7px; }
.place-library-actions a { min-height: 38px; padding: 7px 10px; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; font-size: .74rem; font-weight: 800; }
.place-library-actions .place-add-trip-action { color: white; border-color: var(--forest); background: var(--forest); }
.place-library-actions button { min-height: 38px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--forest); background: var(--paper); font-size: .74rem; font-weight: 800; cursor: pointer; }
.place-add-trip-heading p:last-child { color: var(--muted); }
.place-add-trip-form { max-width: 720px; }
.place-manual-badge { margin-left: 6px; padding: 3px 7px; display: inline-flex; border-radius: 999px; color: var(--forest); background: rgba(81, 133, 96, .12); font-size: .68rem; font-weight: 800; }
.place-organize-form small { color: var(--muted); line-height: 1.5; }
.place-organize-helper { min-width: 0; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 14px; }
.place-auto-toggle { min-height: 32px; display: inline-flex; align-items: center; flex: 0 0 auto; gap: 7px; color: var(--forest); font-size: .75rem; font-weight: 800; white-space: nowrap; cursor: pointer; }
.place-organize-form .place-auto-toggle input[type="checkbox"] { appearance: auto; width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; flex: 0 0 auto; border: 0; border-radius: 0; background: transparent; accent-color: var(--forest); }
.place-organize-form .place-auto-toggle span { color: var(--forest); font-weight: 800; }
.place-section-heading { margin: 4px 0 12px; display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.place-section-heading h2 { margin: 2px 0; }
.place-section-heading > span { color: var(--muted); font-size: .72rem; font-weight: 750; }
.place-library-cta { min-height: 76px; margin-top: 16px; padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-radius: 17px; color: white; background: var(--forest); box-shadow: var(--shadow); }
.place-library-cta span:first-child { display: grid; gap: 3px; }
.place-library-cta small { color: #dce9e3; }
.place-library-cta span:last-child { font-size: 1.5rem; }
.place-organized-feature { margin: 4px 0 28px; padding: 20px; display: grid; gap: 16px; border-radius: 19px; color: white; background: var(--forest); box-shadow: var(--shadow); }
.place-organized-feature h2, .place-organized-feature p { margin: 4px 0; }
.place-organized-feature p { color: #dce9e3; }
.place-organized-feature .primary-button { width: 100%; min-height: 48px; color: var(--forest); background: white; }
.place-browse-hero { margin-top: 16px; }
.place-organized-card { grid-template-columns: minmax(0,1fr); }
.place-rating-actions { margin-top: 12px; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.place-rating-actions form { margin: 0; }
.place-rating-actions button { width: 100%; min-height: 44px; padding: 7px 5px; border: 1px solid var(--line); border-radius: 10px; color: var(--forest); background: var(--paper); font-size: .72rem; font-weight: 800; cursor: pointer; }
.place-rating-actions button.is-selected { color: white; border-color: var(--accent); background: var(--accent); }
.place-rating-actions .field-error { grid-column: 1/-1; }
.place-tree { display: grid; gap: 10px; }
.place-tree > h2 { margin: 0 0 4px; }
.place-tree-node { border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.place-tree-node > summary { min-height: 50px; padding: 11px 13px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--forest); font-weight: 850; cursor: pointer; list-style-position: inside; }
.place-tree-node > summary strong { min-width: 28px; padding: 3px 7px; border-radius: 999px; text-align: center; color: var(--muted); background: var(--sand); font-size: .72rem; }
.place-tree-children { padding: 0 8px 8px 18px; display: grid; gap: 8px; }
.place-tree-cards { padding: 0 8px 10px; display: grid; gap: 10px; }
.place-screenshot-dialog { width: min(94vw, 760px); max-height: 92vh; padding: 14px; border: 0; border-radius: 18px; background: var(--surface); box-shadow: 0 22px 70px rgba(20,39,31,.3); }
.place-screenshot-dialog::backdrop { background: rgba(13,25,20,.72); }
.place-screenshot-dialog .dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.place-screenshot-dialog .dialog-header h2 { margin: 2px 0 8px; }
.place-screenshot-dialog .dialog-header button { width: 44px; height: 44px; border-radius: 50%; font-size: 1.4rem; }
.place-screenshot-dialog img { width: 100%; max-height: 72vh; object-fit: contain; border-radius: 12px; background: var(--paper); }
.place-screenshot-dialog .dialog-footer { padding-top: 10px; display: flex; justify-content: flex-end; }
.place-screenshot-dialog .dialog-footer button { min-height: 44px; padding: 8px 18px; }
.place-review-layout { display: grid; gap: 20px; }
.place-review-source, .place-review-main, .place-candidate { padding: 16px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); }
.place-review-source img { width: 100%; max-height: 70vh; object-fit: contain; border-radius: 12px; background: var(--paper); }
.place-review-main h1 { margin: 5px 0 12px; }
.place-candidate h2, .place-candidate h3, .place-candidate p { margin: 4px 0; }
.place-candidate small { display: block; margin-bottom: 10px; color: var(--muted); }
.place-candidate form { margin: 10px 0 0; }
.place-search-form { margin-top: 16px; }
.text-link { display: inline-block; margin-top: 18px; font-weight: 750; }
.empty-state { padding: 34px; text-align: center; background: var(--surface); border: 1px dashed #b9c5bf; border-radius: var(--radius); }
.empty-state h2, .empty-state h3 { margin: 0; }
.empty-state p { color: var(--muted); }
.back-link { display: inline-block; margin-bottom: 20px; color: var(--muted); font-weight: 700; font-size: 0.85rem; }
.timeline-shell { padding: 18px 0 105px; }
.trip-hero { position: relative; padding: 0 66px 14px 18px; }
.trip-hero .back-link { margin-bottom: 12px; }
.trip-hero h1 { margin-block: 3px 4px; font-size: clamp(1.75rem, 7.5vw, 3.3rem); }
.trip-route-row { max-width: 100%; display: flex; align-items: center; gap: 8px; }
.trip-hero-route { min-width: 0; padding: 2px 0; overflow-wrap: anywhere; border: 0; color: var(--accent); background: transparent; text-align: left; font-size: clamp(1.05rem, 5vw, 1.65rem); font-weight: 850; line-height: 1.25; letter-spacing: -.025em; cursor: pointer; }
.trip-route-edit { min-height: 36px; padding: 6px 9px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: rgba(255,255,255,.86); font-size: .7rem; font-weight: 800; cursor: pointer; }
.trip-hero-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.photo-camera-button { min-width: 38px; min-height: 38px; padding: 5px 8px; display: inline-flex; align-items: center; justify-content: center; gap: 3px; border: 1px solid var(--line); border-radius: 999px; color: var(--forest); background: var(--surface); font-size: .83rem; font-weight: 850; line-height: 1; text-decoration: none; }
.photo-camera-button small { margin: 0; color: inherit; font-size: .65rem; }
.photo-camera-button:hover { border-color: var(--forest); background: var(--sand); }
.photo-camera-button:focus-visible { outline: 3px solid rgba(196, 91, 55, .35); outline-offset: 2px; }
.photo-camera-entry { position: absolute; z-index: 3; top: var(--card-camera-inset); right: var(--card-camera-inset); }
.trip-hero-dates { margin: 0; color: var(--muted); font-size: .86rem; }
.trip-hero-actions { max-width: 520px; margin-top: 10px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.trip-hero-actions a { min-width: 0; min-height: 42px; padding: 8px 9px; display: flex; align-items: center; justify-content: center; gap: 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-align: center; white-space: nowrap; font-size: .74rem; font-weight: 800; }
.date-strip { position: sticky; top: 0; z-index: 5; display: flex; gap: 7px; overflow-x: auto; padding: 12px 18px 16px; scrollbar-width: none; background: rgba(247, 245, 239, 0.94); backdrop-filter: blur(14px); scroll-padding-inline: 18px; }
.date-strip::-webkit-scrollbar { display: none; }
.date-chip { flex: 0 0 78px; min-width: 0; padding: 7px 5px 8px; display: grid; align-content: center; justify-items: center; row-gap: 1px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); color: var(--muted); }
.date-chip span, .date-chip small { font-size: 0.68rem; text-transform: uppercase; }
.date-chip strong { color: var(--ink); font-size: .88rem; font-weight: 800; line-height: 1.22; letter-spacing: -.025em; white-space: nowrap; }
.date-chip .day-tab-order { font-size: .63rem; font-weight: 750; text-transform: none; }
.date-chip .day-weather-preview { max-width: 100%; margin-top: 2px; overflow: hidden; color: var(--ink); font-size: .67rem; font-weight: 850; line-height: 1.15; text-overflow: ellipsis; text-transform: none; white-space: nowrap; }
.date-chip .day-weather-location { max-width: 100%; overflow: hidden; font-size: .62rem; line-height: 1.2; text-overflow: ellipsis; text-transform: none; white-space: nowrap; }
.date-chip.weather-unavailable .day-weather-preview { color: var(--muted); }
.date-chip.is-active { color: #c8dbd5; background: var(--forest); border-color: var(--forest); box-shadow: 0 8px 20px rgba(18, 63, 58, 0.2); }
.date-chip.is-active strong { color: white; }
.date-chip.is-active .day-weather-preview, .date-chip.is-active .day-weather-location { color: white; }
.timeline-layout { padding: 12px 18px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 22px; }
.timeline > .section-heading { position: relative; padding-right: 62px; }
.section-heading h2 { margin: 3px 0 0; font-size: 1.35rem; letter-spacing: -0.025em; }
.timeline-day-summary { min-width: 0; flex: 1 1 auto; }
.timeline-day-kicker { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 3px 12px; }
.timeline-day-kicker-actions { min-width: 0; margin-left: auto; display: flex; align-items: center; gap: 7px; }
.timeline-day-summary > p:last-child { margin: 3px 0 0; color: var(--muted); font-size: 0.78rem; font-weight: 750; }
.icon-button { width: 42px; height: 42px; display: inline-grid; flex: 0 0 42px; place-items: center; border: 0; border-radius: 50%; color: white; background: var(--forest); font-size: 1.5rem; }
.timeline-heading-actions { display: flex; flex: 0 0 auto; align-items: center; justify-content: flex-end; gap: 6px; }
.timeline-heading-actions form { margin: 0; display: flex; }
.timeline-heading-action { box-sizing: border-box; min-width: 52px; height: 40px; padding: 0 10px; display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 12px; color: var(--forest); background: var(--surface); box-shadow: none; font: inherit; font-size: .74rem; font-weight: 850; line-height: 1; white-space: nowrap; cursor: pointer; }
.timeline-heading-action.route-map-button { min-width: 82px; }
.timeline-heading-action.timeline-parse-button { color: white; background: var(--accent); }
.timeline-heading-action.is-add { width: 40px; min-width: 40px; padding: 0; border-radius: 50%; color: white; background: var(--forest); font-size: 1.2rem; }
.timeline-heading-action:hover { transform: translateY(-1px); filter: brightness(.98); }
.timeline-heading-action:active { transform: translateY(0); }
.timeline-day-weather-summary { min-width: 0; max-width: 100%; margin: 0 0 0 auto; overflow: hidden; color: var(--muted); font-size: .72rem; font-weight: 800; line-height: 1.25; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.timeline-list { position: relative; display: grid; isolation: isolate; }
.timeline-list:has(.timeline-item)::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 13px;
  bottom: 0;
  left: 72px;
  width: 3px;
  transform: translateX(-50%);
  background: var(--theme-border, #f1b7c1);
  pointer-events: none;
}
.timeline-travel-time { min-width: 0; min-height: 30px; display: grid; grid-template-columns: 54px 20px minmax(0, 1fr); gap: 8px; align-items: center; }
.timeline-travel-time-rail { display: none; }
.timeline-travel-time-label { grid-column: 3; grid-row: 1; width: fit-content; max-width: 100%; padding: 4px 10px; border: 1px solid var(--theme-border, var(--line)); border-radius: 999px; color: var(--theme-text, var(--ink)); background: var(--theme-surface, var(--surface)); font-size: .72rem; font-weight: 850; line-height: 1.25; white-space: nowrap; }
.timeline-segment-action { min-width: 0; margin: -1px 0 7px; padding-left: 82px; display: flex; justify-content: center; }
.timeline-segment-action a { min-height: 38px; padding: 7px 13px; display: inline-flex; align-items: center; justify-content: center; border: 1px dashed var(--line); border-radius: 999px; color: var(--forest); background: var(--surface); font-size: .72rem; font-weight: 850; }
.timeline-connector-row { min-width: 0; min-height: 30px; display: grid; grid-template-columns: 54px 20px minmax(0, 1fr); gap: 8px; align-items: center; }
.timeline-connector-controls { grid-column: 3; min-width: 0; display: flex; align-items: center; gap: 8px; }
.timeline-connector-row .timeline-travel-time { min-height: 0; display: flex; flex: 0 0 auto; }
.timeline-connector-row .timeline-travel-time-label { grid-column: auto; grid-row: auto; display: inline-flex; align-items: center; }
.timeline-connector-row .timeline-segment-action { margin: 0; padding: 0; display: flex; flex: 0 1 auto; }
.timeline-connector-row .timeline-segment-action a { width: auto; min-height: 0; padding: 4px 10px; line-height: 1.25; white-space: nowrap; }
.timeline-item { display: grid; grid-template-columns: 54px 20px minmax(0, 1fr); gap: 8px; min-height: 82px; }
.timeline-time { padding-top: 3px; text-align: right; font-size: 0.77rem; }
.timeline-time strong, .timeline-time span { display: block; }
.timeline-time span { color: var(--muted); font-size: 0.7rem; }
.timeline-marker { position: relative; display: flex; justify-content: center; }
.timeline-marker::after { content: none; }
.timeline-marker span { z-index: 1; width: 12px; height: 12px; margin-top: 6px; border: 3px solid var(--surface); border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.timeline-card { align-self: start; margin-bottom: 9px; padding: 10px 13px; border: 1px solid rgba(23, 50, 47, 0.08); border-radius: 14px; background: var(--surface); box-shadow: 0 5px 18px rgba(18, 63, 58, 0.055); }
.timeline-card h3 { margin: 2px 0 3px; font-size: 0.96rem; }
.hotel-stay-card { min-width: 0; overflow-wrap: anywhere; }
.hotel-stay-card .timeline-role-date { margin-bottom: 0; }
.timeline-card p { margin: 2px 0; color: var(--muted); font-size: 0.79rem; }
.timeline-card .place-name { color: var(--ink); font-weight: 700; }
.map-view-shell { width: min(1080px, 100%); padding: 18px 14px 105px; }
.map-view-header { display: grid; gap: 4px; padding: 0 4px 12px; }
.map-view-header .back-link { margin-bottom: 8px; }
.map-view-header h1, .map-view-header p { margin: 0; }
.map-view-header > p { color: var(--muted); font-weight: 750; }
.map-date-strip { margin-inline: -14px; }
.map-interactive-region, .map-fallback-list, .map-unmapped-list { display: grid; gap: 12px; margin-top: 16px; }
.map-canvas { width: 100%; min-height: min(58dvh, 580px); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: #e7eee9; }
.map-view-warning, .map-load-error { margin: 14px 0 0; padding: 12px 14px; border: 1px solid #e9c67b; border-radius: 13px; background: #fff8df; color: #76591a; }
.map-selected-summary { min-height: 80px; }
.map-selected-summary > p { margin: 8px 0; color: var(--muted); text-align: center; }
.map-fallback-list > h2, .map-unmapped-list > h2 { margin-bottom: 2px; font-size: 1.15rem; }
.map-place-card { position: relative; min-width: 0; padding: 14px 14px 14px 54px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 5px 16px rgba(18,63,58,.06); }
.map-marker-number { position: absolute; top: 14px; left: 14px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50% 50% 50% 10%; background: var(--accent); color: white; font-weight: 900; }
.map-place-card-content { min-width: 0; }
.map-place-card-copy { min-width: 0; }
.map-place-thumbnail { width: 68px; height: 68px; object-fit: cover; border-radius: 12px; background: var(--sand); }
.map-place-thumbnail.is-placeholder, .timeline-place-thumbnail.is-placeholder { object-fit: contain; padding: 7px; }
.map-place-card h2, .map-place-card p { margin: 3px 0; overflow-wrap: anywhere; }
.map-place-card h2 { font-size: 1rem; }
.map-place-card p, .map-place-card small, .map-place-meta { color: var(--muted); font-size: .78rem; }
.map-place-card nav, .map-unmapped-list nav { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 9px; font-size: .82rem; font-weight: 800; }
.map-unmapped-list article { padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px dashed var(--line); border-radius: 13px; background: var(--surface); }
.map-unmapped-list strong, .map-unmapped-list small { display: block; }
.map-unmapped-list small { margin-top: 3px; color: var(--muted); }
.map-provider-marker { width: 34px; height: 34px; border: 3px solid white; border-radius: 50% 50% 50% 8px; color: white; background: var(--accent); box-shadow: 0 4px 12px rgba(54,34,40,.3); font-weight: 900; cursor: pointer; }
.map-empty-state { margin-top: 18px; }
.route-map-intro { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.route-map-intro h2, .route-map-intro p { margin: 0; }
.route-map-intro h2 { font-size: 1.05rem; }
.route-map-intro p { margin-top: 4px; color: var(--muted); font-size: .8rem; }
.daily-refresh-status { margin-top: 12px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.daily-refresh-status div { display: grid; gap: 2px; }
.daily-refresh-status span { color: var(--forest); font-weight: 800; }
.daily-refresh-status small { color: var(--muted); }
.daily-refresh-status form { margin: 0; }
.route-refresh-current { white-space: nowrap; }
.route-external-button { flex: 0 0 auto; min-height: 42px; padding: 10px 13px; display: inline-flex; align-items: center; justify-content: center; border-radius: 11px; color: white; background: var(--forest); font-size: .8rem; font-weight: 850; }
.route-stop-list { display: grid; gap: 0; margin-top: 18px; }
.route-stop-list > h2 { margin: 0 0 10px; font-size: 1.15rem; }
.route-stop-card { width: 100%; }
.route-stop-card .route-stop-card-layout { min-width: 0; display: grid; grid-template-columns: 68px minmax(0, 1fr); align-items: center; gap: 11px; }
.route-stop-card .route-stop-card-thumbnail { width: 68px; height: 68px; }
.route-stop-card .route-stop-card-main { min-width: 0; width: 100%; }
.route-stop-card .route-stop-card-address { width: auto; max-width: none; word-break: normal; overflow-wrap: break-word; }
.route-stop-card .route-stop-card-provider { display: block; min-width: 0; overflow-wrap: break-word; }
.route-stop-card .route-stop-card-actions { min-width: 0; display: flex; flex-flow: row wrap; align-items: center; gap: 12px; }
.route-stop-card .route-stop-card-actions a { display: inline-flex; white-space: nowrap; }
.route-segment-action { min-width: 0; min-height: 48px; padding: 5px 14px 5px 27px; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .78rem; font-weight: 800; }
.route-segment-action > span:first-child { color: var(--accent); font-size: 1.45rem; }
.route-segment-action a { overflow-wrap: anywhere; }
.route-segment-details { min-width: 0; display: grid; gap: 2px; }
.route-segment-details strong { color: var(--ink); font-size: .85rem; }
.route-segment-details small { color: var(--muted); font-weight: 650; }
.route-segment-details a { margin-top: 3px; }
.route-segment-action.is-unavailable > span:first-child { color: var(--muted); }
.route-daily-summary { margin-top: 12px; padding: 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; border-radius: 14px; background: var(--sand); }
.route-daily-summary span { color: var(--forest); font-weight: 900; text-align: right; }
.route-daily-summary small { grid-column: 1 / -1; color: var(--muted); }
.route-unresolved-list article { min-width: 0; justify-content: flex-start; }
.route-unresolved-list article > div { min-width: 0; flex: 1 1 auto; }
.route-unresolved-number { width: 30px; height: 30px; display: grid; flex: 0 0 30px; place-items: center; border: 1px dashed var(--muted); border-radius: 50%; color: var(--muted); font-weight: 900; }
.route-return { margin: 22px 4px 0; }
@media (max-width: 620px) {
  body.timeline-page .timeline > .section-heading { min-width: 0; padding-right: 15px; display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; }
  body.timeline-page .timeline-day-summary { min-width: 0; padding-right: 47px; }
  .timeline-day-summary h2 { max-width: 100%; font-size: clamp(1.05rem, 5vw, 1.28rem); white-space: nowrap; }
  .timeline-heading-actions { width: min(100%, 268px); justify-self: end; display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
  .timeline-heading-action { height: 40px; min-width: 50px; padding-inline: 8px; }
  .timeline-heading-action.route-map-button { min-width: 80px; }
  .route-map-intro { align-items: stretch; flex-direction: column; }
  .daily-refresh-status { align-items: stretch; flex-direction: column; }
  .route-external-button { width: 100%; }
  .route-unresolved-list article { align-items: flex-start; flex-wrap: wrap; }
  .route-unresolved-list nav { width: 100%; padding-left: 42px; }
  .route-daily-summary { grid-template-columns: 1fr; }
  .route-daily-summary span { text-align: left; }
  .route-stop-card .route-stop-card-layout { grid-template-columns: 60px minmax(0, 1fr); gap: 9px; }
  .route-stop-card .route-stop-card-thumbnail { width: 60px; height: 60px; }
}
.timeline-place-summary { min-width: 0; }
.timeline-place-summary.has-photo { margin-top: 5px; display: grid; grid-template-columns: 76px minmax(0,1fr); align-items: center; gap: 10px; }
.timeline-place-thumbnail { width: 76px; height: 58px; object-fit: cover; border-radius: 10px; background: var(--sand); }
.timeline-place-summary-text { min-width: 0; }
.timeline-card .timeline-place-rating { color: #9a5b20; font-size: .73rem; font-weight: 850; }
.timeline-card .timeline-place-address { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: .72rem; line-height: 1.35; }
.timeline-card small { display: block; margin-top: 10px; color: var(--muted); }
.timeline-card-actions { margin-top: 8px; padding-top: 8px; gap: 7px; border-top: 1px solid var(--line); }
.timeline-card-actions:not([hidden]) { display: flex; flex-wrap: wrap; justify-content: space-between; }
.timeline-primary-actions, .timeline-management-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.timeline-management-actions { margin-left: auto; justify-content: flex-end; }
.timeline-card-actions a, .timeline-card-actions button { min-height: 36px; padding: 7px 10px; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; color: var(--forest); background: var(--paper); font-size: 0.72rem; font-weight: 800; cursor: pointer; }
.timeline-card-actions form { display: inline-flex; margin: 0; }
.timeline-card-actions .action-delete { color: #973c2a; }
@media (max-width: 520px) {
  .timeline-card-actions { flex-wrap: wrap; gap: 5px; }
  .timeline-primary-actions, .timeline-management-actions { flex: 0 1 auto; flex-wrap: wrap; gap: 4px; }
  .timeline-primary-actions { min-width: 0; }
  .timeline-management-actions { justify-content: flex-end; }
  .timeline-card-actions a, .timeline-card-actions button { min-height: 38px; padding: 7px 7px; font-size: .68rem; white-space: nowrap; }
}
.timeline-card { position: relative; }
.timeline-card-content { padding-right: 58px; }
.timeline-utility-rail { position: absolute; z-index: 2; top: 62px; right: 11px; display: grid; gap: 5px; }
.timeline-expense-icon { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid #cbd8d3; border-radius: 50%; color: var(--forest); background: #f7faf8; font-size: .78rem; font-weight: 900; text-decoration: none; box-shadow: 0 2px 7px rgba(18, 63, 58, .07); }
.timeline-expense-icon:hover { border-color: var(--forest); background: var(--sand); }
.timeline-expense-icon:focus-visible { outline: 3px solid rgba(196, 91, 55, .35); outline-offset: 2px; }
.timeline-parking-icon { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; border: 1px solid #cbd8d3; border-radius: 50%; color: var(--forest); background: #f7faf8; font-size: .74rem; font-weight: 950; line-height: 1; box-shadow: 0 2px 7px rgba(18, 63, 58, .07); cursor: pointer; }

/* Travel Photo Gallery V1 */
.photo-gallery-page { overflow-x: clip; }
.photo-gallery-shell { width: min(1120px, 100%); padding: 18px 18px 118px; }
.photo-gallery-header { display: grid; gap: 7px; margin-bottom: 20px; }
.photo-gallery-header .back-link { margin-bottom: 4px; }
.photo-gallery-header h1, .photo-gallery-header p { margin: 0; }
.photo-gallery-header > p:last-of-type, .photo-gallery-header > small { color: var(--muted); }
.photo-upload-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 8px; }
.photo-upload-actions form { margin: 0; }
.photo-upload-actions label { min-height: 44px; padding: 10px 15px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; cursor: pointer; }
.photo-upload-actions .secondary-button { border: 1px solid var(--line); color: var(--forest); background: var(--surface); font-weight: 850; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.photo-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; }
.photo-tile { aspect-ratio: 1; min-width: 0; padding: 0; overflow: hidden; border: 0; border-radius: 10px; background: var(--sand); cursor: zoom-in; }
.photo-tile img { width: 100%; height: 100%; display: block; object-fit: cover; }
.photo-pagination { margin-top: 22px; display: flex; align-items: center; justify-content: center; gap: 18px; }
.photo-pagination a { min-height: 40px; padding: 8px 13px; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; font-weight: 800; }
.photo-viewer { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); border: 0; color: white; background: rgba(8, 10, 10, .97); }
.photo-viewer[open] { display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; grid-template-rows: auto minmax(0, 1fr) auto; align-items: center; }
.photo-viewer::backdrop { background: #080a0a; }
.photo-viewer-toolbar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; }
.photo-viewer-toolbar button { width: 44px; height: 44px; border: 0; border-radius: 50%; color: white; background: rgba(255,255,255,.14); font-size: 1.5rem; }
.photo-viewer figure { min-width: 0; max-height: 100%; margin: 0; display: grid; place-items: center; gap: 8px; }
.photo-viewer figure img { max-width: 100%; max-height: calc(100dvh - 150px); object-fit: contain; }
.photo-viewer figcaption { color: #d6dcda; font-size: .75rem; }
.photo-viewer-nav { width: 44px; height: 52px; border: 0; border-radius: 12px; color: white; background: rgba(255,255,255,.12); font-size: 2rem; }
.photo-delete-trigger { grid-column: 1 / -1; min-height: 42px; justify-self: center; padding: 8px 14px; border: 1px solid #c86f68; border-radius: 10px; color: #ffb5ae; background: transparent; }
.photo-delete-dialog { width: min(430px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 18px; }
.photo-delete-dialog::backdrop { background: rgba(8,10,10,.66); }
.photo-delete-panel { padding: 20px; display: grid; gap: 12px; }
.photo-delete-panel h2, .photo-delete-panel p { margin: 0; }
.photo-delete-panel div { display: flex; justify-content: flex-end; gap: 9px; }
.photo-delete-panel button { min-height: 42px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 10px; }
.photo-delete-panel .danger-button { color: white; background: #a53e34; }
@media (max-width: 840px) { .photo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 520px) {
  .photo-gallery-shell { padding-inline: 10px; }
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .photo-upload-actions > form { flex: 1 1 0; }
  .photo-upload-actions label { width: 100%; }
  .photo-viewer[open] { grid-template-columns: 40px minmax(0, 1fr) 40px; }
  .photo-viewer-nav { width: 38px; }
}
.timeline-parking-icon:hover { border-color: var(--forest); background: var(--sand); }
.timeline-parking-icon:focus-visible { outline: 3px solid rgba(196, 91, 55, .35); outline-offset: 2px; }
.timeline-parking-icon:disabled { opacity: .58; cursor: wait; }
.context-back-links { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.timeline-item.category-hotel .timeline-card { border-color: #c8dcd5; box-shadow: 0 8px 26px rgba(18, 63, 58, 0.1); }
.timeline-card .timeline-role-date { color: var(--forest); font-weight: 750; }
.parking-sheet { width: min(560px, 100%); max-height: min(82dvh, 720px); margin: auto auto 0; padding: 0; overflow: hidden; border: 0; border-radius: 22px 22px 0 0; color: var(--ink); background: transparent; box-shadow: 0 -16px 55px rgba(18,63,58,.22); }
.parking-sheet::backdrop { background: rgba(20,30,28,.52); backdrop-filter: blur(2px); }
.parking-sheet-panel { max-height: min(82dvh, 720px); padding: 16px 16px max(20px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; background: var(--paper); }
.parking-sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.parking-sheet-header h2 { margin: 2px 0 0; font-size: 1.12rem; overflow-wrap: anywhere; }
.parking-sheet-close { width: 42px; height: 42px; flex: 0 0 42px; padding: 0; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: var(--surface); font-size: 1.35rem; cursor: pointer; }
.parking-sheet-status { margin: 12px 0 8px; color: var(--muted); font-size: .8rem; font-weight: 750; }
.parking-map-region { position: relative; flex: 0 0 auto; height: clamp(180px, 25dvh, 220px); margin-top: 12px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.parking-map-canvas { width: 100%; height: 100%; }
.parking-map-canvas[hidden], .parking-map-message[hidden] { display: none; }
.parking-map-message { position: absolute; inset: 0; padding: 18px; display: grid; align-content: center; justify-items: center; gap: 9px; color: var(--muted); background: var(--surface); text-align: center; font-size: .76rem; font-weight: 750; }
.parking-map-message p { margin: 0; }
.parking-map-message button { min-height: 34px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--forest); background: var(--surface); font-size: .72rem; font-weight: 850; cursor: pointer; }
.parking-map-marker { min-width: 30px; height: 30px; padding: 0 8px; border: 2px solid white; border-radius: 999px; color: white; background: var(--forest); box-shadow: 0 3px 9px rgba(18,63,58,.3); font-size: .72rem; font-weight: 950; cursor: pointer; }
.parking-map-marker.is-target { background: var(--accent); }
.parking-result-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 9px; padding: 2px 2px 4px; }
.parking-result-card { min-width: 0; padding: 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.parking-result-card.is-map-selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(196, 91, 55, .16); }
.parking-result-card h3, .parking-result-card p { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.parking-result-name { grid-column: 1; font-size: .92rem; }
.parking-result-distance { grid-column: 1; color: var(--accent); font-size: .75rem; font-weight: 850; }
.parking-result-address, .parking-result-meta { grid-column: 1; color: var(--muted); font-size: .72rem; }
.parking-navigation-action { grid-column: 2; grid-row: 1 / span 4; align-self: center; min-height: 42px; padding: 9px 13px; display: inline-flex; align-items: center; border-radius: 10px; color: white; background: var(--forest); font-size: .78rem; font-weight: 850; }
.detour-store-shell { width: 100%; margin-inline: auto; display: grid; grid-template-columns: minmax(0, 1fr) !important; }
.detour-store-header h1 { margin-bottom: 8px; }
.detour-segment-title { min-width: 0; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; color: var(--muted); }
.detour-segment-title strong { min-width: 0; overflow-wrap: anywhere; color: var(--ink); }
.detour-search-controls { min-width: 0; padding: 16px; display: grid; gap: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.detour-map-region { min-width: 0; width: 100%; }
.detour-map-canvas { width: 100%; height: clamp(360px, 58dvh, 600px); min-height: 360px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: #e7eee9; }
.detour-map-fallback { min-height: 92px; padding: 18px; display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 16px; background: #e7eee9; }
.detour-map-fallback strong { width: 34px; height: 34px; display: grid; flex: 0 0 34px; place-items: center; border-radius: 50%; color: white; background: var(--forest); }
.detour-map-fallback span { height: 3px; flex: 1; border-radius: 999px; background: var(--muted); }
.detour-map-region > small { display: block; margin-top: 6px; color: var(--muted); }
.detour-map-marker.is-endpoint { background: var(--forest); }
.detour-map-marker.is-store { background: var(--accent); }
.detour-search-form { display: grid; gap: 14px; }
.detour-brand-list { min-width: 0; padding: 12px; display: flex; gap: 8px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 14px; }
.detour-brand-list legend { padding: 0 5px; font-weight: 850; }
.detour-brand-option { min-width: 0; min-height: 42px; padding: 7px 10px; display: flex; align-items: center; gap: 7px; border-radius: 999px; background: var(--surface); cursor: pointer; }
.detour-brand-option input { width: 20px; height: 20px; flex: 0 0 20px; }
.detour-brand-option small { color: var(--muted); }
.detour-search-submit-row { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.detour-search-submit-row > .primary-button { min-width: 112px; min-height: 44px; }
.detour-minutes-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-weight: 800; }
.detour-minutes-field input { width: 88px; min-height: 42px; padding: 8px; border: 1px solid var(--line); border-radius: 9px; }
.detour-custom-brand { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 14px; }
.detour-custom-brand summary { cursor: pointer; font-weight: 850; }
.detour-custom-brand > form { margin-top: 12px; display: grid; gap: 10px; }
.detour-custom-brand label { display: grid; gap: 4px; font-size: .75rem; font-weight: 750; }
.detour-custom-brand input { min-height: 42px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; }
.detour-custom-brand button, .detour-result-actions a, .detour-result-actions button { min-height: 40px; padding: 8px 11px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 9px; color: var(--forest); background: var(--paper); font-weight: 800; cursor: pointer; }
.detour-custom-brand-list { margin-top: 12px; display: grid; gap: 8px; }
.detour-custom-brand-list form { min-width: 0; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.detour-custom-brand-list span { margin-right: auto; overflow-wrap: anywhere; }
.detour-result-list { display: grid; gap: 12px; }
.detour-results { min-width: 0; }
.detour-result-card { position: relative; min-width: 0; padding: 14px 14px 14px 54px; display: grid; gap: 7px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.detour-result-card.is-map-selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(196, 91, 55, .16); }
.detour-result-select { position: absolute; inset: 10px auto auto 10px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--paper); cursor: pointer; }
.detour-result-select input { width: 22px; height: 22px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.detour-result-card h3, .detour-result-card p { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.detour-result-card small { color: var(--muted); font-weight: 800; }
.detour-minutes { color: var(--accent); font-size: 1rem; }
.detour-result-actions { min-width: 0; display: flex; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.detour-result-actions form { margin: 0; display: flex; }
.detour-result-actions .primary-button { color: white; background: var(--forest); }
.detour-result-actions button:disabled { opacity: .55; cursor: default; }
.detour-bulk-bar { position: sticky; bottom: 8px; z-index: 4; margin-top: 14px; padding: 12px; display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--paper) 94%, transparent); box-shadow: 0 8px 24px rgba(18, 63, 58, .12); }
.detour-bulk-bar > span { margin-right: auto; font-weight: 850; }
.detour-bulk-bar button { min-height: 42px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; }
.detour-bulk-bar .primary-button { color: white; background: var(--forest); }
.detour-bulk-bar button:disabled { opacity: .55; }
.detour-bulk-bar small { flex-basis: 100%; color: var(--muted); text-align: right; }
.detour-confirm-card { width: min(600px, 100%); margin-inline: auto; }
.detour-confirm-label { margin: 14px 0 4px; color: var(--muted); font-size: .76rem; font-weight: 850; }
.detour-confirm-route { display: flex; gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; }
.detour-threshold-warning { padding: 10px 12px; border: 1px solid #e6b777; border-radius: 10px; color: #704716; background: #fff5df; font-weight: 750; }
.timeline-card-label { display: flex; align-items: center; gap: 7px; }
.category-icon { width: 20px; height: 20px; display: inline-grid; flex: 0 0 20px; place-items: center; border-radius: 6px; color: var(--category-color, var(--forest)); background: var(--category-bg, #edf3f0); font-size: 0.64rem; font-weight: 900; }
.category-icon::before { content: "項"; }
.icon-attraction::before { content: "景"; }
.icon-hotel::before { content: "宿"; }
.icon-restaurant::before { content: "餐"; }
.icon-shopping::before { content: "購"; }
.icon-rental_car::before { content: "車"; }
.icon-flight::before { content: "航"; }
.icon-transport::before { content: "交"; }
.icon-activity::before { content: "活"; }
.icon-note::before { content: "提"; }
.icon-check_in::before { content: "集"; }
.icon-parking::before { content: "停"; }
.icon-free_time::before { content: "閒"; }
.category-hotel { --category-color: #27675f; --category-bg: #e5f1ed; }
.category-attraction { --category-color: #8a5a20; --category-bg: #f8eddc; }
.category-restaurant { --category-color: #9a4937; --category-bg: #fae9e4; }
.category-shopping { --category-color: #66518f; --category-bg: #eee9f7; }
.category-rental_car, .category-transport, .category-flight { --category-color: #376684; --category-bg: #e7f0f5; }
.category-activity { --category-color: #426d3c; --category-bg: #eaf2e7; }
.category-note { --category-color: #76652c; --category-bg: #f5f0dc; }
.category-check_in, .category-parking, .category-free_time { --category-color: #596a65; --category-bg: #edf0ef; }
.timeline-conflict { width: fit-content; margin-top: 6px !important; padding: 3px 7px; border-radius: 6px; color: #8a3522 !important; background: #fff0eb; font-weight: 800; }
.untimed-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.untimed-section > h3 { margin: 0 0 10px 82px; font-size: 0.92rem; }
.timeline-item.is-untimed .timeline-marker span { background: var(--muted); box-shadow: 0 0 0 2px var(--muted); }
.timeline-warning { margin: 0 18px 18px; padding: 14px 16px; border: 1px solid #e6b777; border-radius: 14px; color: #704716; background: #fff5df; }
.timeline-warning p { margin: 3px 0 8px; font-size: 0.78rem; }
.timeline-warning div { display: flex; flex-wrap: wrap; gap: 7px; }
.timeline-warning a { padding: 5px 8px; border-radius: 8px; background: white; font-size: 0.7rem; font-weight: 750; }
.timeline-warning .timeline-warning-action { display: inline-flex; min-height: 34px; align-items: center; }
.out-of-range-review { margin: 0 18px 22px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.out-of-range-review > p { color: var(--muted); font-size: 0.82rem; }
.out-of-range-list { display: grid; gap: 8px; }
.out-of-range-card { padding: 11px 13px; display: flex; justify-content: space-between; gap: 12px; border-left: 3px solid var(--category-color, var(--muted)); border-radius: 9px; background: var(--paper); }
.out-of-range-card h3, .out-of-range-card p { margin: 2px 0; }
.out-of-range-card p { color: var(--muted); font-size: 0.78rem; }
.out-of-range-card nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.72rem; font-weight: 800; }
.out-of-range-card nav form { margin: 0; }
.out-of-range-card nav button { padding: 0; border: 0; color: #973c2a; background: transparent; font: inherit; font-weight: inherit; cursor: pointer; }
.item-type { color: var(--accent); font-size: 0.65rem; font-weight: 800; letter-spacing: 0.11em; text-transform: uppercase; }
.timeline-category-grid { display: grid; gap: 11px; }
.timeline-category-card { min-height: 82px; padding: 15px; display: flex; align-items: center; gap: 13px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 5px 18px rgba(18, 63, 58, 0.05); }
.timeline-category-card .category-icon { width: 42px; height: 42px; flex-basis: 42px; border-radius: 12px; font-size: 0.8rem; }
.timeline-category-card h2, .timeline-category-card p { margin: 0; }
.timeline-category-card h2 { font-size: 0.98rem; }
.timeline-category-card p { margin-top: 2px; color: var(--muted); font-size: 0.76rem; }
.timeline-editor-form { padding-bottom: 24px; }
.place-parse-input-row { display: flex; gap: 8px; align-items: stretch; }
.place-parse-input-row input { flex: 1; min-width: 0; }
.place-parse-results { padding: 12px; border: 1px solid var(--line); border-radius: 14px; }
.place-parse-results > p { margin-top: 0; }
.place-parse-results [data-place-candidate-list] { display: grid; gap: 8px; }
.place-candidate-card { min-width: 0; min-height: 88px; padding: 8px; display: grid; grid-template-columns: 20px 116px minmax(0,1fr); align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--surface); cursor: pointer; transition: border-color .15s ease, background .15s ease, box-shadow .15s ease; }
.place-candidate-card:hover, .place-candidate-card:focus-within { border-color: rgba(216,107,127,.58); box-shadow: 0 4px 14px rgba(94,48,60,.08); }
.place-candidate-card.is-selected { border-color: var(--accent); background: rgba(255,235,239,.72); box-shadow: 0 0 0 2px rgba(216,107,127,.12); }
.place-candidate-card > input[type="radio"] { width: 17px; height: 17px; min-height: 0; margin: 0; padding: 0; accent-color: var(--accent); }
.place-candidate-media { position: relative; width: 116px; height: 76px; display: grid; place-items: center; overflow: hidden; border-radius: 11px; color: var(--muted); background: linear-gradient(135deg,var(--sand),#f2e5e6); font-size: .68rem; font-weight: 800; }
.place-candidate-media img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.place-candidate-placeholder { display: grid; place-items: center; width: 100%; height: 100%; }
.place-candidate-content { min-width: 0; display: grid; align-content: center; gap: 3px; }
.place-candidate-content strong { display: block; overflow-wrap: anywhere; font-size: .9rem; line-height: 1.3; }
.place-candidate-meta { color: #9a5b20; font-size: .73rem; font-weight: 800; }
.place-candidate-address { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; color: var(--muted); font-size: .7rem; line-height: 1.35; }
.place-pending-candidate { display: block; padding: 0; }
.place-candidate-choice { width: 100%; min-height: 88px; padding: 8px; display: grid; grid-template-columns: 20px 116px minmax(0,1fr); align-items: center; gap: 10px; border: 0; border-radius: inherit; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.place-candidate-radio { width: 17px; height: 17px; border: 2px solid var(--accent); border-radius: 50%; }
@media (max-width: 520px) {
  .place-candidate-card, .place-candidate-choice { grid-template-columns: 18px 88px minmax(0,1fr); gap: 8px; }
  .place-candidate-media { width: 88px; height: 70px; }
  .place-candidate-content strong { font-size: .82rem; }
  .place-candidate-meta, .place-candidate-address { font-size: .66rem; }
}
.timeline-place-enrichment-status { display: inline-block; margin-top: 6px; color: var(--muted); }
.timeline-place-enrichment-status.status-pending_confirmation { color: var(--accent-strong); font-weight: 700; }
.timeline-place-enrichment-status.status-provider_failed { color: var(--danger); }
.readonly-value { min-height: 45px; padding: 10px 12px; display: flex; align-items: center; border: 1px solid var(--line); border-radius: 11px; background: #f1f3f1; }
.timeline-time-fields { display: grid; grid-column: 1 / -1; gap: 17px; }
.timeline-range-ack { padding: 13px 15px; border: 1px solid #e6b777; border-radius: 12px; color: #704716; background: #fff5df; }
.timeline-range-ack p { margin: 3px 0 9px; font-size: 0.8rem; }
.timeline-range-ack label { display: flex; align-items: flex-start; gap: 8px; font-weight: 750; }
.trip-preparation-link { display: inline-flex; margin-top: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 0.76rem; font-weight: 800; }
.trip-preparation-progress { margin-left: 5px; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.checklist-create-form { margin-bottom: 24px; }
.checklist-template-list { margin-top: 20px; display: grid; gap: 11px; }
.checklist-template-list .record-card { display: flex; justify-content: space-between; gap: 16px; }
.checklist-template-list h2, .checklist-template-list p { margin: 2px 0; }
.checklist-editor { margin-top: 24px; display: grid; gap: 10px; }
.checklist-category { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.checklist-category > summary { min-height: 48px; padding: 11px 13px; display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; font-weight: 850; }
.checklist-category > summary small { color: var(--muted); font-size: 0.72rem; }
.checklist-category-body { padding: 0 12px 12px; display: grid; gap: 10px; }
.checklist-admin-row, .checklist-admin-row form, .checklist-add-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.checklist-admin-row { padding-top: 9px; border-top: 1px solid var(--line); }
.checklist-admin-row input, .checklist-add-row input, .checklist-items input:not([type='checkbox']) { min-width: 0; min-height: 38px; padding: 7px 9px; border: 1px solid #cbd5d0; border-radius: 8px; }
.checklist-admin-row button, .checklist-add-row button, .checklist-items button { min-height: 36px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--forest); background: var(--paper); font-weight: 750; }
.checklist-items { margin: 0; padding: 0; display: grid; gap: 6px; list-style: none; }
.checklist-items > li { min-height: 44px; padding: 5px 0; display: flex; align-items: center; justify-content: space-between; gap: 9px; border-bottom: 1px solid var(--line); }
.checklist-item-row > details > summary { color: var(--muted); cursor: pointer; font-size: 0.7rem; font-weight: 750; }
.checklist-item-row > details[open] { width: 100%; }
.checklist-item-row > details form { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.checklist-toggle label { min-height: 40px; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.checklist-toggle input { width: 20px; height: 20px; accent-color: var(--forest); }
.checklist-toggle-error { display: block; margin-top: 2px; color: #973c2a; font-size: 0.7rem; font-weight: 750; }
.checklist-toggle-error[hidden] { display: none; }
.checklist-item.is-completed .checklist-item-title,
.checklist-item-row.is-completed .checklist-item-title { color: var(--muted); text-decoration: line-through; opacity: 0.78; }
.checklist-item.is-completed .checklist-item-note,
.checklist-item-row.is-completed .checklist-item-note { color: var(--muted); opacity: 0.78; }
.danger-text { color: #973c2a !important; }
.danger-button { margin-top: 24px; padding: 10px 14px; border: 1px solid #d7a89e; border-radius: 10px; color: #973c2a; background: #fff4f1; font-weight: 800; }
.template-apply { margin-bottom: 20px; padding: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.template-apply select { min-height: 42px; padding: 8px 10px; border: 1px solid #cbd5d0; border-radius: 9px; }
.template-apply small { flex-basis: 100%; color: var(--muted); }
.timeline-checklist { margin-top: 8px; border-top: 1px solid var(--line); }
.timeline-checklist > summary { min-height: 40px; padding-top: 8px; display: flex; justify-content: space-between; cursor: pointer; color: var(--forest); font-size: 0.76rem; font-weight: 850; }
.timeline-checklist-body { display: grid; gap: 8px; }
.timeline-checklist .checklist-category > summary { min-height: 42px; padding: 8px 10px; }
.timeline-checklist .checklist-category-body { padding-inline: 9px; }
.timeline-preparation-overview { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.timeline-preparation-overview h2 { font-size: 1.1rem; }
.timeline-preparation-overview a { display: block; padding: 8px 0; font-weight: 750; }
.empty-state.compact { margin-left: 82px; padding: 26px; }
.flash-stack { margin: 0 0 18px; }
.flash { margin: 0; padding: 12px 15px; border: 1px solid #b9d6c9; border-radius: 12px; color: var(--forest); background: #edf7f1; font-size: 0.88rem; }
.flash.error { border-color: #ebbbb0; color: #8a3522; background: #fff1ed; }
.auth-shell { min-height: calc(100vh - 64px); display: grid; place-items: center; padding-block: 32px; }
.auth-card { width: min(430px, 100%); padding: 26px 22px; border: 1px solid rgba(23, 50, 47, 0.08); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.auth-card h1 { margin: 5px 0; font-size: clamp(2rem, 10vw, 3rem); letter-spacing: -0.045em; }
.auth-card > p:not(.eyebrow) { margin: 0 0 24px; color: var(--muted); }
.auth-form { display: grid; gap: 17px; }
.auth-form .primary-button { width: 100%; }
.auth-message:empty { display: none; }
.auth-message .flash { margin: 0; }
.compact-heading { margin-bottom: 24px; }
.compact-heading h1, .detail-main h1 { margin: 4px 0 7px; font-size: clamp(2rem, 7vw, 3.35rem); line-height: 1.05; letter-spacing: -0.045em; }
.action-grid, .record-list { display: grid; gap: 13px; }
.action-card { min-height: 104px; padding: 20px; display: flex; align-items: center; gap: 17px; border: 1px solid rgba(23, 50, 47, 0.08); border-radius: var(--radius); background: var(--surface); box-shadow: 0 7px 24px rgba(18, 63, 58, 0.06); }
.action-card > span { flex: 0 0 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; color: white; background: var(--forest); font-size: 1.45rem; }
.action-card h2, .action-card p { margin: 0; }
.action-card h2 { font-size: 1rem; }
.action-card p { margin-top: 3px; color: var(--muted); font-size: 0.82rem; }
.action-card.is-disabled { opacity: 0.58; box-shadow: none; }
.form-card { padding: 20px; display: grid; gap: 17px; border: 1px solid rgba(23, 50, 47, 0.08); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.field { display: grid; align-content: start; gap: 6px; }
.field label, .toolbar label { color: var(--ink); font-size: 0.78rem; font-weight: 800; }
.field label span { color: var(--muted); font-weight: 500; }
.field input, .field select, .field textarea, .toolbar select { width: 100%; min-height: 45px; padding: 10px 12px; border: 1px solid #cbd5d0; border-radius: 11px; color: var(--ink); background: white; font: inherit; }
.field textarea { resize: vertical; }
.field select[multiple] { min-height: 112px; }
.field small { color: var(--muted); font-size: 0.72rem; }
.form-actions { display: flex; align-items: center; gap: 18px; }
.primary-button { min-height: 43px; padding: 10px 16px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 12px; color: white; background: var(--forest); font-weight: 800; cursor: pointer; }
.toolbar { margin-bottom: 20px; display: flex; align-items: end; justify-content: space-between; gap: 14px; }
.toolbar form { display: grid; gap: 5px; }
.toolbar select { min-width: 155px; }
.record-card { padding: 17px; display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: center; gap: 13px; border: 1px solid rgba(23, 50, 47, 0.08); border-radius: 16px; background: var(--surface); }
.record-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: white; background: var(--forest); font-size: 1.15rem; }
.record-card h2 { margin: 2px 0; font-size: 1rem; }
.record-card p, .record-card time { margin: 0; color: var(--muted); font-size: 0.75rem; }
.record-card time { display: none; text-align: right; }
.booking-bulk-form { display: grid; gap: 13px; }
.booking-bulk-toolbar { padding: 12px 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.booking-bulk-toolbar label { display: inline-flex; align-items: center; gap: 7px; font-size: .78rem; font-weight: 800; }
.booking-bulk-toolbar input, .booking-select-control input { width: 20px; height: 20px; accent-color: var(--forest); }
.booking-bulk-toolbar [data-booking-selected-count] { color: var(--muted); font-size: .76rem; font-weight: 750; }
.booking-bulk-toolbar .primary-button { margin-left: auto; }
.booking-bulk-actions,.booking-management-actions { display:flex; flex-wrap:wrap; align-items:center; gap:10px; }
.booking-bulk-actions { margin-left:auto; }
.booking-bulk-actions .primary-button { margin-left:0; }
.booking-management-actions { position:relative; z-index:1; margin-top:12px; }
.booking-management-actions form { margin:0; }
.booking-management-actions .text-button { font:inherit; }
.booking-record-card { grid-template-columns: 24px minmax(0, 1fr); }
.booking-select-control { display: grid; place-items: center; }
.booking-record-main { min-width: 0; display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: center; gap: 13px; color: inherit; text-decoration: none; }
.booking-record-main > div { min-width: 0; }
.booking-assignment-selection { display: grid; gap: 8px; }
.booking-assignment-selection h2 { margin: 0 0 3px; font-size: 1rem; }
.booking-assignment-selection div { padding: 10px 12px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; border-radius: 10px; background: var(--paper); }
.booking-assignment-selection span { color: var(--muted); font-size: .74rem; }
.detail-layout { display: grid; gap: 20px; }
.detail-main > .eyebrow { margin-top: 3px; }
.detail-lead { color: var(--muted); }
.booking-section { margin-top: 22px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.booking-section h2 { margin: 0 0 16px; font-size: 1.05rem; }
.detail-grid { margin: 0; display: grid; gap: 14px; }
.detail-grid div { min-width: 0; }
.detail-grid dt { color: var(--muted); font-size: 0.68rem; font-weight: 750; text-transform: uppercase; }
.detail-grid dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.detail-notes { margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line); }
.detail-notes h3 { margin: 0 0 5px; font-size: 0.8rem; }
.detail-notes p { margin: 0; color: var(--muted); white-space: pre-wrap; }
.source-preview, .pdf-preview { width: 100%; margin-top: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.source-preview { max-height: 580px; object-fit: contain; }
.pdf-preview { height: min(70vh, 680px); }
.raw-text, .linked-records { margin-top: 22px; padding: 20px; border-radius: 16px; background: var(--surface); }
.raw-text h2, .linked-records h2 { margin: 0 0 10px; font-size: 1rem; }
.raw-text p { margin: 0; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.linked-records { display: grid; gap: 8px; }
.linked-records h2 { margin-bottom: 2px; }
.linked-records a { color: var(--forest); font-weight: 750; }
.source-links { gap: 12px; }
.linked-source { padding-top: 12px; display: grid; gap: 10px; border-top: 1px solid var(--line); }
.linked-source:first-of-type { padding-top: 4px; border-top: 0; }
.linked-source h3 { margin: 2px 0; font-size: 0.95rem; }
.linked-source p { margin: 0; color: var(--muted); font-size: 0.75rem; }
.source-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.source-actions a { padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); font-size: 0.75rem; }
.immutable-file { padding: 14px; display: grid; gap: 2px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.immutable-file span, .immutable-file small { color: var(--muted); font-size: 0.72rem; }
.analysis-actions { margin-top: 20px; padding-top: 18px; display: grid; gap: 10px; border-top: 1px solid rgba(255, 255, 255, 0.22); }
.analysis-actions h3 { margin: 0; font-size: 0.85rem; }
.analysis-actions form { display: grid; gap: 3px; }
.analysis-actions button, .confirm-button { min-height: 44px; padding: 9px 12px; border: 0; border-radius: 11px; color: var(--forest); background: white; font-weight: 850; cursor: pointer; }
.analysis-actions small, .review-source form small { color: #b9d0c9; font-size: 0.68rem; }
.analysis-actions details { font-size: 0.7rem; }
.analysis-actions summary { color: #b9d0c9; cursor: pointer; }
.analysis-actions details div { margin-top: 8px; display: grid; gap: 7px; }
.analysis-actions details button { min-height: 36px; color: white; background: rgba(255, 255, 255, 0.12); font-size: 0.7rem; }
.active-draft-link { min-height: 42px; padding: 9px 12px; display: grid; place-items: center; border-radius: 11px; color: var(--forest); background: white; font-size: 0.76rem; font-weight: 850; }
.review-banner { margin-bottom: 22px; padding: 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; border: 1px solid #e7c9a0; border-radius: var(--radius); background: #fff8e9; }
.review-banner h1 { margin: 4px 0 5px; font-size: clamp(1.8rem, 7vw, 3rem); line-height: 1.05; letter-spacing: -0.04em; }
.review-banner p:last-child { margin: 0; color: var(--muted); font-size: 0.85rem; }
.status-pill { flex: none; padding: 6px 9px; border-radius: 999px; color: #81551b; background: #f5dfbb; font-size: 0.68rem; font-weight: 800; text-transform: uppercase; }
.draft-error { margin: -8px 0 18px; padding: 14px 16px; border: 1px solid #ebbbb0; border-radius: 14px; color: #8a3522; background: #fff1ed; }
.draft-error p { margin: 3px 0 0; font-size: 0.8rem; }
.failed-analysis { max-width: 680px; padding: 20px; border: 1px solid #ebbbb0; border-radius: var(--radius); background: #fff1ed; }
.failed-analysis h2 { margin: 4px 0 6px; font-size: 1.25rem; }
.failed-analysis > p:not(.eyebrow) { margin: 0; color: #6f453b; font-size: 0.82rem; }
.failed-analysis dl { margin: 18px 0; display: grid; grid-template-columns: minmax(110px, 0.7fr) 1.5fr; gap: 7px 12px; font-size: 0.75rem; }
.failed-analysis dt { color: #795b53; }
.failed-analysis dd { margin: 0; overflow-wrap: anywhere; }
.failed-analysis-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.failed-analysis-actions form { display: grid; gap: 4px; }
.failed-analysis-actions .analysis-loading { color: #6f453b; }
.review-summary { margin-bottom: 20px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.review-summary div { padding: 12px 8px; display: grid; justify-items: center; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.review-summary strong { font-size: 1.25rem; }
.review-summary span { color: var(--muted); font-size: 0.65rem; }
.review-layout { display: grid; gap: 20px; }
.review-form { display: grid; gap: 18px; }
.review-section { padding: 18px; border: 1px solid rgba(23, 50, 47, 0.08); border-radius: var(--radius); background: var(--surface); }
.review-section-heading { margin-bottom: 16px; }
.review-section-heading h2 { margin: 3px 0 0; font-size: 1.15rem; }
.review-section-heading p:last-child:not(.eyebrow) { margin: 5px 0 0; color: var(--muted); font-size: 0.76rem; }
.review-section-primary { border-color: #cfded8; box-shadow: 0 8px 24px rgba(18, 63, 58, 0.045); }
.review-section-primary .review-section-heading h2 { font-size: 1.28rem; }
.review-section-secondary { background: #fbfaf6; }
.review-section-technical { border-style: dashed; background: #f2f5f3; }
.review-fields { display: grid; gap: 12px; }
.review-fields .span-full, .count-fields { grid-column: 1 / -1; }
.review-subgroup + .review-subgroup { margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--line); }
.review-subgroup h3 { margin: 0 0 10px; color: var(--muted); font-size: 0.75rem; letter-spacing: 0.04em; }
.paired-fields, .count-fields { display: grid; gap: 10px; }
.review-field { padding: 12px; display: grid; gap: 7px; border: 1px solid var(--line); border-radius: 13px; background: #fbfcfa; }
.review-field.needs-review { border-color: #e8b36f; background: #fff9ed; box-shadow: inset 3px 0 #dd8b31; }
.review-field.unresolved { border-color: #dfa99d; background: #fff5f2; box-shadow: inset 3px 0 var(--accent); }
.review-field.not-provided { border-color: #ccd8d4; background: #f3f6f4; box-shadow: inset 3px 0 #91a69f; }
.review-field.not-provided .review-label span { color: #526862; background: #dfe8e4; }
.review-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.review-label label { font-size: 0.78rem; font-weight: 800; }
.review-label span { padding: 3px 6px; border-radius: 999px; color: #8a571d; background: #f6dfba; font-size: 0.62rem; font-weight: 800; text-transform: uppercase; }
.review-field input, .review-field select, .review-field textarea { width: 100%; min-height: 46px; padding: 10px 11px; border: 1px solid #cbd5d0; border-radius: 9px; color: var(--ink); background: white; font: inherit; }
.review-field textarea { min-height: 92px; resize: vertical; }
.review-field input[readonly] { color: var(--muted); background: #eef1ee; }
.field-error { margin: 0; color: #a33725; font-size: 0.7rem; font-weight: 750; }
.field-evidence { color: var(--muted); font-size: 0.68rem; }
.field-evidence > summary { cursor: pointer; font-weight: 750; }
.field-evidence > div { margin-top: 6px; padding: 8px; border-radius: 8px; background: rgba(23, 50, 47, 0.05); }
.field-evidence p { margin: 4px 0 0; overflow-wrap: anywhere; }
.review-save { padding: 16px; display: flex; align-items: center; flex-wrap: wrap; gap: 12px; border-radius: 14px; background: var(--sand); }
.review-save span { color: var(--muted); font-size: 0.75rem; }
.review-source { padding: 20px; align-self: start; border-radius: var(--radius); color: white; background: var(--forest); }
.review-source h2 { margin: 4px 0; font-size: 1.1rem; overflow-wrap: anywhere; }
.review-source > p:not(.eyebrow) { margin: 0; color: #b9d0c9; font-size: 0.75rem; }
.review-source .source-actions { margin: 16px 0; }
.review-source .source-actions a { color: var(--forest); background: white; }
.review-source dl { margin: 18px 0; display: grid; gap: 5px; font-size: 0.7rem; }
.review-source dt { margin-top: 6px; color: #b9d0c9; }
.review-source dd { margin: 0; overflow-wrap: anywhere; }
.review-source form, .review-confirm { display: grid; gap: 6px; }
.review-document { margin: 16px -10px 0; overflow: hidden; border-radius: 13px; background: white; }
.review-document object, .review-document iframe, .review-document img { width: 100%; display: block; border: 0; background: white; }
.review-document object, .review-document iframe { height: min(55vh, 520px); }
.review-document img { max-height: 520px; object-fit: contain; }
.confirmation-ack { padding: 10px; display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 8px; border-radius: 10px; color: var(--forest); background: #fff8e9; font-size: 0.72rem; font-weight: 750; }
.confirmation-ack input { margin-top: 2px; }
.confirm-button { color: white; background: var(--accent); }
.provenance-note { margin-top: 20px; padding: 14px; display: flex; align-items: flex-start; gap: 11px; border: 1px solid #cbdad5; border-radius: 14px; background: #eef5f1; }
.provenance-note > span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; color: white; background: var(--forest); }
.provenance-note strong { font-size: 0.82rem; }
.provenance-note p { margin: 2px 0 0; color: var(--muted); font-size: 0.75rem; }
.provenance-note a { color: var(--forest); font-weight: 750; }
.metadata-card { padding: 20px; align-self: start; border-radius: var(--radius); color: white; background: var(--forest); }
.metadata-card h2 { margin: 0 0 16px; font-size: 1rem; }
.metadata-card dl { margin: 0; display: grid; grid-template-columns: 1fr 1.5fr; gap: 11px; font-size: 0.78rem; }
.metadata-card dt { color: #b9d0c9; }
.metadata-card dd { margin: 0; overflow-wrap: anywhere; }
.detail-actions { margin-top: 20px; display: flex; align-items: center; gap: 14px; }
.place-detail-content { display: grid; gap: 18px; }
.place-information-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.place-information-heading h1 { margin: 3px 0 0; font-size: clamp(1.65rem, 6vw, 2.4rem); line-height: 1.1; overflow-wrap: anywhere; }
.place-compact-actions { margin: 0; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.place-compact-actions form { margin: 0; }
.place-compact-actions a, .place-compact-actions button { min-height: 40px; padding: 8px 11px; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; font-size: .74rem; font-weight: 800; }
.place-information-intro.has-photo { display: grid; grid-template-columns: 156px minmax(0, 1fr); align-items: start; gap: 16px; margin-bottom: 18px; }
.place-information-intro.has-photo .place-information-heading { margin-bottom: 0; }
.place-detail-thumbnail { width: 156px; max-width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 16px; background: var(--sand); }
.attraction-description-card { line-height: 1.7; }
.attraction-description-heading { gap: 14px; }
.attraction-description-heading form { margin: 0 0 0 auto; }
.attraction-description-refresh { min-height: 38px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--forest); background: var(--surface); font-size: .72rem; font-weight: 800; white-space: nowrap; cursor: pointer; }
.attraction-description-job-status { width: fit-content; margin: 0 0 12px; }
.attraction-description-content { width: 100%; max-width: 70ch; margin-inline: auto; font-size: 1rem; }
.attraction-description-summary { margin: 0; font-size: 1.08rem; line-height: 1.6; font-weight: 750; color: var(--ink); }
.attraction-description-introduction { margin-top: 16px; display: grid; gap: 10px; }
.attraction-description-introduction p, .attraction-description-section p { margin: 0; }
.attraction-description-section { margin-top: 22px; }
.attraction-description-section h3 { margin: 0 0 8px; font-size: .92rem; line-height: 1.35; }
.attraction-description-highlights, .attraction-description-notes { margin: 0; display: grid; gap: 8px; }
.attraction-description-highlights { padding: 0; list-style: none; }
.attraction-description-highlights li { position: relative; padding-left: 18px; }
.attraction-description-highlights li::before { content: ""; position: absolute; left: 2px; top: .72em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); transform: translateY(-50%); }
.attraction-description-notes { padding-left: 20px; }
.attraction-description-timestamp { margin-top: 18px; display: block; color: var(--muted); }
.attraction-description-sources { margin-top: 22px; }
.attraction-description-sources summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 700; }
.attraction-description-sources ul { margin: 6px 0 0; padding-left: 20px; overflow-wrap: anywhere; }
.attraction-description-sources li + li { margin-top: 7px; }
.attraction-description-sources a { overflow-wrap: anywhere; }
.attraction-stories-card { line-height: 1.7; }
.attraction-stories-heading { margin-bottom: 14px; }
.attraction-stories-list { display: grid; gap: 22px; }
.attraction-story + .attraction-story { padding-top: 20px; border-top: 1px solid var(--line); }
.attraction-story header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; }
.attraction-story h3 { margin: 0; font-size: 1rem; line-height: 1.4; }
.attraction-story > p { margin: 9px 0 0; font-size: 1rem; line-height: 1.75; }
.attraction-story-badge { padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--surface); font-size: .7rem; font-weight: 800; white-space: nowrap; }
.attraction-story-badge.story-fact { color: var(--forest); border-color: color-mix(in srgb, var(--forest) 35%, var(--line)); }
.attraction-story-badge.story-legend { color: #8b5b20; }
.attraction-story-sources { margin-top: 9px; }
.attraction-story-sources summary { min-height: 42px; display: inline-flex; align-items: center; color: var(--forest); cursor: pointer; font-size: .78rem; font-weight: 800; }
.attraction-story-sources ul { margin: 4px 0 0; padding-left: 20px; overflow-wrap: anywhere; font-size: .78rem; }
.attraction-story-sources li + li { margin-top: 6px; }
.metadata-card .primary-button { color: var(--forest); background: white; }
.analysis-actions button:disabled { cursor: wait; opacity: 0.72; }
.analysis-loading { margin: 2px 0 0; color: white; font-size: 0.75rem; font-weight: 750; }
.analysis-wait-note { display: block; color: #b9d0c9; font-size: 0.68rem; }
.batch-preview { grid-column: 1 / -1; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--sand); }
.batch-preview h2 { margin: 0; font-size: 1rem; }
.batch-preview ol { margin: 10px 0; padding-left: 24px; }
.batch-preview p { margin: 0; color: var(--muted); font-size: 0.78rem; }
.batch-progress { margin: 18px 0; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px; }
.batch-progress div { display: grid; }
.batch-progress strong { font-size: 1.35rem; }
.batch-progress span { color: var(--muted); font-size: 0.72rem; }
.batch-progress progress { width: 100%; accent-color: var(--forest); }
.batch-items { margin-top: 24px; display: grid; gap: 12px; }
.batch-item { padding: 15px; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.batch-item.is-current { border-color: var(--accent); box-shadow: inset 3px 0 var(--accent); }
.batch-item-position { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--forest); font-weight: 800; }
.batch-item h2 { margin: 0; overflow-wrap: anywhere; font-size: 0.95rem; }
.batch-item-main > p { margin: 3px 0; color: var(--muted); font-size: 0.72rem; }
.batch-item-status { font-size: 0.76rem; font-weight: 800; }
.status-failed { color: #a33725; }
.status-needs_review { color: #a35f16; }
.batch-item-actions { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 9px; font-size: 0.75rem; }
.batch-item-actions form { display: inline-flex; align-items: center; }
.batch-complete { margin-top: 24px; padding: 20px; border-radius: var(--radius); color: white; background: var(--forest); }
.batch-complete h2 { margin: 4px 0 14px; }
.batch-complete > div, .batch-complete nav { display: flex; flex-wrap: wrap; gap: 14px; }
.batch-complete nav { margin-top: 16px; }
.batch-complete a { color: white; font-weight: 750; }
.batch-nav { margin-bottom: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.batch-context { padding: 12px 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--sand); }
.expense-form .expense-amount input { font-size: 1.35rem; font-weight: 800; }
.payment-method { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.payment-method legend { width: 100%; font-size: .78rem; font-weight: 800; }
.payment-method label { min-height: 44px; display: flex; align-items: center; gap: 6px; }
.expense-summary { margin: 20px 0; }
.expense-summary-grid, .card-management { display: grid; gap: 12px; }
.expense-summary article, .saved-card, .expense-row { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.expense-summary h3 { margin: 0 0 10px; font-size: 1.25rem; }
.expense-summary h4 { margin: 12px 0 5px; }
.expense-summary dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; font-size: .78rem; }
.expense-summary dd { margin: 0; font-variant-numeric: tabular-nums; }
.expense-row { display: grid; gap: 7px; margin-bottom: 10px; }
.expense-row h2, .expense-row p { margin: 2px 0; }
.expense-row strong { font-size: 1.05rem; }
.expense-row nav, .saved-card > div { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.expense-row nav form, .saved-card form { margin: 0; }
.saved-card.is-inactive { opacity: .62; }
.saved-card > form { display: grid; gap: 8px; }
.saved-card input, .saved-card button { min-height: 42px; }

@media (min-width: 680px) {
  .expense-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .expense-row { grid-template-columns: 120px minmax(0, 1fr) auto auto; align-items: center; }
  .page-shell { padding: 48px 28px 80px; }
  .trip-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timeline-category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .checklist-template-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-summary { grid-template-columns: repeat(4, 1fr); }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timeline-shell { width: min(960px, 100%); padding: 42px 28px 80px; }
  .map-view-shell { padding: 38px 28px 80px; }
  .map-date-strip { margin-inline: 0; }
  .map-canvas { min-height: min(68vh, 650px); }
  .trip-hero { padding-right: 66px; padding-left: 0; }
  .trip-city-card { grid-template-columns: 36px minmax(0,1fr) auto; align-items: center; }
  .trip-city-actions { grid-column: 3; justify-content: flex-end; max-width: 330px; }
  .inbox-upload { padding: 24px; }
  .inbox-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .place-library-filters { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .place-library-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .place-review-layout { grid-template-columns: minmax(0,1fr) minmax(0,1.15fr); align-items: start; }
  .place-review-source { position: sticky; top: 20px; }
  .trip-hero .back-link { margin-bottom: 20px; }
  .trip-hero h1 { font-size: clamp(2.2rem, 5vw, 3.3rem); }
  .trip-hero > p:last-child { font-size: 1rem; }
  .trip-hero-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .date-strip { top: 0; gap: 9px; padding-inline: 0; }
  .date-chip { flex-basis: 82px; padding: 9px 7px; }
  .timeline-layout { padding: 24px 0 30px; }
  .timeline-warning { margin-inline: 0; }
  .out-of-range-review { margin-inline: 0; }
  .timeline-item { grid-template-columns: 65px 24px minmax(0, 1fr); }
  .timeline-list:has(.timeline-item)::before { left: 85px; }
  .action-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .action-card { align-items: flex-start; flex-direction: column; }
  .form-card { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 28px; }
  .field.full, .form-actions { grid-column: 1 / -1; }
  .timeline-time-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .record-card { grid-template-columns: 46px minmax(0, 1fr) auto; padding: 19px; }
  .record-card time { display: block; }
  .booking-record-card { grid-template-columns: 24px minmax(0, 1fr); }
  .booking-record-main { grid-template-columns: 46px minmax(0, 1fr) auto; }
  .detail-layout { grid-template-columns: minmax(0, 1fr) 260px; gap: 32px; }
  .metadata-card { position: sticky; top: 24px; }
  .linked-source { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .review-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .paired-fields { grid-template-columns: minmax(0, 2fr) minmax(112px, 1fr); }
  .count-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .batch-item { grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; }
  .batch-item-actions { grid-column: 3; justify-content: flex-end; }
}

@media (max-width: 679px) {
  .detour-store-page { --detour-bulk-bar-mobile-height: 152px; }
  .detour-result-list { padding-bottom: calc(var(--mobile-travel-bar-height) + var(--detour-bulk-bar-mobile-height) + env(safe-area-inset-bottom) + 24px); }
  .detour-bulk-bar {
    bottom: calc(var(--mobile-travel-bar-height) + env(safe-area-inset-bottom) + 8px);
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px;
  }
  .detour-bulk-bar > span { margin-right: 0; }
  .detour-bulk-bar > .primary-button { width: 100%; grid-column: 1 / -1; }
  .detour-bulk-bar > small { grid-column: 1 / -1; text-align: left; }
  .city-manager { width: 100%; max-width: none; max-height: min(82dvh, 760px); margin: auto 0 0; border-radius: 22px 22px 0 0; }
  .city-manager-panel { max-height: min(82dvh, 760px); padding: 17px 16px max(18px, env(safe-area-inset-bottom)); }
  .city-manager::backdrop { background: rgba(35,31,31,.42); }
}

/* Mobile Travel Mode: reusable, configurable actions supplied by the view. */
.mobile-travel-bar { display: none; }
.next-stop-badge {
  display: inline-flex; margin: 0 0 8px; padding: 4px 9px; border-radius: 999px;
  color: #a23c59; background: #ffe4eb; font-size: .72rem; font-weight: 800;
}
.timeline-item.is-next-stop .timeline-card {
  border-color: #e9849d; box-shadow: 0 10px 25px rgba(182, 73, 102, .16);
}
.translator-page { overflow-x: clip; }
.translator-shell { width: min(980px, 100%); padding-bottom: 120px; }
.translator-heading { margin: 8px 0 18px; }
.translator-heading h1 { margin: 3px 0; font-size: clamp(2rem, 8vw, 3.5rem); }
.translator-heading > p:last-child { max-width: 680px; margin: 5px 0 0; color: var(--muted); }
.translator-pair-card { margin-bottom: 16px; padding: 15px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.translator-pair-card h2 { margin: 0 0 10px; font-size: 1rem; }
.translator-provider-selector { min-width: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: .76rem; font-weight: 850; }
.translator-provider-selector button { min-height: 36px; max-width: 100%; padding: 6px 10px; display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 999px; color: var(--forest); background: var(--paper); font: inherit; cursor: pointer; }
.translator-provider-selector button[aria-pressed="true"] { border-color: color-mix(in srgb, var(--accent) 52%, var(--line)); color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--paper)); }
.translator-provider-selector button:disabled { opacity: .52; cursor: not-allowed; }
.translator-provider-selector button small { font-size: .65rem; }
.translator-auto-speak { width: fit-content; max-width: 100%; margin: 0 0 12px; display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-size: .78rem; font-weight: 800; cursor: pointer; }
.translator-auto-speak input { width: 18px; height: 18px; margin: 0; flex: 0 0 auto; accent-color: var(--accent); }
.translator-pair-controls { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr); align-items: end; gap: 7px; }
.translator-pair-controls label, .translator-context { min-width: 0; display: grid; gap: 4px; color: var(--muted); font-size: .72rem; font-weight: 800; }
.translator-pair-controls select, .translator-context select { width: 100%; min-width: 0; min-height: 44px; padding: 8px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: var(--paper); }
.translator-swap { width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 50%; color: var(--forest); background: var(--paper); font-size: 1.3rem; font-weight: 900; cursor: pointer; }
.translator-presets { margin-top: 10px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.translator-presets::-webkit-scrollbar { display: none; }
.translator-presets button { min-height: 38px; padding: 7px 10px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; color: var(--forest); background: var(--paper); font-size: .72rem; font-weight: 850; cursor: pointer; }
.translator-context { width: min(210px, 100%); margin-top: 10px; }
.translator-panels { min-width: 0; display: grid; gap: 18px; }
.translator-panel { min-width: 0; padding: 18px; display: grid; justify-items: stretch; gap: 12px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.translator-panel > header h2 { margin: 3px 0 0; font-size: 1.25rem; }
.translator-microphone { width: 112px; height: 112px; margin: 2px auto; padding: 12px; display: grid; place-items: center; align-content: center; gap: 3px; border: 4px solid color-mix(in srgb, var(--forest) 30%, white); border-radius: 50%; color: white; background: var(--forest); box-shadow: 0 10px 24px color-mix(in srgb, var(--forest) 28%, transparent); cursor: pointer; }
.translator-microphone > span { font-size: 2.4rem; line-height: 1; }
.translator-microphone small { font-size: .68rem; font-weight: 850; }
.translator-panel[data-state="listening"] .translator-microphone { animation: translator-listening 1.1s ease-in-out infinite; background: var(--accent); }
.translator-microphone:disabled { opacity: .58; cursor: wait; }
.translator-cancel { min-height: 40px; justify-self: center; padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--accent); background: var(--paper); cursor: pointer; }
.translator-state, .translator-support-note, .translator-privacy-note { min-height: 1.45em; margin: 0; color: var(--muted); text-align: center; font-weight: 800; }
.translator-privacy-note { font-size: .74rem; line-height: 1.45; }
.translator-panel[data-state="error"] .translator-state { color: #a53e34; }
.translator-source-field { width: 100%; display: grid; gap: 5px; color: var(--muted); font-size: .78rem; font-weight: 850; }
.translator-source-field textarea { width: 100%; min-height: 92px; padding: 11px; resize: vertical; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--paper); font: inherit; font-size: 1rem; }
.translator-submit { width: 100%; min-height: 46px; }
.translator-result { width: 100%; padding: 14px; border-radius: 16px; background: var(--paper); }
.translator-result > p { margin: 0 0 5px; color: var(--muted); font-size: .75rem; font-weight: 850; }
.translator-result output { display: block; overflow-wrap: anywhere; font-size: clamp(1.25rem, 5vw, 1.8rem); font-weight: 850; line-height: 1.45; }
.translator-result-actions { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 7px; }
.translator-result-actions button { min-height: 42px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--forest); background: var(--surface); font-weight: 800; cursor: pointer; }
.translator-result > small { display: block; min-height: 1.2em; margin-top: 6px; color: var(--muted); }
.translator-result .translator-provider-status { color: var(--muted); font-size: .7rem; }
.translator-history { width: 100%; border-top: 1px solid var(--line); padding-top: 10px; }
.translator-history h3 { margin: 0 0 7px; font-size: .85rem; }
.translator-history ol { margin: 0; padding-left: 20px; display: grid; gap: 7px; }
.translator-history li p, .translator-history li strong { margin: 0; overflow-wrap: anywhere; font-size: .76rem; }
.translator-history li p { color: var(--muted); }
.translator-large-dialog { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); border: 0; color: var(--ink); background: var(--surface); }
.translator-large-dialog::backdrop { background: var(--surface); }
.translator-large-panel { width: 100%; height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; place-items: center; gap: 18px; }
.translator-large-panel output { max-width: 100%; overflow-wrap: anywhere; text-align: center; font-size: clamp(2.4rem, 11vw, 7rem); font-weight: 900; line-height: 1.25; }
.translator-large-panel > div { display: flex; gap: 10px; }
.translator-large-panel button { min-height: 48px; padding: 9px 16px; border: 1px solid var(--line); border-radius: 12px; color: var(--forest); background: var(--paper); font-weight: 850; }
.translator-page button:focus-visible, .translator-page select:focus-visible, .translator-page textarea:focus-visible { outline: 3px solid rgba(196, 91, 55, .35); outline-offset: 2px; }
@keyframes translator-listening { 50% { transform: scale(1.05); box-shadow: 0 0 0 12px color-mix(in srgb, var(--accent) 16%, transparent); } }
@media (min-width: 820px) { .translator-panels { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
.theme-switcher { position: relative; flex: 0 0 auto; font-size: .75rem; font-weight: 700; }
.theme-switcher > summary { min-height: 38px; padding: 8px 10px; display: flex; align-items: center; border-radius: 10px; color: var(--muted); font-size: .76rem; font-weight: 800; cursor: pointer; list-style: none; }
.theme-switcher > summary::-webkit-details-marker { display: none; }
.theme-switcher > summary::after { content: "⌄"; margin-left: 5px; }
.theme-switcher[open] > summary, .theme-switcher > summary:hover { color: var(--forest); background: var(--paper); }
.theme-switcher-panel { position: absolute; z-index: 65; top: calc(100% + 9px); right: 0; width: min(250px, calc(100vw - 24px)); padding: 8px; display: grid; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 14px 34px rgba(40,30,33,.18); }
.theme-switcher-panel p { margin: 5px 10px 3px; color: var(--muted); font-size: .66rem; font-weight: 850; letter-spacing: .08em; }
.theme-switcher-panel form { margin: 0; }
.theme-switcher-panel button, .theme-switcher-panel a { width: 100%; min-height: 42px; padding: 9px 10px; display: flex; align-items: center; gap: 8px; border: 0; border-radius: 9px; color: var(--ink); background: transparent; font-size: .78rem; font-weight: 800; text-align: left; cursor: pointer; }
.theme-switcher-panel button:hover, .theme-switcher-panel button:focus-visible, .theme-switcher-panel a:hover, .theme-switcher-panel a:focus-visible, .theme-switcher-panel .is-current { color: var(--forest); background: var(--paper); }
.theme-switcher-panel button > span, .theme-switcher-panel a > span { width: 14px; flex: 0 0 14px; color: var(--accent); visibility: hidden; }
.theme-switcher-panel button.is-current > span, .theme-switcher-panel a.is-current > span { visibility: visible; }
.theme-quick-assignment { max-width: 620px; }
.theme-quick-assignment h2 { margin-top: 0; }
.theme-quick-assignment form { display: grid; gap: 14px; }
.theme-quick-assignment .primary-button { width: max-content; }

@media (max-width: 679px) {
  body:has(.mobile-travel-bar) .page-shell { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
  .attraction-description-content { max-width: none; font-size: 1rem; line-height: 1.68; }
  .attraction-description-summary { font-size: 1.04rem; line-height: 1.58; }
  .attraction-description-section, .attraction-description-sources { margin-top: 18px; }
  .timeline-page { overflow-x: clip; }
  .trip-hero h1 { font-size: clamp(1.48rem, 6.2vw, 1.9rem); }
  .trip-hero-route { font-size: clamp(.94rem, 4.2vw, 1.12rem); font-weight: 800; }
  .timeline-item { grid-template-columns: 42px 14px minmax(0, 1fr); gap: 5px; }
  .timeline-list:has(.timeline-item)::before { left: 54px; }
  .timeline-travel-time { min-height: 28px; grid-template-columns: 42px 14px minmax(0, 1fr); gap: 5px; }
  .timeline-travel-time-label { padding: 4px 8px; font-size: .69rem; }
  .timeline-connector-row { min-height: 28px; grid-template-columns: 42px 14px minmax(0, 1fr); gap: 5px; }
  .timeline-connector-controls { gap: 5px; }
  .timeline-connector-row .timeline-segment-action a { padding: 4px 8px; font-size: .69rem; }
  .timeline-segment-action { padding-left: 56px; }
  .timeline-segment-action a { width: min(100%, 190px); }
  .detour-result-actions { justify-content: stretch; }
  .detour-result-actions a, .detour-result-actions button, .detour-result-actions form { flex: 1 1 auto; }
  .detour-result-actions form button { width: 100%; }
  .timeline-time { padding-top: 4px; font-size: .69rem; line-height: 1.15; }
  .timeline-time span { font-size: .64rem; }
  .timeline-item.is-untimed .timeline-time strong { font-size: .61rem; line-height: 1.12; }
  .timeline-marker span { width: 9px; height: 9px; margin-top: 6px; border-width: 2px; box-shadow: 0 0 0 1px var(--accent); }
  .untimed-section > h3 { margin-left: 61px; }
  .parking-sheet { max-height: 86dvh; }
  .parking-sheet-panel { max-height: 86dvh; }
  .parking-map-region { height: clamp(180px, 24dvh, 210px); }
  .mobile-travel-bar {
    position: fixed; z-index: 45; right: 0; bottom: 0; left: 0;
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: end;
    gap: 2px; padding: 7px max(8px, env(safe-area-inset-right)) max(7px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    border-top: 1px solid #f2cbd5; background: rgba(255, 250, 249, .96);
    box-shadow: 0 -8px 24px rgba(83, 48, 57, .12); backdrop-filter: blur(12px);
  }
  .mobile-travel-action, .mobile-travel-more > summary {
    display: flex; min-width: 0; min-height: 54px; padding: 5px 2px; align-items: center;
    justify-content: center; flex-direction: column; gap: 2px; border: 0; border-radius: 13px;
    color: #705b60; background: transparent; cursor: pointer; text-decoration: none;
  }
  .mobile-travel-icon { width: 27px; height: 27px; display: grid; place-items: center; overflow: hidden; border-radius: 9px; font-size: 1.15rem; font-weight: 900; line-height: 1; }
  .mobile-travel-icon img { width: 100%; height: 100%; display: block; object-fit: cover; }
  .mobile-travel-icon i { font-style: normal; }
  .mobile-travel-action small, .mobile-travel-more small { max-width: 100%; font-size: .68rem; font-weight: 800; white-space: nowrap; }
  .mobile-travel-action.is-active { color: #aa3f5d; background: #fff0f4; }
  .mobile-travel-action.is-prominent { color: #fff; background: #d95b7b; box-shadow: 0 5px 12px rgba(183, 65, 96, .26); }
  .mobile-travel-more { position: relative; min-width: 0; }
  .mobile-travel-more > summary { list-style: none; }
  .mobile-travel-more > summary::-webkit-details-marker { display: none; }
  .mobile-travel-overflow {
    position: absolute; right: 0; bottom: calc(100% + 10px); display: grid; width: min(230px, calc(100vw - 24px));
    padding: 8px; border: 1px solid #f0c8d2; border-radius: 16px; background: #fff;
    box-shadow: 0 14px 35px rgba(66, 40, 47, .2);
  }
  .mobile-travel-overflow form { margin: 0; }
  .mobile-travel-overflow a, .mobile-travel-overflow button { width: 100%; display: flex; min-height: 46px; padding: 10px 12px; align-items: center; gap: 10px; border: 0; border-radius: 10px; color: var(--theme-text, #573f45); background: transparent; font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
  .mobile-travel-overflow a:hover, .mobile-travel-overflow a:focus-visible, .mobile-travel-overflow button:hover, .mobile-travel-overflow button:focus-visible { background: color-mix(in srgb, var(--theme-primary, #d95b7b) 10%, transparent); }
  .site-header { gap: 8px; }
  .header-nav-primary { min-width: 0; margin-left: auto; gap: 1px; overflow: visible; }
  .header-nav-primary a { padding: 7px 5px; white-space: nowrap; }
  .header-more-menu > summary { padding-inline: 7px; }
  .theme-switcher > summary { min-height: 36px; padding-inline: 7px; font-size: .7rem; }
  .theme-switcher-panel { position: fixed; top: 58px; right: 8px; width: min(250px, calc(100vw - 16px)); }
  .theme-quick-assignment .primary-button { width: 100%; }
  .translator-shell { padding-inline: 12px; padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
  .place-information-heading { display: grid; }
  .place-compact-actions { justify-content: flex-start; }
  .place-information-intro.has-photo { grid-template-columns: 128px minmax(0, 1fr); gap: 12px; }
  .place-detail-thumbnail { width: 128px; border-radius: 14px; }
}

@media (min-width: 1000px) {
  .trip-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .timeline-card { padding: 12px 14px; }
}

@media (min-width: 1100px) {
  .review-shell { width: min(1500px, 100%); }
  .review-layout { grid-template-columns: minmax(0, 54fr) minmax(420px, 46fr); gap: 24px; align-items: start; }
  .review-form, .review-source { max-height: calc(100vh - 96px); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
  .review-form { padding-right: 5px; }
  .review-source { position: sticky; top: 18px; }
  .review-document { margin-inline: -10px; }
  .review-document object, .review-document iframe { height: min(62vh, 720px); }
  .review-document img { max-height: 720px; }
  .review-date-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

.update-history-shell { display: grid; gap: 18px; }
.update-history-heading { margin-bottom: 0; }
.update-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.update-counts a { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-decoration: none; display: grid; gap: 2px; }
.update-counts strong { font-size: 1.25rem; }
.update-counts span { color: var(--muted); font-size: .86rem; }
.update-history-filters { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.update-history-filters label { min-width: min(180px, 100%); flex: 1 1 180px; display: grid; gap: 5px; }
.update-history-filters label span { color: var(--muted); font-size: .82rem; }
.update-history-filters input, .update-history-filters select { width: 100%; min-width: 0; }
.update-history-sections { display: grid; gap: 22px; }
.update-history-sections > section { min-width: 0; }
.update-history-sections .section-heading { margin-bottom: 10px; }
.update-history-sections .section-heading > span { color: var(--muted); }
.update-history-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr)); gap: 12px; }
.update-history-card { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); display: grid; gap: 10px; overflow-wrap: anywhere; }
.update-history-card-heading { min-width: 0; display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.update-history-card-heading > div { min-width: 0; }
.update-history-card-heading h3 { margin: 4px 0 0; font-size: 1rem; }
.update-target-link { color: inherit; text-decoration-color: color-mix(in srgb, var(--theme-primary, var(--forest)) 45%, transparent); text-underline-offset: 3px; }
.update-target-link:hover { color: var(--theme-primary, var(--forest)); }
.update-status { flex: 0 0 auto; border-radius: 999px; padding: 4px 8px; background: var(--paper); color: var(--muted); font-size: .78rem; }
.update-status-running { color: var(--forest); }
.update-status-failure, .update-repeat-warning { color: var(--accent); }
.update-history-card dl { margin: 0; display: grid; gap: 5px; }
.update-history-card dl > div { display: grid; grid-template-columns: 5.2em minmax(0, 1fr); gap: 8px; font-size: .84rem; }
.update-history-card dt { color: var(--muted); }
.update-history-card dd { margin: 0; }
.update-history-card.is-long-term, .update-history-card.is-stale-running { border-inline-start: 4px solid var(--theme-accent, var(--accent)); }
.update-repeat-warning, .update-stale-warning { margin: 0; font-weight: 700; }
.update-stale-warning { color: var(--muted); font-size: .82rem; }
.update-safe-error { padding: 9px 10px; border-radius: 10px; background: var(--paper); }
.update-safe-error strong { font-size: .76rem; }
.update-safe-error p { margin: 3px 0 0; font-size: .86rem; }
.update-history-card form { margin: 0; }
.update-history-card-actions { display: flex; justify-content: flex-end; margin-top: 2px; }
.update-history-pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
@media (max-width: 560px) {
  .update-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .update-history-filters { align-items: stretch; }
  .update-history-filters button, .update-history-filters > a { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
}

.ai-assistant-page { color: var(--theme-text, var(--ink)); }
.ai-assistant-heading { margin-bottom: 16px; }
.ai-assistant-card,
.ai-proposal-summary,
.ai-protected-card,
.ai-action-card,
.ai-apply-panel,
.ai-proposal-state {
  min-width: 0; padding: 20px; border: 1px solid var(--theme-border, var(--line));
  border-radius: 18px; background: var(--theme-surface, var(--surface));
  box-shadow: 0 10px 30px var(--theme-shadow, rgba(67, 42, 49, .08));
}
.ai-assistant-intro h2,
.ai-proposal-summary h2,
.ai-protected-card h2,
.ai-proposal-state h2 { margin: 0 0 7px; }
.ai-assistant-intro p,
.ai-assistant-privacy,
.ai-action-rationale,
.ai-protected-card > p { color: var(--theme-muted, var(--muted)); }
.ai-assistant-form { display: grid; gap: 16px; margin-top: 18px; }
.ai-scope-options { min-width: 0; margin: 0; padding: 14px; display: flex; flex-wrap: wrap; gap: 10px 18px; border: 1px solid var(--theme-border, var(--line)); border-radius: 14px; }
.ai-scope-options legend { padding-inline: 6px; color: var(--theme-muted, var(--muted)); font-size: .82rem; font-weight: 800; }
.ai-scope-options label { display: flex; align-items: center; gap: 7px; }
.ai-scope-options input,
.ai-action-heading input,
.ai-apply-panel input { width: 20px; height: 20px; flex: 0 0 auto; accent-color: var(--theme-primary, var(--forest)); }
.ai-prompt-field textarea { width: 100%; min-width: 0; resize: vertical; }
.ai-quick-prompts { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-quick-prompts button { min-height: 38px; padding: 8px 11px; border: 1px solid var(--theme-border, var(--line)); border-radius: 999px; color: var(--theme-text, var(--ink)); background: color-mix(in srgb, var(--theme-primary, var(--forest)) 8%, var(--theme-surface, var(--surface))); cursor: pointer; }
.ai-assistant-error { padding: 11px 13px; border-radius: 12px; color: var(--danger, #a43f52); background: color-mix(in srgb, var(--danger, #a43f52) 9%, var(--theme-surface, var(--surface))); font-weight: 750; }
.ai-assistant-privacy { margin: 0; font-size: .82rem; line-height: 1.55; }
.ai-generate-button { width: max-content; min-width: 150px; }
.ai-proposal-summary,
.ai-protected-card,
.ai-action-list,
.ai-proposal-state { margin-bottom: 16px; }
.ai-provider-badge,
.ai-protected-badge { display: inline-flex; width: max-content; max-width: 100%; padding: 4px 9px; border-radius: 999px; color: var(--theme-primary, var(--forest)); background: color-mix(in srgb, var(--theme-primary, var(--forest)) 12%, var(--theme-surface, var(--surface))); font-size: .76rem; font-weight: 850; }
.ai-warning-list,
.ai-reason-list { margin-top: 14px; padding: 13px 15px; border-radius: 14px; background: var(--theme-background, var(--paper)); }
.ai-warning-list h3,
.ai-reason-list h3 { margin: 0 0 7px; font-size: .92rem; }
.ai-warning-list ul,
.ai-reason-list ul { margin: 0; padding-left: 1.2rem; }
.ai-protected-card ul { margin: 12px 0 0; padding: 0; display: grid; gap: 8px; list-style: none; }
.ai-protected-card li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--theme-background, var(--paper)); }
.ai-protected-card li span { color: var(--theme-muted, var(--muted)); font-size: .78rem; font-weight: 800; }
.ai-action-list { display: grid; gap: 12px; }
.ai-action-card { display: grid; gap: 13px; }
.ai-action-card.is-read-only { border-inline-start: 4px solid var(--theme-accent, var(--gold)); }
.ai-action-heading { min-width: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ai-action-heading label { min-width: 0; display: flex; align-items: center; gap: 9px; font-weight: 850; }
.ai-action-heading h2 { margin: 0; font-size: 1rem; }
.ai-diff-grid { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; gap: 10px; }
.ai-diff-grid > div { min-width: 0; padding: 12px; border-radius: 13px; background: var(--theme-background, var(--paper)); overflow-wrap: anywhere; }
.ai-diff-grid > span { align-self: center; color: var(--theme-primary, var(--forest)); font-weight: 900; }
.ai-diff-grid small { color: var(--theme-muted, var(--muted)); font-weight: 800; }
.ai-diff-grid p,
.ai-action-rationale { margin: 5px 0 0; line-height: 1.5; }
.ai-apply-panel { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ai-apply-panel label { min-width: 0; display: flex; align-items: center; gap: 9px; font-weight: 750; }
.ai-reject-form { display: flex; justify-content: flex-end; }
.ai-proposal-state { display: grid; gap: 14px; }
.ai-proposal-state > p,
.ai-proposal-state > div p { margin: 0; }

@media (max-width: 640px) {
  body.ai-assistant-page .page-shell {
    padding-bottom: calc(var(--mobile-travel-bar-height) + env(safe-area-inset-bottom) + 200px);
  }
  .ai-assistant-card,
  .ai-proposal-summary,
  .ai-protected-card,
  .ai-action-card,
  .ai-apply-panel,
  .ai-proposal-state { padding: 16px; }
  .ai-scope-options { display: grid; }
  .ai-quick-prompts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-quick-prompts button { width: 100%; border-radius: 12px; }
  .ai-generate-button { width: 100%; min-height: 46px; }
  .ai-action-heading,
  .ai-apply-panel { display: grid; justify-content: stretch; }
  .ai-diff-grid { grid-template-columns: minmax(0, 1fr); }
  .ai-diff-grid > span { justify-self: center; transform: rotate(90deg); }
  .ai-apply-panel .primary-button { width: 100%; min-height: 46px; }
  .ai-protected-card li { align-items: flex-start; flex-direction: column; }
}
