/* Family Move to Europe — Shared Styles */
/* Dark theme, responsive, information-dense dashboard */

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #21262d;
  --surface3: #2d333b;
  --border: #30363d;
  --border-light: #3d444d;
  --text: #c9d1d9;
  --text-dim: #8b949e;
  --text-bright: #f0f6fc;
  --accent: #58a6ff;
  --accent-dim: #1f3a5f;
  --green: #3fb950;
  --green-dim: #1a3a2a;
  --yellow: #d29922;
  --yellow-dim: #3d2e00;
  --red: #f85149;
  --red-dim: #4a1c1a;
  --purple: #bc8cff;
  --purple-dim: #2d1f4e;
  --orange: #d18616;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
  --nav-height: 56px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  padding-top: var(--nav-height);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ═══ Navigation ═══ */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 1000;
  gap: 8px;
}

nav .logo {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-bright);
  white-space: nowrap;
  margin-right: 16px;
}

nav .logo span { color: var(--accent); }

nav .nav-links {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex: 1;
}

nav .nav-links::-webkit-scrollbar { display: none; }

nav .nav-links a {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.15s;
}

nav .nav-links a:hover {
  color: var(--text);
  background: var(--surface2);
  text-decoration: none;
}

nav .nav-links a.active {
  color: var(--text-bright);
  background: var(--accent-dim);
}

/* Hamburger button — hidden on desktop, shown on mobile via the @media block */
nav .nav-burger {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Overflow-safe nav drawer (works at ANY width) ──
 * The inline .nav-links row scrolls when it doesn't fit, but a hidden
 * scrollbar makes overflow undiscoverable on mouse/desktop. So whenever the
 * links overflow (detected by JS at any width, see page-enhancements.js), we
 * surface the hamburger, which opens this drawer containing the COMPLETE menu.
 * That guarantees every top-level item is reachable at every width, on every
 * platform, including snapped/virtual-desktop windows. The mobile @media block
 * below reuses the same drawer for the phone layout.
 */
.nav-mobile {
  display: block;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 1100;
  transform: translateX(-100%);
  transition: transform 0.22s ease;
  visibility: hidden;
}
body.menu-open .nav-mobile { transform: translateX(0); visibility: visible; }

.nav-mobile a {
  display: block;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  border-left: 3px solid transparent;
  border-bottom: 1px solid var(--border);
}
.nav-mobile a:hover { background: var(--surface2); text-decoration: none; }
.nav-mobile a.active {
  background: var(--accent-dim);
  border-left-color: var(--accent);
  color: var(--text-bright);
}

.nav-backdrop {
  display: block;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1099;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
body.menu-open .nav-backdrop { opacity: 1; pointer-events: auto; }
:root[data-theme="light"] .nav-backdrop { background: rgba(31, 35, 40, 0.4); }
body.menu-open { overflow: hidden; }

/* Show the hamburger whenever the inline links overflow (JS-toggled). On wide
 * screens with room for all tabs, body.nav-overflow is absent and the burger
 * stays hidden. A right-edge fade hints that the row is scrollable. */
body.nav-overflow nav .nav-burger { display: flex; }
body.nav-overflow nav .nav-links {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%);
  mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%);
}

/* ═══ Page Header ═══ */
.page-header {
  padding: 32px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 4px;
}

.page-header .subtitle {
  color: var(--text-dim);
  font-size: 13px;
}

/* ═══ Layout ═══ */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 48px;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ═══ Cards ═══ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.card h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-bright);
}

.card h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 8px;
}

.card p { font-size: 13px; color: var(--text); }

.card-accent { border-left: 3px solid var(--accent); }
.card-green { border-left: 3px solid var(--green); }
.card-yellow { border-left: 3px solid var(--yellow); }
.card-red { border-left: 3px solid var(--red); }
.card-purple { border-left: 3px solid var(--purple); }

/* ═══ Badges ═══ */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  vertical-align: middle;
}

.badge-blue { background: var(--accent-dim); color: var(--accent); }
.badge-green { background: var(--green-dim); color: var(--green); }
.badge-yellow { background: var(--yellow-dim); color: var(--yellow); }
.badge-red { background: var(--red-dim); color: var(--red); }
.badge-purple { background: var(--purple-dim); color: var(--purple); }
.badge-dim { background: var(--surface2); color: var(--text-dim); }

.badge-english { background: var(--green-dim); color: var(--green); }
.badge-french { background: var(--accent-dim); color: var(--accent); }
.badge-dutch { background: var(--purple-dim); color: var(--purple); }

/* Status badges */
.status { padding: 3px 10px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.status-not-started { background: var(--surface2); color: var(--text-dim); }
.status-in-progress { background: var(--yellow-dim); color: var(--yellow); }
.status-done { background: var(--green-dim); color: var(--green); }
.status-waiting { background: var(--purple-dim); color: var(--purple); }
.status-urgent { background: var(--red-dim); color: var(--red); }
.status-sponsored { background: var(--green-dim); color: var(--green); }

/* ═══ Tooltips ═══ */
[data-tip] {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted var(--text-dim);
}

[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface3);
  color: var(--text-bright);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
  width: max-content;
  max-width: 300px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s, visibility 0.15s;
  z-index: 100;
  pointer-events: none;
}

[data-tip]:hover::after,
[data-tip].tip-open::after {
  opacity: 1;
  visibility: visible;
}

/* Long unbreakable tokens (URLs, file paths) in code spans used to widen the
   whole page on a phone: /briefs and /projects/expat-intel both scrolled
   sideways. Break them instead. */
code, kbd, samp { overflow-wrap: anywhere; }

/* ═══ Tables ═══ */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 10px 12px;
  background: var(--surface2);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tr:hover td { background: rgba(88,166,255,0.03); }

/* ═══ Countdown Chips ═══ */
.countdown-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.countdown-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  flex: 1;
  min-width: 160px;
  text-align: center;
}

.countdown-chip .count-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.countdown-chip .count-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.countdown-chip .count-unit {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.countdown-chip.urgent .count-value { color: var(--red); }
.countdown-chip.warning .count-value { color: var(--yellow); }
.countdown-chip.good .count-value { color: var(--green); }

/* ═══ Progress Bars ═══ */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.progress-fill.green { background: var(--green); }
.progress-fill.yellow { background: var(--yellow); }
.progress-fill.red { background: var(--red); }

.progress-text {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
}

/* ═══ Checklists ═══ */
.checklist-category {
  margin-bottom: 24px;
}

.checklist-category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: pointer;
  user-select: none;
}

.checklist-category-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-bright);
  margin: 0;
}

.checklist-category-header .cat-progress {
  font-size: 12px;
  color: var(--text-dim);
}

.checklist-items {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
  transition: background 0.1s;
}

.checklist-item:last-child { border-bottom: none; }
.checklist-item:hover { background: rgba(88,166,255,0.03); }
.checklist-items.collapsed { display: none; }

/* Ad-hoc item buttons */
.adhoc-add-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
  margin-left: 8px;
}
.adhoc-add-btn:hover { color: var(--accent); border-color: var(--accent); }

.adhoc-delete-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.checklist-item:hover .adhoc-delete-btn { opacity: 1; }
.adhoc-delete-btn:hover { color: var(--red); }

/* Legacy sync indicator removed: the site is online-only by design,
   so we no longer surface "Offline" / "Synced" badges — they were
   confusing on mobile when transient blips latched a badge in the
   corner. The new tasks-sync-indicator (further down) shows only
   brief "Saving… → Saved" feedback on actual user edits. */

.checklist-item input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.checklist-item.checked .item-label { color: var(--text-dim); text-decoration: line-through; }

.item-content { flex: 1; min-width: 0; }
.item-label { font-size: 13px; color: var(--text); }

.item-detail {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
  line-height: 1.4;
}

.item-tags {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

/* ═══ Collapsible Sections ═══ */
.collapsible-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}

.collapsible-header:hover { background: var(--surface2); }

.collapsible-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-bright);
}

.collapsible-header .toggle-icon {
  color: var(--text-dim);
  font-size: 14px;
  transition: transform 0.2s;
}

.collapsible-header.open .toggle-icon { transform: rotate(180deg); }
.collapsible-header.open { border-radius: var(--radius) var(--radius) 0 0; }

.collapsible-content {
  display: none;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 20px;
  background: var(--surface);
}

.collapsible-content.open { display: block; }

/* ═══ Timeline ═══ */
.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
  padding-left: 20px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface2);
  border: 2px solid var(--border);
}

.timeline-item.active::before { background: var(--accent); border-color: var(--accent); }
.timeline-item.done::before { background: var(--green); border-color: var(--green); }
.timeline-item.future::before { background: var(--surface2); border-color: var(--border); }

.timeline-date {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.timeline-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-bright);
  margin-top: 2px;
}

.timeline-desc {
  font-size: 12px;
  color: var(--text);
  margin-top: 4px;
}

/* ═══ Status Selector ═══ */
.status-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath d='M0 2l4 4 4-4' fill='none' stroke='%238b949e' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 22px;
}

/* ═══ Stat Cards ═══ */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.stat-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* ═══ City Cards ═══ */
.city-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.city-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.city-card-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-bright);
}

.city-card-body { padding: 16px 20px; }

.city-stat {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.city-stat:last-child { border-bottom: none; }
.city-stat-label { color: var(--text-dim); }
.city-stat-value { color: var(--text); font-weight: 500; text-align: right; }

/* ═══ Comparison Table ═══ */
.comparison-table th:first-child { width: 160px; }
.comparison-table td:first-child {
  font-weight: 600;
  color: var(--text-dim);
  font-size: 12px;
}

/* ═══ Info Callout ═══ */
.callout {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin: 16px 0;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.callout-info { background: var(--accent-dim); border: 1px solid rgba(88,166,255,0.2); }
.callout-warning { background: var(--yellow-dim); border: 1px solid rgba(210,153,34,0.2); }
.callout-success { background: var(--green-dim); border: 1px solid rgba(63,185,80,0.2); }
.callout-danger { background: var(--red-dim); border: 1px solid rgba(248,81,73,0.2); }

.callout-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

/* A callout is a flex ROW only when it leads with an icon. Without one its
   children are a heading and one or more paragraphs, and the flex row laid
   them out side by side and pushed the page sideways on a phone: /places
   scrolled 173px to the right. Found and fixed September 16, 2026. */
.callout:not(:has(> .callout-icon)) { display: block; }
.callout > * { min-width: 0; }

/* ═══ Section Spacing ═══ */
.section { margin-bottom: 32px; }
.section > h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.subsection { margin-bottom: 20px; }
.subsection > h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 10px;
}

/* ═══ Workstream Status ═══ */
.workstream {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.workstream-icon { font-size: 20px; flex-shrink: 0; }
.workstream-info { flex: 1; min-width: 0; }
.workstream-name { font-size: 13px; font-weight: 600; color: var(--text-bright); }
.workstream-detail { font-size: 11px; color: var(--text-dim); }

/* ═══ Split Arrival Diagram ═══ */
.split-diagram {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0;
}

.split-track {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.split-track h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.split-step {
  display: flex;
  gap: 8px;
  padding: 6px 0;
  font-size: 12px;
  color: var(--text);
  align-items: flex-start;
}

.split-step .step-marker {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface2);
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-dim);
  margin-top: 1px;
}

/* ═══ Responsive ═══ */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .split-diagram { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  /* Nav, main padding, grids, countdown-bar, page-header are all handled in
     the consolidated mobile block at the bottom of this file (max-width: 720px).
     Older duplicates were removed because they forced position:absolute on the
     mobile menu inside the fixed nav, which collapsed it to zero height. */
  .comparison-table { font-size: 11px; }
  .comparison-table th, .comparison-table td { padding: 6px 8px; }
}

/* ═══════════════════════════════════════════════════════════ */
/* ═══ NEW (April 2026 overhaul): tabs, tasks, inventory ═══ */
/* ═══════════════════════════════════════════════════════════ */

/* ── Tab strips ── */
.tab-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin: 16px 0 24px;
  scrollbar-width: none;
  position: sticky;
  top: var(--nav-height);
  background: var(--bg);
  z-index: 50;
}
.tab-strip::-webkit-scrollbar { display: none; }
.tab-strip .tab-link {
  padding: 10px 16px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.15s;
}
.tab-strip .tab-link:hover {
  color: var(--text);
  text-decoration: none;
}
.tab-strip .tab-link.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Pre-Staging planner: single-form editing ──
 * People pills and row state reflect their checkboxes live via :has(), so a
 * click shows immediately without submitting. The batch Save persists it. */
.ppl-pill {
  cursor: pointer; display: inline-flex; align-items: center;
  font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 20px;
  border: 1px solid var(--border); background: transparent; color: var(--text-dim);
  user-select: none;
}
.ppl-pill input { position: absolute; opacity: 0; width: 0; height: 0; }
.ppl-pill:has(input:checked) { background: var(--pc); border-color: var(--pc); color: #fff; }
.ptask-row.is-done .ptask-label { text-decoration: line-through; opacity: .6; }
.ptask-row:has(.ptask-del:checked) { opacity: .55; border-color: var(--red); }
.ptask-row:has(.ptask-del:checked) .ptask-label::after {
  content: " — will delete on Save"; color: var(--red); font-size: 11px; font-weight: 600;
}
/* Save button draws attention while there are unsaved edits. */
.btn-attn { box-shadow: 0 0 0 2px var(--yellow); }

/* ── Section ── */
.section { margin-bottom: 32px; }
.section h2 { font-size: 16px; font-weight: 600; color: var(--text-bright); margin-bottom: 12px; }
.section-toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.muted { color: var(--text-dim); font-size: 12px; }
.empty-state { padding: 40px; text-align: center; color: var(--text-dim); border: 1px dashed var(--border); border-radius: var(--radius); }
.callout { background: var(--surface); border-left: 3px solid var(--accent); padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }

/* ── Buttons ── */
.btn { padding: 6px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface2); color: var(--text); font-size: 12px; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--surface3); }
.btn-add { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.btn-add:hover { background: var(--accent); color: var(--bg); }
.btn-edit { color: var(--accent); }
.btn-delete { color: var(--red); }
.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 12px; padding: 2px 6px; }
.btn-link:hover { text-decoration: underline; }
.btn-link-danger { color: var(--red); }

/* ── Critical narrative ── */
.critical-narrative {
  background: linear-gradient(135deg, var(--red-dim) 0%, var(--surface) 100%);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 16px 0 24px;
}
.critical-narrative-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.critical-narrative-header h2 { font-size: 14px; font-weight: 700; color: var(--red); margin: 0; text-transform: uppercase; letter-spacing: 0.5px; }
.critical-narrative-sub { font-size: 11px; color: var(--text-dim); }
.critical-narrative-footer { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12px; }
.critical-item { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); align-items: flex-start; }
.critical-item:first-child { border-top: none; padding-top: 0; }
.critical-item-status { flex-shrink: 0; align-self: flex-start; min-width: 80px; text-align: center; }
.critical-item-body { flex: 1; min-width: 0; }
.critical-item-title { font-size: 13px; font-weight: 600; color: var(--text-bright); margin-bottom: 4px; }
.critical-item-link { color: var(--text-bright); text-decoration: none; }
.critical-item-link:hover { text-decoration: underline; color: var(--accent); }
.critical-item-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.critical-item-detail { font-size: 12px; color: var(--text); line-height: 1.5; }
.critical-item-control { flex-shrink: 0; display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.critical-item-control-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.critical-item-status-select {
  background: var(--surface);
  color: var(--text-bright);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
}
.critical-item-status-select:hover { border-color: var(--accent); }
.critical-item-status-select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.critical-empty {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 4px;
  font-size: 13px;
}
.critical-empty .muted { font-size: 12px; }
.critical-more { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12px; }
.critical-more a { color: var(--accent); }

/* ── Task list ── */
.task-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.stat-pill { padding: 6px 12px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; background: var(--surface2); color: var(--text-dim); }
.stat-overdue { background: var(--red-dim); color: var(--red); }
.stat-behind { background: var(--yellow-dim); color: var(--yellow); }
.stat-ready { background: var(--accent-dim); color: var(--accent); }
.stat-progress { background: var(--purple-dim); color: var(--purple); }
.stat-blocked { background: var(--surface3); color: var(--text-dim); }
.stat-done { background: var(--green-dim); color: var(--green); }
.stat-total { background: var(--surface); color: var(--text-bright); border: 1px solid var(--border); }

.filter-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; font-size: 12px; }
.filter-label { color: var(--text-dim); margin-right: 4px; min-width: 70px; }
.filter-chip {
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--surface2);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
}
.filter-chip:hover { background: var(--surface3); color: var(--text); text-decoration: none; }
.filter-chip.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }

.task-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  border-left-width: 3px;
}
.task-card.task-overdue { border-left-color: var(--red); }
.task-card.task-behind { border-left-color: var(--yellow); }
.task-card.task-ready { border-left-color: var(--accent); }
.task-card.task-in-progress { border-left-color: var(--purple); }
.task-card.task-blocked { border-left-color: var(--text-dim); opacity: 0.85; }
.task-card.task-done { border-left-color: var(--green); opacity: 0.6; }

.task-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.task-title { font-size: 14px; font-weight: 600; color: var(--text-bright); flex: 1; min-width: 200px; }
.task-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.task-body { font-size: 12px; color: var(--text); }
.task-meta-line { color: var(--text-dim); margin-bottom: 4px; }
.task-meta-line strong { color: var(--text); }
.task-notes { margin: 6px 0; line-height: 1.5; }
.task-url { font-size: 11px; color: var(--accent); margin-left: 6px; }
.dep-row { font-size: 11px; margin-top: 6px; }
.dep-label { color: var(--text-dim); margin-right: 4px; }
.dep-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  margin-right: 4px;
  margin-bottom: 4px;
  background: var(--surface2);
  color: var(--text-dim);
  text-decoration: none;
  border: 1px solid var(--border);
}
.dep-chip:hover { background: var(--surface3); color: var(--text); text-decoration: none; }
.dep-chip.dep-done { background: var(--green-dim); color: var(--green); border-color: var(--green); }
.dep-chip.dep-overdue { background: var(--red-dim); color: var(--red); border-color: var(--red); }
.dep-chip.dep-behind { background: var(--yellow-dim); color: var(--yellow); border-color: var(--yellow); }
.dep-chip.dep-ready { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.dep-chip.dep-blocked { opacity: 0.7; }
.dep-chip.dep-downstream { background: var(--purple-dim); color: var(--purple); border-color: var(--purple); }

.task-actions { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.task-status-select { padding: 4px 8px; background: var(--surface2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12px; }

/* ── Inventory tables ── */
.inventory-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.inventory-table th { padding: 8px 10px; text-align: left; background: var(--surface2); border-bottom: 1px solid var(--border); }
.inventory-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.inventory-table tr:hover td { background: rgba(88,166,255,0.03); }
.inventory-table tr[data-ship="ship"] td { background: rgba(63,185,80,0.05); }
.inventory-table tr[data-ship="lean-ship"] td { background: rgba(210,153,34,0.05); }
.inventory-table tr[data-ship="replace"] td { background: rgba(248,81,73,0.05); }
.inventory-table tr[data-ship="ship-sentimental"] td { background: rgba(163,113,247,0.05); }
.inventory-table tr[data-ship="ship"] td:first-child,
.inventory-table tr[data-ship="ship-sentimental"] td:first-child { border-left: 3px solid var(--green); padding-left: 7px; }
.inventory-table tr[data-ship="lean-ship"] td:first-child { border-left: 3px solid var(--yellow); padding-left: 7px; }
.inventory-table tr[data-ship="replace"] td:first-child { border-left: 3px solid var(--red); padding-left: 7px; }

/* ── Wave cards ── */
.wave-card { padding: 16px; }
.wave-stats { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0; }
.wave-stat { display: flex; flex-direction: column; }
.wave-stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); }
.wave-stat-value { font-size: 14px; font-weight: 600; color: var(--text-bright); }
.wave-stat-value.wave-good { color: var(--green); }
.wave-stat-value.wave-warn { color: var(--yellow); }
.wave-stat-value.wave-bad { color: var(--red); }
.wave-warning { background: var(--yellow-dim); color: var(--yellow); padding: 8px 12px; border-radius: var(--radius-sm); font-size: 12px; margin: 8px 0; }
.wave-config { margin-top: 8px; font-size: 12px; color: var(--text-dim); display: flex; gap: 16px; flex-wrap: wrap; }
.wave-config select, .wave-config input { background: var(--surface2); color: var(--text); border: 1px solid var(--border); padding: 4px 8px; border-radius: var(--radius-sm); margin-left: 4px; }

/* ── Dispose tiles ── */
.dispose-item { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.dispose-item:last-child { border-bottom: none; }

/* ── Vendor cards (Bulk Exodus) ── */
.vendor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.vendor-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.vendor-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.vendor-name { font-size: 14px; font-weight: 600; color: var(--text-bright); }
.vendor-rank { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); }
.vendor-badges { margin-bottom: 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.vendor-detail { font-size: 12px; margin-bottom: 4px; line-height: 1.5; }
.vendor-notes { font-size: 11px; color: var(--text-dim); margin-top: 6px; line-height: 1.4; }
.vendor-actions { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); display: flex; gap: 8px; }

/* Cost-tier badge colors (for vendor cards) */
.badge.cost-pays-user { background: var(--green-dim); color: var(--green); }
.badge.cost-free { background: var(--accent-dim); color: var(--accent); }
.badge.cost-paid-low { background: var(--yellow-dim); color: var(--yellow); }
.badge.cost-paid-high { background: var(--red-dim); color: var(--red); }

/* Badge accent */
.badge-accent { background: var(--accent-dim); color: var(--accent); }
.card-accent { border-left: 3px solid var(--accent); }

/* ── Commute cards (london.html) ── */
.commute-card { display: flex; flex-direction: column; gap: 10px; }
.commute-leg { display: flex; gap: 12px; padding: 8px 0; border-top: 1px dashed var(--border); }
.commute-leg:first-of-type { border-top: none; }
.leg-num { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-dim); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.leg-body { font-size: 13px; line-height: 1.5; }
.leg-body .muted { font-size: 11px; }
.commute-target { background: var(--accent-dim); color: var(--accent); padding: 8px 12px; border-radius: var(--radius-sm); font-size: 12px; margin-top: 6px; }
.commute-todo { background: var(--yellow-dim); color: var(--yellow); padding: 8px 12px; border-radius: var(--radius-sm); font-size: 12px; }
.commute-todo strong { color: var(--text-bright); }

/* ── Mobile tweaks for new components ── */
@media (max-width: 640px) {
  .vendor-grid { grid-template-columns: 1fr; }
  .task-header { flex-direction: column; align-items: flex-start; }
  .filter-row { flex-direction: column; align-items: flex-start; }
  .filter-label { min-width: 0; margin-bottom: 2px; }
}

/* ── Stale task indicator ── */
.task-card.task-stale {
  border-left-color: var(--purple);
  background: linear-gradient(90deg, rgba(188,140,255,0.06), var(--surface) 60%);
}
.task-meta-stale { color: var(--purple) !important; }
.task-meta-stale strong { color: var(--purple); }
.critical-stale .critical-item-status { background: var(--purple-dim); color: var(--purple); }

/* Digest controls */
.digest-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.digest-controls .btn { margin-left: auto; }

/* Tasks sync indicator (rendered by tasks.js so the user can see when
   their change has actually saved before navigating away). */
.tasks-sync-indicator {
  position: fixed;
  bottom: 16px;
  right: 16px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-dim);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  pointer-events: none;
  z-index: 800;
  transition: opacity 0.3s ease;
}
.tasks-sync-indicator[data-status="syncing"] { color: var(--yellow); border-color: var(--yellow); }
.tasks-sync-indicator[data-status="error"] { color: var(--yellow); border-color: var(--yellow); }
.tasks-sync-indicator[data-status="saved"] { color: var(--green); border-color: var(--green); }
.tasks-sync-indicator[data-status="conflict-recovered"] { color: var(--purple); border-color: var(--purple); }
/* Indicator is sticky for 'syncing' and 'error' (until the syncer settles).
   It auto-hides only for 'saved' and 'conflict-recovered' once the work
   has been confirmed on the server. See setSyncIndicator() in tasks.js. */

/* ── Media digitization (stuff.html#media) ── */
.tab-strip-inner {
  margin-top: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  /* When nested inside a page that already has a sticky outer .tab-strip,
     stick this one below it so both stay visible while scrolling. */
  top: calc(var(--nav-height) + 42px);
  z-index: 49;
}
.tab-strip-inner .tab-link { font-size: 12px; padding: 6px 12px; }

.quick-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.quick-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-dim);
}
.quick-chip strong { color: var(--text-bright); font-weight: 600; }

.batch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}
.batch-card {
  padding: 14px;
}
.batch-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  font-size: 12px;
  margin-top: 8px;
  margin-bottom: 8px;
}
.batch-meta > div { line-height: 1.5; }
.batch-tracking {
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.batch-items {
  font-size: 12px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.batch-items summary { cursor: pointer; color: var(--accent); }
.batch-items ul { margin: 6px 0 0 0; padding-left: 18px; }
.batch-items li { margin-bottom: 2px; }
.batch-notes {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-style: italic;
}

@media (max-width: 640px) {
  .batch-grid { grid-template-columns: 1fr; }
  .batch-meta { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════ */
/* ═══ Light theme override (data-theme="light" on <html>) ═══ */
/* ═══════════════════════════════════════════════════════════ */

:root[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f6f8fa;
  --surface2: #eaeef2;
  --surface3: #d0d7de;
  --border: #d0d7de;
  --border-light: #afb8c1;
  --text: #1f2328;
  --text-dim: #59636e;
  --text-bright: #0d1117;
  --accent: #0969da;
  --accent-dim: #ddf4ff;
  --green: #1a7f37;
  --green-dim: #dafbe1;
  --yellow: #9a6700;
  --yellow-dim: #fff8c5;
  --red: #d1242f;
  --red-dim: #ffebe9;
  --purple: #8250df;
  --purple-dim: #fbefff;
  --orange: #bc4c00;
  --shadow: 0 1px 3px rgba(31, 35, 40, 0.12);
  --shadow-lg: 0 4px 12px rgba(31, 35, 40, 0.15);
}

/* Light-mode-specific tweaks where the dark assumption shows through */
:root[data-theme="light"] tr:hover td { background: rgba(9, 105, 218, 0.05); }
:root[data-theme="light"] .critical-narrative {
  background: linear-gradient(135deg, #ffebe9 0%, #f6f8fa 100%);
}
:root[data-theme="light"] .task-card.task-stale {
  background: linear-gradient(90deg, rgba(130,80,223,0.08), var(--surface) 60%);
}

/* Theme toggle button in nav */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  margin-left: 8px;
  flex-shrink: 0;
  line-height: 1;
}
.theme-toggle:hover { color: var(--text-bright); background: var(--surface2); }

@media (max-width: 640px) {
  .theme-toggle { margin-left: auto; }
}

/* ═══════════════════════════════════════════════════════════ */
/* ═══ Modal (single-form edit dialogs) ═══ */
/* ═══════════════════════════════════════════════════════════ */

body.modal-open { overflow: hidden; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  z-index: 2000;
  overflow-y: auto;
  backdrop-filter: blur(2px);
}

:root[data-theme="light"] .modal-backdrop { background: rgba(31, 35, 40, 0.35); }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 640px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 80px);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-bright);
  margin: 0;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--surface2); color: var(--text-bright); }

.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-field {
  margin-bottom: 14px;
}
.modal-field:last-child { margin-bottom: 0; }
.modal-field label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: 0.2px;
}
.modal-field input[type="text"],
.modal-field input[type="number"],
.modal-field input[type="date"],
.modal-field select,
.modal-field textarea {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.4;
}
.modal-field input:focus,
.modal-field select:focus,
.modal-field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}
.modal-field textarea { resize: vertical; min-height: 60px; }
.modal-field-help {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
  line-height: 1.4;
}
.modal-field-inline { display: flex; align-items: center; gap: 8px; }
.modal-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.modal-checkbox-label input { margin: 0; }

.modal-dimensions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-dimensions input { width: 90px; }
.modal-dimensions span { color: var(--text-dim); font-size: 14px; }

.modal-multiselect {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  background: var(--bg);
}
.modal-multiselect-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}
.modal-multiselect-item input { margin: 0; flex-shrink: 0; }
.modal-multiselect-item:hover { color: var(--text-bright); }
.modal-empty { color: var(--text-dim); font-size: 12px; padding: 6px 0; }

.modal-error {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid var(--red);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-top: 8px;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .modal-backdrop { padding: 16px 8px; }
  .modal { max-height: calc(100vh - 32px); }
  .modal-dimensions { flex-wrap: wrap; }
  .modal-dimensions input { flex: 1; min-width: 60px; }
}

/* ── Settings: people warnings ── */
.person-warning {
  background: var(--yellow-dim);
  color: var(--yellow);
  border-left: 3px solid var(--yellow);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  margin-top: 6px;
}

/* ═══════════════════════════════════════════════════════════ */
/* ═══ Universal timeline widget (live, hover-detail) ═══ */
/* ═══════════════════════════════════════════════════════════ */

.timeline-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 16px 0;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}
.timeline-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.timeline-counts {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.timeline-counts .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-dim);
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.legend-done { background: var(--green); }
.legend-ready { background: var(--accent); }
.legend-progress { background: var(--purple); }
.legend-blocked { background: var(--text-dim); }
.legend-behind { background: var(--yellow); }
.legend-overdue { background: var(--red); }

.timeline-track {
  position: relative;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: visible;
  min-height: 60px;
}

.timeline-month-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 1px dashed var(--border-light);
  pointer-events: none;
}
.timeline-month-tick:first-of-type { border-left: none; }
.timeline-month-tick-end { border-left: 1px solid var(--border); }
.timeline-month-label {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg);
  padding: 0 4px;
  white-space: nowrap;
}

.timeline-today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 2px solid var(--accent);
  pointer-events: none;
  z-index: 1;
}
.timeline-today-label {
  position: absolute;
  top: 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 1px 6px;
  border-radius: 8px;
  transform: translateX(-50%);
  white-space: nowrap;
  z-index: 2;
}

.timeline-milestone {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  z-index: 3;
}
.timeline-milestone:hover { z-index: 10; }
.timeline-milestone:hover .timeline-dot {
  transform: scale(1.4);
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px currentColor;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--border);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

/* Status colors mirror status badge palette */
.timeline-status-done .timeline-dot { background: var(--green); }
.timeline-status-done { color: var(--green); }
.timeline-status-ready .timeline-dot { background: var(--accent); }
.timeline-status-ready { color: var(--accent); }
.timeline-status-in-progress .timeline-dot { background: var(--purple); }
.timeline-status-in-progress { color: var(--purple); }
.timeline-status-blocked .timeline-dot { background: var(--text-dim); }
.timeline-status-blocked { color: var(--text-dim); }
.timeline-status-behind .timeline-dot {
  background: var(--yellow);
  /* Triangle/warning visual differentiation: subtle inner ring */
  box-shadow: 0 0 0 1px var(--yellow), 0 0 0 2px var(--bg), 0 0 0 3px var(--border);
}
.timeline-status-behind { color: var(--yellow); }
.timeline-status-overdue .timeline-dot {
  background: var(--red);
  /* Pulsing for max attention */
  animation: timeline-pulse 1.6s ease-in-out infinite;
}
.timeline-status-overdue { color: var(--red); }

@keyframes timeline-pulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--red); }
  50% { box-shadow: 0 0 0 2px var(--bg), 0 0 0 6px rgba(248, 81, 73, 0.4); }
}

/* Custom rich tooltip (single floating element, positioned by JS) */
.timeline-tooltip {
  position: absolute;
  z-index: 1000;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text);
  box-shadow: var(--shadow-lg);
  max-width: 360px;
  pointer-events: none;
  line-height: 1.45;
}
.timeline-tooltip .tt-title {
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 6px;
  font-size: 13px;
}
.timeline-tooltip .tt-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.timeline-tooltip .tt-line {
  margin-top: 3px;
}
.timeline-tooltip .tt-label {
  color: var(--text-dim);
  margin-right: 4px;
}
.timeline-tooltip .tt-stale {
  color: var(--yellow);
  font-weight: 600;
}
.timeline-tooltip .tt-notes {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
}
.timeline-tooltip .tt-hint {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  color: var(--accent);
  font-size: 11px;
}

.timeline-empty .muted { font-size: 12px; }

@media (max-width: 640px) {
  .timeline-counts { font-size: 10px; gap: 8px; }
  .timeline-month-label { font-size: 9px; padding: 0 2px; }
  .timeline-tooltip { max-width: calc(100vw - 24px); }
}

/* ═══════════════════════════════════════════════════════════ */
/* ═══ MOBILE PASS — comprehensive responsive treatment ═══ */
/* ═══════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════ */
/* Mobile nav (≤720px). Industry-standard pattern, dead simple:  */
/*   - Inline desktop links (.nav-links) hidden                  */
/*   - Hamburger button (.nav-burger) shown                      */
/*   - Mobile menu (.nav-mobile) and backdrop (.nav-backdrop)    */
/*     are TOP-LEVEL siblings of <nav>, NOT children. This       */
/*     avoids position:fixed-inside-fixed quirks on iOS Safari.  */
/*   - Single class on <body> drives everything: body.menu-open  */
/* ═══════════════════════════════════════════════════════════ */
@media (max-width: 720px) {
  :root { --nav-height: 56px; }

  /* Nav bar layout */
  nav { padding: 0 12px; gap: 8px; }
  nav .logo {
    font-size: 14px;
    margin-right: 0;
    flex: 1;
    text-decoration: none;
  }

  /* Hide the inline desktop links on mobile */
  nav .nav-links { display: none; }

  /* Show the hamburger and theme toggle */
  nav .nav-burger { display: flex; }
  body.menu-open nav .nav-burger {
    background: var(--surface2);
  }
  .theme-toggle {
    width: 44px;
    height: 44px;
    font-size: 18px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Mobile menu panel: full-screen below the nav */
  .nav-mobile {
    display: block;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 1100;
    /* Hidden via translate (cheaper to animate, GPU-friendly) */
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    visibility: hidden;
  }
  body.menu-open .nav-mobile {
    transform: translateX(0);
    visibility: visible;
  }

  /* Each link inside the mobile menu */
  .nav-mobile a {
    display: block;
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    border-left: 3px solid transparent;
    border-bottom: 1px solid var(--border);
  }
  .nav-mobile a:active { background: var(--surface2); }
  .nav-mobile a.active {
    background: var(--accent-dim);
    border-left-color: var(--accent);
    color: var(--text-bright);
  }

  /* Backdrop: dim the rest of the screen, tap to close */
  .nav-backdrop {
    display: block;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1099;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }
  body.menu-open .nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  :root[data-theme="light"] .nav-backdrop { background: rgba(31, 35, 40, 0.4); }

  /* Lock body scroll while menu is open (also disable touch scroll on iOS) */
  body.menu-open {
    overflow: hidden;
    touch-action: none;
  }

  /* ─── Page header / layout ─── */
  main { padding: 0 14px 48px; }
  .page-header { padding: 24px 0 16px; margin-bottom: 16px; }
  .page-header h1 { font-size: 20px; }
  .page-header .subtitle { font-size: 12px; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; gap: 12px; }
  .countdown-bar { flex-direction: column; gap: 8px; }
  .countdown-chip { min-width: 0; }

  /* ─── Cards ─── */
  .card { padding: 14px; }

  /* ─── Tab strips: scroll smoothly, larger tap targets ─── */
  .tab-strip {
    margin: 12px -4px 16px;
    padding: 0 4px;
    -webkit-overflow-scrolling: touch;
  }
  .tab-strip .tab-link {
    padding: 12px 14px;
    font-size: 13px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* ─── Forms / inputs: prevent iOS auto-zoom on focus ─── */
  input[type="text"],
  input[type="number"],
  input[type="date"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  select,
  textarea {
    font-size: 16px !important;     /* iOS zooms on inputs <16px; force 16px on mobile */
  }

  /* ─── Modals: full-screen with safe area, scrollable ─── */
  .modal-backdrop { padding: 0; }
  .modal {
    max-width: 100%;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: none;
  }
  .modal-header {
    padding: 14px 16px;
    padding-top: max(14px, env(safe-area-inset-top));
  }
  .modal-header h2 { font-size: 17px; }
  .modal-close {
    width: 36px;
    height: 36px;
    font-size: 28px;
  }
  .modal-body {
    padding: 14px 16px;
    flex: 1;
  }
  .modal-footer {
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    background: var(--surface);
    position: sticky;
    bottom: 0;
  }
  .modal-footer .btn {
    min-height: 44px;
    padding: 10px 18px;
    font-size: 14px;
  }

  /* ─── Tables: horizontal scroll containers ───
     Every table in the page body scrolls on its own instead of widening the
     page. .card table below is the older, narrower version of this rule. */
  main table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  /* ─── Tooltips: out of the layout until tapped ───
     The tooltip box is only visibility:hidden, so it still counted toward the
     page's scroll width and gave any page with a tooltip near the right edge
     a phantom sideways scroll (/property scrolled 24px). On a phone it opens
     on tap, so keep it out of the layout until then. */
  [data-tip]::after { display: none; }
  [data-tip].tip-open::after {
    display: block;
    max-width: calc(100vw - 32px);
  }

  .inventory-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .inventory-table thead, .inventory-table tbody, .inventory-table tr { display: table; width: 100%; table-layout: auto; }
  .inventory-table tr { white-space: nowrap; }

  /* Generic tables inside cards: also scroll if too wide */
  .card table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ─── Buttons / link-buttons: larger touch targets ─── */
  .btn {
    min-height: 36px;
    padding: 8px 14px;
  }
  .btn-add {
    min-height: 40px;
  }
  .btn-link {
    padding: 8px 10px;       /* widen tap target */
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }
  .adhoc-add-btn {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }
  .checklist-item input[type="checkbox"] {
    width: 22px;
    height: 22px;
  }

  /* ─── Tasks: tighten spacing on mobile ─── */
  .task-card { padding: 12px; }
  .task-title { min-width: 0; font-size: 13px; }
  .task-status-select { min-height: 36px; }
  .filter-chip { padding: 6px 12px; font-size: 12px; }

  /* ─── Timeline widget: more compact, horizontal scroll if many milestones ─── */
  .timeline-widget { padding: 10px 12px; margin: 12px 0; }
  .timeline-track { min-height: 70px; }
  .timeline-month-label { font-size: 9px; }
  .timeline-counts { font-size: 10px; gap: 8px; }
  .timeline-tooltip {
    max-width: calc(100vw - 24px);
    font-size: 12px;
  }

  /* ─── Vendor / dispose / digest ─── */
  .vendor-grid { grid-template-columns: 1fr; }
  .vendor-card { padding: 12px; }
  .vendor-actions .btn-link { padding: 10px; min-height: 40px; }

  .digest-controls { flex-direction: column; align-items: stretch; gap: 8px; }
  .digest-controls .btn { margin-left: 0; width: 100%; }

  /* ─── Settings person cards ─── */
  .people-grid { grid-template-columns: 1fr; }
  .person-card { padding: 12px; }

  /* ─── Critical narrative (Hot items) ─── */
  .critical-narrative { padding: 12px 14px; margin: 12px 0; }
  .critical-item {
    padding: 10px 0;
    flex-wrap: wrap;
  }
  .critical-item-status { min-width: 70px; font-size: 10px; }
  .critical-item-control {
    width: 100%;
    min-width: 0;
    margin-top: 6px;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
  .critical-item-control-label { flex-shrink: 0; }
  .critical-item-status-select { flex: 1; min-height: 44px; }

  /* ─── Workstreams: stack the status select under the label ─── */
  .workstream { flex-wrap: wrap; gap: 8px; }
  .workstream .status-select { flex: 1; min-width: 140px; min-height: 40px; }

  /* ─── Filter rows: stack labels + chips ─── */
  .filter-row { gap: 6px; }
  .filter-label { font-size: 11px; min-width: 0; }
}

/* Even narrower (phones in portrait under 380px): tighten further */
@media (max-width: 380px) {
  nav .logo { font-size: 13px; }
  .timeline-counts .legend-item { font-size: 9px; }
  .page-header h1 { font-size: 18px; }
}

/* Touch device hover-state suppression: don't apply hover backgrounds on touch */
@media (hover: none) {
  .timeline-milestone:hover .timeline-dot { transform: none; box-shadow: 0 0 0 1px var(--bg), 0 0 0 2px var(--border); }
  .filter-chip:hover { background: var(--surface2); }
}

/* ═══════════════════════════════════════════════════════════ */
/* ═══ Woking town map (Leaflet) ═══ */
/* ═══════════════════════════════════════════════════════════ */

.map-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 14px;
  margin-top: 14px;
}

.woking-map {
  height: 600px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  z-index: 0; /* keep below nav */
}

.map-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 13px;
  max-height: 600px;
  overflow-y: auto;
}
.map-sidebar h3 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.map-sidebar ul { line-height: 1.6; }
.map-sidebar .legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  vertical-align: middle;
  border-radius: 3px;
}

.map-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Pin marker (used by L.divIcon) */
.map-pin-wrap { display: block; }
.map-pin {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
  font-size: 14px;
  line-height: 1;
}
.map-pin span { line-height: 1; }

/* Leaflet popup styling, theme-aware */
.leaflet-popup-content-wrapper {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}
.leaflet-popup-tip { background: var(--surface); }
.leaflet-popup-content { font-size: 12px; line-height: 1.5; margin: 10px 12px; }
.leaflet-popup-content strong { color: var(--text-bright); }
.leaflet-control-layers {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
}
.leaflet-control-layers-expanded { padding: 8px 10px !important; }
.leaflet-control-layers label { font-size: 12px; }
.leaflet-control-attribution {
  background: rgba(0, 0, 0, 0.5) !important;
  color: var(--text-dim) !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--accent) !important; }
.leaflet-control-scale-line {
  background: rgba(0, 0, 0, 0.5) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

:root[data-theme="light"] .leaflet-control-attribution { background: rgba(255,255,255,0.85) !important; color: var(--text-dim) !important; }
:root[data-theme="light"] .leaflet-control-scale-line { background: rgba(255,255,255,0.85) !important; color: var(--text) !important; }

/* Mobile: stack sidebar under map, shorter map */
@media (max-width: 720px) {
  .map-grid { grid-template-columns: 1fr; }
  .woking-map { height: 420px; }
  .map-sidebar { max-height: none; }
  .leaflet-control-layers-expanded { font-size: 13px; padding: 10px 12px !important; }
}

/* ── Live-sync indicator (in nav) ── */
/*
 * Always shows an explicit status word + icon. NEVER just an undifferentiated
 * dot — Richard reported the previous version was unreadable on mobile.
 * Color background per state for instant visual recognition.
 */
.live-sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 0.5px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 4px;
  line-height: 1;
  min-height: 26px;
}
.live-sync-indicator:hover { filter: brightness(1.1); }
.live-sync-indicator .sync-icon { font-size: 12px; line-height: 1; }
.live-sync-indicator .sync-label { font-size: 10px; }
.live-sync-indicator .sync-icon.spin { animation: live-sync-spin 1s linear infinite; display: inline-block; }
@keyframes live-sync-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

.live-sync-indicator[data-state="live"]    { background: rgba(63,185,80,0.18);  border-color: var(--green);  color: var(--green); }
.live-sync-indicator[data-state="syncing"] { background: rgba(88,166,255,0.18); border-color: var(--accent); color: var(--accent); }
.live-sync-indicator[data-state="stale"]   { background: rgba(210,153,34,0.22); border-color: var(--yellow); color: var(--yellow); }
.live-sync-indicator[data-state="error"]   { background: rgba(248,81,73,0.20);  border-color: var(--red);    color: var(--red); }
.live-sync-indicator[data-state="offline"] { background: rgba(248,81,73,0.20);  border-color: var(--red);    color: var(--red); text-decoration: line-through; }
.live-sync-indicator[data-state="pending"] { background: var(--surface2);       border-color: var(--border); color: var(--text-dim); }

/* Mobile: keep the label visible — DON'T hide it. Just shrink padding. */
@media (max-width: 720px) {
  .live-sync-indicator {
    padding: 4px 8px;
    min-height: 30px;
    font-size: 10px;
  }
  .live-sync-indicator .sync-label { font-size: 10px; }
  .live-sync-indicator .sync-icon { font-size: 11px; }
}

/* ── Sync diagnostic sheet ── */
.sync-diag-sheet {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 16px 16px;
  z-index: 3000;
  overflow-y: auto;
  backdrop-filter: blur(2px);
}
:root[data-theme="light"] .sync-diag-sheet { background: rgba(31, 35, 40, 0.4); }
.sync-diag-panel {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.sync-diag-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.sync-diag-header h2 { font-size: 14px; font-weight: 700; color: var(--text-bright); margin: 0; text-transform: uppercase; letter-spacing: 0.5px; }
.sync-diag-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  line-height: 1;
}
.sync-diag-close:hover { background: var(--surface2); color: var(--text-bright); }
.sync-diag-content { padding: 16px 18px; }
.sync-diag-overall { padding-bottom: 14px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.sync-diag-state { font-size: 18px; font-weight: 700; letter-spacing: 1px; margin-bottom: 8px; }
.sync-diag-meta { font-size: 12px; line-height: 1.6; color: var(--text); }
.sync-diag-meta strong { color: var(--text-bright); }
.sync-diag-content h3 { font-size: 11px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin: 12px 0 6px; }
.sync-diag-channels { display: flex; flex-direction: column; gap: 6px; }
.sync-diag-row {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.sync-diag-row-name { font-size: 13px; font-weight: 600; color: var(--text-bright); }
.sync-diag-row-meta { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.sync-diag-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.sync-diag-actions .btn { width: 100%; min-height: 40px; }
.sync-diag-footer { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 11px; line-height: 1.5; }
.sync-diag-footer code { font-size: 10px; background: var(--surface2); padding: 1px 4px; border-radius: 3px; word-break: break-all; }

@media (max-width: 720px) {
  .sync-diag-sheet { padding: 60px 8px 8px; }
}

/* ── Sync diag — find-an-item search ── */
.sync-diag-content #sync-diag-search {
  width: 100%;
  font-size: 16px; /* prevents iOS zoom-on-focus */
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.sync-diag-content #sync-diag-search:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}
.sync-diag-search-results {
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 12px;
}
.sync-diag-result {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 12px;
}
.sync-diag-result summary {
  padding: 8px 10px;
  cursor: pointer;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.sync-diag-result summary::-webkit-details-marker { display: none; }
.sync-diag-result summary:hover { background: var(--surface2); }
.sync-diag-result[open] summary { border-bottom: 1px solid var(--border); }
.sync-diag-result pre {
  padding: 8px 10px;
  margin: 0;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 280px;
  overflow-y: auto;
}

.sync-diag-test-result {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 32px;
}
.sync-diag-test-result:empty { display: none; }

.sync-diag-host {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

/* ── Auth-expired recovery banner (Cloudflare Access SSO timeout) ── */
.auth-expired-banner {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  z-index: 1500;
  background: var(--yellow-dim);
  color: var(--text-bright);
  border-bottom: 2px solid var(--yellow);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  line-height: 1.4;
}
.auth-expired-text { flex: 1; min-width: 200px; }
.auth-expired-text strong {
  color: var(--yellow);
  font-weight: 700;
  margin-right: 6px;
}
.auth-expired-text span { color: var(--text); }
.auth-expired-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.auth-expired-actions .btn-add {
  background: var(--yellow);
  color: #1f1500;
  border-color: var(--yellow);
}
.auth-expired-actions .btn-add:hover {
  background: var(--yellow);
  color: #000;
  filter: brightness(1.1);
}

@media (max-width: 720px) {
  .auth-expired-banner { padding: 12px; font-size: 12px; }
  .auth-expired-actions { width: 100%; }
  .auth-expired-actions .btn,
  .auth-expired-actions .btn-add { flex: 1; min-height: 40px; }
}

/* ═══════════════════════════════════════════════════════════ */
/* ═══ Usability pass (August 2026): responsive SSR layouts,   */
/* ═══ scrollable tab strips, tap tooltips, map overlay ═══    */
/* ═══════════════════════════════════════════════════════════ */

/* Two-panel page shells (/properties, /property): side-by-side on wide
   screens, single column on phones. Replaces the inline
   grid-template-columns that forced a 740px+ minimum width. */
.split-shell {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(420px, 2fr);
  gap: 18px;
}

/* Hero-photo-plus-facts split (featured property panel, property detail
   overview). Gap varies per use and stays inline. */
.split-hero {
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) minmax(320px, 1fr);
}

/* Fixed-count form rows inside edit dialogs. Inputs render at their
   default intrinsic width (.form-row is unstyled), so these grids cannot
   shrink below ~185px per column; they must stack on narrow screens. */
.form-row-2   { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.form-row-3   { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.form-row-4   { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 10px; }
.form-row-log { display: grid; grid-template-columns: 140px 1fr auto; gap: 8px; align-items: end; }

/* Auto-fitting card/fact grids. Column minimum set per use via
   --auto-grid-min; gap varies per use and stays inline where needed. */
.auto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--auto-grid-min, 220px), 1fr));
  gap: 12px;
}
.auto-grid-fill {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--auto-grid-min, 110px), 1fr));
  gap: 6px 12px;
}

/* Key/value definition grid (term groups on the property detail page). */
.kv-grid { display: grid; grid-template-columns: max-content 1fr; gap: 4px 10px; }

@media (max-width: 760px) {
  .split-shell,
  .split-hero { grid-template-columns: 1fr; }
  .form-row-4 { grid-template-columns: 1fr 1fr; }

  /* Tab strips scroll horizontally on phones instead of wrapping into
     4-5 rows that stack under the sticky nav. The right-edge fade is the
     only hint that there is more to the right, since the scrollbar is
     hidden; the nav bar uses the same trick. */
  .tab-strip {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent 100%);
    mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent 100%);
  }
}

@media (max-width: 560px) {
  .form-row-2,
  .form-row-2-1,
  .form-row-3,
  .form-row-4,
  .form-row-log { grid-template-columns: 1fr; }
}

/* ── Tap-to-interact overlay for the /properties Leaflet map ──
   isolation: isolate contains Leaflet's internal z-indexes (panes and
   controls run up to 1000) inside the shell, so neither they nor the
   overlay can paint over the fixed nav (z-index 1000). */
.properties-map-shell { isolation: isolate; }
.map-touch-overlay {
  position: absolute;
  inset: 0;
  z-index: 1001;             /* above Leaflet controls, contained by the shell */
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 17, 23, 0.25);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.map-touch-overlay span {
  background: rgba(13, 17, 23, 0.82);
  color: #e1e4ed;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}


/* ── Site tree ("All pages" dropdown, mobile drawer, /sitemap) ─────────── */
nav .site-tree-menu { position: relative; flex-shrink: 0; }
nav .site-tree-menu > summary {
  list-style: none; cursor: pointer; user-select: none;
  padding: 6px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  color: var(--text-dim); font-size: 12px; font-weight: 500; white-space: nowrap;
}
nav .site-tree-menu > summary::-webkit-details-marker { display: none; }
nav .site-tree-menu > summary:hover, nav .site-tree-menu[open] > summary { color: var(--text-bright); background: var(--surface2); }
nav .site-tree-menu .st-caret { font-size: 10px; margin-left: 2px; }
nav .site-tree-panel {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - var(--nav-height, 60px) - 24px);
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0,0,0,0.45); padding: 10px 12px 12px; z-index: 1200;
}
.st-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--text); padding: 2px 4px 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.st-head a { font-size: 11px; color: var(--accent); }
.site-tree { font-size: 12.5px; line-height: 1.45; }
.site-tree details > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 4px 4px; border-radius: var(--radius-sm); }
.site-tree details > summary::-webkit-details-marker { display: none; }
.site-tree details > summary::before { content: '▸'; font-size: 10px; color: var(--text-dim); width: 10px; flex-shrink: 0; transition: transform 0.12s; }
.site-tree details[open] > summary::before { transform: rotate(90deg); }
.site-tree details > summary:hover { background: var(--surface2); }
.site-tree .st-section > summary { font-weight: 700; color: var(--text-bright); font-size: 13px; }
.site-tree .st-section > summary a { color: inherit; }
.site-tree ul { list-style: none; margin: 0; padding: 0 0 4px 16px; }
.site-tree .st-page { padding: 2px 0; }
.site-tree .st-page > a, .site-tree .st-page summary a { color: var(--text); font-weight: 500; }
.site-tree .st-page > a:hover, .site-tree .st-page summary a:hover { color: var(--accent); text-decoration: none; }
.site-tree .st-note { color: var(--text-dim); font-size: 11px; margin-left: 4px; }
.site-tree .st-subs { padding-left: 18px; }
.site-tree .st-subs li { padding: 1px 0; }
.site-tree .st-subs a { color: var(--text-dim); font-size: 12px; }
.site-tree .st-subs a:hover { color: var(--accent); }
.site-tree a.st-current { color: var(--accent); font-weight: 700; }
.sitemap-page .site-tree { columns: 2; column-gap: 32px; }
.sitemap-page .site-tree .st-section { break-inside: avoid; margin-bottom: 8px; }
.nav-mobile-tree { padding: 8px 12px 24px; border-top: 1px solid var(--border); }
.nav-mobile-tree .site-tree { font-size: 14px; }
.nav-mobile-tree .site-tree .st-subs a { font-size: 13px; }
@media (max-width: 720px) {
  nav .site-tree-menu { display: none; }

  /* The full site tree lives in the drawer on a phone, so its rows have to be
     thumb-sized, not mouse-sized. */
  .nav-mobile-tree .site-tree details > summary,
  .nav-mobile-tree .site-tree .st-page > a,
  .nav-mobile-tree .site-tree .st-subs a {
    display: flex;
    align-items: center;
    min-height: 36px;
  }
}
@media (max-width: 900px) {
  .sitemap-page .site-tree { columns: 1; }
}
