:root {
  --primary: #0077b6;
  --primary-hover: #023e8a;
  --primary-glow: rgba(0, 119, 182, 0.4);
  --accent: #00b4d8;
  --accent-cyan: #48cae4;
  --bg-dark: #0f172a;
  --bg-panel: #0f172a;
  --bg-card: rgba(15, 23, 42, 0.88);
  --bg-surface: #1e293b;
  --bg-surface-elevated: #283548;
  --bg-hover: #334155;
  --surface-card: rgba(30, 41, 59, 0.45);
  --surface-sunken: rgba(15, 23, 42, 0.35);
  --text-main: #f8fafc;
  --text-primary: #f8fafc;
  --text-bright: #ffffff;
  --text-dark: #0f172a;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --border-subtle: rgba(255, 255, 255, 0.12);
  --border-main: rgba(255, 255, 255, 0.22);
  --border-active: rgba(0, 180, 216, 0.5);
  
  /* Depth palette - Bathymetric Blue/Navy/Violet Gradient */
  --depth-shallow: #38bdf8;  /* < 18m Coastal Azure */
  --depth-mid: #0284c7;      /* 18-30m Marine Blue */
  --depth-deep: #1e40af;     /* 30-45m Deep Ocean Navy */
  --depth-tech: #6d28d9;     /* > 45m Technical Violet */
  --depth-unknown: #94a3b8;
  
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

[data-theme="light"] {
  --bg-dark: #f8fafc;
  --bg-panel: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.96);
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-hover: #f1f5f9;
  --surface-card: #f8fafc;
  --surface-sunken: #f1f5f9;
  --text-main: #0f172a;
  --text-primary: #0f172a;
  --text-bright: #0f172a;
  --text-dark: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
  --border-subtle: rgba(0, 0, 0, 0.12);
  --border-main: rgba(0, 0, 0, 0.22);
  --border-active: rgba(2, 132, 199, 0.6);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
}

/* Light Theme Component Overrides */
[data-theme="light"] header.app-header {
  background: rgba(255, 255, 255, 0.96);
  border-bottom-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .header-connection-pill {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #475569;
}

[data-theme="light"] .header-connection-pill.online {
  background: rgba(240, 253, 244, 0.95);
  border-color: rgba(34, 197, 94, 0.45);
  color: #15803d;
}

[data-theme="light"] .header-connection-pill.online .conn-dot {
  color: #16a34a;
}

[data-theme="light"] .header-connection-pill.offline {
  background: rgba(254, 243, 199, 0.95);
  border-color: rgba(245, 158, 11, 0.5);
  color: #b45309;
}

[data-theme="light"] .header-connection-pill.offline .conn-dot {
  color: #d97706;
}

[data-theme="light"] .btn-tier-indicator {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #475569;
}

[data-theme="light"] .btn-tier-indicator:hover {
  background: #f1f5f9;
  border-color: #0284c7;
  color: #0f172a;
}

[data-theme="light"] .btn-tier-indicator.tier-pro {
  background: linear-gradient(135deg, rgba(254, 240, 138, 0.5), rgba(253, 230, 138, 0.7));
  border-color: rgba(217, 119, 6, 0.45);
  color: #92400e;
}

[data-theme="light"] .btn-tier-indicator.tier-pro:hover {
  border-color: #d97706;
  box-shadow: 0 1px 4px rgba(217, 119, 6, 0.25);
  color: #78350f;
}

[data-theme="light"] .brand-title {
  background: linear-gradient(90deg, #0f172a, #0077b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .timeline-controls {
  background: rgba(241, 245, 249, 0.9);
  border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .day-pill {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #475569;
}
[data-theme="light"] .day-pill:hover {
  background: #f1f5f9;
  color: #0f172a;
}
[data-theme="light"] .day-pill.active {
  background: #0284c7;
  color: #ffffff;
}

[data-theme="light"] .planner-date-pro-wrap input[type="date"] {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .slack-pill {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #1e293b;
}
[data-theme="light"] .slack-pill:hover {
  background: #f8fafc;
}
[data-theme="light"] .slack-pill.active {
  background: rgba(16, 185, 129, 0.15);
  border-color: #059669;
  color: #047857;
}

[data-theme="light"] .slack-offset-badge {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #0f172a;
}
[data-theme="light"] .pro-modal-dialog {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
}
[data-theme="light"] .pro-modal-header {
  background: #f8fafc;
  border-color: rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .pro-modal-title-wrap h3 {
  color: #0f172a;
}
[data-theme="light"] .pro-tier-card {
  background: #f8fafc;
  border-color: rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .tier-title {
  color: #0f172a;
}
[data-theme="light"] .tier-price {
  color: #0f172a;
}
[data-theme="light"] .tier-features {
  color: #334155;
}
[data-theme="light"] .pro-modal-footer {
  background: #f8fafc;
  border-color: rgba(0, 0, 0, 0.1);
}


[data-theme="light"] .btn-action {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .btn-action.highlight {
  background: rgba(2, 132, 199, 0.15);
  color: #0284c7;
  border-color: #0284c7;
}

[data-theme="light"] .btn-ctrl {
  border-color: rgba(0, 0, 0, 0.15);
  color: #0f172a;
}

[data-theme="light"] .coord-badge {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(0, 0, 0, 0.12);
  color: #475569;
}

[data-theme="light"] .coord-badge span.val {
  color: #0284c7;
}

[data-theme="light"] .compass-widget {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .legend-overlay {
  background: rgba(255, 255, 255, 0.97);
  border-color: rgba(0, 0, 0, 0.14);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  color: #0f172a;
}

[data-theme="light"] .legend-title {
  color: #475569;
}

[data-theme="light"] .legend-group-header {
  color: #0284c7;
  border-bottom-color: rgba(2, 132, 199, 0.25);
}

[data-theme="light"] .legend-item {
  color: #0f172a;
}

[data-theme="light"] .legend-item .swatch {
  border-color: rgba(0, 0, 0, 0.25);
}

[data-theme="light"] .legend-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .legend-item.active {
  background: rgba(2, 132, 199, 0.12);
  border-color: rgba(2, 132, 199, 0.4);
}

[data-theme="light"] .search-drawer {
  background: rgba(255, 255, 255, 0.98);
  border-left-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .drawer-tabs {
  background: #f1f5f9;
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .drawer-tab-btn {
  color: #475569;
}

[data-theme="light"] .drawer-tab-btn.active {
  background: #ffffff;
  color: #0284c7;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .wreck-card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .wreck-card:hover {
  background: #f8fafc;
  border-color: #0284c7;
}

[data-theme="light"] .wreck-detail-panel {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(0, 0, 0, 0.14);
}

[data-theme="light"] .detail-panel-header {
  background: #f1f5f9;
  border-bottom-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .detail-vessel-name {
  color: #0f172a;
}

[data-theme="light"] .specs-grid {
  background: #f8fafc;
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .spec-cell .lbl {
  color: #64748b;
}

[data-theme="light"] .spec-cell .val {
  color: #0f172a;
}

[data-theme="light"] .detail-archive-switcher {
  background: #f8fafc;
  border-color: rgba(2, 132, 199, 0.3);
}

[data-theme="light"] .archive-tab-btn {
  background: #ffffff;
  color: #334155;
  border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .archive-tab-btn.active {
  background: #0284c7;
  color: #ffffff;
}

[data-theme="light"] .wreck-tidal-section {
  background: linear-gradient(180deg, rgba(2, 132, 199, 0.08), rgba(241, 245, 249, 0.8));
  border-color: rgba(2, 132, 199, 0.25);
}

[data-theme="light"] .stream-gauge-row {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .stream-speed-indicator {
  color: #0f172a;
}

[data-theme="light"] #search-wrecks-input {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(0, 0, 0, 0.15);
}

/* Light Theme Overrides for Dropdown Selects */
[data-theme="light"] .custom-select,
[data-theme="light"] .filter-select,
[data-theme="light"] select {
  background-color: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid #cbd5e1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='14' height='14' fill='%2364748b'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  -webkit-appearance: none;
  appearance: none;
  padding-right: 28px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

[data-theme="light"] .custom-select:hover,
[data-theme="light"] .filter-select:hover,
[data-theme="light"] select:hover {
  border-color: #0284c7;
}

[data-theme="light"] .custom-select:focus,
[data-theme="light"] .filter-select:focus,
[data-theme="light"] select:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
  outline: none;
}

[data-theme="light"] .custom-select option,
[data-theme="light"] .filter-select option,
[data-theme="light"] select option {
  background-color: var(--bg-surface);
  color: var(--text-main);
}

/* Light Theme Overrides for Tidal Station Coverage Stat Cards */
[data-theme="light"] .tidal-stat-card {
  background: var(--bg-dark);
  border-color: var(--border-subtle);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .tidal-stat-card .stat-total {
  color: var(--text-main);
}
[data-theme="light"] .tidal-stat-card .stat-calm {
  color: #059669;
}
[data-theme="light"] .tidal-stat-card .stat-mod {
  color: #d97706;
}
[data-theme="light"] .tidal-stat-card .stat-race {
  color: #dc2626;
}
[data-theme="light"] .tidal-stat-lbl {
  color: var(--text-dim);
}

/* Light Theme Overrides for Drawer Date Card & Input */
[data-theme="light"] .drawer-date-card {
  background: var(--bg-dark);
  border-color: var(--border-subtle);
}
[data-theme="light"] .custom-date-input {
  background: var(--bg-surface);
  color: var(--text-main);
  border-color: rgba(0, 0, 0, 0.15);
}

/* Light Theme Overrides for Filter Chips & Geographic Scope Buttons */
[data-theme="light"] .chip {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #475569;
}
[data-theme="light"] .chip:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: rgba(0, 0, 0, 0.2);
}
[data-theme="light"] .chip.active {
  background: rgba(2, 132, 199, 0.15);
  border-color: #0284c7;
  color: #0284c7;
}

[data-theme="light"] .scope-btn {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #475569;
}
[data-theme="light"] .scope-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}
[data-theme="light"] .scope-btn.active {
  background: rgba(2, 132, 199, 0.15);
  border-color: #0284c7;
  color: #0284c7;
  box-shadow: 0 0 6px rgba(2, 132, 199, 0.2);
}

[data-theme="light"] .btn-clear-search {
  color: #64748b;
}
[data-theme="light"] .btn-clear-search:hover {
  color: #0f172a;
}

[data-theme="light"] .btn-reset-filters {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #475569;
}
[data-theme="light"] .btn-reset-filters:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #0284c7;
}

[data-theme="light"] .extreme-tides-row {
  background: #f8fafc;
  border-color: rgba(0, 0, 0, 0.12);
  color: #0f172a;
}

/* Light Theme Overrides for Secondary Headerbar */
[data-theme="light"] .sub-header-planner {
  background: rgba(248, 250, 252, 0.97);
  border-bottom-color: rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .btn-lock-planner {
  border-color: rgba(0, 0, 0, 0.15);
  color: #475569;
}
[data-theme="light"] .btn-lock-planner:hover {
  background: #f1f5f9;
  color: #0f172a;
}
[data-theme="light"] .btn-lock-planner.pinned {
  background: rgba(2, 132, 199, 0.15);
  color: #0284c7;
  border-color: #0284c7;
}
[data-theme="light"] .btn-action.active-planner {
  background: rgba(2, 132, 199, 0.15);
  color: #0284c7;
  border-color: #0284c7;
}

[data-theme="light"] .planner-date-pro-wrap input[type="date"] {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.2);
  color: #0f172a;
}
[data-theme="light"] .day-pill {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.15);
  color: #475569;
}
[data-theme="light"] .day-pill.active {
  background: rgba(2, 132, 199, 0.12);
  border-color: #0284c7;
  color: #0284c7;
}
[data-theme="light"] .slack-pill {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.15);
  color: #0f172a;
}
[data-theme="light"] .btn-trim-step,
[data-theme="light"] .btn-duration-step {
  border-color: rgba(0, 0, 0, 0.2);
  color: #475569;
}
[data-theme="light"] .slack-offset-badge {
  background: #f1f5f9;
  border-color: rgba(0, 0, 0, 0.15);
  color: #0f172a;
}

[data-theme="light"] .legend-toggle-pill {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(0, 0, 0, 0.15);
  color: #0f172a;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .legend-toggle-pill:hover {
  background: #f1f5f9;
  border-color: #0284c7;
  color: #0284c7;
}

[data-theme="light"] .legend-toggle-pill .legend-pill-count {
  background: rgba(2, 132, 199, 0.15);
  color: #0284c7;
}

[data-theme="light"] .legend-close-btn {
  color: #64748b;
}

[data-theme="light"] .legend-close-btn:hover {
  color: #0f172a;
  background: rgba(0, 0, 0, 0.05);
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

#app-container {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

/* ---------------- Top Header Bar ---------------- */
header.app-header {
  height: 58px;
  flex-shrink: 0;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1000;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  cursor: pointer;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #0077b6, #00b4d8);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.brand-icon svg {
  width: 24px;
  height: 24px;
}

.brand-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #ffffff, #90e0ef);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 2px 6px;
  background: rgba(0, 180, 216, 0.15);
  color: var(--accent);
  border: 1px solid rgba(0, 180, 216, 0.3);
  border-radius: 4px;
}

/* Secondary Lockable Headerbar: Expedition Planning & Slack Toolbar */
.sub-header-planner {
  position: relative;
  z-index: 995;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 6px 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  flex-shrink: 0;
  transition: all 0.2s ease-in-out;
}

.sub-header-planner.collapsed {
  display: none !important;
}

.sub-planner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 1100px;
  min-width: 0;
}

.btn-lock-planner {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-lock-planner:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--accent);
}

.btn-lock-planner.pinned {
  background: rgba(0, 180, 216, 0.15);
  color: var(--accent);
  border-color: var(--border-active);
}

/* Mobile Expedition Sub-Planner Chevron Toggle (Hidden on Desktop) */
.btn-sub-planner-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.15));
  background: var(--bg-surface, #1e293b);
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-sub-planner-toggle:hover {
  background: var(--bg-hover, #334155);
  color: var(--text-main, #f8fafc);
  border-color: var(--accent, #00b4d8);
}

[data-theme="light"] .btn-sub-planner-toggle {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.15);
  color: #475569;
}

[data-theme="light"] .btn-sub-planner-toggle:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.btn-action.active-planner {
  background: rgba(0, 180, 216, 0.2);
  border-color: var(--accent);
  color: var(--accent-cyan);
}

/* Header Middle: Expedition Planner & Tidal Controls */
.timeline-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(30, 41, 59, 0.75);
  backdrop-filter: blur(10px);
  padding: 4px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  flex: 1;
  max-width: 720px;
  min-width: 0;
}

.planner-days-container {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.planner-days-strip {
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
}
.planner-days-strip::-webkit-scrollbar {
  display: none;
}

.day-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 38px;
  line-height: 1.1;
}

.day-pill:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.day-pill.active {
  background: var(--primary);
  border-color: var(--primary-hover);
  color: #ffffff;
  box-shadow: 0 0 8px rgba(14, 165, 233, 0.4);
}

.day-pill-name {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.day-pill-num {
  font-size: 12px;
  font-weight: 700;
}

.planner-date-pro-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.planner-date-pro-wrap input[type="date"] {
  background: #0f172a;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  outline: none;
  cursor: pointer;
  width: 125px;
}

.btn-pro-badge {
  display: flex;
  align-items: center;
  gap: 3px;
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.15), rgba(245, 158, 11, 0.25));
  border: 1px solid rgba(234, 179, 8, 0.45);
  color: #facc15;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-pro-badge:hover {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.3), rgba(245, 158, 11, 0.4));
  border-color: #facc15;
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.35);
  transform: translateY(-1px);
}

.btn-pro-badge.active-pro {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.3));
  border-color: #10b981;
  color: #34d399;
}

.planner-divider {
  width: 1px;
  height: 28px;
  background: var(--border-subtle);
  margin: 0 2px;
  flex-shrink: 0;
}

.planner-slack-container {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.slack-jumper-row {
  display: flex;
  align-items: center;
  gap: 5px;
  position: relative;
}

.slack-site-selector-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.slack-jumper-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
  cursor: pointer;
  transition: color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  border-radius: 4px;
}

.slack-jumper-label:hover {
  color: var(--accent-cyan, #0ea5e9);
  background: rgba(56, 189, 248, 0.1);
}

.slack-site-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  text-transform: none;
}

[data-theme="light"] .slack-site-count-badge {
  background: rgba(2, 132, 199, 0.12);
  color: #0284c7;
  border-color: rgba(2, 132, 199, 0.3);
}

.header-sites-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 440px;
  max-width: min(720px, 94vw);
  max-height: 255px;
  overflow-y: auto;
  scrollbar-width: thin;
  background: rgba(15, 23, 42, 0.98);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-active, rgba(56, 189, 248, 0.4));
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.65);
  padding: 6px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

[data-theme="light"] .header-sites-dropdown {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(2, 132, 199, 0.35);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.header-sites-dropdown-hint {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-dim);
  padding: 2px 6px 4px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-site-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.header-site-row:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.3);
}

.header-site-row.active {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: inset 3.5px 0 0 var(--accent-cyan, #38bdf8);
}

[data-theme="light"] .header-site-row:hover {
  background: rgba(2, 132, 199, 0.08);
  border-color: rgba(2, 132, 199, 0.25);
}

[data-theme="light"] .header-site-row.active {
  background: rgba(2, 132, 199, 0.16);
  border-color: rgba(2, 132, 199, 0.45);
  box-shadow: inset 3.5px 0 0 #0284c7;
}

.header-site-row-info {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 140px;
  flex: 1;
}

.header-site-row-name {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-site-row.active .header-site-row-name {
  color: var(--accent-cyan, #38bdf8);
}

[data-theme="light"] .header-site-row.active .header-site-row-name {
  color: #0284c7;
}

.header-site-row-station {
  font-size: 10px;
  font-family: ui-monospace, monospace;
  color: var(--text-muted);
  white-space: nowrap;
}

.header-site-row-pills {
  display: grid;
  grid-template-columns: repeat(4, 62px);
  gap: 5px;
  align-items: center;
  flex-shrink: 0;
}

.header-site-row-pills .slack-pill {
  width: 62px;
  min-width: 62px;
  max-width: 62px;
  box-sizing: border-box;
  justify-content: center;
  text-align: center;
  padding: 1px 2px;
  font-size: 10px;
  height: 22px;
  white-space: nowrap;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.header-site-row-pills .slack-pill-placeholder {
  width: 62px;
  height: 22px;
  visibility: hidden;
  display: inline-block;
}

.slack-pills-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.slack-pills-wrap::-webkit-scrollbar {
  display: none;
}

.slack-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.slack-pill:hover {
  background: var(--bg-hover);
  border-color: rgba(255, 255, 255, 0.25);
}

.slack-pill.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #34d399;
  font-weight: 700;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.3);
}

.slack-pill-time {
  font-family: ui-monospace, monospace;
  font-size: 10.5px;
  opacity: 0.85;
}

.slack-calmest-star {
  color: #f59e0b;
  font-size: 11px;
  font-weight: bold;
}
[data-theme="light"] .slack-calmest-star {
  color: #d97706;
}

/* Out-of-Range Ghost Pills (Exploration & Headerbar) */
.slack-pill-compact-tag {
  display: none;
}

.slack-pill.out-of-range {
  opacity: 0.45;
  border: 1px dashed rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.3);
  filter: grayscale(0.5);
}

.slack-pill.out-of-range:hover {
  opacity: 0.85;
  border-style: solid;
  border-color: rgba(148, 163, 184, 0.6);
  filter: none;
}

.slack-pill.out-of-range.active {
  opacity: 0.95;
  border: 1px solid #10b981;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  filter: none;
}

[data-theme="light"] .slack-pill.out-of-range {
  opacity: 0.5;
  background: rgba(241, 245, 249, 0.6);
  border: 1px dashed rgba(148, 163, 184, 0.6);
  color: #64748b;
  filter: grayscale(0.5);
}

[data-theme="light"] .slack-pill.out-of-range:hover {
  opacity: 0.9;
  border-style: solid;
  border-color: #94a3b8;
  color: #334155;
  filter: none;
}

[data-theme="light"] .slack-pill.out-of-range.active {
  opacity: 1;
  background: rgba(240, 253, 244, 0.9);
  border: 1px solid #10b981;
  color: #15803d;
  filter: none;
}

.slack-trim-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-trim-step,
.btn-duration-step {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.2;
}

.btn-trim-step:hover,
.btn-duration-step:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--accent);
}

.btn-trim-step:active,
.btn-duration-step:active {
  transform: scale(0.95);
  border-color: var(--accent);
}

.trim-slider-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
}

.trim-bound-label {
  font-size: 9px;
  color: var(--text-muted);
  font-family: ui-monospace, monospace;
  white-space: nowrap;
}

/* Trim Slider specifics */
.trim-slider-wrap input[type="range"] {
  flex: 1;
}

.slack-offset-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  font-family: ui-monospace, monospace;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  color: #e2e8f0;
}

/* Disabled Slack Offset Slider State (Mode-Sensitive) */
.disabled-control {
  opacity: 0.45;
  cursor: not-allowed;
  transition: opacity 0.2s ease;
}

.disabled-control input[type="range"]:disabled,
.disabled-control button:disabled {
  cursor: not-allowed !important;
  pointer-events: auto !important;
}

.disabled-control .slack-offset-badge {
  opacity: 0.75;
  border-style: dashed;
}

.slack-offset-badge.turn-exact {
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.slack-offset-badge.turn-before {
  border-color: rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
}

.slack-offset-badge.turn-after {
  border-color: rgba(245, 158, 11, 0.35);
  color: #fcd34d;
}

.slack-offset-badge .utc-clock {
  color: #94a3b8;
  font-size: 10px;
  margin-left: 3px;
}

/* Standalone Slack Window Duration Slider in Secondary Headerbar */
.planner-duration-container {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 170px;
  flex-shrink: 0;
}

.duration-slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.duration-slider-lbl {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.duration-slider-val {
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
  font-family: ui-monospace, monospace;
}

.duration-slider-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.duration-bound-lbl {
  font-size: 9px;
  color: var(--text-muted);
  font-family: ui-monospace, monospace;
  white-space: nowrap;
}

/* Duration Slider row specifics */
.duration-slider-row input[type="range"] {
  flex: 1;
}

/* ==========================================================================
   Unified Range Slider Scheme (Single-Value Scalar Controls)
   Applies to: Offset Trim, Expedition Slack Duration, Threshold Popover Duration,
   Scoring Weights (Dive Planner & Wreck Drawer), Search Opacity & Window Sliders
   ========================================================================== */
.trim-slider-wrap input[type="range"],
.duration-slider-row input[type="range"],
.dp-weight-row input[type="range"],
.expert-slider,
#dp-window-duration-slider,
#slack-window-slider,
#tidal-opacity-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  background: #334155;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

/* WebKit Track */
.trim-slider-wrap input[type="range"]::-webkit-slider-runnable-track,
.duration-slider-row input[type="range"]::-webkit-slider-runnable-track,
.dp-weight-row input[type="range"]::-webkit-slider-runnable-track,
.expert-slider::-webkit-slider-runnable-track,
#dp-window-duration-slider::-webkit-slider-runnable-track,
#slack-window-slider::-webkit-slider-runnable-track,
#tidal-opacity-slider::-webkit-slider-runnable-track {
  height: 5px;
  background: #334155;
  border-radius: 3px;
  transition: background 0.15s ease;
}

/* WebKit Thumb (Round Circular Dial - 14px) */
.trim-slider-wrap input[type="range"]::-webkit-slider-thumb,
.duration-slider-row input[type="range"]::-webkit-slider-thumb,
.dp-weight-row input[type="range"]::-webkit-slider-thumb,
.expert-slider::-webkit-slider-thumb,
#dp-window-duration-slider::-webkit-slider-thumb,
#slack-window-slider::-webkit-slider-thumb,
#tidal-opacity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-cyan, #38bdf8);
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.7);
  border: none;
  margin-top: -4.5px;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.12s ease, box-shadow 0.12s ease;
}

.trim-slider-wrap input[type="range"]::-webkit-slider-thumb:hover,
.duration-slider-row input[type="range"]::-webkit-slider-thumb:hover,
.dp-weight-row input[type="range"]::-webkit-slider-thumb:hover,
.expert-slider::-webkit-slider-thumb:hover,
#dp-window-duration-slider::-webkit-slider-thumb:hover,
#slack-window-slider::-webkit-slider-thumb:hover,
#tidal-opacity-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.9);
}

/* Gecko / Firefox Track */
.trim-slider-wrap input[type="range"]::-moz-range-track,
.duration-slider-row input[type="range"]::-moz-range-track,
.dp-weight-row input[type="range"]::-moz-range-track,
.expert-slider::-moz-range-track,
#dp-window-duration-slider::-moz-range-track,
#slack-window-slider::-moz-range-track,
#tidal-opacity-slider::-moz-range-track {
  height: 5px;
  background: #334155;
  border-radius: 3px;
  border: none;
  transition: background 0.15s ease;
}

/* Gecko / Firefox Thumb (Round Circular Dial - 14px) */
.trim-slider-wrap input[type="range"]::-moz-range-thumb,
.duration-slider-row input[type="range"]::-moz-range-thumb,
.dp-weight-row input[type="range"]::-moz-range-thumb,
.expert-slider::-moz-range-thumb,
#dp-window-duration-slider::-moz-range-thumb,
#slack-window-slider::-moz-range-thumb,
#tidal-opacity-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-cyan, #38bdf8);
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.7);
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.12s ease, box-shadow 0.12s ease;
}

.trim-slider-wrap input[type="range"]::-moz-range-thumb:hover,
.duration-slider-row input[type="range"]::-moz-range-thumb:hover,
.dp-weight-row input[type="range"]::-moz-range-thumb:hover,
.expert-slider::-moz-range-thumb:hover,
#dp-window-duration-slider::-moz-range-thumb:hover,
#slack-window-slider::-moz-range-thumb:hover,
#tidal-opacity-slider::-moz-range-thumb:hover {
  transform: scale(1.25);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.9);
}

/* -------------------------------------------------------------
   Light Theme Overrides for Range Sliders (Round Thumbs)
   ------------------------------------------------------------- */
[data-theme="light"] .trim-slider-wrap input[type="range"],
[data-theme="light"] .duration-slider-row input[type="range"],
[data-theme="light"] .dp-weight-row input[type="range"],
[data-theme="light"] .expert-slider,
[data-theme="light"] #dp-window-duration-slider,
[data-theme="light"] #slack-window-slider,
[data-theme="light"] #tidal-opacity-slider {
  background: #cbd5e1;
}

[data-theme="light"] .trim-slider-wrap input[type="range"]::-webkit-slider-runnable-track,
[data-theme="light"] .duration-slider-row input[type="range"]::-webkit-slider-runnable-track,
[data-theme="light"] .dp-weight-row input[type="range"]::-webkit-slider-runnable-track,
[data-theme="light"] .expert-slider::-webkit-slider-runnable-track,
[data-theme="light"] #dp-window-duration-slider::-webkit-slider-runnable-track,
[data-theme="light"] #slack-window-slider::-webkit-slider-runnable-track,
[data-theme="light"] #tidal-opacity-slider::-webkit-slider-runnable-track {
  background: #cbd5e1;
}

[data-theme="light"] .trim-slider-wrap input[type="range"]::-moz-range-track,
[data-theme="light"] .duration-slider-row input[type="range"]::-moz-range-track,
[data-theme="light"] .dp-weight-row input[type="range"]::-moz-range-track,
[data-theme="light"] .expert-slider::-moz-range-track,
[data-theme="light"] #dp-window-duration-slider::-moz-range-track,
[data-theme="light"] #slack-window-slider::-moz-range-track,
[data-theme="light"] #tidal-opacity-slider::-moz-range-track {
  background: #cbd5e1;
}

[data-theme="light"] .trim-slider-wrap input[type="range"]::-webkit-slider-thumb,
[data-theme="light"] .duration-slider-row input[type="range"]::-webkit-slider-thumb,
[data-theme="light"] .dp-weight-row input[type="range"]::-webkit-slider-thumb,
[data-theme="light"] .expert-slider::-webkit-slider-thumb,
[data-theme="light"] #dp-window-duration-slider::-webkit-slider-thumb,
[data-theme="light"] #slack-window-slider::-webkit-slider-thumb,
[data-theme="light"] #tidal-opacity-slider::-webkit-slider-thumb {
  background: #0284c7;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

[data-theme="light"] .trim-slider-wrap input[type="range"]::-webkit-slider-thumb:hover,
[data-theme="light"] .duration-slider-row input[type="range"]::-webkit-slider-thumb:hover,
[data-theme="light"] .dp-weight-row input[type="range"]::-webkit-slider-thumb:hover,
[data-theme="light"] .expert-slider::-webkit-slider-thumb:hover,
[data-theme="light"] #dp-window-duration-slider::-webkit-slider-thumb:hover,
[data-theme="light"] #slack-window-slider::-webkit-slider-thumb:hover,
[data-theme="light"] #tidal-opacity-slider::-webkit-slider-thumb:hover {
  background: #0369a1;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.4);
}

[data-theme="light"] .trim-slider-wrap input[type="range"]::-moz-range-thumb,
[data-theme="light"] .duration-slider-row input[type="range"]::-moz-range-thumb,
[data-theme="light"] .dp-weight-row input[type="range"]::-moz-range-thumb,
[data-theme="light"] .expert-slider::-moz-range-thumb,
[data-theme="light"] #dp-window-duration-slider::-moz-range-thumb,
[data-theme="light"] #slack-window-slider::-moz-range-thumb,
[data-theme="light"] #tidal-opacity-slider::-moz-range-thumb {
  background: #0284c7;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

[data-theme="light"] .trim-slider-wrap input[type="range"]::-moz-range-thumb:hover,
[data-theme="light"] .duration-slider-row input[type="range"]::-moz-range-thumb:hover,
[data-theme="light"] .dp-weight-row input[type="range"]::-moz-range-thumb:hover,
[data-theme="light"] .expert-slider::-moz-range-thumb:hover,
[data-theme="light"] #dp-window-duration-slider::-moz-range-thumb:hover,
[data-theme="light"] #slack-window-slider::-moz-range-thumb:hover,
[data-theme="light"] #tidal-opacity-slider::-moz-range-thumb:hover {
  background: #0369a1;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.4);
}

/* Pro Upgrade Modal */
.pro-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.15s ease-out;
}

.pro-modal-dialog {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.8), 0 0 30px rgba(14, 165, 233, 0.15);
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pro-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(30, 41, 59, 0.4);
}

.pro-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pro-modal-icon {
  font-size: 26px;
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.3);
  border-radius: 8px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pro-modal-title-wrap h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}

.pro-modal-title-wrap p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: #94a3b8;
}

.pro-modal-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 4px;
}

.pro-modal-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.pro-modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pro-callout-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(234, 179, 8, 0.08);
  border: 1px solid rgba(234, 179, 8, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

.pro-callout-icon {
  font-size: 22px;
}

.pro-callout-banner strong {
  display: block;
  font-size: 13.5px;
  color: #facc15;
}

.pro-callout-banner p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: #cbd5e1;
}

.pro-tiers-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.pro-tier-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all 0.2s ease;
}

.pro-tier-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.pro-tier-card.popular {
  border-color: #0ea5e9;
  background: rgba(14, 165, 233, 0.08);
  box-shadow: 0 0 20px rgba(14, 165, 233, 0.2);
}

.pro-tier-card.current {
  border-color: rgba(255, 255, 255, 0.15);
  opacity: 0.85;
}

.tier-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.tier-badge.highlight {
  color: #38bdf8;
}

.tier-badge.popular-badge {
  color: #38bdf8;
  font-weight: 800;
}

.tier-title {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
}

.tier-price {
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 12px;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.tier-price small {
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
}

.tier-price .alt-price {
  font-size: 11px;
  color: #94a3b8;
  font-weight: normal;
}

.tier-features {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  font-size: 12px;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
}

.tier-btn {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  text-align: center;
}

.tier-btn.disabled {
  background: rgba(255, 255, 255, 0.08);
  color: #64748b;
  cursor: not-allowed;
}

.tier-btn.primary {
  background: #0284c7;
  color: #ffffff;
}
.tier-btn.primary:hover {
  background: #0369a1;
}

.tier-btn.upgrade {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.5);
}
.tier-btn.upgrade:hover {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  transform: translateY(-1px);
}

.tier-btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  border: 1px solid var(--border-subtle);
}
.tier-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.18);
}

.pro-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.8);
}

.pro-demo-tool {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #94a3b8;
}

.btn-demo-toggle {
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.4);
  color: #facc15;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-demo-toggle:hover {
  background: rgba(234, 179, 8, 0.25);
  border-color: #facc15;
}

.btn-dismiss-text {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 13px;
  cursor: pointer;
  padding: 6px 12px;
}
.btn-dismiss-text:hover {
  color: #ffffff;
}

/* Header Right: Layer switcher & Search */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}


.btn-action {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-action:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.btn-action.highlight {
  background: rgba(0, 119, 182, 0.2);
  border-color: var(--accent);
  color: var(--accent-cyan);
}

/* ---------------- Map Viewport ---------------- */
#map-viewport {
  flex: 1;
  position: relative;
  width: 100%;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
  background: #0c1a2c;
  transition: background 0.25s ease;
}

[data-theme="light"] #map {
  background: #cce3ee;
}

/* Cursor Coordinates Badge */
.coord-badge {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: var(--text-muted);
  z-index: 900;
  pointer-events: none;
  display: flex;
  gap: 12px;
}

.coord-badge span.val {
  color: var(--accent-cyan);
  font-weight: 600;
}

/* Decoupled Legend Overlays */
.legend-overlay {
  position: absolute;
  bottom: 58px;
  left: 16px;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  z-index: 900;
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  overflow-y: auto;
  scrollbar-width: thin;
  transition: all 0.2s ease;
}

.legend-overlay.legend-wrecks {
  width: 290px;
  max-height: calc(100vh - 165px);
  overflow-x: hidden;
}

.legend-overlay.legend-slacks {
  width: 224px;
  max-height: 280px;
}

/* Tooltip Popover for Slacks Legend Display Mode & Opacity */
.legend-slacks-tooltip {
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 8px;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.legend-slacks-tooltip .tooltip-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.legend-slacks-tooltip .tooltip-label {
  color: var(--text-muted);
  font-size: 10.5px;
}

.legend-slacks-tooltip .tooltip-val {
  color: #38bdf8;
  font-weight: 600;
  font-size: 11px;
}

.legend-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.legend-info-btn:hover {
  background: #38bdf8;
  color: #0f172a;
}

/* On desktop, if both wrecks and slacks legends are open in Unified mode, place slacks side-by-side */
@media (min-width: 769px) {
  .legend-wrecks:not(.collapsed) ~ .legend-slacks:not(.collapsed) {
    left: 318px;
  }
}

.legend-title {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.legend-group-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #38bdf8;
  margin: 9px 0 4px 0;
  padding-bottom: 2px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.legend-group-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.legend-scale {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 5px;
  font-size: 11.5px;
  color: var(--text-main);
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s ease;
}

.legend-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.legend-item.active {
  background: rgba(56, 189, 248, 0.18);
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.legend-symbol-cell {
  width: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.legend-label-cell {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  line-height: 1.25;
}

.legend-iho-code {
  font-size: 9.5px;
  color: #94a3b8;
  margin-left: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.legend-count-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 6px;
  white-space: nowrap;
  letter-spacing: -0.2px;
  border: 1px solid var(--border-subtle);
  transition: all 0.15s ease;
}

[data-theme="light"] .legend-count-badge {
  background: rgba(0, 0, 0, 0.04);
  color: #475569;
}

.legend-item:hover .legend-count-badge {
  color: var(--accent-cyan);
  border-color: rgba(56, 189, 248, 0.4);
}

.legend-item.zero-dataset {
  opacity: 0.42;
}

.legend-item.zero-dataset:hover {
  opacity: 0.8;
}

.legend-item.zero-dataset .legend-count-badge {
  color: var(--text-dim);
  opacity: 0.7;
}

.legend-circle-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  flex-shrink: 0;
}

[data-theme="light"] .legend-circle-swatch {
  border: 1.5px solid rgba(15, 23, 42, 0.45);
}

.legend-swatch-depth {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

.legend-item .swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Light / Dark Mode Toggle Buttons */
.btn-theme-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--accent-cyan);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  height: 32px;
  transition: all 0.15s ease;
}

.btn-theme-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.theme-btn-label {
  font-size: 11px;
  font-weight: 600;
}

.legend-theme-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
  line-height: 1.3;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.15s ease;
}

.legend-theme-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

/* Admiralty paper chart inline recommendation banner */
.admiralty-theme-notice {
  margin-bottom: 8px;
  padding: 6px 10px;
  background: rgba(2, 132, 199, 0.15);
  border: 1px solid rgba(2, 132, 199, 0.35);
  border-radius: 6px;
  font-size: 10.5px;
  color: #38bdf8;
  display: flex;
  flex-direction: column;
  gap: 5px;
  line-height: 1.35;
}

.btn-theme-switch-inline {
  align-self: flex-start;
  background: #0284c7;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 3px 8px;
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 600;
  transition: background 0.15s ease;
}

.btn-theme-switch-inline:hover {
  background: #0369a1;
}

.admiralty-dark-cell {
  background: rgba(248, 250, 252, 0.08);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Light Theme Scrollbars */
[data-theme="light"] ::-webkit-scrollbar-track {
  background: #f1f5f9;
}
[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: #cbd5e1;
}
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Touch targets and mobile helpers (Desktop default) */
button, input, select {
  touch-action: manipulation;
}

/* Adaptive Legend Trigger Pills Container */
.legend-pills-container {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 850;
  pointer-events: none;
}

.legend-pills-container button {
  pointer-events: auto;
}

.legend-toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  transition: all 0.15s ease;
  user-select: none;
}

.legend-toggle-pill:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent-cyan);
  transform: translateY(-1px);
}

.legend-toggle-pill.active-pill {
  background: rgba(14, 165, 233, 0.25);
  border-color: #38bdf8;
  color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.legend-toggle-pill .legend-pill-count {
  font-size: 10px;
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
}

.legend-toggle-pill .legend-pill-badge {
  font-size: 10px;
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
}

.legend-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
  transition: color 0.15s ease;
  border-radius: 4px;
}

.legend-close-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.legend-overlay.collapsed {
  display: none !important;
}

/* Mobile Bottom-Docked Slacks Peek Strip */
.legend-slacks-peek-strip {
  display: none !important;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 28px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-subtle);
  z-index: 840;
  padding: 0 12px;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.5);
}

.peek-scale-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.peek-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
}

.swatch-mini {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

.peek-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.peek-mode-badge {
  font-size: 10px;
  font-weight: 600;
  color: #38bdf8;
}

.peek-opacity-badge {
  font-size: 10px;
  color: var(--text-muted);
}

/* Mobile Below-Chart Inspection Deck */
.mobile-deck-panel {
  display: none;
  background: #0f172a;
  border-top: 2px solid var(--border-subtle);
  flex-direction: column;
  height: 45vh;
  z-index: 800;
  overflow: hidden;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

.deck-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(30, 41, 59, 0.75);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.deck-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.deck-tab-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.deck-tab-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.deck-tab-btn.active {
  background: rgba(14, 165, 233, 0.18);
  border-color: #38bdf8;
  color: #38bdf8;
}

.deck-close-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.deck-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.deck-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  scrollbar-width: thin;
}

.deck-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #38bdf8;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
}

.deck-scale {
  margin-top: 6px;
}

/* Split-View Mode Active Layout */
body.split-view-active #map-viewport {
  height: 55vh !important;
  min-height: 280px;
  flex-shrink: 0;
  margin-bottom: 0 !important;
}

body.split-view-active .mobile-deck-panel {
  display: flex !important;
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  margin-bottom: calc(56px + env(safe-area-inset-bottom, 0px)) !important;
}

body.split-view-active .legend-pills-container {
  bottom: 8px;
}

body.split-view-active .legend-slacks-peek-strip {
  display: none !important;
}

/* Light Theme Overrides */
[data-theme="light"] .legend-slacks-peek-strip {
  background: rgba(255, 255, 255, 0.96);
  border-top-color: #cbd5e1;
  color: #0f172a;
}

[data-theme="light"] .swatch-mini {
  border-color: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .mobile-deck-panel {
  background: #f8fafc;
  border-top-color: #cbd5e1;
}

[data-theme="light"] .deck-header {
  background: #ffffff;
  border-bottom-color: #e2e8f0;
}

[data-theme="light"] .legend-slacks-tooltip {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .legend-slacks-tooltip .tooltip-val {
  color: #0284c7;
}

[data-theme="light"] .legend-info-btn {
  background: rgba(2, 132, 199, 0.12);
  color: #0284c7;
}

[data-theme="light"] .legend-info-btn:hover {
  background: #0284c7;
  color: #ffffff;
}

/* ---------------- Tablet / Medium Screen Responsive Media Queries ---------------- */
@media (max-width: 1040px) and (min-width: 769px) {
  .sub-planner-inner {
    flex-wrap: wrap;
    row-gap: 8px;
    justify-content: center;
  }
  .planner-divider {
    display: none;
  }
  .planner-days-container {
    flex: 1 1 100%;
    justify-content: center;
  }
  .planner-slack-container {
    flex: 1 1 auto;
    max-width: 620px;
    justify-content: center;
  }
}

/* ---------------- Mobile Responsive Media Queries (<= 768px) ---------------- */
@media (max-width: 768px) {
  /* Compact Top Header Bar */
  header.app-header {
    height: 52px;
    padding: 0 10px;
    gap: 8px;
  }

  .brand-icon {
    width: 28px;
    height: 28px;
  }

  .brand-icon svg {
    width: 21px;
    height: 21px;
  }

  .brand-title {
    font-size: 16px;
  }

  .brand-badge {
    display: none;
  }

  .header-actions {
    gap: 6px;
  }


  .btn-action {
    padding: 6px 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
  }

  .btn-action span.btn-label,
  .btn-action span:not(.btn-icon):not(.planner-count-badge) {
    display: none; /* Hide text label on mobile, preserve icons & badge */
  }

  .btn-action span.btn-icon,
  .btn-action svg.btn-icon {
    display: inline-flex !important;
    font-size: 14px;
    line-height: 1;
  }

  /* Mobile Top Header Pruning (<= 768px): BottomNavBar owns Map, Planner, Expedition, and Sites */
  .brand-nav-links,
  #btn-page-planner,
  #btn-toggle-planner,
  #btn-toggle-search {
    display: none !important;
  }

  /* Mobile Expedition Planner Sub-Header */
  .sub-header-planner {
    position: relative;
    z-index: 995;
    padding: 6px 8px;
    background: rgba(15, 23, 42, 0.98);
    overflow-x: hidden;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .btn-sub-planner-toggle.has-selection {
    display: inline-flex !important;
  }

  .sub-planner-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
  }

  .planner-days-container {
    width: 100%;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
  }

  .planner-days-strip {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 5px;
    padding-bottom: 4px;
  }

  .day-pill {
    min-width: 44px;
    min-height: 42px;
    padding: 3px 6px;
  }

  .planner-date-pro-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
  }

  .planner-date-pro-wrap input[type="date"] {
    width: 100%;
    max-width: 180px;
    font-size: 12.5px;
    padding: 5px 8px;
    min-height: 34px;
    height: 34px;
  }

  /* Hide redundant Pro badge on mobile to allow date controls on single row */
  .btn-pro-badge {
    display: none !important;
  }

  /* Compact Mode: Conserves vertical space on mobile phones */
  #sub-header-planner.compact-mobile {
    padding: 4px 8px;
  }

  #sub-header-planner.compact-mobile .planner-slack-container,
  #sub-header-planner.compact-mobile .planner-duration-container,
  #sub-header-planner.compact-mobile .planner-offset-trim-container,
  #sub-header-planner.compact-mobile .planner-divider {
    display: none !important;
  }

  .planner-divider {
    display: none;
  }

  .planner-slack-container {
    width: 100%;
    gap: 6px;
  }

  .slack-jumper-row {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
  }

  .slack-pills-wrap {
    flex: 1;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 5px;
  }

  .slack-pill {
    min-height: 44px;
    padding: 3px 10px;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
  }

  .slack-pill.out-of-range {
    min-width: 44px;
    min-height: 44px;
    padding: 3px 8px;
    justify-content: center;
    gap: 0;
  }
  .slack-pill.out-of-range .slack-pill-label,
  .slack-pill.out-of-range .slack-pill-time,
  .slack-pill.out-of-range .slack-calmest-star {
    display: none !important;
  }
  .slack-pill.out-of-range .slack-pill-compact-tag {
    display: inline-flex !important;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    font-family: ui-monospace, monospace;
  }

  .slack-trim-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .btn-trim-step,
  .btn-duration-step {
    min-width: 44px;
    min-height: 44px;
    padding: 6px 10px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .duration-slider-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  #planner-duration-slider {
    flex: 1;
    min-width: 70px;
    height: 5px;
  }

  .trim-slider-wrap {
    flex: 1;
    min-width: 0;
  }

  #slack-offset-slider {
    flex: 1;
    min-width: 70px;
    height: 5px;
  }

  .slack-offset-badge {
    flex-shrink: 0;
    font-size: 11px;
    padding: 4px 8px;
    white-space: nowrap;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
  }

  .planner-duration-container {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 4px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
  }

  .duration-slider-header {
    flex-shrink: 0;
  }

  .duration-slider-row {
    flex: 1;
    min-width: 0;
  }

  #planner-duration-slider {
    height: 5px;
  }

  .search-drawer {
    padding-bottom: 0;
  }

  .btn-lock-planner {
    display: none;
  }

  .pro-tiers-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  #map-viewport {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
  }

  /* Hide cursor coordinates badge on mobile */
  .coord-badge {
    display: none;
  }

  /* Compass Widget Scaled and Moved */
  .compass-widget {
    top: 10px;
    left: 10px;
    width: 40px;
    height: 40px;
  }

  /* Adaptive Legend Trigger Pills Container on Mobile */
  .legend-pills-container {
    position: absolute;
    bottom: 12px;
    left: 10px;
    gap: 6px;
    z-index: 860;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    max-width: calc(100vw - 20px);
    pointer-events: none;
  }

  .legend-pills-container button {
    pointer-events: auto;
  }

  /* When bottom peek strip is visible (in tides and unified mode), float pills above 28px peek strip */
  body[data-map-mode="tides"] .legend-pills-container,
  body[data-map-mode="unified"] .legend-pills-container {
    bottom: 34px;
  }

  body.split-view-active .legend-pills-container {
    bottom: 8px !important;
  }

  .legend-toggle-pill {
    padding: 5px 10px;
    font-size: 11px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  }

  .legend-toggle-pill:active {
    background: #1e293b;
    transform: scale(0.97);
  }

  /* Collapsible Floating Legend Cards on Mobile */
  .legend-overlay {
    display: none; /* hidden until tapped */
    position: fixed;
    top: auto;
    bottom: 74px;
    left: 10px;
    right: 10px;
    width: auto;
    max-width: 360px;
    max-height: 52vh;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    border-color: rgba(56, 189, 248, 0.3);
  }

  .legend-overlay.mobile-open {
    display: flex !important;
    flex-direction: column;
  }

  .legend-close-btn {
    display: block !important;
  }
}

/* ---------------- Phone Screen Condensation (<= 480px) ---------------- */
@media (max-width: 480px) {
  header.app-header {
    padding: 0 6px;
    gap: 4px;
  }

  .header-actions {
    gap: 3px;
  }


  .btn-action {
    padding: 5px 7px;
  }

  /* Hide subtle redundant top-tier badge on narrow phone viewports */
  #btn-header-tier,
  .btn-tier-indicator {
    display: none !important;
  }

  /* Condense Account and Connection to icon/dot only */
  .btn-account-pill span.account-text {
    display: none !important;
  }

  .btn-account-pill {
    padding: 4px 7px;
  }

  .header-connection-pill .conn-label {
    display: none !important;
  }

  .header-connection-pill {
    padding: 4px 6px;
  }
}

/* --- Tide State Pill Tints (HW/MW/LW) - Marine Directional Palette --- */
.slack-pill.slack-hw, .novice-pill.slack-hw, .dp-pill.slack-hw {
    background-color: rgba(14, 165, 233, 0.15); /* Sky Blue (Rising Tide / Flood) */
    border-color: rgba(14, 165, 233, 0.35);
    color: #38bdf8;
}
.slack-pill.slack-mw, .novice-pill.slack-mw, .dp-pill.slack-mw {
    background-color: rgba(99, 102, 241, 0.15); /* Soft Indigo (Mid-Water) */
    border-color: rgba(99, 102, 241, 0.35);
    color: #818cf8;
}
.slack-pill.slack-lw, .novice-pill.slack-lw, .dp-pill.slack-lw {
    background-color: rgba(100, 116, 139, 0.20); /* Cool Slate (Falling Tide / Ebb) */
    border-color: rgba(148, 163, 184, 0.35);
    color: #94a3b8;
}

[data-theme="light"] .slack-pill.slack-hw {
    background-color: rgba(2, 132, 199, 0.10);
    border-color: rgba(2, 132, 199, 0.35);
    color: #0284c7;
}
[data-theme="light"] .slack-pill.slack-mw {
    background-color: rgba(99, 102, 241, 0.10);
    border-color: rgba(99, 102, 241, 0.35);
    color: #4f46e5;
}
[data-theme="light"] .slack-pill.slack-lw {
    background-color: rgba(71, 85, 105, 0.10);
    border-color: rgba(71, 85, 105, 0.35);
    color: #475569;
}

/* Selected/Active states for Tide Pills */
.slack-pill.slack-hw.active, .novice-pill.slack-hw.active, .dp-pill.slack-hw.active {
    border: 2px solid #0ea5e9;
    box-shadow: 0 0 6px rgba(14, 165, 233, 0.45);
    color: #7dd3fc;
}
.slack-pill.slack-mw.active, .novice-pill.slack-mw.active, .dp-pill.slack-mw.active {
    border: 2px solid #6366f1;
    box-shadow: 0 0 6px rgba(99, 102, 241, 0.45);
    color: #a5b4fc;
}
.slack-pill.slack-lw.active, .novice-pill.slack-lw.active, .dp-pill.slack-lw.active {
    border: 2px solid #94a3b8;
    box-shadow: 0 0 6px rgba(148, 163, 184, 0.45);
    color: #cbd5e1;
}

[data-theme="light"] .slack-pill.slack-hw.active {
    border-color: #0284c7;
    color: #0369a1;
}
[data-theme="light"] .slack-pill.slack-mw.active {
    border-color: #4f46e5;
    color: #3730a3;
}
[data-theme="light"] .slack-pill.slack-lw.active {
    border-color: #475569;
    color: #1e293b;
}


/* === NATIVE MOBILE BOTTOM NAVIGATION BAR & EXPEDITION SHEET (PHASE 3) === */
.mobile-bottom-nav {
  display: none;
}

.expedition-controls-sheet {
  display: none;
}

@media (max-width: 768px) {
  /* Reserve bottom clearance on map and panels for the 56px bottom nav bar */
  #map-viewport {
    bottom: auto !important;
    margin-bottom: calc(56px + env(safe-area-inset-bottom, 0px)) !important;
  }

  #dive-planner-panel {
    bottom: calc(56px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--bg-surface, rgba(15, 23, 42, 0.96));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-subtle, rgba(148, 163, 184, 0.22));
    z-index: 1050;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
    align-items: stretch;
    justify-content: space-around;
    box-sizing: border-box;
  }

  [data-theme="light"] .mobile-bottom-nav {
    background: rgba(255, 255, 255, 0.96);
    border-top-color: #cbd5e1;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  }

  .mobile-nav-btn {
    flex: 1 1 0%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: transparent;
    border: none;
    color: var(--text-dim, #94a3b8);
    cursor: pointer;
    padding: 6px 4px;
    transition: color 0.15s ease, transform 0.1s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  [data-theme="light"] .mobile-nav-btn {
    color: #64748b;
  }

  .mobile-nav-btn:active {
    transform: scale(0.92);
  }

  .mobile-nav-btn.active {
    color: var(--accent, #38bdf8);
    font-weight: 700;
  }

  [data-theme="light"] .mobile-nav-btn.active {
    color: #0284c7;
  }

  .mobile-nav-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
  }

  .mobile-nav-label {
    font-size: 10px;
    line-height: 1.1;
    letter-spacing: 0.2px;
  }

  .mobile-nav-badge {
    position: absolute;
    top: -3px;
    right: -8px;
    background: #0284c7;
    color: #ffffff;
    font-size: 9px;
    font-weight: 800;
    padding: 1px 4px;
    border-radius: 999px;
    min-width: 12px;
    text-align: center;
    line-height: 1.1;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  }

  /* Expedition Controls Slide-Up Bottom Sheet */
  .expedition-controls-sheet {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: auto;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    left: 0;
    right: 0;
    width: 100vw;
    max-width: 100%;
    max-height: 75vh;
    background: var(--bg-surface, rgba(15, 23, 42, 0.98));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 18px 18px 0 0;
    border-top: 1px solid var(--border-subtle, rgba(148, 163, 184, 0.25));
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.75);
    z-index: 1060;
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    overflow: hidden;
  }

  [data-theme="light"] .expedition-controls-sheet {
    background: rgba(255, 255, 255, 0.98);
    border-top-color: #cbd5e1;
    box-shadow: 0 -8px 25px rgba(0, 0, 0, 0.15);
  }

  .expedition-controls-sheet.open {
    transform: translateY(0);
  }

  .expedition-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 12px 16px;
    border-bottom: 1px solid var(--border-subtle, rgba(148, 163, 184, 0.15));
  }

  .expedition-sheet-body {
    padding: 14px 16px 20px 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* === STANDALONE PWA FULLSCREEN DISPLAY MODE RULES (PHASE 4) === */
@media all and (display-mode: standalone) {
  .app-header {
    padding-top: calc(env(safe-area-inset-top, 0px) + 6px);
  }

  body {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }

  input, textarea, select, [contenteditable="true"] {
    -webkit-user-select: text;
    user-select: text;
  }
}
