/*
 * Jeju Caferi Route Planner - Visual System Redesign
 * Understated Luxury & Clean Active Glass System
 */

:root {
  /* Color Palette - Understated Luxury */
  --basalt-950: #0f1115;
  --basalt-900: #15181f;
  --basalt-800: #20242f;
  --basalt-700: #2d3342;
  
  --ocean-deep: #0f2435;
  --ocean-medium: #17364e;
  --ocean-light: #204b6b;
  --ocean-accent: #1e70ad;
  
  --mint-deep: #0a4f45;
  --mint-medium: #0e6b5e;
  --mint-light: #159482;
  
  --sand-base: #f9f7f2;
  --sand-card: #ffffff;
  --sand-muted: #f4f1e9;
  --sand-border: #e6e2d8;
  
  --text-dark: #12151a;
  --text-medium: #3d4554;
  --text-muted: #7d879c;
  
  --danger: #9e2a2b;
  --danger-soft: #fff5f5;
  --danger-border: #f8d7da;
  
  --warning: #8c5b00;
  --warning-soft: #fffbeb;
  --warning-border: #fdecbe;
  
  /* Active Glass System (Used only for overlays, ribbon, header) */
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-bg-strong: rgba(255, 255, 255, 0.88);
  --glass-bg-dark: rgba(21, 24, 31, 0.85);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-border-dark: rgba(255, 255, 255, 0.1);
  --glass-blur: 18px;
  --glass-shadow: 0 10px 30px rgba(18, 21, 26, 0.04);
  
  /* Typography */
  --font-sans: 'Outfit', 'Noto Sans KR', system-ui, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  
  /* Layout Options */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 99px;
  
  /* Animations */
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s var(--ease-spring);
  --transition-fast: 0.15s var(--ease-smooth);
}

/* Base Styles & Resets */
* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  min-width: 320px;
  overflow: hidden;
  color: var(--text-dark);
  background-color: var(--sand-base);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select {
  font-family: inherit;
  font-size: inherit;
}

button, select {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button, a, input, select {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--ocean-accent);
  text-decoration: none;
  transition: var(--transition-fast);
}
a:hover {
  color: var(--ocean-light);
}

/* Skip Link for Accessibility */
.skip-link {
  position: fixed;
  z-index: 10000;
  top: 12px;
  left: 12px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  color: #fff;
  background-color: var(--ocean-medium);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  font-weight: 600;
  transform: translateY(-180%);
  transition: transform var(--transition-normal);
}
.skip-link:focus {
  transform: translateY(0);
}

/* Focus Ring for Keyboard Access */
:where(button, a, input, select, [tabindex]):focus-visible {
  outline: 2px solid var(--ocean-accent);
  outline-offset: 3px;
}

/* Typography Hierarchy */
h1, h2, h3, h4, p {
  margin: 0;
}
h1 { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 16px; font-weight: 700; letter-spacing: -0.015em; }
h3 { font-size: 14px; font-weight: 600; }

.eyebrow {
  margin-bottom: 2px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* --- Layout Structure (App Shell) --- */
.app-shell {
  display: grid;
  grid-template-rows: 56px 44px 52px minmax(0, 1fr);
  height: 100dvh;
}

/* Glass Reflection Animation (Very Subtle, Low 대비) */
.app-header::after,
.transport-ribbon::after,
.timeline-panel::after,
.edit-dialog::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(
    105deg,
    rgba(255, 255, 255, 0) 30%,
    rgba(255, 255, 255, 0.02) 42%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.02) 58%,
    rgba(255, 255, 255, 0) 70%
  );
  transform: translateX(-100%);
  animation: glass-sheen-loop 14s var(--ease-spring) infinite;
  pointer-events: none;
  z-index: 5;
}
.transport-ribbon::after { animation-delay: 3s; }
.timeline-panel::after { animation-delay: 6s; }
.edit-dialog::after { animation-delay: 9s; }

@keyframes glass-sheen-loop {
  0% { transform: translateX(-100%); }
  18%, 100% { transform: translateX(100%); }
}

/* --- Header Redesign --- */
.app-header {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  overflow: hidden;
  background-color: var(--basalt-950);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #ffffff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 16px;
}
.brand-mark b { font-style: normal; }
.brand-mark i { display: none; }

.brand div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.brand .eyebrow {
  color: rgba(255, 255, 255, 0.45);
  font-weight: 500;
  font-size: 8px;
}
.brand h1 {
  font-size: 14px;
  color: #fff;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Status Pill: Rebuilt as a subtle indicator dot */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  padding: 0 10px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
}
.status-pill::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.35);
}
.status-pill.status-neutral::before { background-color: #90a4ae; }
.status-pill.status-success { color: #81c784; }
.status-pill.status-success::before { background-color: #81c784; }
.status-pill.status-loading { color: #64b5f6; }
.status-pill.status-loading::before {
  background-color: #64b5f6;
  animation: pulse-dot 1.5s infinite ease-in-out;
}
.status-pill.status-error { color: #e57373; }
.status-pill.status-error::before { background-color: #e57373; }

@keyframes pulse-dot {
  0% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.8); opacity: 0.5; }
}

/* Standard Premium Buttons */
.primary-button, .secondary-button, .danger-button, .icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform var(--ease-spring) 0.2s, background var(--transition-fast), border var(--transition-fast);
}

.primary-button {
  background: var(--basalt-800);
  border: 1px solid var(--basalt-700);
  color: #fff;
}
.primary-button:hover:not(:disabled) {
  background: var(--basalt-700);
}

.secondary-button {
  background: #fff;
  border: 1px solid var(--sand-border);
  color: var(--text-medium);
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.secondary-button:hover:not(:disabled) {
  background: var(--sand-muted);
  color: var(--text-dark);
  border-color: #ccc;
}

.danger-button {
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  color: var(--danger);
}
.danger-button:hover:not(:disabled) {
  background: #fde8e8;
}

.icon-button {
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
}
.icon-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.icon-button.accent {
  background: var(--ocean-accent);
  border: 1px solid var(--ocean-light);
  color: #fff;
}
.icon-button.accent:hover:not(:disabled) {
  background: var(--ocean-light);
}
.icon-button.subtle {
  background: transparent;
  border-color: transparent;
  color: rgba(255, 255, 255, 0.6);
}
.icon-button.subtle:hover:not(:disabled) {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.button-label-compact { display: none; }

button:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

/* --- Transport Ribbon (Journey Strip) --- */
.transport-ribbon {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 20px;
  background-color: var(--basalt-900);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: #fff;
  height: 44px;
}

.transport-leg {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
}
.transport-leg.outbound {
  justify-content: flex-end;
}
.transport-direction {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 2px 5px;
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.5);
}
.transport-leg div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.transport-leg strong {
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}
.transport-leg span {
  color: rgba(255, 255, 255, 0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.transport-leg span b {
  color: #fff;
}
.transport-cabin {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.transport-manifest {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0 20px;
  height: 100%;
  font-size: 11px;
}
.transport-manifest > span {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.45);
}
.transport-manifest strong {
  color: #fff;
  white-space: nowrap;
}
.readiness-button {
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  transition: var(--transition-fast);
}
.readiness-button b {
  color: #ffd042;
}
.readiness-button:hover {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}
.readiness-button.ready {
  border-color: rgba(22, 148, 130, 0.25);
  background-color: rgba(22, 148, 130, 0.12);
}
.readiness-button.ready b {
  color: var(--mint-light);
}

/* --- Trip Strip (Day Select & Mini Stats) --- */
.trip-strip {
  position: relative;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background-color: var(--sand-muted);
  border-bottom: 1px solid var(--sand-border);
  height: 52px;
  gap: 16px;
}

.day-tabs {
  display: flex;
  gap: 4px;
  height: 100%;
  align-items: center;
}

.day-tab {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 2px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  height: 38px;
  transition: var(--transition-fast);
  text-align: left;
}
.day-tab b {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.day-tab span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}
.day-tab:hover {
  color: var(--text-dark);
}
.day-tab.active {
  background-color: var(--sand-card);
  border-color: var(--sand-border);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}
.day-tab.active b {
  color: var(--ocean-accent);
}
.day-tab.active span {
  color: var(--text-dark);
}
.day-tab.drop-target {
  background-color: rgba(21, 148, 130, 0.08);
  border-color: var(--mint-light);
}

.day-stop-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 50%;
  background-color: var(--sand-border);
  color: var(--text-medium);
  font-size: 9px;
  font-weight: 700;
  margin-left: 6px;
  font-style: normal;
}
.day-tab.active .day-stop-count {
  background-color: var(--basalt-800);
  color: #fff;
}

/* Summary Grid: Transformed into horizontal metrics */
.summary-grid {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 11px;
}

.summary-card {
  display: flex;
  align-items: center;
  gap: 6px;
}
.summary-card span {
  color: var(--text-muted);
  font-weight: 500;
}
.summary-card strong {
  color: var(--text-dark);
  font-weight: 600;
}
.summary-card:not(:last-child)::after {
  content: "";
  display: inline-block;
  width: 1px;
  height: 10px;
  background-color: var(--sand-border);
  margin-left: 16px;
}
.summary-card.danger strong {
  color: var(--danger);
}

/* --- Workspace Panels --- */
.workspace {
  display: grid;
  grid-template-columns: minmax(290px, 320px) 1fr minmax(310px, 340px);
  height: 100%;
  overflow: hidden;
  background-color: var(--sand-muted);
}

.panel {
  display: flex;
  flex-direction: column;
  background-color: var(--sand-card);
  overflow-y: auto;
  padding: 16px;
}

.itinerary-panel {
  border-right: 1px solid var(--sand-border);
}

.detail-panel {
  border-left: 1px solid var(--sand-border);
}

.bottom-sheet-handle {
  display: none;
}
.sheet-state-controls {
  display: none;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 12px;
}
.panel-header div {
  min-width: 0;
}
.panel-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.panel-header-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* Locked Checkboxes */
.route-options {
  display: flex;
  gap: 12px;
  padding: 8px 12px;
  background-color: var(--sand-muted);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 11px;
  color: var(--text-medium);
}
.route-options label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.route-options input[type="checkbox"] {
  accent-color: var(--ocean-accent);
  width: 14px;
  height: 14px;
}

.inline-alert {
  padding: 10px 12px;
  border-left: 3px solid var(--ocean-accent);
  background-color: rgba(30, 112, 173, 0.05);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 11px;
  line-height: 1.45;
  margin-bottom: 12px;
}
.inline-alert.warning {
  border-left-color: var(--warning);
  background-color: var(--warning-soft);
  color: var(--warning);
}
.inline-alert.error {
  border-left-color: var(--danger);
  background-color: var(--danger-soft);
  color: var(--danger);
}

.drag-help {
  font-size: 11px;
  color: var(--text-muted);
  margin: 2px 0 8px;
}

/* Itinerary List & Stop Cards */
.stop-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
  flex: 1;
}

.stop-card {
  position: relative;
  display: flex;
  background-color: #fff;
  border: 1px solid var(--sand-border);
  border-radius: var(--radius-md);
  transition: border var(--transition-normal), transform var(--transition-normal), box-shadow var(--transition-normal);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(18, 21, 26, 0.01);
}
.stop-card:hover {
  border-color: #c0baa8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(18, 21, 26, 0.04);
}
.stop-card.selected {
  background-color: var(--sand-muted);
  border-color: #bcb6a2;
}
.stop-card.selected::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background-color: var(--ocean-accent);
}
.stop-card.dragging {
  opacity: 0.4;
  border-style: dashed;
}
.stop-card.drag-over {
  border-color: var(--ocean-accent);
  transform: translateY(2px);
}

.stop-main {
  display: grid;
  grid-template-columns: 14px 24px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  background: transparent;
  border: none;
  text-align: left;
  flex: 1;
}

.drag-handle {
  align-self: center;
  color: #bbb;
  font-size: 14px;
  cursor: grab;
}

.sequence-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background-color: var(--basalt-800);
  color: #fff;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}
.stop-card.selected .sequence-number {
  background-color: var(--ocean-accent);
}

.stop-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.stop-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.stop-title-row strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stop-segment {
  font-size: 11px;
  color: var(--ocean-accent);
  font-weight: 500;
}
.stop-sub {
  font-size: 11px;
  color: var(--text-muted);
}
.departure-deadline {
  display: inline-block;
  font-size: 10px;
  color: var(--warning);
  background-color: var(--warning-soft);
  border: 1px solid var(--warning-border);
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 3px;
  width: fit-content;
}
.long-drive {
  color: var(--warning);
  font-weight: 700;
  margin-left: 4px;
}
.stop-poi {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.order-buttons {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  border-left: 1px solid var(--sand-border);
  background-color: rgba(0, 0, 0, 0.01);
}
.order-buttons button {
  width: 24px;
  height: 24px;
  min-height: 24px;
  border: 1px solid var(--sand-border);
  background-color: #fff;
  border-radius: 4px;
  color: var(--text-medium);
  font-size: 10px;
  font-weight: 700;
  transition: var(--transition-fast);
}
.order-buttons button:hover:not(:disabled) {
  background-color: var(--sand-muted);
  color: var(--text-dark);
}
.order-buttons button:disabled {
  opacity: 0.35;
}
.order-buttons .card-manage-button {
  width: auto;
  height: 22px;
  padding: 0 6px;
  font-size: 10px;
  background-color: var(--sand-muted);
  color: var(--text-medium);
}
.order-buttons .card-manage-button:hover {
  background-color: var(--text-muted);
  color: #fff;
}

.stop-list-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 16px;
  border: 1.5px dashed var(--sand-border);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  text-align: center;
  gap: 12px;
  background-color: rgba(255, 255, 255, 0.3);
}

.mini-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 600;
}
.mini-badge.warning {
  color: var(--warning);
  background-color: var(--warning-soft);
  border: 1px solid var(--warning-border);
}
.mini-badge.verified {
  color: var(--mint-medium);
  background-color: rgba(14, 107, 94, 0.06);
  border: 1px solid rgba(14, 107, 94, 0.15);
}
.mini-badge.ferry {
  color: var(--ocean-accent);
  background-color: rgba(30, 112, 173, 0.06);
  border: 1px solid rgba(30, 112, 173, 0.15);
}
.mini-badge.mainland-ferry {
  color: #624fa8;
  background-color: rgba(98, 79, 168, 0.06);
  border: 1px solid rgba(98, 79, 168, 0.15);
}

/* --- Map & HUD --- */
.map-panel {
  position: relative;
  z-index: 1;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
  background-color: var(--sand-muted);
}

/* Floating HUDs on Map */
.map-overlay {
  position: absolute;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--glass-shadow);
  color: var(--text-dark);
}
.map-overlay.top-left {
  top: 16px;
  left: 16px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.legend-dot.destination { background-color: var(--mint-medium); }
.legend-line {
  width: 16px;
  height: 3px;
  border-radius: 1.5px;
}
.legend-line.road { background-color: var(--ocean-accent); }
.legend-line.ferry { border-top: 3px dashed #08a4a7; background: transparent; width: 18px; }
.legend-line.mainland { border-top: 3px dashed #7c4fc3; background: transparent; width: 18px; }

.poi-zoom-status {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 1000;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg-strong);
  backdrop-filter: blur(var(--glass-blur));
  border-radius: var(--radius-md);
  padding: 5px 12px;
  box-shadow: var(--glass-shadow);
  color: var(--text-dark);
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition-fast);
}
.poi-zoom-status:hover {
  background: #fff;
  transform: translateY(-1px);
}
.poi-zoom-status .zoom-number {
  background-color: var(--basalt-800);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
}
.poi-zoom-status.mode-cluster .zoom-number,
.poi-zoom-status.mode-focus .zoom-number,
.poi-zoom-status.mode-detail .zoom-number {
  background-color: var(--mint-medium);
}

.map-loading {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--basalt-900);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Floating Timeline Panel at map bottom */
.timeline-panel {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  z-index: 1000;
  max-height: 112px;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.timeline-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-medium);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.timeline-heading span {
  color: var(--text-muted);
  text-transform: none;
  font-weight: 500;
}
.segment-timeline {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 4px;
}
.timeline-item {
  flex: 0 0 190px;
  display: flex;
  gap: 8px;
  background-color: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--sand-border);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  min-height: 52px;
  align-items: center;
}
.timeline-item.mode-udoFerry {
  border-color: rgba(8, 164, 167, 0.25);
  background-color: rgba(8, 164, 167, 0.04);
}
.timeline-index {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background-color: var(--ocean-accent);
  color: #fff;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}
.timeline-item div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.timeline-item strong {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timeline-item div > span {
  font-size: 11px;
  color: var(--ocean-accent);
  font-weight: 500;
}
.timeline-item small {
  font-size: 9px;
  color: var(--text-muted);
}
.timeline-empty {
  font-size: 11px;
  color: var(--text-muted);
  padding: 12px 0;
}

/* --- Details Panel --- */
.detail-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background-color: var(--sand-muted);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 4px;
  margin-bottom: 16px;
}
.detail-tabs button {
  background: transparent;
  border: none;
  padding: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 8px;
  transition: var(--transition-fast);
}
.detail-tabs button.active {
  background-color: #fff;
  color: var(--text-dark);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}
.detail-tab-panel {
  display: none;
}
.detail-tab-panel.active {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-meta {
  background-color: var(--sand-card);
  border: 1px solid var(--sand-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.01);
}
.detail-meta.empty-state {
  border-style: dashed;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 36px 16px;
  align-items: center;
  justify-content: center;
}
.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.detail-meta dl {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.detail-meta dl > div {
  display: grid;
  grid-template-columns: 66px 1fr;
  gap: 12px;
  font-size: 12px;
  line-height: 1.5;
  border-bottom: 1px dashed var(--sand-border);
  padding-bottom: 8px;
}
.detail-meta dl > div:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.detail-meta dt {
  color: var(--text-muted);
  font-weight: 500;
}
.detail-meta dd {
  margin: 0;
  color: var(--text-dark);
  font-weight: 500;
}
.detail-callout {
  border-left: 3px solid var(--ocean-accent);
  background-color: rgba(30, 112, 173, 0.03);
  padding: 12px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 12px;
}
.detail-callout span {
  display: block;
  font-size: 9px;
  font-weight: 700;
  color: var(--ocean-accent);
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.detail-callout p {
  margin: 0;
  color: var(--text-medium);
  line-height: 1.5;
}
.warning-text { color: var(--warning) !important; }
.error-text { color: var(--danger) !important; }

/* POI Controls */
.poi-controls, .poi-results, .food-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.poi-controls {
  background-color: var(--sand-muted);
  border: 1px solid var(--sand-border);
  border-radius: var(--radius-lg);
  padding: 14px;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.section-heading select {
  border: 1px solid var(--sand-border);
  background-color: #fff;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-medium);
}
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.category-toggle {
  cursor: pointer;
  position: relative;
}
.category-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.category-toggle span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  border: 1px solid var(--sand-border);
  background-color: #fff;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-medium);
  transition: var(--transition-fast);
}
.category-toggle input:checked + span {
  border-color: var(--category-color);
  background-color: color-mix(in srgb, var(--category-color) 8%, white);
  color: var(--category-color);
  font-weight: 600;
}

.poi-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.poi-summary > span {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: var(--sand-muted);
  color: var(--text-medium);
  border-left: 2.5px solid var(--category-color);
}
.poi-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 10px;
  align-items: center;
  background-color: #fff;
  border: 1px solid var(--sand-border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  text-decoration: none;
  color: var(--text-dark);
  transition: var(--transition-fast);
}
.poi-row:hover {
  border-color: #c0baa8;
  transform: translateY(-1px);
}
.poi-row-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background-color: var(--category-color);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}
.poi-row span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.poi-row strong {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.poi-row small {
  font-size: 10px;
  color: var(--text-muted);
}
.poi-row > b {
  font-size: 11px;
  color: var(--ocean-accent);
  font-weight: 500;
}

.food-card {
  background-color: #fff;
  border: 1px solid var(--sand-border);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 2px rgba(18, 21, 26, 0.01);
}
.food-card-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.food-card-heading div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.food-card-heading strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
}
.food-card-heading span {
  font-size: 10px;
  color: var(--text-muted);
}
.grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 700;
}
.grade-a { color: #155724; background-color: #d4edda; border: 1px solid #c3e6cb; }
.grade-b { color: #004085; background-color: #cce5ff; border: 1px solid #b8daff; }
.grade-c { color: #856404; background-color: #fff3cd; border: 1px solid #ffeeba; }
.grade-x { color: #721c24; background-color: #f8d7da; border: 1px solid #f5c6cb; }

.food-card p {
  margin: 0;
  font-size: 11px;
  color: var(--text-medium);
  line-height: 1.45;
}
.food-card-footer {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  border-top: 1px solid var(--sand-border);
  padding-top: 8px;
  margin-top: 4px;
}
.food-card-footer a {
  color: var(--ocean-accent);
  text-decoration: none;
  font-weight: 600;
}

.empty-state, .loading-state {
  padding: 24px 16px;
  border: 1.5px dashed var(--sand-border);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  background-color: rgba(255, 255, 255, 0.3);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.loading-state .spinner {
  border-color: rgba(14, 107, 94, 0.2);
  border-top-color: var(--mint-medium);
}

/* --- Dialogs --- */
.edit-dialog {
  width: min(500px, calc(100vw - 24px));
  max-height: min(720px, calc(100dvh - 24px));
  padding: 0;
  overflow-y: auto;
  border: 1px solid var(--sand-border);
  border-radius: var(--radius-lg);
  color: var(--text-dark);
  background-color: #fff;
  box-shadow: 0 24px 64px rgba(18, 22, 26, 0.18);
}
.edit-dialog::backdrop {
  background-color: rgba(13, 15, 18, 0.45);
  backdrop-filter: blur(8px);
}
.edit-dialog form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
}

.compact-dialog {
  width: min(440px, calc(100vw - 24px));
}
.add-stop-dialog {
  width: min(580px, calc(100vw - 24px));
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid var(--sand-border);
  padding-bottom: 12px;
  margin-bottom: 4px;
}
.dialog-header h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
}
.dialog-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background-color: var(--sand-muted);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 16px;
}
.dialog-close:hover {
  background-color: var(--sand-border);
  color: var(--text-dark);
}

.edit-dialog label, .search-box > label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-medium);
}
.edit-dialog input, .edit-dialog select {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--sand-border);
  border-radius: var(--radius-sm);
  background-color: var(--sand-muted);
  color: var(--text-dark);
  transition: var(--transition-fast);
}
.edit-dialog input:focus, .edit-dialog select:focus {
  outline: 2px solid var(--ocean-accent);
  background-color: #fff;
}
.coordinate-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.search-box, .dialog-section, .managed-stop-summary {
  padding: 12px;
  border: 1px solid var(--sand-border);
  border-radius: var(--radius-md);
  background-color: var(--sand-muted);
}
.search-row {
  display: flex;
  gap: 8px;
}
.search-row > :first-child {
  flex: 1;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 160px;
  overflow-y: auto;
  margin-top: 8px;
  border: 1px solid var(--sand-border);
  background-color: #fff;
  border-radius: var(--radius-sm);
}
.search-results button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--sand-border);
  width: 100%;
  text-align: left;
}
.search-results button:last-child {
  border-bottom: none;
}
.search-results button:hover {
  background-color: var(--sand-muted);
}
.search-results button strong {
  font-size: 11px;
  color: var(--text-dark);
}
.search-results button span {
  font-size: 10px;
  color: var(--text-muted);
}

.managed-stop-summary {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.managed-stop-summary strong {
  font-size: 14px;
  color: var(--text-dark);
}
.managed-stop-summary span {
  font-size: 11px;
  color: var(--text-muted);
}

.dialog-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
}
.dialog-divider::before, .dialog-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background-color: var(--sand-border);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.split-actions {
  justify-content: space-between;
}
.dialog-action-spacer {
  flex: 1;
}

/* --- Toasts --- */
.toast-region {
  position: fixed;
  z-index: 99999;
  right: 20px;
  bottom: 20px;
  display: flex;
  width: min(340px, calc(100vw - 40px));
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: #fff;
  background-color: var(--basalt-900);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  font-size: 12px;
  line-height: 1.45;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.toast.warning {
  color: var(--warning);
  background-color: var(--warning-soft);
  border-color: var(--warning-border);
}
.toast.error {
  color: var(--danger);
  background-color: var(--danger-soft);
  border-color: var(--danger-border);
}

/* --- Leaflet Map Marker Styling --- */
.stop-marker {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background-color: var(--basalt-800);
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 4px 10px rgba(18, 21, 26, 0.2);
  color: #fff;
  font-family: var(--font-sans);
  transition: transform var(--ease-spring) 0.2s, background var(--transition-fast);
}
.stop-marker b {
  transform: rotate(45deg);
  font-size: 11px;
  font-weight: 700;
}
.stop-marker i {
  display: none;
}
.stop-marker.lodging { background-color: #614fa8; }
.stop-marker.terminal { background-color: var(--ocean-accent); }
.stop-marker.island { background-color: var(--mint-medium); }
.stop-marker.selected {
  width: 38px;
  height: 38px;
  background-color: #e05e2b;
  box-shadow: 0 6px 14px rgba(224, 94, 43, 0.4);
}
.stop-marker.selected b {
  font-size: 13px;
}

.poi-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: var(--poi-color);
  color: #fff;
  border: 1.5px solid #fff;
  font-size: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.pin-pick-marker span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 2.5px solid #fff;
  border-radius: 50%;
  color: #fff;
  background-color: #f35824;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  font-size: 18px;
  font-weight: 700;
}
.pin-pick-mode {
  cursor: crosshair !important;
}

.transport-port-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 36px;
  background-color: var(--basalt-800);
  color: #fff;
  border: 2.5px solid #fff;
  border-radius: 10px 10px 10px 3px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.transport-port-marker b {
  font-size: 7px;
  letter-spacing: 0.05em;
  opacity: 0.65;
}
.transport-port-marker i {
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.leaflet-control-zoom {
  border: 1px solid var(--sand-border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06) !important;
  overflow: hidden;
}
.leaflet-control-zoom a {
  background-color: #fff !important;
  color: var(--text-dark) !important;
  border-bottom: 1px solid var(--sand-border) !important;
  transition: var(--transition-fast);
}
.leaflet-control-zoom a:hover {
  background-color: var(--sand-muted) !important;
}
.leaflet-control-attribution {
  background-color: rgba(255,255,255,0.75) !important;
  font-size: 9px !important;
  border-radius: 4px 0 0 0;
  backdrop-filter: blur(4px);
}

/* Protocol Guard overlay */
.protocol-guard {
  position: fixed;
  z-index: 99999;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at top left, rgba(21, 148, 130, 0.15), transparent 35%), var(--basalt-950);
}
.protocol-guard-card {
  width: min(500px, 100%);
  padding: 36px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  color: #eff3f6;
  background-color: var(--basalt-900);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.4);
}
.protocol-code {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--mint-light);
}
.protocol-guard-card h1 {
  font-size: 24px;
  margin: 12px 0;
}
.protocol-guard-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}
.protocol-guard-card code {
  display: block;
  margin: 20px 0;
  padding: 12px;
  border-radius: var(--radius-sm);
  background-color: #0c0e12;
  color: #fff;
  font-size: 12px;
}

/* --- Responsive Adaptations (<1100px) --- */
@media (max-width: 1100px) {
  body {
    overflow: auto;
  }
  
  .app-shell {
    display: block;
    height: auto;
    min-height: 100dvh;
  }
  
  .app-header {
    position: sticky;
    top: 0;
    z-index: 990;
    min-height: 52px;
    height: 52px;
    padding: 0 12px;
  }
  .header-actions .status-pill,
  .header-actions .subtle {
    display: none; /* Hide secondary actions on mobile header */
  }
  
  /* Ferry Ribbon as Horizontal Scroll */
  .transport-ribbon {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    height: 48px;
    padding: 0 10px;
    gap: 16px;
  }
  .transport-leg {
    min-width: 220px;
    flex: 0 0 auto;
    scroll-snap-align: start;
  }
  .transport-leg.outbound {
    justify-content: flex-start;
  }
  .transport-manifest {
    min-width: 200px;
    flex: 0 0 auto;
    border-left: none;
    border-right: none;
    padding: 0;
    scroll-snap-align: start;
  }
  .transport-cabin {
    display: none; /* Hide cabin detail in mobile ribbon */
  }

  /* Trip Strip in Mobile */
  .trip-strip {
    display: flex;
    flex-direction: column;
    height: auto;
    padding: 8px 12px;
    gap: 8px;
    align-items: stretch;
  }
  .day-tabs {
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    width: 100%;
    justify-content: flex-start;
    padding-bottom: 2px;
  }
  .day-tabs::-webkit-scrollbar {
    display: none;
  }
  .day-tab {
    flex: 0 0 auto;
    min-width: 96px;
    min-height: 40px;
    scroll-snap-align: start;
    white-space: nowrap;
  }
  .summary-grid {
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    width: 100%;
    gap: 12px;
    padding-bottom: 2px;
  }
  .summary-grid::-webkit-scrollbar {
    display: none;
  }
  .summary-card {
    flex: 0 0 auto;
    min-width: 100px;
    scroll-snap-align: start;
  }
  .summary-card::after {
    display: none !important;
  }

  /* Workspace Reflow */
  .workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 80dvh auto auto;
    height: auto;
    overflow: visible;
  }
  
  .map-panel {
    grid-row: 1;
    height: 80dvh;
    min-height: 80dvh;
  }

  /* Sticky Bottom Sheet for Itinerary Panel */
  .itinerary-panel {
    position: sticky;
    bottom: 0;
    z-index: 900;
    grid-row: 2;
    height: 48dvh;
    min-height: 0;
    overflow: hidden;
    padding: 12px 16px max(16px, env(safe-area-inset-bottom));
    border: 1px solid var(--sand-border);
    border-bottom: none;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -12px 32px rgba(18, 21, 26, 0.08);
  }
  
  .itinerary-panel[data-sheet-state="collapsed"] {
    height: 98px;
  }
  .itinerary-panel[data-sheet-state="expanded"] {
    height: calc(100dvh - 52px);
  }
  
  .itinerary-panel[data-sheet-state="collapsed"] .route-options,
  .itinerary-panel[data-sheet-state="collapsed"] .inline-alert,
  .itinerary-panel[data-sheet-state="collapsed"] .drag-help,
  .itinerary-panel[data-sheet-state="collapsed"] .stop-list {
    display: none;
  }

  /* Bottom sheet handle */
  .bottom-sheet-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 28px;
    margin-top: -8px;
    margin-bottom: 4px;
    background: transparent;
    border: none;
  }
  .bottom-sheet-handle span {
    width: 36px;
    height: 4px;
    border-radius: 99px;
    background-color: var(--sand-border);
  }

  .sheet-state-controls {
    position: absolute;
    top: 12px;
    right: 16px;
    display: flex;
    gap: 3px;
    z-index: 10;
  }
  .sheet-state-controls button {
    width: 44px;
    height: 38px;
    padding: 0;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    background-color: var(--sand-muted);
    font-size: 11px;
    font-weight: 700;
  }
  .sheet-state-controls button.active {
    color: #fff;
    background-color: var(--basalt-800);
  }

  .itinerary-panel .panel-header {
    padding-right: 100px;
  }
  .mobile-detail-button {
    display: inline-flex;
  }
  
  .stop-card {
    min-height: 106px;
  }
  .order-buttons {
    display: grid;
    grid-template-columns: repeat(2, 44px);
    grid-template-rows: repeat(2, 44px);
    gap: 4px;
    padding: 6px;
    align-content: center;
    flex-shrink: 0;
  }
  .order-buttons button {
    width: 44px;
    height: 44px;
    min-height: 44px;
  }
  .order-buttons .card-manage-button {
    grid-column: 1 / -1;
    width: 100%;
    height: 44px;
    min-height: 44px;
  }

  /* Details Panel on Mobile */
  .detail-panel {
    grid-row: 3;
    overflow: visible;
    padding: 20px 16px max(80px, calc(env(safe-area-inset-bottom) + 32px));
    border-top: 8px solid var(--sand-muted);
    border-left: none;
  }
  .detail-tabs {
    position: sticky;
    top: 50px;
    z-index: 10;
  }
  
  /* Tap Target sizes */
  .detail-tabs button,
  .category-toggle span,
  .section-heading select,
  #map .leaflet-control-zoom a,
  .poi-zoom-status {
    min-height: 44px;
  }
  
  #map .leaflet-control-zoom a {
    width: 44px !important;
    height: 44px !important;
    line-height: 44px !important;
  }
  
  .map-overlay.top-left {
    top: 12px;
    left: 12px;
  }
  .poi-zoom-status {
    top: 12px;
    right: 12px;
  }
  .timeline-panel {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
  .leaflet-bottom.leaflet-right {
    bottom: 120px !important;
  }
}

/* --- Specific Adjustments for Small Mobile (<560px) --- */
@media (max-width: 560px) {
  .app-header {
    height: 50px;
    padding: 0 10px;
  }
  .brand-mark {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
  .brand h1 {
    font-size: 13px;
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .transport-ribbon {
    height: 44px;
  }
  .transport-leg {
    min-width: 180px;
  }
  .transport-manifest {
    min-width: 160px;
  }
  
  .trip-strip {
    padding: 6px 10px;
  }
  .summary-grid {
    display: none; /* Hide summary entirely on small screens */
  }

  .itinerary-panel .panel-header h2 {
    max-width: none;
  }
  
  .button-label-wide { display: none; }
  .button-label-compact { display: inline; }
  
  .itinerary-panel .add-stop-button,
  .itinerary-panel .mobile-detail-button {
    width: 38px;
    padding: 0;
  }
  .itinerary-panel #optimize-button {
    padding: 0 10px;
  }
  
  .coordinate-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .search-row {
    flex-direction: column;
    align-items: stretch;
  }
  
  .dialog-actions {
    flex-wrap: wrap;
    gap: 6px;
  }
  .split-actions .danger-button {
    width: 100%;
  }
  .dialog-action-spacer {
    display: none;
  }
  
  .timeline-panel {
    max-height: 96px;
  }
}

/* Reduced Motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-delay: -1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    background-attachment: initial !important;
    scroll-behavior: auto !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }
  .app-header::after,
  .transport-ribbon::after,
  .timeline-panel::after,
  .edit-dialog::after {
    animation: none !important;
    display: none !important;
  }
}
