/* ===== CSS Variables ===== */
:root {
  --blue: #007AFF;
  --green: #34C759;
  --orange: #FF9500;
  --red: #FF3B30;
  --purple: #AF52DE;
  --teal: #5AC8FA;
  --indigo: #5856D6;
  --gray: #8E8E93;
  --gray2: #AEAEB2;
  --gray5: #E5E5EA;
  --gray6: #F2F2F7;
  --label: #000000;
  --secondary-label: #3C3C43CC;
  --bg: #F2F2F7;
  --card-bg: #FFFFFF;
  --separator: rgba(60,60,67,0.12);
  --tab-height: 82px;
  --top-bar-height: 52px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --label: #FFFFFF;
    --secondary-label: rgba(235,235,245,0.6);
    --bg: #000000;
    --card-bg: #1C1C1E;
    --gray5: #3A3A3C;
    --gray6: #2C2C2E;
    --separator: rgba(84,84,88,0.65);
  }
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', system-ui, sans-serif;
  background: var(--bg);
  color: var(--label);
  overflow: hidden;
  height: 100vh;
  height: -webkit-fill-available;
  height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

html {
  height: 100%;
  height: -webkit-fill-available;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: -webkit-fill-available;
  height: 100dvh;
  overflow: hidden;
}

/* ===== Top Bar ===== */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  padding-top: calc(var(--safe-top) + 8px);
  height: calc(var(--top-bar-height) + var(--safe-top));
  background: var(--card-bg);
  border-bottom: 1px solid var(--separator);
  position: relative;
  z-index: 100;
  flex-shrink: 0;
}

.top-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.4px;
  text-align: center;
  flex: 1;
}

.back-btn {
  background: none;
  border: none;
  color: var(--blue);
  cursor: pointer;
  padding: 8px;
  margin-left: -8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.top-right {
  min-width: 44px;
  display: flex;
  justify-content: flex-end;
}

/* ===== Offline Banner ===== */
.offline-banner {
  background: var(--orange);
  color: white;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 16px;
  flex-shrink: 0;
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding-bottom: 8px;
}

/* ===== Tab Bar ===== */
.tab-bar {
  display: flex;
  background: var(--card-bg);
  border-top: 1px solid var(--separator);
  padding-bottom: var(--safe-bottom);
  flex-shrink: 0;
  height: calc(var(--tab-height) + var(--safe-bottom));
}

.tab-item {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  cursor: pointer;
  color: var(--gray);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: -0.3px;
  min-height: 49px;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s;
}

.tab-item.active { color: var(--blue); }

.tab-icon {
  width: 24px;
  height: 24px;
}

/* ===== Scroll Container ===== */
.scroll-view {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===== Cards ===== */
.card {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--label);
}

.card-title svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.divider {
  height: 1px;
  background: var(--separator);
  margin: 10px 0;
}

/* ===== Info Rows ===== */
.info-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 6px 0;
  gap: 12px;
  font-size: 15px;
}

.info-label {
  color: var(--secondary-label);
  flex-shrink: 0;
  min-width: 110px;
}

.info-value {
  text-align: right;
  word-break: break-word;
  font-weight: 400;
}

.info-value a {
  color: var(--blue);
  text-decoration: none;
}

/* ===== Booking Number Row ===== */
.booking-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  gap: 8px;
  font-size: 15px;
}

.booking-label {
  color: var(--secondary-label);
  font-size: 14px;
}

.booking-value-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.booking-value {
  font-family: 'SF Mono', 'Menlo', 'Courier New', monospace;
  font-weight: 600;
  font-size: 15px;
}

.copy-btn {
  background: none;
  border: none;
  color: var(--blue);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s;
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
}

.copy-btn.copied { color: var(--green); }

/* ===== Badge ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1px;
}

.badge-blue    { background: rgba(0,122,255,0.1);  color: var(--blue); }
.badge-green   { background: rgba(52,199,89,0.1);  color: var(--green); }
.badge-orange  { background: rgba(255,149,0,0.1);  color: var(--orange); }
.badge-red     { background: rgba(255,59,48,0.1);  color: var(--red); }
.badge-purple  { background: rgba(175,82,222,0.1); color: var(--purple); }
.badge-gray    { background: var(--gray6); color: var(--gray); border: 1px solid var(--separator); }
.badge-indigo  { background: rgba(88,86,214,0.1);  color: var(--indigo); }

/* ===== Route Display ===== */
.route-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

.route-airport {
  text-align: center;
  min-width: 60px;
}

.route-code {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -1px;
}

.route-time {
  font-size: 13px;
  color: var(--secondary-label);
}

.route-middle {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
}

.route-line {
  width: 100%;
  height: 1.5px;
  background: var(--separator);
  position: relative;
}

.route-plane {
  font-size: 18px;
  transform: rotate(90deg);
  color: var(--blue);
}

.route-duration {
  font-size: 12px;
  color: var(--secondary-label);
}

/* ===== Timeline ===== */
.timeline-date-header {
  padding: 8px 16px 6px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
  border-bottom: 1px solid var(--separator);
}

.timeline-date-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--secondary-label);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.timeline-date-text.today { color: var(--blue); }

.timeline-items {
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.timeline-dot-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 4px;
  width: 12px;
  flex-shrink: 0;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.timeline-line {
  width: 2px;
  flex: 1;
  min-height: 20px;
  opacity: 0.3;
  margin-top: 2px;
}

.timeline-card {
  flex: 1;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.timeline-card-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.timeline-emoji { font-size: 22px; line-height: 1; }

.timeline-card-title {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
}

.timeline-card-time {
  font-size: 13px;
  color: var(--secondary-label);
}

.timeline-card-desc {
  font-size: 13px;
  color: var(--secondary-label);
  margin-bottom: 4px;
}

.timeline-card-note {
  font-size: 12px;
  background: var(--gray6);
  border-radius: 8px;
  padding: 6px 8px;
  color: var(--secondary-label);
  margin-top: 6px;
}

/* ===== Timeline (new) ===== */
.tl-page {
  background: var(--card-bg); /* white background like Wanderlog */
  padding-bottom: 32px;
  min-height: 100%;
}

/* ===== Timeline Toolbar ===== */
.tl-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  position: sticky;
  top: 0;
  background: var(--card-bg);
  border-bottom: 1px solid var(--separator);
  z-index: 10;
}
.tl-tb-btn {
  background: var(--gray6);
  border: none;
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--label);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.tl-tb-btn:active { opacity: 0.65; }
.tl-tb-add { background: var(--blue); color: #fff; }

/* ===== Day Header – gray bar, label aligned with time column ===== */
.tl-day-hdr {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 7px 16px 7px 8px; /* same left edge as tl-row → aligns with time column */
  background: var(--gray6);
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  gap: 6px;
}
.tl-day-hdr:active { opacity: 0.7; }

.tl-day-lbl {
  font-size: 12px;
  font-weight: 700;
  color: var(--secondary-label);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  flex: 1;
}
.tl-day-today .tl-day-lbl { color: var(--blue); }
.tl-day-meta { font-size: 12px; color: var(--gray2); font-weight: 500; }
.tl-day-chev { font-size: 11px; color: var(--gray2); }

/* ===== Event Row – 3 columns: time | icon+line | content ===== */
.tl-row {
  display: flex;
  align-items: flex-start;
  padding: 0 16px 0 8px;
}
.tl-past { opacity: 0.4; }

/* Column 1: time (right-aligned) */
.tl-time-col {
  width: 46px;
  flex-shrink: 0;
  text-align: right;
  padding-right: 10px;
  padding-top: 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--secondary-label);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.2px;
  line-height: 1.3;
  white-space: nowrap;
}

/* Column 2: blue circle icon + connecting line */
.tl-icon-col {
  width: 36px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 5px;
}
.tl-node-ic {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  z-index: 1;
}
/* Make emoji icons appear white (monochrome silhouette on blue) */
.tl-ic-emoji {
  filter: brightness(0) invert(1);
  line-height: 1;
}
/* SVG icons are already white — no filter needed */
.tl-node-ic svg { display: block; }
.tl-node-today { box-shadow: 0 0 0 4px rgba(0,122,255,0.15); }
.tl-vline {
  width: 2px;
  background: var(--blue);
  opacity: 0.22;
  flex: 1;
  min-height: 8px;
}

/* Column 3: swipeable content (flat, no card border) */
.tl-swipe-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-width: 0;
  touch-action: pan-y;
}
.tl-body {
  padding: 10px 0 18px 14px;
  min-width: 0;
  position: relative;
  will-change: transform;
}
.tl-info { min-width: 0; }
.tl-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--label);
  line-height: 1.35;
  letter-spacing: -0.2px;
}
.tl-sub { font-size: 13px; color: var(--secondary-label); line-height: 1.45; margin-top: 3px; }
.tl-sub + .tl-room-info, .tl-title + .tl-room-info { margin-top: 3px; }
.tl-room-info { font-size: 13px; color: var(--secondary-label); line-height: 1.45; }
.tl-loc { font-size: 13px; color: var(--secondary-label); margin-top: 3px; line-height: 1.4; }
.tl-warn { font-size: 13px; color: var(--orange); font-weight: 600; margin-top: 5px; }

.tl-maps {
  font-size: 13px;
  color: var(--blue);
  text-decoration: none;
  display: block;
  margin-top: 5px;
  font-weight: 500;
}
.tl-maps:active { opacity: 0.6; }
.tl-cost { font-size: 13px; color: var(--green); font-weight: 700; margin-top: 5px; }
.tl-del-btn {
  background: none; border: none; font-size: 11px; color: var(--red);
  cursor: pointer; padding: 0 3px; vertical-align: middle;
  opacity: 0.65; -webkit-tap-highlight-color: transparent;
}
.tl-edited-dot { font-size: 8px; color: var(--blue); vertical-align: super; }
.tl-route-link {
  font-size: 13px; color: var(--teal); text-decoration: none;
  display: block; margin-top: 5px; font-weight: 500;
}
.tl-route-link:active { opacity: 0.6; }

/* Swipe-to-reveal */
.tl-swipe-actions {
  position: absolute; right: 0; top: 0; bottom: 0;
  display: flex; align-items: center; gap: 4px;
  padding: 0 8px; opacity: 0; pointer-events: auto; transition: opacity 0.2s;
}
.tl-swipe-edit, .tl-swipe-reset {
  background: var(--blue); color: white; border: none;
  border-radius: 10px; width: 40px; height: 40px;
  font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.tl-swipe-reset { background: var(--orange); font-size: 16px; }
.tl-swipe-del   { background: var(--red);    font-size: 16px; color: white; border: none;
  border-radius: 10px; width: 40px; height: 40px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent; }
.tl-custom-tag {
  font-size: 10px; font-weight: 600; color: var(--teal);
  background: rgba(var(--teal-rgb, 90,200,250), 0.12);
  border-radius: 4px; padding: 1px 5px; margin-left: 5px;
  vertical-align: middle; letter-spacing: 0.2px;
}

/* Edit form */
.tl-edit-form {
  flex: 1; background: var(--card-bg);
  border-radius: 12px; padding: 14px;
  margin: 6px 0 14px 10px;
  border: 1.5px solid var(--blue); min-width: 0;
}

/* ===== Add Event Form ===== */
.tl-add-form {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 16px;
  margin: 4px 16px 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.tl-add-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--label);
}

.tl-add-row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.tl-add-inp {
  background: var(--gray6);
  border: 1px solid var(--separator);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 16px; /* 16px minimum prevents iOS Safari auto-zoom on focus */
  color: var(--label);
  font-family: -apple-system, system-ui, sans-serif;
  outline: none;
  -webkit-appearance: none;
  box-sizing: border-box;
}

.tl-add-inp:focus { border-color: var(--blue); }
.tl-add-full { display: block; width: 100%; margin-bottom: 8px; }

.tl-add-btns {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.tl-add-cancel {
  flex: 1;
  background: var(--gray6);
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--secondary-label);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tl-add-save {
  flex: 1;
  background: var(--label);
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--card-bg);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tl-add-save:active { opacity: 0.75; }


/* ===== Hotel Card ===== */
.hotel-card {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s;
}

.hotel-card:active { opacity: 0.7; }

.hotel-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.hotel-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(52,199,89,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.hotel-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  flex: 1;
}

.hotel-city {
  font-size: 13px;
  color: var(--secondary-label);
  margin-top: 2px;
}

.hotel-dates-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.hotel-date-block { text-align: center; }
.hotel-date-label { font-size: 11px; color: var(--secondary-label); font-weight: 500; }
.hotel-date-value { font-size: 16px; font-weight: 600; }
.hotel-date-time  { font-size: 12px; color: var(--secondary-label); }

.hotel-nights {
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
}

.hotel-amenities {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.amenity-chip {
  font-size: 12px;
  background: var(--gray6);
  border-radius: 20px;
  padding: 3px 8px;
  color: var(--secondary-label);
  display: flex;
  align-items: center;
  gap: 3px;
}

/* ===== Link Buttons ===== */
.link-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: var(--blue);
  padding: 10px 0;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

.link-btn .link-arrow {
  margin-left: auto;
  opacity: 0.4;
  font-size: 12px;
}

.link-btn.green { color: var(--green); }
.link-btn.orange { color: var(--orange); }
.link-btn.red { color: var(--red); }

/* ===== Phone Link ===== */
.phone-link {
  color: var(--blue);
  text-decoration: none;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  -webkit-tap-highlight-color: transparent;
}

/* ===== Checklist ===== */
.checklist-section {
  background: var(--card-bg);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.checklist-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.checklist-header-icon { font-size: 20px; }

.checklist-header-title {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
}

.checklist-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-bar {
  width: 50px;
  height: 4px;
  background: var(--gray5);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--purple);
  border-radius: 2px;
  transition: width 0.3s;
}

.progress-fill.complete { background: var(--green); }

.progress-text {
  font-size: 12px;
  color: var(--secondary-label);
  min-width: 28px;
  text-align: right;
}

.checklist-items {
  display: none;
  border-top: 1px solid var(--separator);
}

.checklist-items.open { display: block; }

.checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--separator);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s;
}

.checklist-item:last-child { border-bottom: none; }
.checklist-item:active { background: var(--gray6); }

.checklist-check {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  font-size: 22px;
  line-height: 1;
}

.checklist-item-text {
  font-size: 15px;
  flex: 1;
  line-height: 1.4;
}

.checklist-item.done .checklist-item-text {
  color: var(--secondary-label);
  text-decoration: line-through;
}

/* ===== Dashboard Quick Access ===== */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.quick-cell {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 14px 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  border: 1px solid var(--separator);
}

.quick-cell:active { opacity: 0.6; }

.quick-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray6);
  font-size: 22px;
}

.quick-label {
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  color: var(--secondary-label);
  letter-spacing: -0.1px;
}

/* ===== Traveler chip ===== */
.traveler-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--gray6);
  border: 1px solid var(--separator);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 13px;
  margin: 3px;
}

/* ===== Countdown ===== */
.countdown-block {
  text-align: center;
  padding: 8px 0;
}

.countdown-number {
  font-size: 52px;
  font-weight: 800;
  letter-spacing: -3px;
  color: var(--blue);
  line-height: 1;
}

.countdown-label {
  font-size: 14px;
  color: var(--secondary-label);
  margin-top: 4px;
}

/* ===== Map ===== */
.map-container {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.map-embed {
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: var(--gray5);
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-embed iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.map-location-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-location-item {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.map-pin-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

/* ===== Segment ===== */
.segment-block {
  border-left: 3px solid var(--blue);
  padding-left: 12px;
  margin: 8px 0;
}

.layover-block {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(255,149,0,0.1);
  border-radius: 8px;
  font-size: 13px;
  color: var(--orange);
  margin: 4px 0;
}

/* ===== Status Colors ===== */
.status-scheduled  { color: var(--blue); }
.status-onTime     { color: var(--green); }
.status-delayed    { color: var(--orange); }
.status-cancelled  { color: var(--red); }
.status-landed     { color: var(--green); }
.status-unknown    { color: var(--gray); }

/* ===== Detail View ===== */
.detail-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--secondary-label);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 16px 16px 6px;
}

/* ===== Utility ===== */
.hidden { display: none !important; }

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.text-secondary { color: var(--secondary-label); font-size: 13px; }
.text-bold { font-weight: 600; }
.font-mono { font-family: 'SF Mono', 'Menlo', monospace; }

.mt4 { margin-top: 4px; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }

/* ===== Seat Grid ===== */
.seat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}

.seat-item {
  background: var(--gray6);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}

.seat-number {
  font-size: 18px;
  font-weight: 700;
  color: var(--blue);
  font-family: 'SF Mono', monospace;
}

.seat-name { color: var(--secondary-label); font-size: 12px; }
.seat-type { color: var(--secondary-label); font-size: 11px; }

/* ===== Cancellation Warning ===== */
.cancel-warning {
  background: rgba(255,59,48,0.08);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--red);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cancel-ok {
  background: rgba(52,199,89,0.08);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--green);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== More / Settings ===== */
.settings-section {
  background: var(--card-bg);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.settings-row {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--separator);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  gap: 12px;
}

.settings-row:last-child { border-bottom: none; }
.settings-row:active { background: var(--gray6); }

.settings-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.settings-label {
  font-size: 15px;
  flex: 1;
}

.settings-arrow {
  color: var(--gray2);
  font-size: 13px;
}

/* ===== Emergency Contact ===== */
.emergency-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.emergency-name { font-size: 15px; font-weight: 600; }
.emergency-role { font-size: 13px; color: var(--secondary-label); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: calc(var(--tab-height) + var(--safe-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  white-space: nowrap;
  z-index: 999;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== Install Prompt ===== */
.install-banner {
  background: linear-gradient(135deg, var(--blue), var(--indigo));
  color: white;
  border-radius: 14px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.install-banner-text { flex: 1; }
.install-banner-title { font-size: 15px; font-weight: 600; }
.install-banner-sub { font-size: 13px; opacity: 0.85; margin-top: 2px; }

.install-dismiss {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.25s ease-out; }

/* ===== Scrollbar (Desktop) ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray5); border-radius: 2px; }

/* ===== Overlay: Lock / Import / PIN ===== */
#overlay {
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.overlay-content {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 8px;
}

.overlay-logo {
  font-size: 52px;
  margin-bottom: 10px;
  line-height: 1;
}

.overlay-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.6px;
  margin-bottom: 4px;
}

.overlay-subtitle {
  font-size: 15px;
  color: var(--secondary-label);
  margin-bottom: 32px;
}

/* PIN dots */
.pin-dots {
  display: flex;
  gap: 22px;
  margin-bottom: 8px;
}

.pin-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid var(--gray2);
  transition: all 0.15s;
}

.pin-dot.filled {
  background: var(--label);
  border-color: var(--label);
  transform: scale(1.1);
}

/* Error message under dots */
.pin-error {
  font-size: 13px;
  color: var(--red);
  height: 20px;
  margin-bottom: 4px;
  text-align: center;
}

/* PIN numpad */
.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%;
  max-width: 260px;
  margin-top: 8px;
}

.pin-key {
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--card-bg);
  border: none;
  font-size: 26px;
  font-weight: 300;
  color: var(--label);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s, transform 0.08s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 68px;
  font-family: -apple-system, system-ui, sans-serif;
  letter-spacing: -0.5px;
}

.pin-key:active {
  background: var(--gray5);
  transform: scale(0.94);
}

.pin-del { font-size: 20px; }

.pin-secondary-link {
  background: none;
  border: none;
  color: var(--secondary-label);
  font-size: 13px;
  margin-top: 28px;
  cursor: pointer;
  text-decoration: underline;
  padding: 8px 16px;
  -webkit-tap-highlight-color: transparent;
}

/* Import screen */
.import-card {
  width: 100%;
  background: var(--card-bg);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
}

.import-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  color: var(--label);
  line-height: 1.45;
}

.import-step-num {
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--label);
  color: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.import-step code {
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 11px;
  background: var(--gray6);
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
}

.import-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--label);
  color: var(--card-bg);
  border-radius: 14px;
  padding: 15px 24px;
  font-size: 16px;
  font-weight: 600;
  width: 100%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s;
  letter-spacing: -0.2px;
}

.import-btn:active { opacity: 0.75; }

/* ===== Costs Tab ===== */
.costs-page {
  display: flex;
  flex-direction: column;
}

/* Summary bar at top */
.costs-summary {
  display: flex;
  background: var(--card-bg);
  border-bottom: 1px solid var(--separator);
  padding: 14px 16px;
  gap: 0;
}

.costs-sum-block {
  flex: 1;
  text-align: center;
}

.costs-sum-val {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.costs-sum-label {
  font-size: 11px;
  color: var(--secondary-label);
  margin-top: 2px;
  font-weight: 500;
}

.costs-sum-paid .costs-sum-val { color: var(--green); }
.costs-sum-open .costs-sum-val { color: var(--orange); }

.costs-sum-sep {
  width: 1px;
  background: var(--separator);
  margin: 4px 0;
  flex-shrink: 0;
}

/* Toolbar */
.costs-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg);
}

.costs-add-btn {
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.costs-add-btn:active { opacity: 0.75; }

/* Table container */
.costs-table {
  flex: 1;
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Category group */
.costs-group {
  background: var(--card-bg);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.costs-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 8px;
  background: var(--gray6);
  border-bottom: 1px solid var(--separator);
}

.costs-group-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--secondary-label);
}

.costs-group-sum {
  font-size: 13px;
  font-weight: 600;
  color: var(--secondary-label);
}

/* Individual row */
.costs-row {
  display: flex;
  align-items: center;
  padding: 10px 12px 10px 8px;
  border-bottom: 1px solid var(--separator);
  gap: 8px;
  min-height: 52px;
}

.costs-row:last-of-type { border-bottom: none; }
.costs-row-paid { opacity: 0.55; }

.costs-status-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  min-width: 32px;
  min-height: 40px;
  justify-content: center;
}

.costs-desc {
  flex: 1;
  min-width: 0;
}

.costs-desc-text {
  font-size: 14px;
  line-height: 1.35;
  display: block;
}

.costs-row-paid .costs-desc-text {
  text-decoration: line-through;
  color: var(--secondary-label);
}

.costs-amount {
  font-size: 14px;
  font-weight: 600;
  color: var(--orange);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  min-width: 70px;
  text-align: right;
  flex-shrink: 0;
}

.costs-amount-paid {
  color: var(--green);
  text-decoration: line-through;
  text-decoration-color: var(--gray2);
}

.costs-edit-btn {
  background: none;
  border: none;
  color: var(--gray2);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  min-width: 36px;
  min-height: 40px;
  justify-content: center;
}

.costs-edit-btn:active { color: var(--blue); }

/* Subtotal row per group */
.costs-subtotal {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 6px 14px 8px;
  font-size: 12px;
  color: var(--secondary-label);
  font-style: italic;
}

/* Grand total */
.costs-grand-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card-bg);
  border-radius: 14px 14px 0 0;
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 700;
  border-bottom: 1px solid var(--separator);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.costs-grand-rows {
  background: var(--card-bg);
  border-radius: 0 0 14px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.costs-grand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--separator);
}

.costs-grand-row:last-child { border-bottom: none; }
.costs-grand-paid { color: var(--green); }
.costs-grand-open { color: var(--orange); }

/* Add/Edit forms */
.costs-add-form,
.costs-edit-form {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 0 16px 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  border: 1.5px solid var(--blue);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.costs-edit-form {
  margin: 4px 4px 4px 4px;
  border-radius: 10px;
}

.costs-form-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 2px;
}

.costs-form-inp {
  background: var(--gray6);
  border: 1px solid var(--separator);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 16px;
  color: var(--label);
  font-family: -apple-system, system-ui, sans-serif;
  outline: none;
  -webkit-appearance: none;
  width: 100%;
  box-sizing: border-box;
}

.costs-form-inp:focus { border-color: var(--blue); }

.costs-form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  cursor: pointer;
  padding: 4px 0;
}

.costs-form-check input[type=checkbox] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--green);
}

.costs-form-btns {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.costs-form-cancel {
  flex: 1;
  background: var(--gray6);
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--secondary-label);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.costs-form-save {
  flex: 1;
  background: var(--label);
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--card-bg);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.costs-form-save:active { opacity: 0.75; }

.costs-form-del {
  background: rgba(255,59,48,0.1);
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--red);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex: 0 0 auto;
  padding-left: 14px;
  padding-right: 14px;
}

