:root {
  --bg: #fff;
  --bg-elev: #f5f5f7;
  --bg-tile: #fafafa;
  --text: #1a1a1a;
  --text-muted: #666;
  --border: #e0e0e0;
  --accent: #0d6fb8;
  --sand: #f5e6c8;
  --sky: #87ceeb;
  --sea: #0d6fb8;
  --sun: #fdd835;
  --rest: #b8d8a8;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --radius: 12px;
  --bottom-nav-h: 64px;
}

[data-theme="dark"] {
  --bg: #15151a;
  --bg-elev: #1f1f25;
  --bg-tile: #25252c;
  --text: #eee;
  --text-muted: #aaa;
  --border: #333;
  --accent: #4a9eff;
  --sand: #6b5c3e;
  --rest: #4a6840;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0));
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-size: 1.2rem;
  margin: 0;
  font-weight: 600;
}

.btn-icon {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text);
  border-radius: 8px;
  min-height: 44px;
  min-width: 44px;
  font-family: inherit;
}

.btn-icon:active {
  background: var(--bg-tile);
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

.day-hero {
  height: 200px;
  background-size: cover;
  background-position: center;
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.restaurant-card {
  background: linear-gradient(135deg, var(--accent), #4a9eff);
  color: white;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.restaurant-card h3 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.restaurant-loc {
  margin: 0 0 8px;
  font-size: 0.85rem;
  opacity: 0.9;
}

.restaurant-card p {
  margin: 4px 0;
  font-size: 0.95rem;
}

.restaurant-order {
  margin-top: 8px !important;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.3);
  font-size: 0.9rem !important;
}

.weather-card {
  background: linear-gradient(135deg, #87ceeb, #0d6fb8);
  color: white;
  border: none;
}

[data-theme="dark"] .weather-card {
  background: linear-gradient(135deg, #2c5f7c, #1a3a4f);
}

.weather-card h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.weather-card .hint {
  color: rgba(255,255,255,0.9) !important;
  margin: 4px 0 12px !important;
  font-size: 0.9rem !important;
}

.weather-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.weather-day {
  background: rgba(255,255,255,0.15);
  padding: 8px;
  border-radius: 8px;
  text-align: center;
  font-size: 0.85rem;
}

.weather-temp {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 2px 0;
}

.weather-meta {
  font-size: 0.75rem;
  opacity: 0.9;
}

@media print {
  .restaurant-card, .weather-card {
    background: white !important;
    color: black !important;
  }
}

.view {
  display: none;
}

.view.active {
  display: block;
}

/* ── Start / countdown view ────────────────────────────── */
.hero {
  position: relative;
  height: 220px;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  background: #0d6fb8;
}

.hero-image {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.6);
}

.hero-content {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: white;
  padding: 0 16px;
}

.hero-title {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.hero-subtitle {
  margin: 6px 0 0;
  font-size: 1rem;
  opacity: 0.95;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.countdown {
  background: linear-gradient(135deg, #0d6fb8, #4a9eff);
  color: white;
  border-radius: var(--radius);
  padding: 20px 16px;
  margin-bottom: 16px;
  text-align: center;
}

.countdown-status {
  font-size: 0.95rem;
  margin-bottom: 16px;
  opacity: 0.95;
}

.countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.countdown-unit {
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 12px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.countdown-num {
  font-size: 1.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.countdown-label {
  font-size: 0.75rem;
  margin-top: 4px;
  opacity: 0.9;
  text-transform: lowercase;
}

.countdown-flights {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.flight {
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 10px 8px;
}

.flight-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  opacity: 0.8;
  margin-bottom: 4px;
}

.flight-time {
  font-size: 0.95rem;
  font-weight: 600;
}

.flight-route {
  font-size: 0.75rem;
  opacity: 0.9;
  margin-top: 2px;
}

.btn-primary {
  background: white;
  color: var(--accent);
  border: none;
  border-radius: var(--radius);
  padding: 14px 24px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
}

.btn-primary:active {
  opacity: 0.85;
}

[data-theme="dark"] .countdown {
  background: linear-gradient(135deg, #2c5f7c, #1a3a4f);
}

.countdown-active {
  background: linear-gradient(135deg, #fdd835, #f5a623) !important;
  color: #4a3a00 !important;
}

.countdown-active .countdown-unit {
  background: rgba(255,255,255,0.35);
}

.countdown-active .flight {
  background: rgba(255,255,255,0.35);
}

.countdown-past {
  background: linear-gradient(135deg, #6b6b6b, #3a3a3a) !important;
}

@media (min-width: 720px) {
  .hero { height: 280px; }
  .hero-title { font-size: 3.2rem; }
}

@media (max-width: 360px) {
  .countdown-num { font-size: 1.4rem; }
  .countdown-grid { gap: 4px; }
  .countdown-unit { padding: 8px 2px; }
}

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

.day-info {
  flex: 1;
  text-align: center;
}

#current-day-title {
  margin: 0;
  font-size: 1.2rem;
}

#current-day-date {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.quick-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.quick-btn {
  flex: 1;
  background: var(--bg-tile);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
}

.quick-btn:active {
  opacity: 0.7;
}

.block {
  margin-bottom: 16px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.block-header {
  padding: 8px 12px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
}

.block-header.morning { background: #fdd835; color: #4a3a00; }
.block-header.afternoon { background: var(--accent); color: white; }
.block-header.evening { background: #ff7043; color: white; }

.block-header .time-icon {
  font-size: 1rem;
}

.block-items {
  background: var(--bg-tile);
}

.item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

.item:last-child {
  border-bottom: none;
}

.item.rest {
  background: var(--rest);
  color: #1a1a1a;
}

[data-theme="dark"] .item.rest {
  color: #eee;
}

.item-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

.item-text {
  flex: 1;
  font-size: 0.95rem;
}

.item-time {
  font-weight: 600;
  color: var(--accent);
  margin-right: 4px;
}

[data-theme="dark"] .item-time {
  color: var(--accent);
}

.item-sub {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.day-nav-arrows {
  display: flex;
  gap: 8px;
}

.hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 12px;
}

.checklist-section {
  margin-bottom: 24px;
}

.checklist-section h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-tile);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
  cursor: pointer;
}

.checklist-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  flex-shrink: 0;
}

.checklist-item.done {
  opacity: 0.5;
  text-decoration: line-through;
}

.info-card {
  background: var(--bg-tile);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

.info-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-card p {
  margin: 4px 0;
  font-size: 0.9rem;
}

.info-card ul {
  margin: 4px 0;
  padding-left: 20px;
  font-size: 0.9rem;
}

.info-card li {
  margin: 2px 0;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0);
  height: var(--bottom-nav-h);
  z-index: 10;
}

.nav-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-family: inherit;
  font-size: 0.75rem;
}

.nav-btn.active {
  color: var(--accent);
}

.nav-icon {
  font-size: 1.4rem;
}

@media (min-width: 720px) {
  main {
    padding: 24px;
  }
}

@media print {
  .topbar, .bottom-nav, .quick-actions, .btn-icon {
    display: none !important;
  }
  
  body {
    padding: 0;
    background: white;
    color: black;
    font-size: 11pt;
  }
  
  main {
    max-width: 100%;
    padding: 0;
  }
  
  .view {
    display: block !important;
    page-break-after: always;
  }
  
  .view:last-child {
    page-break-after: auto;
  }
  
  .block {
    page-break-inside: avoid;
  }
}
