/* layout.css - Fixed Mobile Appbar Layout & Reset Button Handling */
:root {
  /* --- Typography System --- */
  --font-display: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  /* --- Geometry & Spacing --- */
  --radius: 24px;
  --radius-sm: 12px;
  --pad: 16px;
  --gap: 12px;
  
  /* --- Timeline Metrics --- */
  /* SURGICAL FIX: Updated to 600px to match config.js for 50px 5-min cards */
  --hourH: 600px;
  --appbarH: 64px;
  --ui-font-sm: 12px;
  
  /* Sticky Calculation: Appbar (64px) + Chips (Auto ~50px) */
  /* Dynamically updated by JS */
  --sticky-top-offset: 74px;

  /* --- "Air & Earth" Color Palette --- */
  --bg: #FAFAFA;
  --panel: #FFFFFF;
  --panel2: #F4F4F5;
  
  --lane: #FFFFFF;
  --laneGrid: #E2E8F0;
  
  --inputBorder: #E4E4E7;
  --chipBorder: #E4E4E7;
  
  /* --- Ink (Text) Colors --- */
  --ink: #18181B;
  --ink-dim: #71717A;
  
  /* --- Primary Brand Color --- */
  --primary-bg: #4F46E5;
  --primary-ink: #FFFFFF;
  
  /* --- Semantic Colors --- */
  --warn-bg: #FEF2F2;
  --warn-ink: #DC2626;
  --warn-border: #FECACA;

  /* --- Depth System --- */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow: var(--shadow-md);
}

* { box-sizing: border-box; }
html, body { scroll-behavior: smooth; }
.icon-lock { display: none; }
.actions-spacer { margin-right: auto; }
.read-only-warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
  padding: 8px;
  margin-bottom: 12px;
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
  font-weight: 500;
}
.pwa-update-pill {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 4000;
  background: #4F46E5;
  color: #fff;
  padding: 12px 24px;
  border-radius: 99px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4);
  font-family: system-ui, -apple-system, sans-serif;
  font-weight: 600;
  font-size: 14px;
  transition: transform 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pwa-update-pill:hover {
  transform: translateY(-1px);
}
.remote-sync-pill {
  bottom: 76px;
  background: #0F766E;
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.35);
}
.remote-sync-pill[hidden] {
  display: none;
}

body { 
  margin: 0; 
  font: 13px/1.5 var(--font-body); 
  color: var(--ink); 
  
  /* Aurora Mesh Background */
  background-color: var(--bg);
  background-image: 
    radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.08) 0px, transparent 50%), 
    radial-gradient(at 100% 0%, rgba(16, 185, 129, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
  
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app { 
  max-width: 1764px; 
  margin: 0 auto; 
  padding: 0 12px 24px; 
  overflow: visible; 
}

/* --- App Bar --- */
header.appbar {
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  gap: 12px;
  padding: 12px 16px;
  height: var(--appbarH);
  
  /* Glass Effect */
  background: rgba(255, 255, 255, 0.75); 
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  
  border-bottom: 1px solid rgba(226, 232, 240, 0.6);
  position: relative; 
  
  /* FIX: Z-Index Hierarchy Update (Layer 3) */
  /* Must be above chips (110) and day headers (100) */
  z-index: 120;
}

.appbar-left, .appbar-right { display: flex; align-items: center; gap: 8px; }
.label-mobile { display: none; }
.label-desktop { display: inline; }

@media (min-width: 901px) {
  header.appbar {
    align-items: center;
    height: auto;
    min-height: var(--appbarH);
    padding: 10px 16px;
  }

  .appbar-left {
    flex: 0 0 auto;
    min-width: auto;
    gap: 8px;
    padding-top: 0;
  }

  .appbar-right {
    flex: 1 1 auto;
    max-width: none;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .pill-input.name {
    flex: 0 0 248px;
    width: 248px;
    min-width: 248px;
    max-width: 248px;
  }

  #dtStart,
  #dtEnd {
    flex: 0 0 154px;
    width: 154px;
  }

  .appbar-right .btn {
    min-height: 32px;
    padding: 0 16px;
  }

  .appbar-right .btn.icon-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
  }

  #btnLock {
    order: 0;
    flex-basis: auto;
    margin: 0;
  }
}

/* --- Inputs (Pills) --- */
.pill-input {
  appearance: none; 
  background: var(--panel); 
  color: var(--ink);
  border: 1px solid var(--inputBorder); 
  border-radius: 999px; 
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: 13px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}
.pill-input.name { flex-grow: 1; min-width: 180px; font-weight: 600; }
.pill-input::-webkit-calendar-picker-indicator { filter: none; opacity: 0.5; }
.pill-input:focus { 
  outline: none;
  border-color: var(--primary-bg);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* --- Buttons --- */
.btn {
  appearance: none; 
  border: 1px solid transparent; 
  background: var(--panel);
  color: var(--ink);
  padding: 8px 16px; 
  border-radius: 999px; 
  cursor: pointer; 
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  background: #ffffff;
}
.btn:active { 
  transform: translateY(0); 
  box-shadow: var(--shadow-sm);
}

.btn#btnBooking { 
  background: var(--primary-bg); 
  color: var(--primary-ink); 
  border-color: transparent; 
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}
.btn#btnBooking:hover { background: #4338ca; }

.btn.warn { 
  background: var(--warn-bg); 
  border-color: var(--warn-border); 
  color: var(--warn-ink); 
}
.btn.icon-btn { 
  padding: 0; 
  width: 36px; 
  height: 36px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  border-radius: 50%;
}
#btnLock {
  color: var(--ink);
}
#btnLock svg {
  display: block;
  color: inherit;
}
#btnLock.is-locked {
  color: var(--primary-bg);
  background: rgba(79, 70, 229, 0.08);
  border-color: rgba(79, 70, 229, 0.18);
}
#btnLock.is-locked:hover {
  background: rgba(79, 70, 229, 0.12);
}

.btn.square {
  width: 36px; height: 36px; 
  padding: 0; 
  display: inline-flex; 
  align-items: center; 
  justify-content: center;
}

.btn-subtle {
  appearance: none; 
  background: transparent; 
  border: 1px dashed var(--inputBorder);
  color: var(--ink-dim); 
  padding: 8px 12px; 
  border-radius: var(--radius-sm); 
  font-size: 12px;
  font-weight: 500;
  cursor: pointer; 
  width: 100%; 
  text-align: left;
  transition: all 0.2s ease;
}
.btn-subtle:hover { 
  background: var(--panel2); 
  border-style: solid; 
  color: var(--ink);
}

/* --- Chips Bar --- */
#chips-sticky-wrapper {
  position: sticky;
  top: 0; 
  /* FIX: Z-Index Hierarchy Update (Layer 3) */
  /* Must be above Day Head (100) but below Appbar (120) if overlapping */
  z-index: 110; 
}
#chips {
  position: relative;
  background: rgba(255, 255, 255, 0.8); 
  border-bottom: 1px solid rgba(226, 232, 240, 0.6); 
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: padding 0.2s ease-in-out;
  padding-bottom: 12px;
}
#chips-inner-wrap {
  display: flex; 
  flex-wrap: wrap; 
  justify-content: center; 
  gap: 8px;
  transition: all 0.2s ease-in-out;
  max-height: 500px;
  overflow: hidden;
  padding: 12px 12px 0 12px;
}
body.chips-collapsed #chips { padding-bottom: 0; }
body.chips-collapsed #chips-inner-wrap { max-height: 0; padding-top: 0; padding-bottom: 0; }

#chipsToggle,
#chipsTopBtn { 
  position: absolute;
  bottom: -18px;
  z-index: 26;
  background: var(--panel);
  border: 1px solid var(--chipBorder);
  width: 36px; height: 36px;
  box-shadow: var(--shadow-md);
}
#chipsToggle {
  right: 16px;
}
#chipsTopBtn {
  left: 16px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
body.show-chip-top-btn #chipsTopBtn {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
#chipsToggle svg { transition: transform 0.2s ease-in-out; }
body.chips-collapsed #chipsToggle svg { transform: rotate(180deg); }

#chips button {
  appearance: none; 
  border: 1px solid transparent; 
  background: var(--panel2); 
  color: var(--ink-dim); 
  padding: 6px 12px; 
  border-radius: 999px; 
  cursor: pointer; 
  font-weight: 500;
  font-size: 12px;
  transition: all 0.2s ease;
}
#chips button:hover { 
  background: var(--panel); 
  border-color: var(--chipBorder); 
  color: var(--ink); 
  box-shadow: var(--shadow-sm); 
} 
#chips button:active { transform: scale(0.98); }

/* UX FIX: Active State for "Today" Chip */
#chips button.is-today {
  background: var(--primary-bg);
  color: #ffffff;
  border-color: var(--primary-bg);
  font-weight: 600;
  box-shadow: var(--shadow-md);
}
#chips button.is-today:hover {
  background: #4338ca; /* Slightly darker brand color */
  color: #ffffff;
}

/* --- Grid System --- */
#grid-wrapper { padding-top: 0; }

.grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fill, 420px); 
  justify-content: center; 
  gap: 20px; 
  margin-top: 20px;
}

.day { 
  background: var(--panel); 
  border: 1px solid transparent;
  border-radius: var(--radius); 
  box-shadow: var(--shadow-lg); 
  min-width: 0; 
  scroll-margin-top: 0; 
  overflow: visible; 
  position: relative; 
}

/* --- Day Header --- */
.dayHead { 
  padding: 12px 16px;
  display: flex; 
  flex-direction: column; 
  gap: 8px;
  position: sticky;
  top: var(--sticky-top-offset);
  
  /* FIX: Z-Index Hierarchy Update (Layer 3) */
  /* Must be above Cards (10-90) but below Chips (110) */
  z-index: 100;
  
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  
  border-bottom: 1px solid var(--inputBorder);
  
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 4px 20px -10px rgba(0,0,0,0.1);
}
.dayHead * { font-family: var(--font-display); }

.dayHead .dh-row1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dh-date-wrap { display: flex; align-items: baseline; gap: 6px; flex-shrink: 0; }
.dayHead .dh-date { font-weight: 700; font-size: 14px; letter-spacing: -0.02em; color: var(--ink); }
.dayHead .dh-weekday { font-weight: 500; color: var(--ink-dim); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.dayHead .dh-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.dayHead .btn-day-move {
  min-width: 58px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(79, 70, 229, 0.18);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(238,242,255,0.92));
  color: var(--primary-bg);
  box-shadow: 0 14px 26px -22px rgba(79, 70, 229, 0.52);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
}
.dayHead .btn-day-move:hover { transform: translateY(-1px); }
.dayHead .btn-day-move.is-paste-target {
  border-color: rgba(15, 118, 110, 0.2);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(236,253,245,0.96));
  color: #0f766e;
}
.dayHead .btn-day-move.is-cancel {
  border-color: rgba(180, 83, 9, 0.24);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,247,237,0.96));
  color: #b45309;
}
.dayHead.is-day-move-source {
  box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.18), 0 4px 20px -10px rgba(0,0,0,0.1);
}
.dayHead.is-day-move-target {
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.12), 0 4px 20px -10px rgba(0,0,0,0.1);
}

.dayHead .dh-locs { 
  display: flex; 
  align-items: center; 
  gap: 6px; 
  min-width: 0; 
}

/* FIX: Ensure input-with-chip containers align consistently */
.dayHead .input-with-chip {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.dh-input { 
  background: var(--panel2); 
  color: var(--ink); 
  border: 1px solid transparent; 
  border-radius: 8px; 
  padding: 6px 10px; 
  font-family: var(--font-body);
  font-size: 12px;
  transition: all 0.2s ease;
  flex: 1;
  min-width: 0;
}
.dh-input:focus { background: #fff; border-color: var(--primary-bg); outline: none; }
.dh-input::placeholder { color: var(--ink-dim); opacity: 0.7; }
.dh-arrow { 
  color: var(--ink-dim); 
  font-size: 10px; 
  flex-shrink: 0;
  align-self: center;
}

.dayHead .dh-costs {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  column-gap: 8px;
  margin-top: 6px;
}
.dh-costs > * { line-height: 1.2; }
.cost-graphic-badge {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--cost-accent, var(--primary-bg));
  background:
    radial-gradient(circle at 28% 24%, rgba(255,255,255,0.98), rgba(255,255,255,0) 54%),
    linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.56)),
    var(--cost-surface, rgba(79, 70, 229, 0.12));
  border: 1px solid var(--cost-edge, rgba(79, 70, 229, 0.22));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 12px 24px -18px var(--cost-glow, rgba(79, 70, 229, 0.18));
}
.cost-graphic-badge svg {
  width: 14px;
  height: 14px;
  display: block;
}
.cost-graphic-badge.is-compact {
  width: 22px;
  height: 22px;
  background:
    radial-gradient(circle at 30% 26%, rgba(255,255,255,0.92), rgba(255,255,255,0) 48%),
    linear-gradient(180deg, var(--cost-accent), color-mix(in srgb, var(--cost-accent) 72%, #ffffff));
  border-color: color-mix(in srgb, var(--cost-accent) 55%, #ffffff);
  color: #fff;
  box-shadow: 0 10px 18px -14px var(--cost-glow, rgba(79, 70, 229, 0.2));
}
.cost-graphic-badge.is-compact svg {
  width: 12px;
  height: 12px;
}
.cost-graphic-badge.is-large {
  width: 38px;
  height: 38px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.92), 0 18px 28px -20px var(--cost-glow, rgba(79, 70, 229, 0.2));
}
.cost-graphic-badge.is-large svg {
  width: 18px;
  height: 18px;
}
.cost-graphic-chip {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 6px;
  min-width: 0;
  padding: 2px 8px 2px 2px;
  border: 1px solid color-mix(in srgb, var(--cost-accent) 24%, rgba(15,23,42,0.08));
  border-radius: 999px;
  white-space: nowrap;
  color: var(--ink);
  background: linear-gradient(135deg, color-mix(in srgb, var(--cost-surface) 180%, #ffffff) 0%, rgba(255,255,255,0.96) 58%, rgba(255,255,255,0.9) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.92), 0 12px 22px -20px var(--cost-glow, rgba(15,23,42,0.2));
}
.cost-graphic-chip-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 17px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cost-accent, var(--primary-bg));
  background: color-mix(in srgb, var(--cost-surface) 235%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--cost-accent) 20%, #ffffff);
}
.cost-graphic-chip-value {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--ink);
}
.dh-costs .tot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-weight: 700;
  color: var(--primary-bg);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(238,242,255,0.92));
  border: 1px solid rgba(79, 70, 229, 0.16);
  box-shadow: 0 14px 26px -22px rgba(79, 70, 229, 0.52);
  font-size: 11px;
  white-space: nowrap;
  margin-top: 1px;
}
.dh-spend-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-width: 0;
  align-content: flex-start;
}
.dh-spend-breakdown .cost-graphic-chip {
  flex: 0 0 calc(33% - 8px);
  justify-content: flex-start;
}
.dh-costs .btn-add-spend {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(24, 24, 27, 0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(244,244,245,0.9));
  box-shadow: 0 14px 28px -22px rgba(24, 24, 27, 0.5);
  color: var(--ink);
}
.dh-costs .btn-add-spend svg {
  width: 14px;
  height: 14px;
}
.dh-costs .btn-add-spend:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 30px -22px rgba(24, 24, 27, 0.58);
}

/* --- Lanes & Grid --- */
.lanes { 
  position: relative; 
  height: calc(24 * var(--hourH)); 
  background: var(--lane);
}

.lanes .h { 
  position: absolute; left: 0; right: 0; height: 1px; 
  border-top: none; 
  background-image: radial-gradient(circle, var(--laneGrid) 1px, transparent 1px);
  background-size: 8px 1px;
  background-repeat: repeat-x;
  opacity: 0.8;
}

.lanes .label { 
  position: absolute; left: 12px; top: 0; transform: translateY(-50%); 
  font: 10px/1 var(--font-body); 
  font-weight: 600;
  color: var(--ink-dim); 
  opacity: 0.6;
  background: var(--panel); 
  padding-right: 4px;
}

/* --- Current Time Indicator --- */
.current-time-bar {
  position: absolute;
  left: 0; right: 0; height: 2px;
  background-color: var(--warn-ink);
  /* FIX: Z-Index Update. Above cards (10-89), below Headers */
  z-index: 90;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.3);
}
.current-time-bar::before {
  content: '';
  position: absolute; left: -5px; top: -3px;
  width: 8px; height: 8px; border-radius: 50%;
  background-color: var(--warn-ink);
  box-shadow: 0 0 0 2px #fff;
}

/* --- Confirmation Modal --- */
.confirm-overlay {
  position: fixed; inset: 0; 
  background: rgba(0,0,0,0.4); 
  backdrop-filter: blur(4px); 
  -webkit-backdrop-filter: blur(4px);
  z-index: 2999; 
  display: flex; 
  align-items: center; 
  justify-content: center;
  opacity: 1; transition: opacity 0.3s ease;
}

.confirm-modal {
  background: var(--panel); 
  padding: 24px; 
  border-radius: var(--radius); 
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  width: 90%; 
  max-width: 380px; 
  text-align: center; 
}
.confirm-modal p { margin: 0 0 20px; font-size: 16px; line-height: 1.5; color: var(--ink); }

/* --- General Modals --- */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); backdrop-filter: blur(2px); z-index: 1000; opacity: 0; transition: opacity 0.2s ease; }
.modal.open { display: block; opacity: 1; }
.modal .sheet { 
  position: absolute; top: 80px; left: 50%; transform: translateX(-50%) translateY(10px); 
  width: 720px; max-width: calc(100% - 32px); 
  background: var(--panel); 
  color: var(--ink); 
  border-radius: var(--radius); 
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
  display: flex; flex-direction: column; 
  max-height: calc(100vh - 140px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal.open .sheet { transform: translateX(-50%) translateY(0); }

.modal .hdr { 
  padding: 16px 24px; 
  font-family: var(--font-display);
  font-size: 18px; 
  font-weight: 700; 
  border-bottom: 1px solid var(--inputBorder); 
  flex-shrink: 0; 
  display: flex;
  align-items: center;
}
.modal .body { 
  padding: 0; 
  display: flex; flex-direction: column;
  overflow: hidden; flex: 1 1 auto;
}

/* --- Tabs --- */
.modal-tabs {
  display: flex; flex-shrink: 0; gap: 20px;
  padding: 0 24px;
  border-bottom: 1px solid var(--inputBorder);
  background: var(--panel);
}
.modal-tabs button.modal-tab-btn {
  appearance: none; border: none; background: transparent;
  padding: 12px 0;
  font-family: var(--font-body);
  font-size: 13px; font-weight: 500;
  color: var(--ink-dim);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}
.modal-tabs button.modal-tab-btn:hover { color: var(--ink); }
.modal-tabs button.modal-tab-btn.active {
  color: var(--primary-bg);
  border-bottom-color: var(--primary-bg);
  font-weight: 600;
}

.modal-tab-content {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px 24px;
  background: #fff;
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* Form Elements */
.modal label { 
  font-family: var(--font-body);
  font-size: 12px; 
  color: var(--ink-dim); 
  font-weight: 600; 
  margin-bottom: 4px; 
  display: block;
}

/* FIX: Strict height enforcement for pixel-perfect alignment */
.modal input, .modal select {
  width: 100%; 
  background: var(--panel2); 
  border: 1px solid transparent; 
  color: var(--ink); 
  border-radius: var(--radius-sm); 
  padding: 0 12px; /* Reset vertical padding */
  height: 38px; /* Strict Height */
  line-height: normal; /* Reset line-height */
  outline: none; 
  font-family: var(--font-body);
  font-size: 14px; 
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.modal textarea { 
  width: 100%; 
  background: var(--panel2); 
  border: 1px solid transparent; 
  color: var(--ink); 
  border-radius: var(--radius-sm); 
  padding: 10px 12px; 
  outline: none; 
  font-family: var(--font-body);
  font-size: 14px; 
  line-height: 1.5;
  transition: all 0.2s ease;
  min-height: 80px; 
}

.modal input:focus, .modal select:focus, .modal textarea:focus {
  background: #fff;
  border-color: var(--primary-bg);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.modal input:disabled, .modal select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--panel2);
}

.modal .row { margin-bottom: 16px; }
.modal .actions { 
  padding: 16px 24px; 
  border-top: 1px solid var(--inputBorder); 
  display: flex; justify-content: flex-end; gap: 12px; 
  flex-shrink: 0; background: var(--panel);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* --- Global Input with Chip Component --- */
.input-with-chip { position: relative; width: 100%; }
.input-with-chip input { width: 100%; padding-right: 40px; }
.input-with-chip.map-chip-hidden input { padding-right: 8px; }
.input-with-chip .chip { 
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); 
  width: 28px; height: 28px; border-radius: 50%; 
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; 
  background: rgba(0,0,0,0.04); color: var(--ink-dim); border: 1px solid transparent;
  transition: all 0.2s ease; padding: 0;
}
.input-with-chip .chip:hover { background: var(--primary-bg); color: #fff; }
.input-with-chip .chip[hidden] { display: none; }
.input-with-chip:has(> .chip[hidden]) input { padding-right: 8px; }
.input-with-chip .chip-icon::before {
  content: '';
  width: 14px;
  height: 14px;
  display: block;
  background-color: currentColor;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
}
.chip-icon-route-map::before,
.input-with-chip .chip-icon-map::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 20 3 17V4l6 3m0 13 6-3m-6 3V7m6 10 6 3V7l-6-3m0 13V4M9 7l6-3' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 20 3 17V4l6 3m0 13 6-3m-6 3V7m6 10 6 3V7l-6-3m0 13V4M9 7l6-3' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.chip-icon-route-map::before {
  content: '';
  width: 15px;
  height: 15px;
  display: block;
  background-color: currentColor;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
}
.input-with-chip .chip-icon-link::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-4M14 4h6m0 0v6m0-6L10 14' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-4M14 4h6m0 0v6m0-6L10 14' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.modal-grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.modal-grid-two > div {
  min-width: 0;
}
.modal-grid-two.modal-grid-two-balanced {
  gap: 12px;
  align-items: start;
}
.modal-grid-two.modal-grid-two-balanced > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.modal-grid-two-compact {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--compact-gap, 8px);
}
.modal-grid-two-compact > div {
  min-width: 0;
}
.modal-grid-three {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.modal-grid-three > div {
  min-width: 0;
}

/* --- Special Grids --- */
.perday-triple {
  display: grid; 
  grid-template-columns: 1fr 1fr 1fr; 
  gap: 8px;
}

/* Per-Day Times section layout.
   #perDayCompact is a 3-column grid matching .perday-triple exactly.
   Row 1: label in col 1 (centered) — same column as Luggage Drop.
   Row 2: .perday spanning all 3 cols, which contains the control row
   and triple using the same 1fr 1fr 1fr rhythm. */
#perDayCompact {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  align-items: start;
}

#perDayCompact > label {
  grid-column: 1;
  grid-row: 1;
  text-align: left;
  margin-left: calc(36px + 4px); /* skip < button + nav gap to align with select */
  margin-bottom: 4px;
}

#perDayCompact > .perday {
  grid-column: 1 / -1;
  grid-row: 2;
}

.per-day-control-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.per-day-nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}
.per-day-control-row select {
  flex-grow: 1;
}
.per-day-nav-group select {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

/* Control row: flex so Apply to all days sits immediately after >. */
#perDayCompact .per-day-control-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

#perDayCompact .per-day-nav-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  min-width: 0;
}

#perDayCompact .per-day-nav-group select {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

/* --- Spend Modal --- */
#spendModal .spend-sheet { width: 360px; max-width: 90vw; border-radius: 20px; }
.spend-display { font-family: var(--font-display); font-size: 40px; font-weight: 700; color: var(--ink); background: var(--panel2); padding: 16px; border-radius: 16px; text-align: center; letter-spacing: -0.03em; }

/* --- Global Utilities --- */
.toast-notice {
  font-family: var(--font-body);
  font-weight: 500;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-lg);
  position: fixed; bottom: 20px; left: 50%;
  transform: translate(-50%, 100px);
  padding: 12px 24px; border-radius: 999px;
  font-size: 14px; z-index: 3000; opacity: 0;
  transition: all 0.4s cubic-bezier(0.21, 1.02, 0.73, 1);
}
.toast-notice.visible { transform: translate(-50%, 0); opacity: 1; }

.confirm-modal p { font-size: 16px; color: var(--ink); }

/* --- Mobile Overrides --- */
@media (max-width: 900px){
  #app { padding: 0; }
  #grid-wrapper { padding: 8px; }
  
  header.appbar { 
    padding: 12px; 
    flex-wrap: wrap; 
    height: auto; 
    min-height: var(--appbarH);
    gap: 12px;
  }

  .appbar-left {
    width: 100%;
    flex-wrap: wrap;
  }
  
  .pill-input.name {
    width: 100%;
    min-width: 0;
    margin-bottom: 8px;
  }
  
  #dtStart, #dtEnd {
    flex: 1;
    min-width: 0;
  }
  
  .appbar-right {
    width: 100%;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    margin-top: 8px;
    gap: 4px;
  }
  
  /* Hide scrollbar for horizontal scroll if triggered */
  .appbar-right::-webkit-scrollbar { display: none; }
  
  .appbar-right .btn {
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
    font-size: 11px;
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .appbar-right .btn.icon-btn {
    width: 32px;
    min-width: 32px;
    padding: 0;
  }

  #btnBooking {
    padding: 0 10px;
  }

  .label-desktop { display: none; }
  .label-mobile { display: inline; }
  
  /* Optional: Hide Reset button on very small screens if needed, or just let it scroll */
  /* #btnReset { display: none; } */ 
}
@media (max-width: 560px){
  .grid { padding: 0; grid-template-columns: 1fr; gap: 0; }
  .day { border-radius: 0; border: none; box-shadow: none; margin-bottom: 8px; border-bottom: 1px solid var(--inputBorder); }
  .dayHead .dh-date { font-size: 16px; }
  .dayHead { padding: 10px 12px; }
  .dayHead .btn-day-move { min-width: 52px; min-height: 30px; padding: 0 10px; font-size: 10px; }
  .dh-spend-breakdown {
    gap: 4px 5px;
  }
  .dayHead .dh-costs {
    grid-template-columns: minmax(62px, auto) minmax(0, 1fr) 28px;
    column-gap: 5px;
  }
  .dh-spend-breakdown .cost-graphic-chip-label {
    min-width: 25px;
    height: 16px;
    padding: 0 4px;
    font-size: 8.5px;
    letter-spacing: 0.035em;
  }
  .dh-spend-breakdown .cost-graphic-chip-value {
    font-size: 10px;
  }
  .cost-graphic-badge.is-compact { width: 18px; height: 18px; }
  .cost-graphic-badge.is-compact svg { width: 10px; height: 10px; }
}

@media (pointer: coarse) and (min-width: 380px) and (max-width: 460px) {
  .dayHead .dh-date { font-size: 17px; }
  .dayHead .dh-weekday { font-size: 13px; }
  .dh-input { font-size: 13px; }
  .dh-arrow { font-size: 11px; }
  .dayHead .btn-day-move { font-size: 11px; }
  .dh-spend-breakdown .cost-graphic-chip-value { font-size: 10px; }
}

@media (max-width: 560px){
  #actModal .sheet, #bookModal .sheet { width: 100% !important; border-radius: 20px 20px 0 0; }
}



.itinerary-export-sheet {
  max-width: min(560px, calc(100vw - 32px));
}
.itinerary-export-content {
  display: grid;
  gap: 14px;
}
.itinerary-export-summary {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(238,242,255,0.92));
  border: 1px solid rgba(79, 70, 229, 0.14);
  box-shadow: 0 18px 32px -28px rgba(79, 70, 229, 0.24);
  color: var(--ink-dim);
  font-size: 13px;
  line-height: 1.55;
}
.itinerary-export-summary strong {
  color: var(--ink);
  font-size: 14px;
}
.itinerary-export-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.itinerary-export-list {
  display: grid;
  gap: 10px;
  max-height: min(52vh, 520px);
  overflow-y: auto;
  padding-right: 4px;
}
.itinerary-export-day {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.95));
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 18px 30px -28px rgba(15, 23, 42, 0.28);
  cursor: pointer;
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.itinerary-export-day:hover {
  border-color: rgba(79, 70, 229, 0.2);
  box-shadow: 0 20px 34px -28px rgba(79, 70, 229, 0.24);
  transform: translateY(-1px);
}
.itinerary-export-day:focus-visible {
  outline: none;
  border-color: rgba(79, 70, 229, 0.28);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12), 0 20px 34px -28px rgba(79, 70, 229, 0.24);
}
.itinerary-export-day.is-selected {
  border-color: rgba(79, 70, 229, 0.26);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08), 0 22px 36px -30px rgba(79, 70, 229, 0.26);
}
.itinerary-export-check {
  appearance: auto;
  -webkit-appearance: checkbox;
  accent-color: var(--primary-bg);
  margin-top: 0;
  width: 18px !important;
  min-width: 18px;
  height: 18px !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 4px !important;
  background: transparent !important;
  box-shadow: none !important;
  flex: 0 0 auto;
  justify-self: start;
  align-self: center;
}
.itinerary-export-day-info {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.itinerary-export-day-title {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
}
.itinerary-export-day-route {
  display: block;
  font-size: 12px;
  color: var(--ink-dim);
  line-height: 1.5;
  word-break: break-word;
}
.itinerary-export-day-meta {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 20px;
  width: fit-content;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.08);
  color: var(--primary-bg);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
@media (max-width: 768px) {
  .itinerary-export-sheet {
    max-width: min(100vw - 20px, 560px);
  }
  .itinerary-export-list {
    max-height: min(56vh, 460px);
  }
  .itinerary-export-day {
    padding: 12px 13px;
    border-radius: 16px;
  }
}







/* --- Day Header Luggage Strip --- */
.dayHead .dh-luggage-wrap { margin-top: 8px; }
.dayHead .dh-luggage-wrap:empty { display: none; }
.dh-luggage { width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 8px 10px; border-radius: 18px; border: 1px solid rgba(226, 232, 240, 0.92); background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(248,250,252,0.88)); box-shadow: 0 16px 28px -28px rgba(15, 23, 42, 0.32); cursor: pointer; text-align: left; }
.dh-luggage:hover { transform: translateY(-1px); box-shadow: 0 18px 30px -28px rgba(79, 70, 229, 0.28); }
.dh-luggage.is-empty { justify-content: flex-start; gap: 8px; }
.dh-luggage-empty-copy { font-size: 10px; font-weight: 600; color: var(--ink-dim); }
.dh-luggage-group { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.dh-luggage-kicker { font-size: 9px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-dim); }
.dh-luggage-token-row { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.luggage-token { --luggage-accent: #4F46E5; min-width: 30px; height: 22px; display: inline-flex; align-items: center; justify-content: center; padding: 0 8px; border-radius: 999px; font-size: 10px; font-weight: 700; letter-spacing: 0.02em; color: color-mix(in srgb, var(--luggage-accent) 78%, black); background: color-mix(in srgb, var(--luggage-accent) 12%, white); border: 1px solid color-mix(in srgb, var(--luggage-accent) 28%, white); box-shadow: inset 0 1px 0 rgba(255,255,255,0.84); }
.luggage-token.is-arriving { box-shadow: 0 0 0 3px color-mix(in srgb, var(--luggage-accent) 16%, white), inset 0 1px 0 rgba(255,255,255,0.84); }
.luggage-token.is-forwarding { background: linear-gradient(180deg, color-mix(in srgb, var(--luggage-accent) 16%, white), color-mix(in srgb, var(--luggage-accent) 10%, white)); }
.luggage-token.is-transit { background: rgba(255,255,255,0.94); border-style: dashed; }
@media (max-width: 560px) { .dayHead .dh-luggage-wrap { margin-top: 6px; } .dh-luggage { gap: 6px 8px; padding: 7px 8px; border-radius: 16px; } .dh-luggage-group { gap: 5px; } .dh-luggage-kicker { font-size: 8px; } .luggage-token { min-width: 28px; height: 20px; padding: 0 7px; font-size: 9px; } }

/* --- Mobile Luggage Strip And Picker Refinements --- */
@media (max-width: 560px) {
    .dh-luggage-kicker {
        font-size: 9px;
    }

    .luggage-token {
        min-width: 32px;
        height: 22px;
        padding: 0 8px;
        font-size: 10px;
        letter-spacing: 0.02em;
    }
}

.luggage-picker-sheet {
    overflow: hidden;
}

.luggage-picker-list {
    max-height: min(46vh, 360px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding-right: 4px;
}

@media (max-width: 768px) {
    .luggage-picker-list {
        max-height: min(44vh, 340px);
    }
}


.modal-tab-content {
  position: relative;
}

.modal .kind-transport-only {
  position: relative;
}

.transport-route-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}

.transport-endpoint {
  min-width: 0;
}

.transport-label-row {
  position: relative;
  display: block;
}

.transport-label-row input {
  width: 100%;
  min-width: 0;
  padding-right: 42px;
}
.transport-label-row input::placeholder,
.transport-label-row input::-webkit-input-placeholder {
  color: var(--ink-dim);
  -webkit-text-fill-color: var(--ink-dim);
  opacity: 1;
}

.transport-location-row input::placeholder,
.transport-location-row input::-webkit-input-placeholder {
  color: var(--ink-dim);
  -webkit-text-fill-color: var(--ink-dim);
  opacity: 1;
}


.transport-place-trigger {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(15, 23, 42, 0.04);
  color: var(--ink-dim);
  padding: 0;
}

.transport-place-trigger:hover {
  background: var(--primary-bg);
  color: var(--primary-ink);
}

.transport-place-trigger::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 7h16M4 12h16M4 17h16' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 7h16M4 12h16M4 17h16' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.transport-location-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.transport-location-cell {
  min-width: 0;
}

.transport-location-spacer {
  width: 100%;
  min-height: 65px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 1px;
}

.transport-route-map-btn {
  appearance: none;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--inputBorder);
  background: var(--panel);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.transport-route-map-btn:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
}

.transport-route-map-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent);
  outline-offset: 2px;
}

.transport-location-row {
  width: 100%;
}
.transport-location-row input {
  width: 100%;
  min-width: 0;
  padding-right: 46px;
}
.transport-swap-col {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 2px;
}

.transport-swap-btn {
  appearance: none;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--inputBorder);
  background: var(--panel);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.transport-swap-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.transport-swap-btn:focus-visible {
  outline: none;
  border-color: var(--primary-bg);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.transport-swap-icon {
  display: block;
  font-size: 18px;
  line-height: 1;
}

.transport-place-picker {
  position: absolute;
  z-index: 35;
  min-width: 280px;
  max-width: 360px;
  max-height: 260px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--inputBorder);
  border-radius: 16px;
  background: rgba(255,255,255,0.96);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.transport-place-picker[data-empty="true"] {
  pointer-events: none;
}

.transport-place-empty {
  padding: 14px 12px;
  border-radius: 12px;
  background: var(--panel2);
  color: var(--ink-dim);
  font-size: 12px;
  text-align: center;
  pointer-events: none;
}

.transport-place-row {
  appearance: none;
  width: 100%;
  display: block;
  text-align: left;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.transport-place-row:hover,
.transport-place-row:focus-visible {
  background: #f5f7ff;
}

.transport-place-row:focus {
  outline: none;
}

.transport-place-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.transport-place-meta,
.transport-place-location {
  font-size: 12px;
  color: var(--ink-dim);
}

.transport-place-location {
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.transport-place-trigger::before {
  content: '';
  width: 14px;
  height: 14px;
  display: block;
  background-color: currentColor;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
}


.journey-group-only {
  position: relative;
}

.journey-group-editor {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0) 44%),
    linear-gradient(180deg, rgba(240, 253, 250, 0.94), rgba(248, 250, 252, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 12px 30px -28px rgba(15, 23, 42, 0.3);
}

.journey-group-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.journey-group-editor-titleblock {
  display: grid;
  gap: 5px;
  min-width: 0;
  flex: 1 1 240px;
}

.journey-group-editor-head label {
  margin: 0;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.journey-group-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  flex: 0 0 auto;
}

.journey-group-editor-actions .btn-subtle {
  width: auto;
  min-width: 0;
  min-height: 36px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(226, 232, 240, 0.96);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.94));
  color: var(--ink);
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 10px 22px -22px rgba(15, 23, 42, 0.36);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.journey-group-editor-actions .btn-subtle:hover {
  background: linear-gradient(180deg, rgba(255,255,255,1), rgba(241,245,249,0.96));
  border-color: rgba(148, 163, 184, 0.55);
  color: var(--ink);
  transform: translateY(-1px);
  box-shadow: 0 14px 26px -22px rgba(15, 23, 42, 0.42);
}

.journey-group-editor-actions .btn-subtle:focus-visible {
  outline: none;
  border-color: rgba(13, 148, 136, 0.45);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.16), 0 14px 26px -22px rgba(15, 23, 42, 0.42);
}

.journey-group-editor-help {
  margin: 0;
  max-width: 44ch;
  color: var(--ink-dim);
  font-size: 12px;
  line-height: 1.45;
}

.journey-route-planner {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(120, 113, 108, 0.22);
  border-radius: 16px;
  background:
    radial-gradient(circle at top left, rgba(251, 191, 36, 0.13), transparent 34%),
    linear-gradient(135deg, rgba(255, 251, 235, 0.94), rgba(248, 250, 252, 0.96));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.82), 0 16px 34px -30px rgba(51, 65, 85, 0.42);
}

.journey-route-planner-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.journey-route-planner-head strong {
  display: block;
  color: var(--ink);
}

.journey-route-planner-head p {
  margin: 4px 0 0;
  color: var(--ink-dim);
  font-size: 12px;
  line-height: 1.4;
  max-width: 62ch;
}

.journey-route-planner-badge {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 999px;
  color: #9a3412;
  background: rgba(255, 237, 213, 0.94);
  border: 1px solid rgba(249, 115, 22, 0.18);
  font-size: 11px;
  font-weight: 700;
}

.journey-route-planner textarea {
  width: 100%;
  min-height: 118px;
  resize: vertical;
  color: var(--ink);
  background: rgba(255,255,255,0.92);
  border-color: rgba(148, 163, 184, 0.42);
}

.journey-route-planner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.journey-route-planner-actions .btn-subtle {
  flex: 0 0 auto;
  width: auto;
  padding: 7px 12px;
}

.journey-route-planner-status {
  min-height: 18px;
  color: var(--ink-dim);
  font-size: 12px;
}

.journey-route-planner-results {
  display: grid;
  gap: 10px;
}

.journey-route-planner-board {
  display: grid;
  grid-template-columns: minmax(190px, 0.62fr) minmax(340px, 1.72fr);
  gap: 12px;
  align-items: start;
  padding: 10px;
  border-radius: 16px;
  background: rgba(241, 245, 249, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.24);
  container-type: inline-size;
}

.journey-route-option-list {
  display: grid;
  gap: 9px;
  min-width: 0;
  max-height: 720px;
  overflow: auto;
  padding: 6px 6px 6px 0;
  border-right: 1px solid rgba(100, 116, 139, 0.22);
}

.journey-route-detail-panel {
  position: sticky;
  top: 0;
  display: grid;
  gap: 10px;
  min-width: 0;
  min-height: 180px;
  padding: 6px;
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.74);
}

.journey-route-detail-empty {
  padding: 18px;
  border-radius: 16px;
  border: 1px dashed rgba(14, 116, 144, 0.24);
  background: rgba(255,255,255,0.72);
  color: var(--ink-dim);
  font-size: 13px;
  line-height: 1.45;
}

.journey-route-detail-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(100, 116, 139, 0.24);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.98)),
    rgba(255,255,255,0.96);
  box-shadow: 0 18px 34px -30px rgba(15, 23, 42, 0.46);
}

.journey-route-detail-workspace-head,
.journey-route-detail-selection {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(241, 245, 249, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.journey-route-detail-workspace-title,
.journey-route-detail-selection-title {
  color: #0f172a;
}

.journey-route-detail-workspace-copy {
  color: var(--ink-dim);
  font-size: 12px;
  line-height: 1.45;
}

.journey-route-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid rgba(100, 116, 139, 0.2);
  background: rgba(248, 250, 252, 0.82);
}

.journey-route-detail-action-copy {
  color: var(--ink-dim);
  font-size: 12px;
}

.journey-route-repair-banner {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(59, 130, 246, 0.22);
  background: rgba(239, 246, 255, 0.9);
}

.journey-route-repair-banner.is-derived {
  border-color: rgba(16, 185, 129, 0.2);
  background: rgba(236, 253, 245, 0.86);
}

.journey-route-repair-copy {
  color: var(--ink-dim);
  font-size: 12px;
  line-height: 1.45;
}

.journey-route-repair-actions,
.journey-route-transfer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.journey-route-candidate {
  display: grid;
  gap: 7px;
  padding: 10px 11px;
  border: 1px solid rgba(100, 116, 139, 0.18);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.96));
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.journey-route-candidate:hover {
  transform: translateY(-1px);
  border-color: rgba(20, 184, 166, 0.32);
  box-shadow: 0 12px 24px -24px rgba(15, 23, 42, 0.42);
}

.journey-route-candidate.is-selected {
  cursor: default;
  border-color: rgba(15, 118, 110, 0.78);
  background:
    linear-gradient(135deg, rgba(240, 253, 250, 0.96), rgba(255,255,255,0.98)),
    rgba(255,255,255,0.98);
  box-shadow:
    0 0 0 4px rgba(20, 184, 166, 0.18),
    0 0 0 1px rgba(15, 118, 110, 0.42) inset,
    0 18px 34px -28px rgba(15, 23, 42, 0.48);
}

.journey-route-candidate.is-selected::after {
  content: "Selected";
  justify-self: start;
  margin-top: 2px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.14);
  color: #0f766e;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.journey-route-candidate-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.journey-route-candidate-title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.journey-route-candidate-title strong {
  color: var(--ink);
}

.journey-route-candidate-meta {
  color: var(--ink-dim);
  font-size: 12px;
}

.journey-route-risk {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.journey-route-risk.is-safe {
  color: #166534;
  background: rgba(220, 252, 231, 0.9);
}

.journey-route-risk.is-adjusted {
  color: #155e75;
  background: rgba(207, 250, 254, 0.92);
}

.journey-route-risk.is-tight {
  color: #92400e;
  background: rgba(254, 243, 199, 0.92);
}

.journey-route-risk.is-unsafe {
  color: #991b1b;
  background: rgba(254, 226, 226, 0.94);
}

.journey-route-risk.is-unknown,
.journey-route-risk.is-draft {
  color: #475569;
  background: rgba(226, 232, 240, 0.9);
}

.journey-route-mode-chain,
.journey-route-transfer-list,
.journey-route-segment-list,
.journey-route-timeline {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.journey-route-mode-pill {
  padding: 4px 8px;
  border-radius: 999px;
  color: #334155;
  background: rgba(226, 232, 240, 0.86);
  border: 1px solid rgba(100, 116, 139, 0.16);
  font-size: 11px;
  font-weight: 700;
}

.journey-route-candidate .journey-route-mode-chain {
  flex-direction: row;
  flex-wrap: wrap;
}

.journey-route-candidate .journey-route-mode-pill {
  max-width: 100%;
  color: #0f766e;
  background: rgba(204, 251, 241, 0.78);
  border-color: rgba(13, 148, 136, 0.18);
}

.journey-route-segment {
  flex: 1 1 auto;
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.3);
  font-size: 12px;
  box-shadow: 0 8px 20px -22px rgba(15, 23, 42, 0.42);
}

.journey-route-segment strong {
  color: var(--ink);
}

.journey-route-segment span {
  color: var(--ink-dim);
}

.journey-route-segment-buffer {
  padding: 5px 7px;
  border-radius: 9px;
  color: #9a3412 !important;
  background: rgba(255, 237, 213, 0.82);
  border: 1px solid rgba(249, 115, 22, 0.18);
  font-weight: 700;
}

.journey-route-duration-override {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 7px;
  border-radius: 9px;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid rgba(100, 116, 139, 0.2);
  color: #334155;
  font-weight: 700;
}

.journey-route-duration-override input {
  width: 58px;
  min-height: 28px;
  padding: 3px 6px;
  border-radius: 8px;
  border: 1px solid rgba(13, 148, 136, 0.24);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.journey-route-segment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.journey-route-segment-actions .btn-subtle {
  justify-self: start;
  padding: 5px 8px;
  font-size: 11px;
}

.journey-route-transfer {
  flex: 1 1 auto;
  display: grid;
  gap: 6px;
  padding: 9px 10px 9px 18px;
  border-radius: 12px;
  background: rgba(255, 247, 237, 0.94);
  border: 1px solid rgba(245, 158, 11, 0.28);
  font-size: 12px;
  position: relative;
}

.journey-route-transfer.is-inline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: -7px;
  bottom: -7px;
  width: 3px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.46);
}

.journey-route-transfer[data-rating="unsafe"] {
  background: rgba(254, 226, 226, 0.72);
  border-color: rgba(239, 68, 68, 0.24);
}

.journey-route-transfer[data-rating="unsafe"]::before {
  background: rgba(239, 68, 68, 0.58);
}

.journey-route-transfer[data-rating="adjusted"] {
  background: rgba(240, 253, 250, 0.92);
  border-color: rgba(13, 148, 136, 0.26);
}

.journey-route-transfer[data-rating="adjusted"]::before {
  background: rgba(13, 148, 136, 0.58);
}

.journey-route-transfer-stop-preview {
  background: rgba(239, 246, 255, 0.94);
  border-color: rgba(59, 130, 246, 0.24);
}

.journey-route-transfer-stop-preview::before {
  background: rgba(59, 130, 246, 0.52);
}

.journey-route-transfer-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.journey-route-transfer-leg {
  font-weight: 600;
  color: #111827;
}

.journey-route-transfer-leg-meta,
.journey-route-transfer-summary,
.journey-route-transfer-search-note,
.journey-route-transfer-search-path {
  color: var(--ink-dim);
  line-height: 1.45;
}

.journey-route-transfer-search-path {
  font-weight: 600;
}

.journey-route-search-start-time {
  display: block;
  margin-bottom: 2px;
}

.journey-route-transfer .btn-subtle {
  justify-self: start;
}

.journey-route-detail-placeholder {
  padding: 10px;
  border-radius: 12px;
  border: 1px dashed rgba(100, 116, 139, 0.28);
  color: var(--ink-dim);
  background: rgba(248, 250, 252, 0.76);
  font-size: 12px;
}

@media (max-width: 1180px) {
  .journey-route-planner-board {
    grid-template-columns: 1fr;
  }

  .journey-route-option-list {
    max-height: none;
    overflow: visible;
  }

  .journey-route-detail-panel {
    position: static;
  }
}

@container (max-width: 560px) {
  .journey-route-planner-board {
    grid-template-columns: 1fr;
  }

  .journey-route-option-list {
    max-height: 260px;
    overflow: auto;
    padding: 0 0 10px;
    border-right: 0;
    border-bottom: 1px solid rgba(100, 116, 139, 0.22);
  }

  .journey-route-detail-panel {
    position: static;
  }
}

.journey-group-editor-list {
  display: grid;
  gap: 10px;
}

.journey-empty-state {
  padding: 12px;
  border: 1px dashed var(--inputBorder);
  border-radius: 12px;
  color: var(--ink-dim);
  font-size: 12px;
  background: rgba(255,255,255,0.72);
}

.journey-editor-empty {
}

.journey-editor-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  background: rgba(255,255,255,0.92);
}

.journey-editor-row-top {
  display: grid;
  grid-template-columns: minmax(0, 170px) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.journey-editor-row-route {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.journey-editor-row input,
.journey-editor-row select {
  width: 100%;
  color: var(--ink) !important;
  -webkit-text-fill-color: var(--ink) !important;
  caret-color: var(--ink);
  color-scheme: light;
  opacity: 1;
}


.journey-editor-row .transport-label-row input:placeholder-shown,
.journey-editor-row .transport-location-row input:placeholder-shown {
  color: var(--ink-dim) !important;
  -webkit-text-fill-color: var(--ink-dim) !important;
}

.journey-editor-row .transport-location-row input {
  padding-right: 58px;
}

.journey-editor-row .transport-label-row input::placeholder,
.journey-editor-row .transport-label-row input::-webkit-input-placeholder,
.journey-editor-row .transport-location-row input::placeholder,
.journey-editor-row .transport-location-row input::-webkit-input-placeholder {
  color: var(--ink-dim) !important;
  -webkit-text-fill-color: var(--ink-dim) !important;
  opacity: 1;
}

.journey-editor-row label.field.field-inline {
  display: grid;
  gap: 4px;
  height: auto;
  margin: 0;
  overflow: visible;
}

.journey-editor-row .field-label {
  display: block;
  margin: 0;
  font-size: 11px;
  color: var(--ink-dim);
}

.journey-editor-field {
  display: grid;
  gap: 4px;
}

.journey-editor-field label {
  margin: 0;
  font-size: 11px;
  color: var(--ink-dim);
}

.journey-editor-row-timing {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.journey-editor-time-single input {
  min-width: 0;
}

.journey-editor-actions {
  display: inline-flex;
  align-items: end;
  gap: 8px;
  justify-self: end;
}

.journey-editor-row .btn-subtle {
  align-self: end;
}
.journey-editor-route-fields,
.journey-editor-location-fields {
  width: 100%;
}
.journey-editor-route-fields .transport-endpoint,
.journey-editor-location-fields .transport-location-cell {
  min-width: 0;
}
.journey-editor-location-fields .input-with-chip {
  width: 100%;
}
.journey-editor-route-fields .transport-label-row input,
.journey-editor-location-fields input {
  width: 100%;
  min-width: 0;
}
.journey-editor-row input[readonly][data-derived-timing="true"] {
  background: rgba(15, 23, 42, 0.05);
  color: var(--ink-dim) !important;
  -webkit-text-fill-color: var(--ink-dim) !important;
  caret-color: transparent;
  cursor: default;
}
.journey-editor-row-top {
  grid-template-columns: minmax(0, 170px) minmax(0, 1fr) auto;
}


.journey-editor-row.is-segment-active {
  border-color: rgba(99, 102, 241, 0.28);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(245,247,255,0.96));
}

.journey-editor-row.is-segment-active + .journey-segment-details-panel {
  margin-top: -2px;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

.journey-segment-details-panel {
  display: grid;
  scroll-margin-block: 120px;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.94));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.75);
}

.journey-segment-details-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.journey-segment-details-head > div {
  min-width: 0;
  flex: 1 1 auto;
}

.journey-segment-details-head strong {
  display: block;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.journey-segment-details-head p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-dim);
}


.journey-segment-details-tabs {
  margin-top: 2px;
}

.journey-segment-details-content {
  display: grid;
  gap: 12px;
}

.journey-segment-tab-pane {
  display: none;
}

.journey-segment-tab-pane.active {
  display: block;
}

.journey-segment-tab-pane .row + .row {
  margin-top: 12px;
}

.journey-segment-details-route-fields,
.journey-segment-details-location-fields {
  margin-top: 0;
}

.journey-segment-details-grid-booking {
  align-items: end;
}

.journey-segment-details-panel .modal-tab-btn {
  font-size: 13px;
}

.journey-segment-details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.journey-segment-details-grid > div,
.journey-segment-details-notes {
  display: grid;
  gap: 4px;
}

.journey-segment-details-grid label,
.journey-segment-details-notes label {
  margin: 0;
  font-size: 11px;
  color: var(--ink-dim);
}

.journey-segment-details-footnote {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}

.journey-segment-details-actions {
  display: flex;
  justify-content: flex-end;
}

.journey-segment-details-btn,
.journey-segment-details-close {
  white-space: nowrap;
}

.journey-segment-details-close {
  flex: 0 0 auto;
  width: auto;
  min-width: 84px;
  padding-inline: 14px;
}


.journey-segment-details-supplements {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.journey-segment-details-checklist,
.journey-segment-details-docs {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  padding: 12px;
}

.journey-segment-details-checklist > .btn-subtle {
  width: auto;
}

.journey-segment-details-docs > label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-dim);
  margin-bottom: 8px;
}

.journey-segment-details-docs .btn,
.journey-segment-details-checklist .btn {
  width: auto;
}






/* journey segment placeholders intentionally reuse the shared transport placeholder contract above */


