/* ══════════════════════════════════════════════════════════════
   yili-app · Soft-UI H5 �?Apple/Linear 精致风格
   ══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
  /* Colors */
  --bg: #F7F7F5;
  --surface: #FFFFFF;
  --text-primary: #1A1A1A;
  --text-secondary: #6B6B6B;
  --text-tertiary: #9A9A9A;
  --accent: #2E7D6B;
  --accent-light: #3A9A85;
  --border: rgba(0, 0, 0, 0.06);
  --border-hover: rgba(0, 0, 0, 0.1);
  --red: #FC3D3D;
  --overlay: rgba(0, 0, 0, 0.35);

  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Geist Sans', 'PingFang SC', 'Noto Sans SC', sans-serif;
  --font-mono: 'SF Mono', 'Geist Mono', 'Menlo', monospace;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Animation */
  --curve: cubic-bezier(0.32, 0.72, 0, 1);
  --curve-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 200ms;
  --duration-normal: 350ms;
  --duration-slow: 700ms;

  /* Double-Bezel */
  --shell-bg: rgba(0, 0, 0, 0.03);
  --core-bg: #FFFFFF;
  --shell-padding: 2px;
}

/* ── Base Reset ── */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 15px;
  line-height: 1.5;
}

/* ── App Shell ── */
#app {
  max-width: 600px;
  margin: 0 auto;
  background: var(--surface);
  min-height: 100dvh;
  position: relative;
  padding-bottom: calc(56px + env(safe-area-inset-bottom, 16px));
}

/* ── Pages ── */
.page {
  display: none;
  min-height: 100dvh;
  -webkit-overflow-scrolling: touch;
  overflow-y: auto;
  animation: pageEnter var(--duration-slow) var(--curve) both;
}

.page.active {
  display: block;
}

@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(16px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

/* ── Page Header ── */
.page-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  backdrop-filter: blur(16px) saturate(1.8);
  -webkit-backdrop-filter: blur(16px) saturate(1.8);
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-header h1 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ── Header Refresh Button ── */
.header-refresh-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 9999px;
  color: #6B6B6B;
  font-size: 18px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.2s cubic-bezier(0.32, 0.72, 0, 1), transform 0.2s cubic-bezier(0.32, 0.72, 0, 1);
  -webkit-tap-highlight-color: transparent;
}
.header-refresh-btn:active {
  background: rgba(0,0,0,0.06);
  transform: translateY(-50%) rotate(90deg);
}
.header-refresh-btn.spinning {
  animation: header-refresh-spin 0.6s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes header-refresh-spin {
  0% { transform: translateY(-50%) rotate(0deg); }
  100% { transform: translateY(-50%) rotate(360deg); }
}

.page-header a {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  padding: 8px 12px;
  color: var(--accent) !important;
  text-decoration: none !important;
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius-full);
  transition: background var(--duration-fast) var(--curve), transform var(--duration-fast) var(--curve);
  touch-action: manipulation;
}

.page-header a:active {
  background: rgba(46, 125, 107, 0.08);
  transform: translateY(-50%) scale(0.96);
}

.page-body {
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 16px));
}

/* ════════════════════════════
   TabBar �?Linear 风格
   ════════════════════════════ */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border-top: 1px solid var(--border);
  padding: 6px 0;
  padding-bottom: calc(6px + env(safe-area-inset-bottom, 16px));
  z-index: 100;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--text-tertiary);
  font-size: 12px;
  touch-action: manipulation;
  padding: 2px 0;
  transition: color var(--duration-fast) var(--curve), transform var(--duration-fast) var(--curve);
  -webkit-tap-highlight-color: transparent;
}

.tab-item:active {
  transform: scale(0.92);
}

.tab-item.active {
  color: var(--accent);
}

.tab-icon {
  width: 24px;
  height: 24px;
  margin-bottom: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab-icon svg.active-fill {
  fill: currentColor;
}

.tab-text {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ════════════════════════════
   Double-Bezel Card System
   ════════════════════════════ */
.card-shell {
  border-radius: 24px;
  background: var(--shell-bg);
  padding: 8px;
  margin-bottom: 10px;
  transition: transform var(--duration-normal) var(--curve);
  touch-action: manipulation;
}

.card-shell:active {
  transform: scale(0.985);
}

.card-core {
  border-radius: calc(24px - 2px);
  background: var(--core-bg);
  padding: 16px;
  overflow: hidden;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.8);
}

/* ── Legacy .card class maps to double-bezel ── */
.card {
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 16px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  transition: transform var(--duration-normal) var(--curve);
  touch-action: manipulation;
}

.card:active {
  transform: scale(0.985);
}

/* ════════════════════════════
   Buttons �?rounded-full
   ════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 22px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  touch-action: manipulation;
  letter-spacing: -0.01em;
  transition: background var(--duration-fast) var(--curve),
              transform var(--duration-fast) var(--curve),
              box-shadow var(--duration-fast) var(--curve);
}

.btn:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:active {
  background: rgba(0, 0, 0, 0.04);
}

.btn-danger {
  background: var(--red);
}

.btn-danger:active {
  background: #e03030;
}

/* ════════════════════════════
   Typography helpers
   ════════════════════════════ */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }

/* ════════════════════════════
   Entry Animations
   ════════════════════════════ */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-fade-up {
  animation: fadeUp var(--duration-slow) var(--curve) both;
}

.animate-fade-in {
  animation: fadeIn var(--duration-normal) var(--curve) both;
}

.animate-stagger > * {
  animation: fadeUp var(--duration-slow) var(--curve) both;
  animation-delay: calc(var(--i, 0) * 80ms);
}

/* ════════════════════════════
   Loading States
   ════════════════════════════ */
.loading {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-tertiary);
  font-size: 14px;
}

.error {
  text-align: center;
  padding: 48px 20px;
  color: var(--red);
  font-size: 14px;
}

.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-tertiary);
  font-size: 14px;
}

/* ── Skeleton ── */
.skeleton {
  background: linear-gradient(90deg, #EDEDEA 25%, #E2E2DF 50%, #EDEDEA 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s var(--curve) infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card {
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 16px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  min-height: 100px;
}
.skeleton-card .skeleton-badge { display: inline-block; width: 52px; height: 22px; margin-bottom: 8px; }
.skeleton-card .skeleton-title { width: 70%; height: 18px; margin-bottom: 8px; }
.skeleton-card .skeleton-text { width: 90%; height: 16px; margin-bottom: 6px; }
.skeleton-card .skeleton-meta { width: 50%; height: 14px; margin-top: 8px; }

/* ── Weather Skeleton ── */
.skeleton-spot {
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 16px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  min-height: 90px;
}
.skeleton-spot-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.skeleton-spot-header .skeleton { height: 16px; }
.skeleton-spot-header .skeleton:first-child { width: 80px; }
.skeleton-spot-header .skeleton:last-child { width: 32px; height: 32px; border-radius: 50%; }
.skeleton-spot-temp { width: 60px; height: 28px; margin-bottom: 8px; }
.skeleton-spot-desc { width: 120px; height: 14px; }

/* ════════════════════════════
   AI Chat
   ════════════════════════════ */
#chat-wrap {
  background: transparent;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: none;
}

.ai-msg {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  align-items: flex-start;
  animation: fadeUp var(--duration-slow) var(--curve) both;
}

.ai-msg.user {
  flex-direction: row-reverse;
}

.ai-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #EDEDEA;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.ai-avatar svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* User has no avatar in bubble-style chat */
.ai-msg.user .ai-avatar {
  display: none;
}

.ai-content {
  background: #EDEDEA;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.6;
  max-width: 80%;
  word-break: break-word;
  color: var(--text-primary);
}

.ai-msg.user .ai-content {
  background: var(--accent);
  color: #fff;
  border-radius: 16px;
  border-bottom-right-radius: 4px;
}

.ai-content pre {
  background: rgba(0,0,0,0.05);
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-mono);
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
  margin: 4px 0;
}

.ai-msg.user .ai-content pre {
  background: rgba(255,255,255,0.12);
}

/* ── AI Typing ── */
.ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 0;
}
.ai-typing .dot {
  width: 7px;
  height: 7px;
  background: var(--text-tertiary);
  border-radius: 50%;
  animation: typingDot 1.4s var(--curve) infinite;
}
.ai-typing .dot:nth-child(1) { animation-delay: 0s; }
.ai-typing .dot:nth-child(2) { animation-delay: 0.2s; }
.ai-typing .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
  30% { transform: translateY(-7px); opacity: 1; }
}

/* ── Preset Prompts ── */
.preset-item {
  background: #EDEDEA;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
  max-width: 80%;
  transition: background var(--duration-fast) var(--curve), transform var(--duration-fast) var(--curve);
}
.preset-item:active {
  background: #E0E0DD;
  transform: scale(0.98);
}

/* ════════════════════════════
   Trip Import Card
   ════════════════════════════ */
#trip-import-card {
  margin: 0 0 10px 0;
  border-radius: var(--radius-md);
  background: #F0F7F4;
  border: 1px solid rgba(46, 125, 107, 0.2);
  padding: 14px;
  font-size: 13px;
}

/* ── Change Proposal ── */
.change-proposal {
  background: rgba(255, 215, 0, 0.06);
  border: 1px solid rgba(255, 215, 0, 0.25);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 10px;
}
.proposal-header { font-size: 13px; font-weight: 600; color: #B8860B; margin-bottom: 6px; }
.proposal-body { font-size: 12px; color: var(--text-secondary); }
.proposal-label { font-weight: 500; }
.proposal-actions { display: flex; gap: 8px; margin-top: 10px; }
.action-btn { flex: 1; padding: 7px; border-radius: var(--radius-full); font-size: 12px; font-weight: 500; cursor: pointer; text-align: center; touch-action: manipulation; transition: transform var(--duration-fast) var(--curve); }
.action-btn:active { transform: scale(0.96); }
.action-btn.reject { border: 1px solid rgba(184, 134, 11, 0.4); background: transparent; color: #B8860B; }
.action-btn.confirm { border: none; background: var(--accent); color: #fff; }

/* ════════════════════════════
   Day Cards
   ════════════════════════════ */
.day-card {
  cursor: pointer;
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 16px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  transition: transform var(--duration-normal) var(--curve);
}
.day-card:active {
  transform: scale(0.985);
}
.day-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.day-num {
  display: inline-flex;
  align-items: center;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-full);
  padding: 2px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.day-arrow {
  color: var(--text-tertiary);
  font-size: 20px;
  font-weight: 300;
  transition: transform var(--duration-fast) var(--curve);
}
.day-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.day-summary {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.5;
}
.day-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

/* ── Day Detail ── */
#day-detail-title {
  font-size: 18px;
  font-weight: 600;
}

/* ── Journey Switcher ── */
#journey-switcher-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  background: #EDEDEA;
  border-radius: var(--radius-full);
  cursor: pointer;
  touch-action: manipulation;
  transition: background var(--duration-fast) var(--curve);
}
#journey-switcher-btn:active {
  background: #E0E0DD;
  transform: scale(0.98);
}
#journey-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}
#journey-arrow {
  font-size: 10px;
  color: var(--text-tertiary);
  transition: transform var(--duration-fast) var(--curve);
}

#journey-dropdown {
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.journey-item {
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  touch-action: manipulation;
  transition: background var(--duration-fast) var(--curve);
}
.journey-item:last-child { border-bottom: none; }
.journey-item:active { background: #EDEDEA; }
.journey-item.active { color: var(--accent); font-weight: 500; }
.journey-check { color: var(--accent); font-weight: 600; }

/* ════════════════════════════
   Weather Icons �?inline SVG
   ════════════════════════════ */
.weather-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}
.weather-icon svg {
  width: 32px;
  height: 32px;
}
.weather-icon-lg {
  width: 56px;
  height: 56px;
}
.weather-icon-lg svg {
  width: 48px;
  height: 48px;
}

/* ── Weather Spot Card ── */
.spot-card {
  cursor: pointer;
  transition: transform var(--duration-normal) var(--curve);
}
.spot-card:active {
  transform: scale(0.985);
}

/* ════════════════════════════
   Pull to Refresh
   ════════════════════════════ */
#ptr-indicator {
  display: none;
  text-align: center;
  padding: 10px;
  font-size: 13px;
  color: var(--text-tertiary);
  position: relative;
  overflow: hidden;
  height: 0;
  transition: height var(--duration-fast) var(--curve);
}
#ptr-indicator.visible {
  display: block;
  height: 48px;
}
#ptr-indicator.refreshing {
  display: block;
  height: 48px;
}
#ptr-indicator .ptr-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ptrSpin 0.6s var(--curve) infinite;
  vertical-align: middle;
  margin-right: 8px;
}
#ptr-indicator .ptr-arrow {
  display: inline-block;
  font-size: 16px;
  margin-right: 6px;
  transition: transform var(--duration-fast) var(--curve);
  vertical-align: middle;
  color: var(--text-tertiary);
}
#ptr-indicator .ptr-arrow.flip {
  transform: rotate(180deg);
}
@keyframes ptrSpin {
  to { transform: rotate(360deg); }
}

/* ════════════════════════════
   Teammates (Map)
   ════════════════════════════ */
.teammate-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.teammate-item:last-child { border-bottom: none; }
.teammate-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #EDEDEA;
  display: flex; align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-secondary);
}
.teammate-avatar svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.teammate-name { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.teammate-location { font-size: 12px; color: var(--text-tertiary); }

/* ════════════════════════════
   Profile
   ════════════════════════════ */
.menu-card { padding: 4px 16px; }
.menu-item {
  padding: 12px 0;
  touch-action: manipulation;
  color: var(--text-primary);
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: opacity var(--duration-fast) var(--curve);
}
.menu-item:active { opacity: 0.6; }
.menu-item:not(:last-child) { border-bottom: 1px solid var(--border); }

/* Custom toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-track {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #D1D1CE;
  border-radius: 12px;
  transition: background var(--duration-fast) var(--curve);
}
.toggle-dot {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--duration-fast) var(--curve);
}
.toggle-switch input:checked + .toggle-track {
  background: var(--accent);
}
.toggle-switch input:checked ~ .toggle-dot {
  transform: translateX(20px);
}

/* ════════════════════════════
   Marker Action (Map bottom sheet)
   ════════════════════════════ */
.marker-action-item {
  touch-action: manipulation;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  transition: background var(--duration-fast) var(--curve);
}
.marker-action-item:last-child { border-bottom: none; }
.marker-action-item:active { background: #EDEDEA; }

/* ════════════════════════════
   Privacy Page
   ════════════════════════════ */
.sub-title { font-weight: 600; display: block; margin: 14px 0 6px; color: var(--text-primary); }
.para { display: block; margin-bottom: 8px; line-height: 1.8; color: var(--text-secondary); font-size: 14px; }
.update-date { font-size: 12px; color: var(--text-tertiary); display: block; margin-bottom: 12px; }

/* ════════════════════════════
   Global Loading Bar
   ════════════════════════════ */
#global-loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-light), var(--accent));
  background-size: 200% 100%;
  z-index: 99999;
  border-radius: 0 2px 2px 0;
  transition: width 0.3s var(--curve);
  animation: loadingBarShimmer 1.5s var(--curve) infinite;
  display: none;
}
#global-loading-bar.active {
  display: block;
  width: 70%;
}
#global-loading-bar.complete {
  width: 100%;
  opacity: 1;
  transition: width 0.2s var(--curve);
}
@keyframes loadingBarShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ════════════════════════════
   Toast
   ════════════════════════════ */
#app-toast {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  max-width: 80%;
  background: rgba(26, 26, 26, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 14px;
  z-index: 99999;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--curve);
  text-align: center;
  line-height: 1.5;
}

/* ════════════════════════════
   Map Loading
   ════════════════════════════ */
.map-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(247, 247, 245, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: var(--radius-md);
}
.map-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: mapSpinner 0.8s var(--curve) infinite;
  margin-bottom: 10px;
}
@keyframes mapSpinner {
  to { transform: rotate(360deg); }
}
.map-loading-text {
  font-size: 13px;
  color: var(--text-tertiary);
}

/* ════════════════════════════
   404 Page
   ════════════════════════════ */
#page-404 {
  display: none;
  min-height: 100dvh;
  text-align: center;
  padding: 80px 20px;
  background: var(--bg);
}
#page-404.active { display: block; }
.page-404-icon {
  margin-bottom: 16px;
}
.page-404-icon svg {
  width: 64px;
  height: 64px;
  stroke: var(--text-tertiary);
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.page-404-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}
.page-404-desc {
  font-size: 14px;
  color: var(--text-tertiary);
  margin-bottom: 32px;
  line-height: 1.6;
}

/* ════════════════════════════
   Inputs
   ════════════════════════════ */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: var(--font);
  outline: none;
  box-sizing: border-box;
  background: transparent;
  color: var(--text-primary);
  transition: border-color var(--duration-fast) var(--curve),
              box-shadow var(--duration-fast) var(--curve);
  -webkit-appearance: none;
  appearance: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46, 125, 107, 0.12);
}

input::placeholder {
  color: var(--text-tertiary);
}

/* ════════════════════════════
   Scrollbar
   ════════════════════════════ */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-thumb {
  background: #D1D1CE;
  border-radius: 2px;
}

/* ════════════════════════════
   Section Title
   ════════════════════════════ */
.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* ════════════════════════════
   PWA Install Banner
   ════════════════════════════ */
#pwa-install-banner {
  position: fixed;
  bottom: 72px;
  left: 12px;
  right: 12px;
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 9999;
  font-size: 14px;
  transform: translateY(120px);
  opacity: 0;
  transition: all var(--duration-normal) var(--curve);
  box-shadow: none;
}

/* ── Mobile: 768px ── */
@media (min-width: 769px) {
  #app {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}

/* ── Bottom sheet modal ── */
.bottom-sheet-mask {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--overlay);
  z-index: 999;
  animation: fadeIn var(--duration-fast) var(--curve) both;
}

.bottom-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 1000;
  overflow: hidden;
  animation: bottomSheetIn var(--duration-normal) var(--curve) both;
}

@keyframes bottomSheetIn {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ── Pull to Refresh (Ptr) ── */
#ptr-map-indicator,
#ptr-indicator {
  text-align: center;
  height: 0;
  overflow: hidden;
  transition: height 0.2s ease;
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 48px;
  margin: 0;
}
#ptr-map-indicator.visible,
#ptr-indicator.visible {
  overflow: visible;
}
#ptr-map-indicator .ptr-arrow,
#ptr-indicator .ptr-arrow {
  display: inline-block;
  transition: transform 0.2s ease;
  font-size: 16px;
}
#ptr-map-indicator .ptr-arrow.flip,
#ptr-indicator .ptr-arrow.flip {
  transform: rotate(180deg);
}
@keyframes ptrSpinner {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.ptr-spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ptrSpinner 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

/* ── Cursor Blink (ai fake streaming) ── */
.cursor-blink {
  animation: blink-anim 1s steps(2) infinite;
}
@keyframes blink-anim {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ── Weather Toggle (today/trip) ── */
.toggle-option {
  flex: 1;
  text-align: center;
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s;
}
.toggle-option.active {
  background: #fff;
  color: #1A1A1A;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ── Weather Detail Sheet ── */
.weather-detail-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 1000;
  overflow: hidden;
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  max-height: 85vh;
}

/* Tab nav inside weather detail sheet */
.weather-tab-btn {
  flex: 1;
  padding: 8px 6px;
  border: none;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.2s ease;
}
.weather-tab-btn.active {
  background: #EDEDEA;
  color: var(--text-primary);
  font-weight: 600;
}
.weather-tab-btn:active {
  transform: scale(0.96);
}

.weather-tab-body {
  padding: 16px 20px;
  max-height: 50vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.weather-tab-content {
  animation: fadeUp 0.25s ease both;
}
.weather-tab-content .empty {
  text-align: center;
  padding: 24px 0;
  color: var(--text-tertiary);
  font-size: 14px;
}
.weather-detail-sheet .sheet-handle {
  width: 36px; height: 4px;
  background: #DEDEDE;
  border-radius: 2px;
  margin: 8px auto 0;
}
.bottom-sheet-mask {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.35);
  z-index: 999;
}
[data-theme="dark"] .bottom-sheet-mask {
  background: rgba(0,0,0,0.55);
}

/* ── Message Action Menu ── */
.msg-action-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.msg-action-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg, #F7F6F3);
  border-radius: 12px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s;
  touch-action: manipulation;
}
.msg-action-item:active {
  background: #EDEDEA;
}

/* ── Inline Menu ── */
#inline-menu {
  position: fixed;
  z-index: 9999;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  padding: 6px;
  display: flex;
  gap: 4px;
}
#inline-menu button {
  background: none;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  color: var(--accent);
  transition: background 0.15s;
}
#inline-menu button:active {
  background: #EDEDEA;
}

/* ── Completed Badge ── */
.completed-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #2E7D6B;
  background: #E8F4F0;
  padding: 2px 8px;
  border-radius: 9999px;
  vertical-align: middle;
  margin-left: 6px;
  white-space: nowrap;
}

/* ── Quote Bar ── */
#quote-bar {
  display: none;
  margin-bottom: 6px;
  padding: 8px 12px;
  background: #F0F9F5;
  border-left: 3px solid #2E7D6B;
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
[data-theme="dark"] #quote-bar {
  background: #1A2E28;
}

/* ════════════════════════════
   Route Summary (Index)
   ════════════════════════════ */
.route-summary {
  padding: 16px 20px 12px;
  margin-bottom: 6px;
}
.route-svg {
  width: 100%;
  height: 40px;
  display: block;
}
.route-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-tertiary);
  padding: 0 2px;
  margin-top: -4px;
}
