/* bankz-calendar — modern family travel calendar */

:root {
  --bg: #f6f4ef;
  --bg-soft: #fbfaf7;
  --card: #ffffff;
  --ink: #1c1f26;
  --ink-soft: #5a6075;
  --ink-mute: #9097a8;
  --line: #ececec;
  --primary: #2c3e8f;
  --primary-soft: #e8ecff;
  --accent: #ff6b6b;
  --warm: #ffb84d;
  --mint: #4ecdc4;
  --lilac: #a78bfa;
  --shadow-sm: 0 1px 2px rgba(20, 20, 40, 0.04), 0 1px 3px rgba(20, 20, 40, 0.06);
  --shadow-md: 0 4px 12px rgba(20, 20, 40, 0.06), 0 2px 4px rgba(20, 20, 40, 0.04);
  --shadow-lg: 0 16px 40px rgba(20, 20, 40, 0.08), 0 4px 12px rgba(20, 20, 40, 0.04);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  background:
    radial-gradient(1200px 600px at 10% -10%, #eef1ff 0%, transparent 60%),
    radial-gradient(900px 500px at 95% 0%, #fff0ee 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: 'Inter', 'Noto Sans Thai', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* ============ Layout ============ */
.shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px 28px 64px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--lilac));
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
  font-size: 18px;
  box-shadow: var(--shadow-md);
}

.brand-text h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-text p {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: -2px;
}

.nav-links {
  display: flex;
  gap: 6px;
  background: var(--card);
  padding: 5px;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}

.nav-link {
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-link:hover { color: var(--ink); }
.nav-link.active {
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow-sm);
}

/* ============ Hero ============ */
.hero {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.hero h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.hero p {
  color: var(--ink-soft);
  font-size: 14.5px;
}

.hero-stats {
  display: flex;
  gap: 16px;
}

.stat {
  text-align: center;
  padding: 8px 18px;
  border-radius: var(--radius);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  min-width: 80px;
}

.stat-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 11px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

/* ============ Tabs ============ */
.view-toggle {
  display: inline-flex;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}

.view-tab {
  padding: 8px 18px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all .2s;
}

.view-tab.active {
  background: var(--ink);
  color: white;
}

.view-tab svg { width: 16px; height: 16px; }

/* ============ Card ============ */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line);
  overflow: hidden;
}

.card-pad { padding: 24px; }

/* ============ Trip List ============ */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.filter-chip {
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-soft);
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}

.filter-chip:hover { border-color: var(--ink-mute); }
.filter-chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.trip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.trip-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: relative;
  transition: transform .2s, box-shadow .2s;
}

.trip-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.trip-card .stripe {
  height: 5px;
  background: linear-gradient(90deg, var(--primary), var(--lilac));
}

.trip-body {
  padding: 14px 16px 16px;
}

.trip-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
}

.trip-flag {
  font-size: 34px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}
.trip-flag .flag-img { width: 44px; height: 33px; border-radius: 4px; }

.trip-where {
  flex: 1;
  min-width: 0;
}

.trip-country {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.trip-city {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.trip-status {
  font-size: 10.5px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.status-upcoming { background: #e8ecff; color: var(--primary); }
.status-ongoing { background: #d4f6f3; color: #0d8c83; }
.status-past { background: #f1f1f3; color: var(--ink-soft); }

.trip-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.trip-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
}

.trip-meta-row svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.7;
}

.trip-meta-row strong {
  color: var(--ink);
  font-weight: 600;
}

.trip-notes {
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
  border-left: 3px solid var(--warm);
}

/* ============ Calendar ============ */
.cal-wrap {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.cal-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cal-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  transition: all .15s;
}

.cal-btn:hover { background: var(--ink); color: white; border-color: var(--ink); }
.cal-btn svg { width: 16px; height: 16px; }

.cal-today-btn {
  padding: 8px 14px;
  width: auto;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 10px;
}

.cal-grid {
  display: flex;
  flex-direction: column;
}

.cal-day-heads {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-day-head {
  padding: 10px 7px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}

.cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  position: relative;
}

.cal-cell {
  min-height: 107px;
  padding: 5px 5px 20px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: white;
  position: relative;
  transition: background .15s;
}

.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.muted { background: #fafafa; color: var(--ink-mute); }
.cal-cell.today { background: #fff8e7; }
.cal-cell.today .cal-date { color: var(--accent); font-weight: 700; }

.cal-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.cal-cell.muted .cal-date { color: var(--ink-mute); font-weight: 500; }

/* Continuous-bar overlay: one grid per week, bars span days. */
.cal-bars {
  position: absolute;
  top: 22px;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 20px;
  row-gap: 2px;
  padding: 0 2px;
  pointer-events: none;
}

.cal-bar {
  pointer-events: auto;
  min-width: 0;
  font-size: 11.5px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 18px;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid transparent;
  transition: filter .15s, transform .15s;
  margin: 0 1px;
}

.cal-bar:hover { filter: brightness(0.96); transform: translateY(-1px); }
.cal-bar.is-start {
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
  margin-left: 3px;
}
.cal-bar.is-end {
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
  margin-right: 3px;
}
.cal-bar:not(.is-start) {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  margin-left: 0;
  border-left: none;
  padding-left: 4px;
}
.cal-bar:not(.is-end) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  margin-right: 0;
  border-right: none;
  padding-right: 4px;
}

.cal-bar-flag { font-size: 13px; line-height: 1; display: inline-flex; align-items: center; }
.cal-bar-flag .flag-img { width: 14px; height: 10px; border-radius: 1px; }

/* Shared flag image base */
.flag-img {
  display: inline-block;
  vertical-align: middle;
  object-fit: cover;
}
.cal-bar-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-overflow {
  pointer-events: auto;
  font-size: 10.5px;
  color: var(--ink-soft);
  background: #f0f0f3;
  border-radius: 4px;
  padding: 1px 6px;
  margin: 0 3px;
  text-align: center;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.cal-overflow:hover { background: #e3e3e9; }

/* ============ Empty ============ */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-soft);
}
.empty-emoji { font-size: 52px; margin-bottom: 14px; }
.empty h3 { font-size: 18px; color: var(--ink); margin-bottom: 6px; }
.empty p { font-size: 14px; }

/* ============ Forms (admin) ============ */
.form-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line);
  padding: 32px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.form-field { display: flex; flex-direction: column; }
.form-field.full { grid-column: 1 / -1; }

.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.req { color: var(--accent); }

.form-input,
.form-select,
.form-textarea {
  background: var(--bg-soft);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 14px;
  transition: border-color .15s, background .15s;
  width: 100%;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
}

.form-textarea { resize: vertical; min-height: 90px; }

/* ============ Traveler chips ============ */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip-suggest {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-soft);
  font-weight: 500;
  transition: all .15s;
}

.chip-suggest:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-1px);
}

.chip-suggest:active { transform: translateY(0); }

/* ============ Traveler chip picker ============ */
.traveler-picker {
  background: var(--bg-soft);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  transition: border-color .15s, background .15s;
  min-height: 44px;
}

.traveler-picker:focus-within {
  border-color: var(--primary);
  background: white;
}

.traveler-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px 12px;
  background: var(--primary);
  color: white;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  animation: pop .15s ease-out;
}

.traveler-tag .x {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  transition: background .12s;
}

.traveler-tag .x:hover { background: rgba(255, 255, 255, 0.5); }

.traveler-input {
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
  min-width: 160px;
  padding: 4px 6px;
  font-size: 14px;
}

.traveler-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.traveler-suggestion {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-soft);
  font-weight: 500;
  transition: all .15s;
  cursor: pointer;
}

.traveler-suggestion:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-1px);
}

.traveler-suggestion.picked {
  opacity: 0.35;
  pointer-events: none;
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary-soft);
}

.traveler-hint {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 4px;
}

/* ============ Combobox (country) ============ */
.combobox {
  position: relative;
}

.combobox-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  padding: 4px;
}

.combobox-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: background .12s;
}

.combobox-option:hover,
.combobox-option.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.combobox-flag { font-size: 20px; line-height: 1; display: inline-flex; align-items: center; }
.combobox-flag .flag-img { width: 26px; height: 20px; border-radius: 2px; }
.combobox-name { flex: 1; font-weight: 500; color: var(--ink); }
.combobox-option:hover .combobox-name,
.combobox-option.active .combobox-name { color: var(--primary); }

.combobox-code {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-mute);
  background: var(--bg-soft);
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

.combobox-empty {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--ink-soft);
  text-align: center;
  font-style: italic;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 26px;
}

.btn {
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all .15s;
}

.btn-primary {
  background: var(--ink);
  color: white;
}

.btn-primary:hover { background: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-ghost {
  background: var(--bg-soft);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--card); color: var(--ink); }

.btn-danger {
  background: #ffeae8;
  color: var(--accent);
}
.btn-danger:hover { background: var(--accent); color: white; }

.btn svg { width: 16px; height: 16px; }

/* ============ Admin trip rows ============ */
.admin-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  transition: background .15s;
}

.admin-row:last-child { border-bottom: none; }
.admin-row:hover { background: var(--bg-soft); }

.admin-row .flag { font-size: 28px; display: inline-flex; align-items: center; }
.admin-row .flag .flag-img { width: 36px; height: 27px; border-radius: 3px; }
.admin-row .info { flex: 1; min-width: 0; }
.admin-row .who { font-weight: 600; font-size: 14.5px; }
.admin-row .where {
  font-size: 13px;
  color: var(--ink-soft);
  display: flex;
  gap: 6px;
  align-items: center;
}
.admin-row .when {
  font-size: 12.5px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.admin-row .actions { display: flex; gap: 6px; }

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  transition: all .15s;
}
.icon-btn:hover { background: var(--ink); color: white; border-color: var(--ink); }
.icon-btn.danger:hover { background: var(--accent); color: white; border-color: var(--accent); }
.icon-btn svg { width: 15px; height: 15px; }

/* ============ Modal ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 28, 0.45);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 460px;
  width: 100%;
  padding: 28px;
  animation: pop .2s ease-out;
}

@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-flag { font-size: 40px; display: inline-flex; align-items: center; }
.modal-flag .flag-img { width: 48px; height: 36px; border-radius: 4px; }
.modal-title { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.modal-sub { font-size: 13px; color: var(--ink-soft); }

.modal-body { display: flex; flex-direction: column; gap: 10px; padding: 14px 0; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); }
.modal-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.modal-row svg { width: 16px; height: 16px; color: var(--ink-soft); }
.modal-row strong { color: var(--ink); }

.modal-notes {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.55;
  border-left: 3px solid var(--warm);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

/* day-list popup (calendar "+N เพิ่มเติม" click) */
.day-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 14px 0;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
}
.day-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s, transform .15s;
}
.day-row:hover { background: white; transform: translateX(2px); box-shadow: var(--shadow-sm); }
.day-row-flag { font-size: 24px; line-height: 1; display: inline-flex; align-items: center; }
.day-row-flag .flag-img { width: 34px; height: 25px; border-radius: 3px; }
.day-row-info { flex: 1; min-width: 0; }
.day-row-where { font-weight: 600; font-size: 14px; }
.day-row-who { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; display: flex; align-items: center; gap: 6px; }

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--ink);
  color: white;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: all .25s ease-out;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--accent); }

/* ============ Homepage: fit in one screen, no scroll ============ */
body.home {
  height: 100vh;
  overflow: hidden;
}

body.home .shell {
  height: 100vh;
  padding: 14px 24px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

body.home .topbar { margin-bottom: 0; flex-shrink: 0; }
body.home .brand-mark { width: 36px; height: 36px; border-radius: 10px; font-size: 16px; }
body.home .brand-text h1 { font-size: 16px; }
body.home .brand-text p { font-size: 11px; }
body.home .nav-link { padding: 6px 14px; font-size: 13px; }

body.home .hero {
  margin-bottom: 0;
  padding: 10px 18px;
  flex-shrink: 0;
}
body.home .hero h2 { font-size: 16px; margin-bottom: 1px; }
body.home .hero p { font-size: 12px; }
body.home .hero-stats { gap: 10px; }
body.home .stat { padding: 5px 14px; min-width: 64px; }
body.home .stat-num { font-size: 17px; }
body.home .stat-label { font-size: 10px; }

body.home .view-toggle { margin-bottom: 0; flex-shrink: 0; }
body.home .view-tab { padding: 6px 14px; font-size: 12.5px; }

body.home #view-cal {
  flex: 1;
  display: flex;
  min-height: 0;
}
body.home #view-cal .cal-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
body.home .cal-header { padding: 8px 16px; flex-shrink: 0; }
body.home .cal-title { font-size: 16px; }
body.home .cal-btn { width: 30px; height: 30px; border-radius: 8px; }
body.home .cal-today-btn {
  width: auto;
  height: 30px;
  padding: 0 14px;
  font-size: 12px;
  white-space: nowrap;
  line-height: 1;
}

body.home .cal-grid {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
body.home .cal-day-heads { flex-shrink: 0; }
body.home .cal-day-head { padding: 6px 6px; font-size: 10px; }
body.home .cal-week { flex: 1; min-height: 0; overflow: hidden; }
body.home .cal-cell { min-height: 0; padding: 3px 4px 18px; }
body.home .cal-date { font-size: 12px; margin-bottom: 2px; }
body.home .cal-bars { top: 19px; grid-auto-rows: 17px; row-gap: 2px; }
body.home .cal-bar { line-height: 15px; padding: 0 6px; }
body.home .cal-overflow { line-height: 15px; padding: 0 5px; font-size: 10px; }

/* List view on homepage: scroll inside, page stays put */
body.home #view-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

/* On very short windows, give up and allow page scroll */
@media (max-height: 620px) {
  body.home { overflow: auto; height: auto; }
  body.home .shell { height: auto; min-height: 100vh; }
  body.home .cal-week { flex: 0 0 auto; min-height: 78px; }
}

/* ============ Responsive ============ */
@media (max-width: 720px) {
  .shell { padding: 18px 14px 48px; }
  .topbar { flex-direction: column; gap: 14px; align-items: stretch; }
  .nav-links { justify-content: center; }
  .hero { padding: 22px; }
  .hero h2 { font-size: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .cal-cell { min-height: 82px; padding: 3px 3px 15px; }
  .cal-bars { top: 19px; grid-auto-rows: 17px; row-gap: 2px; }
  .cal-bar { font-size: 10px; padding: 0 5px; line-height: 15px; gap: 3px; }
  .cal-bar-flag { font-size: 10.5px; }
  .cal-overflow { font-size: 9.5px; line-height: 15px; padding: 0 4px; }
  .trip-grid { grid-template-columns: 1fr; }

  /* Phone-width: home can't realistically fit; allow normal scroll */
  body.home { overflow: auto; height: auto; }
  body.home .shell { height: auto; min-height: 100vh; padding: 18px 14px 48px; }
  body.home .cal-week { flex: 0 0 auto; min-height: 82px; }
  body.home #view-list { overflow: visible; }
}
