:root {
  --sidebar-w: 288px;
  --color-bg: #fff7ef;
  --color-bg-2: #ffeadf;
  --color-card: #ffffff;
  --color-border: #f1e3d3;
  --color-border-strong: #e6d3bd;
  --color-text: #2a2230;
  --color-muted: #8a7e74;
  --color-accent: #f97056;       /* sunset coral */
  --color-accent-2: #14b8a6;     /* ocean teal */
  --color-accent-3: #fbbf24;     /* sunshine yellow */
  --color-accent-4: #a855f7;     /* twilight purple */
  --shadow-sm: 0 1px 2px rgba(72, 49, 28, 0.06);
  --shadow: 0 2px 6px rgba(72, 49, 28, 0.08), 0 1px 2px rgba(72, 49, 28, 0.04);
  --shadow-lg: 0 8px 24px rgba(72, 49, 28, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC",
               "Microsoft JhengHei", sans-serif;
  background: linear-gradient(135deg, var(--color-bg) 0%, var(--color-bg-2) 100%);
  background-attachment: fixed;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
}

/* ── sidebar ───────────────────────────────────────── */
.sidebar {
  background: linear-gradient(180deg, #2a2238 0%, #1a1626 100%);
  color: #e6e8ef;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-3), var(--color-accent-2));
}
.sidebar-header {
  padding: 18px 16px 8px;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 16px; letter-spacing: 0.5px;
}
.sidebar-brand .bi {
  color: var(--color-accent-3);
  font-size: 22px;
  filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.4));
}
.sidebar-brand strong {
  background: linear-gradient(90deg, var(--color-accent-3), var(--color-accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sidebar-add-row {
  display: flex;
  gap: 6px;
  margin: 4px 12px 8px;
}

.sidebar-add {
  flex: 1;
  background: linear-gradient(135deg, var(--color-accent) 0%, #f9854d 100%);
  border: 0;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(249, 112, 86, 0.35);
  transition: transform 120ms, box-shadow 120ms;
}
.sidebar-add:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(249, 112, 86, 0.45);
  background: linear-gradient(135deg, #fa6849 0%, #f9854d 100%);
}

.sidebar-add-friend {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #e8e1f3;
  font-weight: 600;
  padding: 0 10px;
  transition: background 120ms, border-color 120ms, transform 120ms;
}
.sidebar-add-friend:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.32);
  color: #fff;
  transform: translateY(-1px);
}

.sidebar-section-label {
  padding: 12px 16px 4px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #a89dbb;
  font-weight: 600;
}

.sidebar-list { flex: 1; overflow-y: auto; padding: 0 8px 16px; min-height: 0; }

.sidebar-photo {
  flex-shrink: 0;
  width: 100%;
  position: relative;
  line-height: 0;
}
.sidebar-photo img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 55vh;
  object-fit: cover;
  object-position: center bottom;
}
.sidebar-photo::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 48px;
  background: linear-gradient(180deg, rgba(26, 22, 38, 0.95) 0%, rgba(26, 22, 38, 0) 100%);
  pointer-events: none;
}
.sidebar-item {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: #c8c1d8;
  text-decoration: none;
  margin-bottom: 4px;
  transition: background 120ms, transform 120ms;
  border-left: 3px solid transparent;
}
.sidebar-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  transform: translateX(2px);
}
.sidebar-item.is-active {
  background: linear-gradient(90deg, rgba(249, 112, 86, 0.22), rgba(251, 191, 36, 0.08));
  color: #fff;
  border-left-color: var(--color-accent);
}
.sidebar-item-title {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 78px;  /* keep title from sliding under the 3 action buttons */
}
.sidebar-item-meta { font-size: 11px; color: #a89dbb; margin-top: 2px; }
.sidebar-empty { padding: 12px 16px; font-size: 12px; color: #a89dbb; }
.sidebar-section-label--shared {
  margin-top: 14px;
  color: var(--color-accent-2);
}
.sidebar-item--shared { padding-right: 78px; /* leave room for the 3 action btns */ }
.sidebar-item-origin {
  font-size: 10.5px;
  margin-top: 4px;
  color: var(--color-accent-2);
  letter-spacing: 0.2px;
}
.sidebar-item-origin .bi { font-size: 10px; margin-right: 2px; }
.sidebar-item-origin strong { color: #fff; font-weight: 600; }

.sidebar-item-wrap {
  position: relative;
}
.sidebar-item-edit-btn,
.sidebar-item-delete-btn,
.sidebar-item-share-btn {
  position: absolute;
  top: 8px;
  background: transparent;
  border: 0;
  color: #a89dbb;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 120ms, background 120ms, color 120ms;
}
.sidebar-item-share-btn  { right: 6px; }
.sidebar-item-delete-btn { right: 32px; }
.sidebar-item-edit-btn   { right: 58px; }
.sidebar-item-wrap:hover .sidebar-item-edit-btn,
.sidebar-item-wrap:hover .sidebar-item-delete-btn,
.sidebar-item-wrap:hover .sidebar-item-share-btn {
  opacity: 0.9;
}
.sidebar-item-edit-btn:hover,
.sidebar-item-share-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  opacity: 1;
}
.sidebar-item-delete-btn:hover {
  background: rgba(220, 53, 69, 0.25);
  color: #ff9b9b;
  opacity: 1;
}
.sidebar-item--editing {
  cursor: text;
}
.sidebar-item-title-input {
  width: 100%;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  background: #fff;
  border: 1px solid var(--color-accent);
  border-radius: 4px;
  padding: 4px 8px;
  outline: none;
}
.sidebar-item-title-input:focus {
  box-shadow: 0 0 0 3px rgba(249, 112, 86, 0.25);
}

/* ── main ──────────────────────────────────────────── */
.main {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
#itinerary,
.react-itinerary-mount {
  flex: 1;
  display: flex;
  min-height: 0;
  min-width: 0;
  padding: 0 16px 16px;  /* no top padding — calendar sits flush under the tab strip */
}
.topbar {
  padding: 18px 24px;
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between;
  position: relative;
}
.topbar::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-3) 50%, var(--color-accent-2));
  opacity: 0.85;
}
.topbar.topbar--slim {
  padding: 4px 20px 0;
  align-items: flex-end;
  background: transparent;
  border-bottom: 0;
}
.topbar.topbar--slim::after { display: none; }
.topbar.topbar--slim .schedule-tabs {
  margin-top: 0;
  border-bottom: 0;
}
.topbar-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.topbar-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.3px;
}
.topbar-meta {
  font-size: 12px;
  color: var(--color-muted);
  margin-top: 4px;
  font-weight: 500;
}
.topbar-main {
  flex: 1;
  min-width: 0;
}

/* ── schedule tabs ────────────────────────────────── */
.schedule-tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  margin: 0;
  padding: 6px 12px 0;
  position: relative;
  z-index: 50;  /* above the React calendar's sticky elements (cal-corner z:30) */
  border-bottom: 1px solid var(--color-border-strong);
}
/* Right-side button group: 復原 · 取消復原 · 新增航班 (rightmost). */
.schedule-tabs-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  margin-bottom: 4px;
  align-self: flex-end;
}
.schedule-tabs-action {
  height: 34px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--color-border-strong);
  background: var(--color-card);
  color: var(--color-text);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms, color 120ms, transform 120ms, box-shadow 120ms;
  white-space: nowrap;
  line-height: 1;
}
.schedule-tabs-action:hover:not(:disabled) {
  background: var(--color-bg-2);
  color: var(--color-accent);
  transform: translateY(-1px);
}
.schedule-tabs-action:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.schedule-tabs-action .bi { font-size: 14px; }
.schedule-tabs-action-kbd {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(42, 34, 48, 0.08);
  color: var(--color-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 600;
}
.schedule-tabs-action--flight {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.35);
}
.schedule-tabs-action--flight:hover:not(:disabled) {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.5);
}
/* Legacy class (.schedule-tabs-undo-btn) kept so old test selectors / app.js
   query still resolve — visually identical to .schedule-tabs-action. */
.schedule-tabs-undo-btn { /* defined where the old block was */ }
.schedule-tab-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 22px;
  min-width: 120px;
  background: linear-gradient(180deg, rgba(241, 227, 211, 0.55) 0%, rgba(241, 227, 211, 0.35) 100%);
  border: 1px solid var(--color-border-strong);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  margin-bottom: -1px;  /* sit 1px over the calendar's top border for the "tab attached to ST" look */
  font-size: 15px;
  font-weight: 600;
  transition: background 140ms, transform 140ms;
  isolation: isolate;
}
.schedule-tab-wrap:hover {
  background: linear-gradient(180deg, rgba(255, 234, 223, 0.95) 0%, rgba(255, 234, 223, 0.7) 100%);
  transform: translateY(-1px);
}
.schedule-tab-wrap.is-active {
  background: var(--color-card);
  box-shadow:
    0 -4px 12px rgba(42, 34, 48, 0.06),
    inset 0 -1px 0 var(--color-card);  /* erase calendar's top border under this tab */
  z-index: 6;
}
.schedule-tab-wrap.is-active::before {
  content: "";
  position: absolute;
  inset: 0 14px auto 14px;
  height: 3px;
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-3) 50%, var(--color-accent-2));
  border-radius: 2px;
}
.schedule-tab {
  color: var(--color-muted);
  text-decoration: none;
  font-weight: 600;
  padding: 2px 0;
  letter-spacing: 0.3px;
  font-size: 15px;
}
.schedule-tab-wrap.is-active .schedule-tab {
  color: var(--color-accent);
  font-weight: 700;
}
.schedule-tab-input {
  font-size: 15px;
  border: 1px solid var(--color-accent);
  border-radius: 5px;
  padding: 3px 8px;
  outline: none;
  background: var(--color-card);
  color: var(--color-text);
  width: 140px;
  font-weight: 600;
}
.schedule-tab-edit-btn,
.schedule-tab-delete-btn {
  background: transparent;
  border: 0;
  color: var(--color-muted);
  padding: 3px 6px;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms, background 120ms, color 120ms;
}
.schedule-tab-wrap:hover .schedule-tab-edit-btn,
.schedule-tab-wrap:hover .schedule-tab-delete-btn,
.schedule-tab-wrap.is-active .schedule-tab-edit-btn,
.schedule-tab-wrap.is-active .schedule-tab-delete-btn {
  opacity: 0.85;
}
.schedule-tab-edit-btn:hover {
  background: var(--color-bg-2);
  color: var(--color-text);
  opacity: 1;
}
.schedule-tab-delete-btn:hover {
  background: rgba(220, 53, 69, 0.18);
  color: #b85050;
  opacity: 1;
}
.schedule-tab-add {
  align-self: flex-end;
  margin-left: 4px;
  margin-bottom: 4px;
  background: transparent;
  border: 1.5px dashed var(--color-border-strong);
  color: var(--color-muted);
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 120ms, border-color 120ms, background 120ms;
}
.schedule-tab-add:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: var(--color-bg-2);
}

/* popover menu next to a schedule tab (修改名稱 / 刪除副本) */
.schedule-tab-popover {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  z-index: 100;  /* above .cal-corner (z:30) so popover isn't clipped by the React calendar */
  background: var(--color-card);
  border: 1px solid var(--color-border-strong);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(42, 34, 48, 0.16);
  padding: 4px;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.schedule-tab-popover-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: transparent;
  border: 0;
  border-radius: 5px;
  text-align: left;
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
}
.schedule-tab-popover-item:hover { background: var(--color-bg-2); }
.schedule-tab-popover-item--danger { color: #b85050; }
.schedule-tab-popover-item--danger:hover { background: rgba(220, 53, 69, 0.12); }
.schedule-tab-popover-item--disabled {
  color: var(--color-muted);
  cursor: default;
  font-size: 12px;
  padding: 7px 12px;
}

/* ── sidebar user (logged-in info) ─────────────────── */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  margin: 4px 0 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  font-size: 11px;
  color: #c8c1d8;
}
.sidebar-user-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.sidebar-user-name strong {
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}
.sidebar-user-email {
  font-size: 11px;
  color: #a89dbb;
}
.sidebar-user-logout {
  color: #a89dbb;
  text-decoration: none;
  padding: 2px 6px;
  border-radius: 4px;
}
.sidebar-user-logout:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* ── realtime collaboration toast (top-right fade-in) ─ */
#travelerToasts {
  position: fixed;
  top: 70px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
  max-width: 360px;
}
.traveler-toast {
  background: var(--color-card);
  border-left: 4px solid var(--color-accent-2);
  padding: 10px 14px 10px 12px;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(42, 34, 48, 0.18),
              0 2px 6px rgba(42, 34, 48, 0.08);
  font-size: 13px;
  line-height: 1.4;
  color: var(--color-text);
  opacity: 0;
  transform: translateX(28px);
  transition: opacity 320ms ease-out, transform 320ms ease-out;
  pointer-events: auto;
  word-break: break-word;
}
.traveler-toast--show {
  opacity: 1;
  transform: translateX(0);
}
.traveler-toast strong {
  color: var(--color-accent-2);
  font-weight: 700;
  margin-right: 4px;
}

/* ── auth login page ───────────────────────────────── */
.auth-page {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 200;
  background:
    radial-gradient(circle at 20% 20%, rgba(251, 191, 36, 0.22) 0%, transparent 50%),
    radial-gradient(circle at 85% 75%, rgba(20, 184, 166, 0.18) 0%, transparent 50%),
    linear-gradient(135deg, #fff7ef 0%, #ffeadf 50%, #ffd6c2 100%);
  overflow: hidden;
}
.auth-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.auth-emoji {
  position: absolute;
  user-select: none;
  opacity: 0.22;
  filter: saturate(1.2);
  animation: auth-float 9s ease-in-out infinite alternate;
}
.auth-emoji.emoji-1 { top: 8%;  left: 10%; font-size: 72px; transform: rotate(-12deg); animation-delay: 0s;   }
.auth-emoji.emoji-2 { top: 22%; right: 9%; font-size: 60px; transform: rotate(18deg);  animation-delay: 1.5s; }
.auth-emoji.emoji-3 { bottom: 18%; left: 7%; font-size: 64px; transform: rotate(8deg); animation-delay: 0.8s; }
.auth-emoji.emoji-4 { top: 65%; right: 14%; font-size: 56px; transform: rotate(-10deg); animation-delay: 2.2s; }
.auth-emoji.emoji-5 { top: 12%; left: 48%; font-size: 52px; transform: rotate(6deg);  animation-delay: 3s;   }
.auth-emoji.emoji-6 { bottom: 8%; right: 28%; font-size: 50px; transform: rotate(-4deg); animation-delay: 1.2s; }
.auth-emoji.emoji-7 { top: 50%; left: 5%; font-size: 46px; transform: rotate(14deg); animation-delay: 2.6s; }
.auth-emoji.emoji-8 { bottom: 35%; right: 5%; font-size: 48px; transform: rotate(-16deg); animation-delay: 0.4s; }
@keyframes auth-float {
  from { translate: 0 0;       }
  to   { translate: 0 -14px;   }
}

.auth-card {
  position: relative;
  background: var(--color-card);
  border-radius: 22px;
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  box-shadow:
    0 32px 80px rgba(42, 34, 48, 0.18),
    0 6px 20px rgba(42, 34, 48, 0.08);
  z-index: 1;
}
.auth-hero {
  position: relative;
  width: 100%;
  height: 168px;
  overflow: hidden;
  background: linear-gradient(135deg, #f97056 0%, #fbbf24 50%, #14b8a6 100%);
}
.auth-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.auth-hero-fade {
  position: absolute;
  inset: auto 0 0 0;
  height: 50%;
  background: linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.18) 100%);
  pointer-events: none;
}
.auth-hero--no-image { /* fallback when image fails — gradient already visible */ }

.auth-body {
  padding: 0 32px 28px;
  text-align: center;
}
.auth-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: -36px auto 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 5px solid var(--color-card);
  box-shadow: 0 6px 18px rgba(249, 112, 86, 0.30);
  position: relative;
  z-index: 2;
  font-size: 30px;
  color: var(--color-accent);
}
.auth-title {
  font-size: 26px;
  margin: 4px 0 4px;
  font-weight: 700;
  letter-spacing: 0.4px;
}
.auth-title strong {
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-tagline {
  color: var(--color-muted);
  font-size: 13px;
  margin: 0 0 22px;
  font-weight: 500;
}

.auth-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  background: linear-gradient(135deg, #fee2e2 0%, #ffe4e1 100%);
  color: #991b1b;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 18px;
  border: 1px solid rgba(220, 53, 69, 0.18);
}
.auth-error .bi {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}
.auth-error-title {
  font-weight: 700;
  font-size: 13px;
  line-height: 1.3;
}
.auth-error-detail {
  font-size: 12px;
  color: #7f1d1d;
  margin-top: 2px;
  line-height: 1.4;
  word-break: break-word;
}

.btn-google,
.auth-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 26px;
  background: #fff;
  color: #3c4043;
  border: 1px solid var(--color-border-strong);
  border-radius: 10px;
  font-weight: 600;
  text-decoration: none;
  transition: box-shadow 140ms, transform 140ms;
  cursor: pointer;
}
.btn-google:hover,
.auth-cta:hover {
  box-shadow: 0 6px 16px rgba(42, 34, 48, 0.14);
  transform: translateY(-1px);
  color: #1a1f24;
}
.btn-google .google-g {
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #4285F4;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 50%;
  font-size: 13px;
}
.auth-foot {
  font-size: 11px;
  color: var(--color-muted);
  margin: 14px 0 0;
}

.auth-warn {
  background: #fff3cd;
  color: #664d03;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  margin-bottom: 16px;
  text-align: left;
}
.auth-warn code {
  font-size: 11px;
  background: rgba(0, 0, 0, 0.07);
  padding: 1px 4px;
  border-radius: 3px;
}
.auth-dev-btn code {
  background: rgba(0, 0, 0, 0.18);
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 12px;
}
.auth-divider {
  display: flex;
  align-items: center;
  margin: 20px 0 12px;
  color: var(--color-muted);
  font-size: 11px;
  gap: 10px;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border);
}
.auth-dev-form .form-label {
  font-size: 12px;
  text-align: left;
  margin-bottom: 4px;
}
.auth-dev-lan-btn {
  width: 100%;
}

@media (max-width: 480px) {
  .auth-card { border-radius: 18px; }
  .auth-hero { height: 140px; }
  .auth-body { padding: 0 22px 24px; }
  .auth-emoji { display: none; }
}

/* ── empty ─────────────────────────────────────────── */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
}
.empty-icon {
  font-size: 64px;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 16px;
}
.empty-state h2 {
  font-weight: 700;
  margin-bottom: 8px;
}

/* ── calendar grid ────────────────────────────────── */
.calendar {
  --gutter-w: 76px;
  --header-h: 58px;
  display: grid;
  grid-template-columns: var(--gutter-w) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  flex: 1;
  overflow: auto;
  background: var(--color-card);
  border: 1px solid var(--color-border-strong);
  /* top edge is owned by the schedule tab strip — no radius / border there */
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow:
    0 4px 16px rgba(42, 34, 48, 0.06),
    0 1px 3px rgba(42, 34, 48, 0.04);
}

.cal-corner {
  grid-column: 1; grid-row: 1;
  background: var(--color-card);
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border-strong);
  position: sticky; top: 0; left: 0; z-index: 30;
}

.cal-day-headers {
  grid-column: 2; grid-row: 1;
  display: grid;
  grid-template-columns: repeat(var(--col-count), minmax(160px, 1fr));
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border-strong);
  position: sticky; top: 0; z-index: 20;
}
.cal-day-header {
  padding: 10px 16px;
  border-right: 1px solid var(--color-border);
  display: flex; flex-direction: column; justify-content: center;
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 247, 239, 0.7) 0%, var(--color-card) 100%);
}
.cal-day-header::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--color-accent);
  border-radius: 0 0 3px 3px;
}
.cal-day-header::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: var(--color-border-strong);
}

/* desktop right-click context menu for cal-items */
.cal-ctxmenu {
  position: fixed;
  z-index: 9999;
  min-width: 180px;
  background: var(--color-card);
  border: 1px solid var(--color-border-strong);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(42, 34, 48, 0.18);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cal-ctxmenu[hidden] { display: none; }
.cal-ctxmenu button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: transparent;
  border: 0;
  border-radius: 5px;
  text-align: left;
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
}
.cal-ctxmenu button:hover { background: var(--color-bg-2); }
.cal-ctxmenu-item--danger { color: #b85050; }
.cal-ctxmenu-item--danger:hover { background: rgba(220, 53, 69, 0.12) !important; }

/* "delete this entire day" X button, vertically centered on the right side
   of each day header, sitting just to the left of the + insert button. */
.cal-day-delete-btn {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--color-muted);
  border-radius: 50%;
  font-size: 9px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 140ms, background 120ms, color 120ms, transform 120ms;
  padding: 0;
  z-index: 6;
  transform: translateY(-50%);
}
.cal-day-header:hover .cal-day-delete-btn { opacity: 0.65; }
.cal-day-delete-btn:hover {
  opacity: 1;
  background: #ef4444;
  color: #fff;
  transform: translateY(-50%) rotate(90deg);
}

/* "insert a day between Day X and Day X+1" hover button, sits over the column gutter */
.cal-day-insert-after {
  position: absolute;
  top: 50%;
  right: -11px;
  transform: translateY(-50%);
  z-index: 25;
  margin: 0;
}
.cal-day-insert-after-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  border: 2px solid var(--color-card);
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 140ms, transform 140ms, box-shadow 140ms;
  padding: 0;
}
.cal-day-header:hover .cal-day-insert-after-btn,
.cal-day-insert-after-btn:focus-visible {
  opacity: 1;
}
.cal-day-insert-after-btn:hover {
  transform: scale(1.18);
  box-shadow: 0 3px 10px rgba(249, 112, 86, 0.5);
  opacity: 1;
}
.cal-day-header:nth-child(6n+1)::before { background: var(--color-accent); }
.cal-day-header:nth-child(6n+2)::before { background: var(--color-accent-2); }
.cal-day-header:nth-child(6n+3)::before { background: var(--color-accent-3); }
.cal-day-header:nth-child(6n+4)::before { background: var(--color-accent-4); }
.cal-day-header:nth-child(6n+5)::before { background: #3b82f6; }
.cal-day-header:nth-child(6n+0)::before { background: #ec4899; }

.cal-day-label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--color-text);
}
.cal-day-date {
  font-size: 14px;
  color: var(--color-muted);
  margin-top: 1px;
  font-weight: 600;
  letter-spacing: 0.2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
/* Weekend tinting — green for Sat, red for Sun, gradient fading into card. */
.cal-day-header.is-saturday {
  background: linear-gradient(180deg, rgba(187, 247, 208, 0.7) 0%, var(--color-card) 100%);
}
.cal-day-header.is-sunday {
  background: linear-gradient(180deg, rgba(254, 202, 202, 0.7) 0%, var(--color-card) 100%);
}

.cal-hours {
  grid-column: 1; grid-row: 2;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--color-border);
  background: var(--color-card);
  position: sticky; left: 0; z-index: 10;
}
.cal-hour {
  /* height set inline per row — piecewise scale */
  font-size: 12px;
  color: var(--color-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 0 10px;
  display: flex; align-items: flex-start; justify-content: flex-end;
  transform: translateY(-7px);
  font-weight: 600;
  letter-spacing: 0.3px;
  border-top: 1px solid var(--color-border-strong);
}
.cal-hour:first-child { border-top: 0; }

.cal-grid {
  grid-column: 2; grid-row: 2;
  display: grid;
  grid-template-columns: repeat(var(--col-count), minmax(160px, 1fr));
}
.cal-col {
  position: relative;
  border-right: 1px solid var(--color-border);
}
.cal-col:nth-child(2n) { background: rgba(255, 247, 239, 0.35); }

.cal-slot {
  /* height set inline (matches --unit-height) */
  cursor: pointer;
  transition: background 100ms;
}
/* Tier the grid lines so they read at a glance:
   - hour boundary: solid strong
   - half-hour    : solid faint
   - 15-min       : dotted very faint */
.cal-slot--hour    { border-top: 1px solid var(--color-border-strong); }
.cal-slot--half    { border-top: 1px dashed rgba(230, 211, 189, 0.65); }
.cal-slot--quarter { border-top: 1px dotted rgba(230, 211, 189, 0.45); }
.cal-slot:hover {
  background: linear-gradient(90deg, rgba(249, 112, 86, 0.10), rgba(251, 191, 36, 0.08));
  box-shadow: inset 2px 0 0 var(--color-accent);
}

.cal-item {
  position: absolute;
  /* Default left/right; CalItem switches to inline `left`/`width` + `right:auto`
     when laneCount > 1 for Google-Calendar-style side-by-side overlap. */
  left: 5px; right: 5px;
  /* Flex column so the inline image (≥3hr SCs) sits below text and never
     overlaps it. Padding moves onto .cal-item-text so the image can run
     edge-to-edge along the bottom. */
  display: flex;
  flex-direction: column;
  padding: 0;
  border-radius: 8px;
  border-left: 3px solid var(--color-border);
  background: #fff;
  box-shadow: 0 1px 2px rgba(42, 34, 48, 0.06),
              0 1px 3px rgba(42, 34, 48, 0.04);
  overflow: hidden;
  font-size: 13px;
  line-height: 1.3;
  z-index: 2;
  cursor: pointer;
  user-select: none;
  transition:
    top 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
    height 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 140ms ease-out,
    box-shadow 140ms ease-out;
  animation: cal-item-appear 200ms ease-out;
}
/* Text region — padding lives here (instead of on .cal-item) so the inline
   image can run flush to the card edges. flex-shrink:0 means the image gets
   squeezed down before the text does. */
.cal-item-text {
  padding: 3px 7px 3px 9px;
  flex: 0 0 auto;
  min-height: 0;
  position: relative;
  z-index: 1;
}

/* ≤45-min items: no padding, content centered vertically, description hidden.
   Title + time on one row via .cal-item-compact (set by CalItem). */
.cal-item.is-compact {
  padding: 0 7px 0 9px;
  flex-direction: row;
  align-items: center;
}
/* When two items overlap (laneCount > 1) the card is narrow — drop padding,
   shrink fonts so what's visible reads at a glance. */
.cal-item.is-narrow {
  padding-left: 6px;
  padding-right: 4px;
  font-size: 12px;
}
.cal-item.is-narrow .cal-item-title { font-size: 12px; }
.cal-item.is-narrow .cal-item-time { font-size: 9px; }
@keyframes cal-item-appear {
  from { opacity: 0; }
  to   { opacity: 1; }
}
/* While actively resizing, height must track the cursor 1:1 — kill the
   transition that's nice for state-driven changes (undo, edit, etc.). */
.cal-item.is-resizing {
  transition: transform 140ms ease-out, box-shadow 140ms ease-out;
}
.cal-item:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}
.cal-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(42, 34, 48, 0.12),
              0 2px 4px rgba(42, 34, 48, 0.08);
  z-index: 50;
  overflow: visible;
}
.cal-item.item--spot {
  background: linear-gradient(135deg, #fff4d6 0%, #fef3c7 100%);
  border-left-color: #f59e0b;
}
.cal-item.item--restaurant {
  background: linear-gradient(135deg, #ffe4e1 0%, #fecdd3 100%);
  border-left-color: #ef4444;
}
.cal-item.item--lodging {
  background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
  border-left-color: #8b5cf6;
}
.cal-item.item--transit {
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  border-left-color: #64748b;
}
.cal-item.item--flight {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border-left-color: #3b82f6;
}
.cal-item.item--note {
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  border-left-color: #9ca3af;
}

/* Legacy single-row layout (kept for any consumer still rendering .cal-item-head). */
.cal-item-head {
  display: flex; align-items: baseline;
  gap: 4px;
}
/* New stacked rows: time on top, title below. */
.cal-item-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.cal-item-row--time { line-height: 1; }
.cal-item-row--title { margin-top: -1px; }
/* Compact single-row layout (≤45min items). */
.cal-item-compact {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  width: 100%;
}
.cal-item-compact .cal-item-title { flex: 1; min-width: 0; font-size: 12px; }
.cal-item-compact .cal-item-time { font-size: 9px; }
.cal-item-time {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  color: var(--color-muted);
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.2px;
}
.cal-item-del {
  background: transparent; border: 0; padding: 0;
  width: 18px; height: 18px; line-height: 16px;
  color: var(--color-muted); cursor: pointer; border-radius: 50%;
  font-size: 14px;
  transition: background 120ms, color 120ms, transform 120ms;
  margin-left: auto;
  flex-shrink: 0;
  align-self: center;
  position: relative;
  z-index: 5;  /* above .cal-item-handle (z:4) so click always hits the × */
}
.cal-item-del:hover {
  background: #ef4444;
  color: #fff;
  transform: rotate(90deg);
}
.cal-item-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  flex: 1; min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-item-icon { margin-right: 3px; }

.cal-item-nextday {
  display: inline-block;
  font-size: 10px;
  background: #3b82f6;
  color: #fff;
  padding: 1px 5px;
  border-radius: 8px;
  font-weight: 700;
  margin-left: 2px;
  vertical-align: middle;
}

.cal-item-handle {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 6px;
  cursor: ns-resize;
  z-index: 4;
  background: transparent;
  transition: background 120ms;
}
/* Live duration badge during bottom-edge resize. Bottom-left of the SC, only
   visible while .is-resizing (set by the drag handler). Itinerary.jsx writes
   the current duration into this element on every pointermove. */
.cal-item-dur-tooltip {
  position: absolute;
  left: 4px;
  bottom: 4px;
  z-index: 6;
  display: none;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(42, 34, 48, 0.85);
  color: #fff;
  border-radius: 999px;
  pointer-events: none;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.cal-item.is-resizing .cal-item-dur-tooltip { display: block; }
.cal-item.is-resizing { overflow: visible; }
.cal-item:hover .cal-item-handle {
  background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.10) 100%);
}
.cal-item.item--flight .cal-item-handle { display: none; }
.cal-item.item--flight { cursor: pointer; }
.cal-item.is-dragging {
  opacity: 0.7;
  cursor: grabbing !important;
  z-index: 10;
}
.cal-item.is-resizing {
  opacity: 0.85;
  z-index: 10;
}
.cal-item-sub {
  font-size: 13px;
  color: var(--color-muted);
  margin-top: 2px;
  font-weight: 500;
}
.cal-item.item--spot       .cal-item-sub { color: #a16207; }
.cal-item.item--restaurant .cal-item-sub { color: #b91c1c; }
.cal-item.item--lodging    .cal-item-sub { color: #6d28d9; }
.cal-item.item--transit    .cal-item-sub { color: #475569; }
.cal-item.item--flight     .cal-item-sub { color: #1d4ed8; }
.cal-item.item--note       .cal-item-sub { color: #4b5563; }

/* ── hover popup with image + full description ────────────────
   Image is never inline now; full info lives here. CSS shows the popup only
   after the user has hovered "long enough" (600ms) via a one-way transition
   delay — leaving instantly hides it. */
.cal-item-popup {
  position: absolute;
  z-index: 100;
  top: 0;
  left: 100%;
  margin-left: 8px;
  width: 240px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(42, 34, 48, 0.18),
              0 2px 6px rgba(42, 34, 48, 0.10);
  border: 1px solid rgba(0, 0, 0, 0.05);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease-out 0s;
  overflow: hidden;
}
.cal-item:hover .cal-item-popup,
.cal-item-popup:hover {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 180ms ease-out 600ms;
}
.cal-item-popup-img {
  display: block;
  width: 100%;
  height: 130px;
  object-fit: cover;
}
.cal-item-popup-body {
  padding: 10px 12px 12px;
}
.cal-item-popup-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--color-text);
  margin-bottom: 2px;
}
.cal-item-popup-time {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--color-muted);
  font-weight: 600;
  margin-bottom: 6px;
}
.cal-item-popup-desc {
  font-size: 13px;
  color: var(--color-text);
  line-height: 1.45;
  white-space: pre-wrap;
}
/* When item is in the rightmost columns the popup would overflow the page —
   pop it to the left instead. CalItem could hint via a data-attribute, but for
   v1 a simple rule based on the rightmost two columns works. */
.cal-col:nth-last-child(-n+2) .cal-item-popup {
  left: auto;
  right: 100%;
  margin-left: 0;
  margin-right: 8px;
}

/* Inline image — only rendered by CalItem when duration ≥ 3hr. Pinned to the
   bottom edge of the SC: margin-top:auto absorbs any leftover space between
   text and image as the SC grows so the image stays glued to the bottom.
   flex-basis 50% (capped by max-height) means the image takes half the SC
   normally, but flex-shrink:1 lets it give way if the text needs more — text
   is never covered. (Popup still shows the full image on long hover.) */
.cal-item-img {
  display: block;
  width: 100%;
  max-height: 50%;
  min-height: 0;
  flex: 0 1 50%;
  margin-top: auto;
  object-fit: cover;
  object-position: center;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  pointer-events: none;
  animation: cal-img-fade 240ms ease-out;
}
.cal-item-head,
.cal-item-sub {
  position: relative;
  z-index: 1;
}
@keyframes cal-img-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── stash column (rightmost: parked-for-later items) ────── */
.cal-day-header--stash {
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.12) 0%, var(--color-card) 100%);
}
.cal-day-header--stash::before {
  background: var(--color-accent-4) !important;
}
.cal-day-header--stash .cal-day-label {
  color: #6d28d9;
}
.cal-day-header--stash .bi { margin-right: 2px; }

.cal-col--stash {
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.06) 0%, rgba(168, 85, 247, 0.015) 100%);
  border-left: 1px dashed var(--color-border-strong);
  border-right: none;
}
.cal-col--stash .cal-slot:hover {
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.10), rgba(168, 85, 247, 0.04));
  box-shadow: inset 2px 0 0 var(--color-accent-4);
}

/* fallback decorative emoji when no image */
.cal-item-bgicon {
  position: absolute;
  right: 2px;
  bottom: -6px;
  font-size: 36px;
  opacity: 0.18;
  pointer-events: none;
  filter: saturate(1.3);
  user-select: none;
}

/* ── buttons (override Bootstrap a bit) ────────────── */
.btn {
  font-weight: 600;
  letter-spacing: 0.2px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--color-accent) 0%, #f9854d 100%);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(249, 112, 86, 0.3);
}
.btn-primary:hover,
.btn-primary:focus {
  background: linear-gradient(135deg, #fa6849 0%, #f87b40 100%);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(249, 112, 86, 0.45);
  transform: translateY(-1px);
}
.btn-outline-danger {
  border-radius: var(--radius-sm);
}
.btn-flight {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  border: 0;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}
.btn-flight:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.45);
}

/* ── flight search result cards ───────────────────── */
[x-cloak] { display: none !important; }

/* ── airport autocomplete ─────────────────────────── */
.airport-pick {
  position: relative;
}
.airport-pick .airport-input {
  padding-right: 32px;
}
.airport-pick .airport-pill {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #fff;
  background: var(--color-accent-2);
  border-radius: 10px;
  padding: 2px 6px;
  pointer-events: none;
}
.airport-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--color-card);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(42, 34, 48, 0.12);
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
}
.airport-list:empty { display: none; }
.airport-option {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
}
.airport-option:hover,
.airport-option:focus {
  background: var(--color-bg-2);
  outline: none;
}
.airport-option.is-highlighted,
.airport-option.is-highlighted:hover {
  background: var(--color-bg-2);
  box-shadow: inset 3px 0 0 var(--color-accent);
}
.airport-option .airport-iata {
  font-weight: 700;
  letter-spacing: 0.4px;
  font-size: 13px;
  color: var(--color-accent);
  min-width: 36px;
}
.airport-option .airport-meta {
  color: var(--color-muted);
  font-size: 12px;
}
.airport-empty {
  padding: 10px;
  font-size: 12px;
  color: var(--color-muted);
  text-align: center;
}

/* ── two-leg flight form ──────────────────────────── */
.flight-leg {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.55);
}
.flight-leg-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--color-accent);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.flight-leg-title .bi { font-size: 14px; }

.flight-opt-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.flight-opt-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  transition: box-shadow 120ms, transform 120ms, border-color 120ms;
}
.flight-opt-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.flight-opt-card--pick { cursor: pointer; }
.flight-opt-card--pick.is-selected {
  border-color: var(--color-accent);
  border-width: 2px;
  background: linear-gradient(135deg, #fff4d6 0%, #fed7aa 100%);
  box-shadow: 0 4px 12px rgba(249, 112, 86, 0.20);
}
/* 3-column grid for the picker, single column for the confirm summary. */
.flight-opt-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 2px;
}
.flight-opt-list--single {
  grid-template-columns: 1fr;
}
@media (max-width: 900px) {
  .flight-opt-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .flight-opt-list { grid-template-columns: 1fr; }
}

/* Sort toolbar above the picker. */
.flight-sort-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-muted);
  margin-bottom: 8px;
}
.flight-sort-bar .btn {
  font-size: 12px;
  padding: 2px 10px;
}
.wizard-step-header {
  font-weight: 600;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--color-border);
}
.flight-opt-row {
  display: flex; justify-content: space-between; align-items: center;
}
.flight-opt-airline {
  display: flex; align-items: center; gap: 4px;
  font-weight: 600; font-size: 12px;
  flex: 1; min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.flight-opt-airline > span:not(.badge) {
  overflow: hidden;
  text-overflow: ellipsis;
}
.flight-opt-logo {
  width: 18px; height: 18px;
  border-radius: 4px;
  object-fit: contain;
  background: #fff;
  flex-shrink: 0;
}
.flight-opt-airline .bi { color: #2563eb; }
.flight-opt-airline small {
  color: var(--color-muted);
  font-weight: 500;
  font-size: 10px;
}
.flight-opt-price {
  font-size: 13px;
  font-weight: 700;
  color: #b91c1c;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  flex-shrink: 0;
}
.flight-opt-route {
  margin-top: 6px;
  gap: 6px;
}
.flight-opt-time {
  display: flex; flex-direction: column; align-items: center;
  min-width: 50px;
}
.flight-opt-hhmm {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  font-size: 15px;
  color: var(--color-text);
}
.flight-opt-iata {
  font-size: 10px;
  color: var(--color-muted);
  font-weight: 600;
  margin-top: 1px;
  letter-spacing: 0.5px;
}
.flight-opt-mid {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  color: var(--color-muted);
}
/* Middle text (duration + 直飛/轉機) is the most actionable info at a glance,
   so bump it up — it stays prominent even when the rest of the card shrinks. */
.flight-opt-dur {
  font-weight: 700;
  font-size: 13px;
  color: var(--color-text);
}
.flight-opt-line {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  margin: 3px 0;
}
.flight-opt-line > span:first-child {
  flex: 1; height: 2px;
  background: linear-gradient(90deg, transparent, #93c5fd 30%, #93c5fd 70%, transparent);
}
.flight-opt-line .bi {
  color: #f97316; font-size: 8px;
}
.flight-opt-stop {
  font-weight: 600;
  font-size: 12px;
  color: var(--color-text);
}

/* ── modal ──────────────────────────────────────── */
.modal-content {
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-header {
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-3) 100%);
  color: #fff;
  border: 0;
  padding: 14px 20px;
}
.modal-header .btn-close {
  filter: invert(1) brightness(1.4);
}
.modal-title {
  font-weight: 700;
  letter-spacing: 0.3px;
}
.form-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--color-text);
}

/* ── share modal: current shares roster ──────────── */
.share-current-list {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
  border: 1px solid #e3dcec;
  border-radius: 10px;
  background: rgba(168, 85, 247, 0.04);
}
.share-current-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid #f1ecf7;
}
.share-current-item:last-child { border-bottom: 0; }
.share-current-item .bi-person-circle {
  font-size: 20px;
  color: #b48fbb;
  flex-shrink: 0;
}
.share-current-perm {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 8px;
  font-weight: 600;
  flex-shrink: 0;
}
.share-current-perm.is-write {
  background: rgba(34, 197, 94, 0.15);
  color: #15803d;
}
.share-current-perm.is-read {
  background: rgba(100, 116, 139, 0.15);
  color: #475569;
}
.share-current-perm:not(.is-write):not(.is-read) {
  background: rgba(249, 112, 86, 0.15);
  color: #b91c1c;
}
.share-current-remove {
  background: transparent;
  border: 0;
  color: #b48fbb;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 120ms, color 120ms;
}
.share-current-remove:hover {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

/* ── share friend picker ─────────────────────────── */
.share-friend-list {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid #e3dcec;
  border-radius: 10px;
}
.share-friend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f1ecf7;
  transition: background 120ms;
}
.share-friend-item:last-child { border-bottom: 0; }
.share-friend-item:hover { background: rgba(249, 112, 86, 0.05); }
.share-friend-item.is-selected {
  background: linear-gradient(135deg, rgba(249, 112, 86, 0.10) 0%, rgba(251, 191, 36, 0.06) 100%);
}
.share-friend-item .bi-person-circle {
  font-size: 22px;
  color: #b48fbb;
  flex-shrink: 0;
}
.share-friend-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.share-friend-info strong {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-friend-info small {
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-friend-pending {
  font-size: 11px;
  background: #fef3c7;
  color: #92400e;
  padding: 1px 6px;
  border-radius: 6px;
}
.share-friend-tick {
  color: var(--color-accent);
  font-size: 18px;
  flex-shrink: 0;
}

/* ── nearby-restaurants side panel ───────────────── */
/* The edit modal lives at z-index 1055; the panel sits on top of it. Slides
   in from the right edge of the viewport, doesn't disturb the modal layout. */
.restaurants-panel {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translate(100%, -50%);
  width: 380px;
  max-width: 92vw;
  max-height: 80vh;
  background: #fff;
  border-radius: 12px 0 0 12px;
  box-shadow: -8px 0 24px rgba(42, 34, 48, 0.18);
  z-index: 1060;
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.restaurants-panel.is-open {
  transform: translate(0, -50%);
}
.restaurants-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-3) 100%);
  color: #fff;
  flex-shrink: 0;
}
.restaurants-panel-header .btn-close {
  filter: invert(1) brightness(1.4);
}
.restaurants-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}
.restaurant-card {
  display: block;
  text-decoration: none;
  color: var(--color-text);
  padding: 10px 12px;
  border: 1px solid #e3dcec;
  border-radius: 10px;
  margin-bottom: 8px;
  transition: background 120ms, border-color 120ms, transform 120ms;
}
.restaurant-card:hover {
  background: rgba(249, 112, 86, 0.04);
  border-color: var(--color-accent);
  transform: translateY(-1px);
  color: var(--color-text);
  text-decoration: none;
}
.restaurant-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}
.restaurant-card-head strong {
  font-size: 14px;
  line-height: 1.3;
}
.restaurant-card-rating {
  font-size: 12px;
  font-weight: 700;
  color: #b45309;
  flex-shrink: 0;
}
.restaurant-card-rating .bi-star-fill { color: #f59e0b; }
.restaurant-card-meta {
  font-size: 12px;
  color: var(--color-muted);
  margin-bottom: 3px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.restaurant-card-highlight {
  font-size: 13px;
  color: var(--color-text);
  margin-top: 3px;
}
.restaurant-card-addr {
  margin-top: 2px;
}

/* Auto-generated transit title preview — shown in place of the 名稱 input
   when the user picks 交通; updates live as transit_mode / stations change. */
.transit-title-preview {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  padding: 6px 10px;
  background: rgba(168, 85, 247, 0.06);
  border: 1px dashed var(--color-border);
  border-radius: 8px;
  min-height: 38px;
  display: flex;
  align-items: center;
}

/* ── add-item transit-mode picker ────────────────── */
.transit-mode-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.transit-mode-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border: 1px solid #e3dcec;
  border-radius: 10px;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, transform 120ms;
  font-size: 12px;
  font-weight: 600;
}
.transit-mode-option:hover {
  border-color: var(--color-accent);
  background: rgba(249, 112, 86, 0.04);
}
.transit-mode-option.is-selected {
  border-color: var(--color-accent);
  border-width: 2px;
  background: linear-gradient(135deg, #fff4d6 0%, #fed7aa 100%);
}
.transit-mode-option input[type="radio"] {
  display: none;
}
.transit-mode-icon {
  font-size: 22px;
  line-height: 1;
}

/* ── share-permission radio ─────────────────────── */
.share-permission-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.share-permission-option {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #e3dcec;
  border-radius: 10px;
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.share-permission-option:hover {
  border-color: var(--color-accent);
  background: rgba(249, 112, 86, 0.04);
}
.share-permission-option input[type="radio"] {
  margin-top: 4px;
  flex: 0 0 auto;
}
.share-permission-option.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: rgba(0, 0, 0, 0.025);
}
.share-permission-option.is-disabled:hover {
  border-color: #e3dcec;
  background: rgba(0, 0, 0, 0.025);
}
.share-permission-option .bi { color: var(--color-accent); }

/* Flight leg results dim once that leg has had an option picked (so the user
   can clearly see they only need to pick the other leg now). */
.flight-leg-results.is-picked {
  opacity: 0.55;
  filter: saturate(0.7);
}

/* ── friends modal ──────────────────────────────── */
.friends-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  max-height: 320px;
  overflow-y: auto;
}
.friends-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  transition: background 120ms;
}
.friends-list-item:hover {
  background: rgba(0, 0, 0, 0.035);
}
.friends-list-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.friends-list-info strong {
  font-size: 14px;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.friends-list-email {
  font-size: 12px;
  color: #8a7f9f;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.friends-list-pending {
  display: inline-block;
  font-size: 11px;
  background: #fef3c7;
  color: #92400e;
  padding: 1px 6px;
  border-radius: 6px;
  margin-top: 2px;
  width: max-content;
}
.friends-list-remove {
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  color: #b48fbb;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.friends-list-remove:hover {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}
.friends-list-empty {
  padding: 16px 12px;
  text-align: center;
  color: #a89dbb;
  font-size: 13px;
}
.friends-add-form {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-top: 8px;
}
.friends-add-form .form-control {
  flex: 1;
}
.friends-error {
  margin-top: 10px;
  padding: 8px 12px;
  background: #fef2f2;
  color: #b91c1c;
  border-radius: 8px;
  font-size: 13px;
}
.friends-hint {
  font-size: 12px;
}

/* ── responsive: tablet/mobile ─────────────────────── */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 30% 0 0;
    z-index: 1040;
    transform: translateX(-100%);
    transition: transform 200ms;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
}
