:root {
  color-scheme: light;
  /* Warm paper and pine ink: off-white reading surfaces, warm charcoal text,
     and one restrained green action colour. */
  --theme-background: #f7f6f2;
  --theme-ink: #1c1b18;
  --theme-muted: #5e5c56;
  --theme-accent: #1b5e4b;
  --theme-action: #1b5e4b;
  --theme-action-ink: #ffffff;
  --theme-action-hover: #144a3b;
  --theme-card: #ffffff;
  --theme-soft: #efede7;
  --theme-navigation: #fbfaf7;
  --theme-border: #d8d4ca;
  --theme-border-soft: #e6e2d8;
  --theme-field-border: #8a857b;
  --theme-selected: #e7f2ee;
  --theme-selected-ink: #124537;
  --theme-anime: var(--theme-accent);
  --theme-anime-soft: var(--theme-soft);
  --theme-raised: #ffffff;
  --theme-glass: #fffffff7;
  --theme-scrim: #141310a6;
  --theme-shadow-card: 0 1px 2px #1c1b180a;
  --theme-shadow-sheet: 0 8px 24px -12px #1c1b181f, 0 1px 3px #1c1b180d;
  --theme-shadow-overlay: 0 20px 48px #1c1b1824;
  --theme-danger: #a23b32;
  --theme-danger-surface: #fff0ed;
  --theme-warning: #77520c;
  --theme-warning-surface: #fff5df;
  --theme-info: #255b8c;
  --theme-info-surface: #eef4fd;
  --theme-success: #17613c;
  --theme-success-surface: #edf7ef;
  --ink: var(--theme-ink);
  --muted: var(--theme-muted);
  --accent: var(--theme-action);
  --paper: var(--theme-background);
  --surface: var(--theme-soft);
  --border: var(--theme-border);
  --focus: var(--theme-accent);
}
@media screen {
  :root[data-theme='dark'] {
    color-scheme: dark;
    --theme-background: #131311;
    --theme-ink: #f2f0ea;
    --theme-muted: #a3a097;
    --theme-accent: #68c1a5;
    --theme-action: #58b497;
    --theme-action-ink: #0b1f19;
    --theme-action-hover: #6ec6aa;
    --theme-card: #1c1c19;
    --theme-soft: #252521;
    --theme-navigation: #181815;
    --theme-raised: #2c2c27;
    --theme-border: #3b3a34;
    --theme-border-soft: #2d2c27;
    --theme-field-border: #6e6c64;
    --theme-selected: #1c332b;
    --theme-selected-ink: #d7f2e8;
    --theme-anime: var(--theme-accent);
    --theme-anime-soft: var(--theme-soft);
    --theme-glass: #1c1c19f5;
    --theme-scrim: #080807cc;
    --theme-shadow-card: 0 1px 2px #0000004d;
    --theme-shadow-sheet: 0 12px 28px -10px #00000080;
    --theme-shadow-overlay: 0 24px 56px #000000a6;
    --theme-danger: #ffb0a8;
    --theme-danger-surface: #40292b;
    --theme-warning: #edce8a;
    --theme-warning-surface: #393323;
    --theme-info: #a4caff;
    --theme-info-surface: #243344;
    --theme-success: #91d9ab;
    --theme-success-surface: #23392e;
  }
  :root[data-theme='dark'] .operations-sidebar nav button[aria-current='page'],
  :root[data-theme='dark'] .selection-options button[aria-pressed='true'],
  :root[data-theme='dark'] .desktop-map-modes button[aria-pressed='true'] {
    border-color: transparent;
    background: var(--theme-selected);
    color: var(--theme-selected-ink);
    box-shadow: inset 2px 0 var(--theme-accent);
    font-weight: 600;
  }
  /* Mobile tabs keep the same top indicator in both themes. */
  :root[data-theme='dark']
    .app-mobile-navigation
    :is(button, a)[aria-current='page'] {
    background: var(--theme-selected);
    color: var(--theme-selected-ink);
    box-shadow: inset 0 2px var(--theme-accent);
    font-weight: 700;
  }
  :root[data-theme='dark']
    :is(.story-board-tabs a, .story-topics a)[aria-current='page'] {
    border-color: transparent;
    background: transparent;
    color: var(--theme-ink);
    box-shadow: inset 0 -2px var(--theme-accent);
    font-weight: 600;
  }
  :root[data-theme='dark']
    :is(
      .day-picker button[aria-selected='true'],
      .itinerary-type-chips button[aria-pressed='true'],
      .trip-detail-tabs button[aria-pressed='true'],
      .record-filter-options button[aria-pressed='true'],
      .mobile-map-toolbar button[aria-pressed='true']
    ) {
    border-color: transparent;
    background: var(--theme-selected);
    color: var(--theme-selected-ink);
    box-shadow: inset 0 -2px var(--theme-accent);
    font-weight: 600;
  }
  :root[data-theme='dark'] .composer-piece-actions {
    opacity: 0.85;
  }
  :root[data-theme='dark']
    :is(
      .maplibregl-popup-content,
      .maplibregl-ctrl-group,
      .maplibregl-ctrl-attrib
    ) {
    background: var(--theme-card);
    color: var(--ink);
  }
  :root[data-theme='dark'] .maplibregl-ctrl-attrib a {
    color: var(--ink);
  }
  :root[data-theme='dark'] .maplibregl-ctrl-attrib-button {
    background-color: transparent;
    filter: invert(1);
  }
  :root[data-theme='dark'] .maplibregl-ctrl-icon {
    filter: invert(1);
  }
  :root[data-theme='dark']
    .maplibregl-popup-anchor-bottom
    .maplibregl-popup-tip {
    border-top-color: var(--theme-card);
  }
  :root[data-theme='dark'] .maplibregl-popup-anchor-top .maplibregl-popup-tip {
    border-bottom-color: var(--theme-card);
  }
}
.theme-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  color: var(--ink, #25352f);
  font: 12px var(--font-ui, sans-serif);
}
.theme-control select {
  width: auto;
  min-width: 0;
  min-height: 36px;
  max-width: 100%;
  padding: 6px;
  border: 1px solid var(--border, #d9e5de);
  border-radius: 8px;
  background: var(--theme-card, #fffefa);
  color: var(--ink, #25352f);
  font: inherit;
  cursor: pointer;
}
.theme-control select:focus-visible {
  outline: 2px solid var(--focus, #176b4b);
  outline-offset: 3px;
}
.account-appearance {
  margin: 24px 0;
  padding: 20px;
  border: 1px solid var(--border, #d9e5de);
  border-radius: 12px;
  background: var(--theme-card, #fffefa);
}
.account-appearance .theme-control {
  display: grid;
  gap: 8px;
  width: 100%;
  max-width: 320px;
  font: inherit;
}
.account-appearance .theme-control select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
}
.account-appearance p {
  font-size: 13px;
  color: var(--muted, #60756b);
}
.auth-theme {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}
@media (max-width: 900px) {
  .app-mobile-header .mobile-page-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
@media (max-width: 400px) {
  .mobile-header:has(> button) .mobile-brand > span {
    display: none;
  }
}
@media print {
  :root {
    color-scheme: light;
  }
  .theme-control,
  .auth-theme {
    display: none !important;
  }
}
