/* ========================================================
     Styles
   ======================================================== */

/* ---------- CSS Variables ---------- */
:root {
  --color-bg: #FAF8F5;
  --color-surface: #FFFFFF;
  --color-text: #2B2B2B;
  --color-text-secondary: #6B6B6B;
  --color-text-muted: #999999;
  --color-border: #EDEDEB;
  --color-border-light: #F5F5F3;

  /* Type colors */
  --color-food: #C4704B;
  --color-transport: #5B7FA5;
  --color-stay: #6B8E6B;
  --color-activity: #8B7BB5;
  --color-service: #8B8B8B;

  /* Fonts */
  --font-serif: "Noto Serif JP", serif;
  --font-sans: "Noto Sans JP", sans-serif;

  /* Spacing */
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 16px;
  --sp-lg: 24px;
  --sp-xl: 40px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.08);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  text-decoration: none;
  color: inherit;
}

ul,
ol {
  list-style: none;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
}

/* ---------- Layout ---------- */
.container {
  max-width: 600px;
  margin: 0 auto;
  background-color: var(--color-surface);
  min-height: 100vh;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.03);
  position: relative;
}

/* ---------- Header ---------- */
.main-header {
  position: relative;
  padding: 48px 24px 24px;
  text-align: center;
  background: linear-gradient(175deg, #FAF8F5 0%, #F5F0EA 40%, #EDE6DC 100%);
  overflow: hidden;
}

.header-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(200, 170, 140, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 30%, rgba(180, 160, 130, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

.header-content {
  position: relative;
  z-index: 1;
}

.sub-title {
  font-family: var(--font-serif);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  margin-bottom: 8px;
  color: var(--color-text-secondary);
  font-weight: 400;
}

.main-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.6;
  letter-spacing: 0.06em;
  color: var(--color-text);
}

.header-date-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  background: rgba(255, 255, 255, 0.6);
  padding: 4px 12px;
  border-radius: 99px;
  margin-bottom: 4px;
  backdrop-filter: blur(4px);
}

.header-members {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* ---------- Sticky Nav ---------- */
.sticky-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}

.nav-list {
  display: flex;
  gap: 2px;
  padding: 0 12px;
}

.nav-link {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 8px 12px;
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--color-text-muted);
  border-bottom: 2.5px solid transparent;
  transition: all 0.25s ease;
  position: relative;
  border-radius: 8px 8px 0 0;
}

.nav-link .nav-date {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.nav-link .day-label {
  font-size: 0.6rem;
  margin-top: 3px;
  letter-spacing: 0.08em;
  font-weight: 500;
  opacity: 0.7;
}

.nav-link.active {
  color: var(--color-text);
  border-bottom-color: var(--color-text);
  background: rgba(0, 0, 0, 0.02);
}

.nav-link.active .day-label {
  opacity: 1;
}

.nav-link:active {
  background: rgba(0, 0, 0, 0.03);
}

/* ---------- Tab Views ---------- */
.tab-view {
  display: none;
  animation: fadeIn 0.4s ease;
}

.tab-view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-header {
  padding: 24px 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.view-header.pb-0 {
  padding-bottom: 0;
}

.view-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--color-text);
}

.view-title i {
  margin-right: 8px;
  color: var(--color-text-secondary);
  font-size: 1.1rem;
}

.view-badge {
  font-size: 0.75rem;
  background: var(--color-bg);
  color: var(--color-text-secondary);
  padding: 4px 10px;
  border-radius: 99px;
  font-weight: 500;
  border: 1px solid var(--color-border);
}

/* ---------- Accommodation Cards ---------- */
.accommodation-list {
  padding: 0 20px 40px;
}

/* ---------- Accommodation Cards ---------- */
.accommodation-list {
  padding: 0 20px 20px;
}

.stay-card {
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stay-card:active {
  transform: scale(0.98);
}

.stay-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.stay-night-badge {
  background: var(--color-text);
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.stay-date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.stay-card-name {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.5;
}

.stay-card-info {
  display: flex;
  gap: 16px;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}

.stay-card-info i {
  margin-right: 4px;
  font-size: 0.7rem;
}

.stay-card-meals {
  display: flex;
  gap: 12px;
  font-size: 0.72rem;
  margin-bottom: 6px;
}

.meal-yes {
  color: var(--color-stay);
}

.meal-no {
  color: var(--color-text-muted);
}

.meal-yes i,
.meal-no i {
  margin-right: 3px;
  font-size: 0.65rem;
}

.stay-card-highlight {
  font-size: 0.72rem;
  color: var(--color-food);
  margin-top: 4px;
}

.stay-card-highlight i {
  margin-right: 4px;
  font-size: 0.65rem;
}

/* ---------- Packing List ---------- */
.packing-list {
  padding: 0 20px 40px;
}

.packing-category {
  margin-bottom: 16px;
}

.packing-category-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.packing-category-title i {
  font-size: 0.75rem;
}

.packing-items {
  padding-left: 0;
}

.packing-item {
  margin-bottom: 4px;
}

.custom-checkbox {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 6px 0;
  -webkit-tap-highlight-color: transparent;
}

.custom-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.custom-checkbox input:focus-visible + .checkmark {
  outline: 2px solid var(--color-activity);
  outline-offset: 2px;
}

.checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-radius: 5px;
  margin-right: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  background: var(--color-surface);
}

.checkmark::after {
  content: '';
  width: 6px;
  height: 10px;
  border: solid transparent;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.15s ease;
  margin-top: -2px;
}

.custom-checkbox input:checked+.checkmark {
  background: var(--color-stay);
  border-color: var(--color-stay);
}

.custom-checkbox input:checked+.checkmark::after {
  border-color: #fff;
  transform: rotate(45deg) scale(1);
}

.custom-checkbox input:checked~.item-label {
  color: var(--color-text-muted);
  text-decoration: line-through;
}

.item-label {
  font-size: 0.85rem;
  color: var(--color-text);
  line-height: 1.4;
  transition: color 0.2s;
}

/* Progress Bar */
.progress-bar-container {
  margin: 8px 20px 24px;
  height: 6px;
  background: var(--color-border);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--color-stay);
  border-radius: 99px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Expenses ---------- */
.expense-list {
  padding: 0 20px 40px;
}

.expense-category {
  margin-bottom: 16px;
}

.expense-category-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--color-border-light);
}

.expense-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  font-size: 0.82rem;
}

.expense-name {
  color: var(--color-text);
  flex: 1;
}

.expense-cost {
  color: var(--color-text-secondary);
  font-weight: 500;
  margin-left: 16px;
  white-space: nowrap;
}

/* ---------- Skeleton Loading ---------- */
.skeleton-box {
  background: linear-gradient(90deg, var(--color-border-light) 25%, var(--color-border) 50%, var(--color-border-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

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

/* ---------- Schedule Section ---------- */
.schedule-section {
  padding: 24px 20px 80px;
  background-color: var(--color-surface);
}

/* Day Header */
.day-header-area {
  margin-bottom: 32px;
}

.daily-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.date-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 8px 16px 8px 12px;
  background: linear-gradient(145deg, #F5F0EA, #EDE6DC);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.date-badge .date-num {
  font-size: 2rem;
  font-family: var(--font-serif);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.date-badge .date-sub {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

.date-badge .date-month {
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.3;
  opacity: 0.6;
}

.date-badge .date-dow {
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.3;
  opacity: 0.45;
}

.day-meta {
  flex: 1;
}

.day-area {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.day-area i {
  font-size: 0.65rem;
}

.day-theme {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  padding-left: 68px;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 68px;
  width: 1.5px;
  background: repeating-linear-gradient(to bottom,
      var(--color-border) 0px,
      var(--color-border) 5px,
      transparent 5px,
      transparent 10px);
  transform: translateX(-50%);
}

/* Timeline Item */
.timeline-item {
  position: relative;
  margin-bottom: 42px;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  transition-delay: var(--delay, 0s);
}

.timeline-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.timeline-icon-wrapper {
  position: absolute;
  left: -68px;
  width: 68px;
  display: flex;
  justify-content: center;
  top: 2px;
}

.timeline-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  font-size: 0.85rem;
  box-shadow: 0 0 0 5px var(--color-surface);
  color: #fff;
  transition: transform 0.2s;
}

/* Type Colors */
.type-food {
  background: var(--color-food);
}

.type-transport {
  background: var(--color-transport);
}

.type-stay {
  background: var(--color-stay);
}

.type-activity {
  background: var(--color-activity);
}

.type-service {
  background: var(--color-service);
}

/* Timeline Content */
.timeline-content {
  padding-top: 4px;
  padding-left: 8px;
}

.time-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.time {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  min-width: 42px;
  text-align: right;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}

.time.empty {
  min-width: 42px;
}

.title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--color-text);
  line-height: 1.4;
  letter-spacing: 0.02em;
}

.title.clickable {
  cursor: pointer;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.title.clickable:active {
  color: var(--color-activity);
}

.detail-arrow {
  font-size: 0.6rem;
  color: var(--color-text-muted);
  margin-left: 4px;
  vertical-align: middle;
}

/* Chips */
.chips {
  margin: 4px 0;
  padding-left: 46px;
}

.chip {
  display: inline-block;
  background: var(--color-text);
  color: #fff;
  font-size: 0.62rem;
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: 0.05em;
  font-weight: 500;
  font-family: var(--font-sans);
}

/* Description */
.description {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
  padding-left: 46px;
  line-height: 1.6;
}

/* Transport Details */
.transport-detail {
  padding-left: 46px;
  margin-top: 4px;
}

.transport-row {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
  flex-wrap: wrap;
  gap: 2px;
  font-size: 0.78rem;
  color: var(--color-text-secondary);
}

.transport-row i {
  width: 16px;
  text-align: center;
  margin-right: 6px;
  color: var(--color-transport);
  font-size: 0.7rem;
}

.transport-method {
  font-weight: 500;
  color: var(--color-text);
  margin-right: 4px;
}

.route {
  color: var(--color-text-secondary);
}

.duration,
.cost {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-left: auto;
  padding-left: 8px;
  white-space: nowrap;
}

.transport-note {
  padding-left: 22px;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-top: 0;
  margin-bottom: 4px;
}

/* Memo Box */
.memo-box {
  padding-left: 46px;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 4px;
  line-height: 1.5;
}

.memo-box i {
  margin-right: 4px;
  font-size: 0.65rem;
  color: var(--color-transport);
}

/* ---------- Detail Panel ---------- */
.detail-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s;
}

.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 600px;
  background: var(--color-surface);
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.detail-panel.open {
  transform: translateX(0);
}



/* JS-driven overlay open state */
.detail-panel.open+.detail-overlay {
  opacity: 1;
  visibility: visible;
}

/* Handle overlay separately since sibling order matters */
body:has(.detail-panel.open) .detail-overlay {
  opacity: 1;
  visibility: visible;
}

.detail-panel-content {
  padding: 0;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10;
  border-bottom: 1px solid var(--color-border-light);
}

.detail-back {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.9rem;
  color: var(--color-text);
  transition: background 0.2s;
}

.detail-back:active {
  background: var(--color-bg);
}

.detail-tags {
  display: flex;
  gap: 6px;
}

.detail-tag {
  font-size: 0.62rem;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--color-bg);
  color: var(--color-text-secondary);
  font-weight: 500;
  letter-spacing: 0.03em;
}

.detail-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  padding: 24px 24px 12px;
  line-height: 1.5;
  letter-spacing: 0.03em;
}

.detail-description {
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  padding: 0 24px 24px;
  line-height: 1.8;
}

.info-table {
  padding: 0 24px 24px;
}

.info-row {
  display: flex;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border-light);
  font-size: 0.82rem;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  width: 72px;
  flex-shrink: 0;
  color: var(--color-text-muted);
  font-size: 0.72rem;
  padding-top: 1px;
  line-height: 1.8;
}

.info-label i {
  margin-right: 4px;
  font-size: 0.65rem;
}

.info-value {
  flex: 1;
  color: var(--color-text);
  line-height: 1.7;
}

.info-value a {
  color: var(--color-transport);
  text-decoration: underline;
}

/* Detail Links */
.detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 24px 20px;
}

.detail-link-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-text);
  background: var(--color-surface);
  transition: background 0.2s, border-color 0.2s;
}

.detail-link-button:active {
  background: var(--color-bg);
}

.detail-link-button i {
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

.detail-link-button.disabled {
  color: var(--color-text-muted);
  border-color: var(--color-border-light);
  background: var(--color-bg);
  cursor: default;
  font-size: 0.75rem;
}

.map-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 24px 40px;
  padding: 14px;
  background: var(--color-text);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  transition: opacity 0.2s;
}

.map-button:active {
  opacity: 0.85;
}

/* ---------- Footer ---------- */
footer {
  text-align: center;
  padding: 48px 24px 60px;
  background: linear-gradient(to bottom, var(--color-surface), var(--color-bg));
}

.footer-text {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--color-text-secondary);
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.footer-sub {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
}

/* ---------- Responsive (Mobile) ---------- */
@media (max-width: 480px) {
  .container {
    box-shadow: none;
  }

  .main-header {
    padding: 60px 20px 36px;
  }

  .main-title {
    font-size: 1.45rem;
  }

  .date-circle {
    width: 70px;
    height: 70px;
  }

  .date-circle .day-num {
    font-size: 1.9rem;
  }

  .title {
    font-size: 0.95rem;
  }

  .timeline {
    padding-left: 60px;
  }

  .timeline::before {
    left: 60px;
  }

  .timeline-icon-wrapper {
    left: -60px;
    width: 60px;
  }

  .timeline-icon {
    width: 30px;
    height: 30px;
    font-size: 0.7rem;
  }

  .description,
  .transport-detail,
  .memo-box,
  .chips {
    padding-left: 46px;
  }

  .time {
    min-width: 38px;
    font-size: 0.8rem;
  }
}

/* ---------- Bottom Navigation ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  height: calc(64px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.bottom-nav .nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100%;
  color: var(--color-text-muted);
  font-size: 0.65rem;
  font-weight: 500;
  transition: all 0.2s ease;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav .nav-item i {
  font-size: 1.1rem;
}

.bottom-nav .nav-item.active {
  color: var(--color-text);
  transform: translateY(-2px);
}

.bottom-nav .nav-item.active i {
  color: var(--color-stay);
}

/* ---------- Safe Area & Footer ---------- */
footer {
  padding: 40px 20px calc(90px + env(safe-area-inset-bottom));
  text-align: center;
}

@supports (padding-top: env(safe-area-inset-top)) {
  .main-header {
    padding-top: calc(60px + env(safe-area-inset-top));
  }
}

/* ========================================================
   NEW: Header Actions & Countdown
   ======================================================== */

.header-top-actions {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: flex;
  gap: 8px;
}

.header-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  border: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.header-icon-btn:active {
  background: rgba(255,255,255,0.9);
  color: var(--color-text);
}

.countdown-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 99px;
  margin-top: 10px;
  letter-spacing: 0.03em;
}

.countdown-badge.upcoming {
  background: rgba(91,127,165,0.12);
  color: var(--color-transport);
}

.countdown-badge.active {
  background: rgba(107,142,107,0.15);
  color: var(--color-stay);
  animation: pulse 2s infinite;
}

.countdown-badge.memory {
  background: rgba(196,112,75,0.1);
  color: var(--color-food);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ========================================================
   NEW: Offline Banner
   ======================================================== */

.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3000;
  background: var(--color-text);
  color: #fff;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 8px 16px;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  transform: translateY(-100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.offline-banner.visible {
  transform: translateY(0);
}

.offline-banner.online-restore {
  background: var(--color-stay);
}

/* ========================================================
   NEW: Update Banner
   ======================================================== */

.update-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2500;
  background: var(--color-transport);
  color: #fff;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  transform: translateY(-100%);
  transition: transform 0.35s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.update-banner.visible {
  transform: translateY(0);
}

.update-btn {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.update-btn:active {
  background: rgba(255,255,255,0.35);
}

/* ========================================================
   NEW: Empty State
   ======================================================== */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--color-text-muted);
}

.empty-state i {
  font-size: 2rem;
  margin-bottom: 12px;
  opacity: 0.4;
  display: block;
}

.empty-state p {
  font-size: 0.85rem;
  margin-bottom: 16px;
}

/* ========================================================
   NEW: FAB (Floating Action Button)
   ======================================================== */

.fab-container {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  right: 20px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.fab-main {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--color-text);
  color: #fff;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  border: none;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), background 0.2s;
}

.fab-main.open {
  transform: rotate(45deg);
  background: var(--color-text-secondary);
}

.fab-main:active {
  transform: scale(0.92);
}

.fab-main.open:active {
  transform: rotate(45deg) scale(0.92);
}

.fab-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  opacity: 0;
  transform: translateY(10px) scale(0.9);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}

.fab-menu.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.fab-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-surface);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.fab-menu-item:active {
  background: var(--color-bg);
  transform: scale(0.97);
}

.fab-menu-item i {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  width: 16px;
  text-align: center;
}

/* ========================================================
   NEW: Schedule Action Bar
   ======================================================== */

.schedule-actions {
  display: flex;
  gap: 10px;
  padding: 16px 0 32px;
  justify-content: center;
}

.schedule-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  border: 1.5px solid transparent;
  background: var(--color-text);
  color: #fff;
}

.schedule-action-btn:active {
  transform: scale(0.97);
}

.schedule-action-btn.outline {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: var(--color-border);
}

.schedule-action-btn.outline:active {
  background: var(--color-bg);
}

.schedule-action-btn i {
  font-size: 0.72rem;
}

/* Empty state for no trip */
.no-trip-state {
  text-align: center;
  padding: 60px 20px;
}

.no-trip-state .no-trip-icon {
  font-size: 3rem;
  color: var(--color-border);
  margin-bottom: 16px;
}

.no-trip-state h3 {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--color-text);
}

.no-trip-state p {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-bottom: 24px;
  line-height: 1.6;
}

.no-trip-state .create-trip-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  background: var(--color-text);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform 0.15s, box-shadow 0.2s;
}

.no-trip-state .create-trip-btn:active {
  transform: scale(0.97);
  box-shadow: var(--shadow-sm);
}

/* ========================================================
   NEW: Editor Panel
   ======================================================== */

.editor-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-surface);
  z-index: 2000;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.editor-panel.open {
  transform: translateY(0);
}

.editor-panel-content {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
}

/* Editor Step Layout */
.editor-step {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.editor-step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10;
  border-bottom: 1px solid var(--color-border-light);
}

.editor-close-btn,
.editor-back-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--color-text);
  background: none;
  border: none;
  cursor: pointer;
}

.editor-close-btn:active,
.editor-back-btn:active {
  background: var(--color-bg);
}

.editor-save-btn {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-transport);
  background: none;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.editor-save-btn:active {
  background: rgba(91,127,165,0.08);
}

/* Step Indicator */
.editor-step-indicator {
  display: flex;
  gap: 6px;
  align-items: center;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-border);
  transition: all 0.3s;
}

.step-dot.active {
  width: 24px;
  border-radius: 99px;
  background: var(--color-text);
}

.step-dot.completed {
  background: var(--color-stay);
}

/* Step Content */
.editor-step-content {
  flex: 1;
  padding: 24px 20px;
}

.editor-step-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--color-text);
}

.editor-step-desc {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-bottom: 28px;
  line-height: 1.6;
}

/* Step Footer */
.editor-step-footer {
  padding: 16px 20px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--color-border-light);
  background: var(--color-surface);
  position: sticky;
  bottom: 0;
}

/* Editor Form Elements */
.editor-form-group {
  margin-bottom: 20px;
}

.editor-form-row {
  display: flex;
  gap: 12px;
}

.editor-form-row .editor-form-group {
  flex: 1;
}

.editor-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.03em;
}

.editor-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

.editor-input:focus {
  border-color: var(--color-text-secondary);
}

.editor-input::placeholder {
  color: var(--color-text-muted);
}

.editor-input-sm {
  width: 100%;
  padding: 8px 10px;
  font-size: 0.82rem;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

.editor-input-sm:focus {
  border-color: var(--color-text-secondary);
}

.editor-textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  outline: none;
  resize: vertical;
  line-height: 1.6;
  transition: border-color 0.2s;
}

.editor-textarea:focus {
  border-color: var(--color-text-secondary);
}

.editor-select {
  padding: 8px 10px;
  font-size: 0.82rem;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  outline: none;
  -webkit-appearance: none;
  width: 100%;
}

/* Editor Buttons */
.editor-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  font-family: var(--font-sans);
}

.editor-btn.primary {
  background: var(--color-text);
  color: #fff;
}

.editor-btn.primary:active {
  opacity: 0.85;
  transform: scale(0.98);
}

.editor-btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.78rem;
  font-weight: 500;
  background: var(--color-bg);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
}

.editor-btn-sm:active {
  background: var(--color-border-light);
}

/* Trip Duration Badge */
.trip-duration-badge {
  text-align: center;
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  padding: 14px;
  background: var(--color-bg);
  border-radius: var(--radius-md);
  margin-top: 8px;
}

.trip-duration-badge strong {
  color: var(--color-text);
}

.trip-duration-badge .duration-placeholder {
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

.trip-duration-badge .duration-error {
  color: var(--color-food);
  font-size: 0.82rem;
}

/* ========================================================
   NEW: Day Template Cards (Step 2)
   ======================================================== */

.day-template-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.day-template-card {
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--color-border-light);
}

.day-template-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.day-template-date {
  font-family: var(--font-serif);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text);
}

.day-template-event-count {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  background: var(--color-surface);
  padding: 2px 8px;
  border-radius: 99px;
}

/* Template Chips */
.template-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.template-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: 99px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.2s;
}

.template-chip:active {
  transform: scale(0.96);
}

.template-chip.active {
  background: var(--color-text);
  color: #fff;
  border-color: var(--color-text);
}

.template-chip i {
  font-size: 0.65rem;
}

/* Day Template Inputs */
.day-template-inputs {
  display: flex;
  gap: 8px;
}

.day-template-inputs .editor-input-sm {
  flex: 1;
}

/* ========================================================
   NEW: Editable Timeline (Step 3)
   ======================================================== */

.editor-day-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.editor-day-tabs::-webkit-scrollbar {
  display: none;
}

.editor-day-tab {
  flex-shrink: 0;
  padding: 8px 16px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: 99px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.2s;
}

.editor-day-tab.active {
  background: var(--color-text);
  color: #fff;
  border-color: var(--color-text);
}

.editable-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border-light);
}

.editable-day-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.editable-day-label {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
}

.editable-day-area {
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.editable-day-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.icon-btn:active {
  background: var(--color-border);
}

.icon-btn.danger {
  color: var(--color-food);
}

.icon-btn.danger:active {
  background: rgba(196,112,75,0.1);
}

/* Editable Event Items */
.editable-timeline {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 20px;
}

.editable-event {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.editable-event:active {
  background: var(--color-bg);
}

.editable-event-handle {
  color: var(--color-border);
  font-size: 0.75rem;
  cursor: grab;
  flex-shrink: 0;
  padding: 4px;
}

.editable-event-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: #fff;
  flex-shrink: 0;
}

.editable-event-body {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.editable-event-time {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: 1px;
}

.editable-event-title {
  font-family: var(--font-serif);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.editable-event-desc {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.editable-event-memo {
  font-size: 0.68rem;
  color: var(--color-transport);
  margin-top: 2px;
}

.editable-event-memo i {
  font-size: 0.6rem;
  margin-right: 2px;
}

.editable-event-delete {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--color-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.editable-event-delete:active {
  background: rgba(196,112,75,0.1);
  color: var(--color-food);
}

/* ========================================================
   NEW: Quick Add Bar
   ======================================================== */

.quick-add-bar {
  padding: 16px 0;
  border-top: 1px solid var(--color-border-light);
}

.quick-add-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 10px;
  display: block;
  letter-spacing: 0.05em;
}

.quick-add-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quick-add-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 99px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.15s;
}

.quick-add-chip:active {
  background: var(--color-border);
  transform: scale(0.96);
}

.quick-add-chip i {
  font-size: 0.65rem;
  color: var(--color-text-secondary);
}

/* ========================================================
   NEW: Event Edit Modal
   ======================================================== */

.event-edit-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-surface);
  z-index: 2500;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.event-edit-modal.open {
  transform: translateX(0);
}

.event-edit-modal-content {
  max-width: 600px;
  margin: 0 auto;
}

.event-edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10;
  border-bottom: 1px solid var(--color-border-light);
}

.event-edit-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
}

.event-edit-body {
  padding: 20px;
}

/* Type Selector */
.type-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.type-chip {
  padding: 6px 14px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: 99px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.2s;
}

.type-chip.active {
  background: var(--color-text);
  color: #fff;
  border-color: var(--color-text);
}

/* Icon Grid */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.icon-option {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.icon-option.active {
  background: var(--color-text);
  color: #fff;
  border-color: var(--color-text);
}

.icon-option:active {
  transform: scale(0.93);
}

/* Transport Fields */
.transport-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}

.transport-field-row .editor-select {
  grid-column: span 2;
}

/* Meal Toggles */
.meal-toggles {
  display: flex;
  gap: 16px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  cursor: pointer;
}

.toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-stay);
}

/* Add Accommodation Button */
.add-accommodation-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  margin-top: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: var(--color-bg);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.2s;
}

.add-accommodation-btn:active {
  background: var(--color-border-light);
  border-color: var(--color-text-muted);
}

/* ========================================================
   NEW: Dark Mode
   ======================================================== */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #1A1A1A;
    --color-surface: #242424;
    --color-text: #E8E8E8;
    --color-text-secondary: #A0A0A0;
    --color-text-muted: #666666;
    --color-border: #333333;
    --color-border-light: #2A2A2A;
    --color-food: #D48A6A;
    --color-transport: #7B9FC5;
    --color-stay: #8BAE8B;
    --color-activity: #AB9BD5;
    --color-service: #9B9B9B;
  }

  :root:not([data-theme="light"]) .main-header {
    background: linear-gradient(175deg, #1A1A1A 0%, #222222 40%, #2A2824 100%);
  }

  :root:not([data-theme="light"]) .header-bg {
    background:
      radial-gradient(ellipse at 20% 0%, rgba(120,100,80,0.1) 0%, transparent 60%),
      radial-gradient(ellipse at 80% 30%, rgba(100,90,70,0.08) 0%, transparent 50%);
  }

  :root:not([data-theme="light"]) .sticky-nav {
    background: rgba(36,36,36,0.92);
  }

  :root:not([data-theme="light"]) .bottom-nav {
    background: rgba(36,36,36,0.88);
  }

  :root:not([data-theme="light"]) .detail-header,
  :root:not([data-theme="light"]) .editor-step-header,
  :root:not([data-theme="light"]) .event-edit-header {
    background: rgba(36,36,36,0.95);
  }

  :root:not([data-theme="light"]) .header-icon-btn {
    background: rgba(60,60,60,0.6);
  }

  :root:not([data-theme="light"]) .date-badge {
    background: linear-gradient(145deg, #2A2A2A, #333330);
  }

  :root:not([data-theme="light"]) footer {
    background: linear-gradient(to bottom, var(--color-surface), var(--color-bg));
  }

  :root:not([data-theme="light"]) .header-date-badge {
    background: rgba(60,60,60,0.5);
  }

  :root:not([data-theme="light"]) .timeline-icon {
    box-shadow: 0 0 0 5px var(--color-surface);
  }

  :root:not([data-theme="light"]) .skeleton-box {
    background: linear-gradient(90deg, #2A2A2A 25%, #333333 50%, #2A2A2A 75%);
    background-size: 200% 100%;
  }
}

/* Manual dark override */
[data-theme="dark"] {
  --color-bg: #1A1A1A;
  --color-surface: #242424;
  --color-text: #E8E8E8;
  --color-text-secondary: #A0A0A0;
  --color-text-muted: #666666;
  --color-border: #333333;
  --color-border-light: #2A2A2A;
  --color-food: #D48A6A;
  --color-transport: #7B9FC5;
  --color-stay: #8BAE8B;
  --color-activity: #AB9BD5;
  --color-service: #9B9B9B;
}

[data-theme="dark"] .main-header {
  background: linear-gradient(175deg, #1A1A1A 0%, #222222 40%, #2A2824 100%);
}

[data-theme="dark"] .header-bg {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(120,100,80,0.1) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 30%, rgba(100,90,70,0.08) 0%, transparent 50%);
}

[data-theme="dark"] .sticky-nav {
  background: rgba(36,36,36,0.92);
}

[data-theme="dark"] .bottom-nav {
  background: rgba(36,36,36,0.88);
}

[data-theme="dark"] .detail-header,
[data-theme="dark"] .editor-step-header,
[data-theme="dark"] .event-edit-header {
  background: rgba(36,36,36,0.95);
}

[data-theme="dark"] .header-icon-btn {
  background: rgba(60,60,60,0.6);
}

[data-theme="dark"] .date-badge {
  background: linear-gradient(145deg, #2A2A2A, #333330);
}

[data-theme="dark"] footer {
  background: linear-gradient(to bottom, var(--color-surface), var(--color-bg));
}

[data-theme="dark"] .header-date-badge {
  background: rgba(60,60,60,0.5);
}

[data-theme="dark"] .timeline-icon {
  box-shadow: 0 0 0 5px var(--color-surface);
}

[data-theme="dark"] .skeleton-box {
  background: linear-gradient(90deg, #2A2A2A 25%, #333333 50%, #2A2A2A 75%);
  background-size: 200% 100%;
}

[data-theme="dark"] .fab-main {
  background: #E8E8E8;
  color: #1A1A1A;
}

[data-theme="dark"] .fab-menu-item {
  background: #2A2A2A;
  border-color: #3A3A3A;
}

[data-theme="dark"] .schedule-action-btn {
  background: #E8E8E8;
  color: #1A1A1A;
}

[data-theme="dark"] .schedule-action-btn.outline {
  background: transparent;
  color: var(--color-text-muted);
  border-color: #3A3A3A;
}

[data-theme="dark"] .no-trip-state .create-trip-btn {
  background: #E8E8E8;
  color: #1A1A1A;
}

/* Force light for data-theme="light" */
[data-theme="light"] {
  --color-bg: #FAF8F5;
  --color-surface: #FFFFFF;
  --color-text: #2B2B2B;
  --color-text-secondary: #6B6B6B;
  --color-text-muted: #999999;
  --color-border: #EDEDEB;
  --color-border-light: #F5F5F3;
  --color-food: #C4704B;
  --color-transport: #5B7FA5;
  --color-stay: #6B8E6B;
  --color-activity: #8B7BB5;
  --color-service: #8B8B8B;
}