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

:root {
  --bg: #fafaf9;
  --fg: #1c1917;
  --muted: #78716c;
  --border: #e7e5e4;
  --card: #ffffff;
  --accent: #d97706;
  --accent-light: #fef3c7;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --event-1: #f87171;
  --event-2: #fb923c;
  --event-3: #fbbf24;
  --event-4: #34d399;
  --event-5: #60a5fa;
  --event-6: #a78bfa;
  --event-7: #f472b6;
  --event-8: #2dd4bf;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  min-height: 100dvh;
  line-height: 1.5;
}

.view[hidden] {
  display: none !important;
}

/* ---- Login ---- */

#login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 1rem;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

#login-form input {
  display: block;
  width: 100%;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
}

#login-form input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: transparent;
}

#login-form button {
  display: block;
  width: 100%;
  padding: 0.65rem;
  border: none;
  border-radius: var(--radius);
  background: var(--fg);
  color: var(--bg);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  margin-top: 0.25rem;
}

#login-form button:hover {
  opacity: 0.85;
}

#login-error {
  color: #dc2626;
  font-size: 0.875rem;
  margin-top: 0.75rem;
}

#login-error[hidden] {
  display: none;
}

/* ---- App ---- */

#app-view {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 0 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

header h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.875rem;
  text-decoration: underline;
  font-family: var(--font);
  padding: 0;
}

.link-btn:hover {
  color: var(--fg);
}

/* ---- Hero ---- */

#hero {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.hero-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.hero-city {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
}

.hero-dates {
  font-size: 0.95rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

/* ---- Upcoming ---- */

#upcoming {
  margin-bottom: 2rem;
}

#upcoming h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

#upcoming-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.upcoming-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}

.upcoming-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.upcoming-city {
  font-weight: 500;
}

.upcoming-dates {
  color: var(--muted);
}

/* ---- Calendar ---- */

.cal-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.cal-nav h2 {
  font-size: 1.125rem;
  font-weight: 600;
  min-width: 10rem;
  text-align: center;
}

.cal-nav button {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  font-size: 1rem;
  color: var(--fg);
  font-family: var(--font);
}

.cal-nav button:hover {
  background: var(--border);
}

.today-btn {
  margin-left: auto;
  font-size: 0.85rem !important;
}

.cal-day-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.week-row {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border);
  min-height: 4.5rem;
}

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

.day-cell {
  padding: 0.3rem 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.day-cell.today {
  font-weight: 700;
  color: var(--accent);
}

.day-cell.other-month {
  opacity: 0.3;
}

.event-lanes {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 0 0.35rem;
}

.event-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  height: 1.35rem;
}

.event-bar {
  border-radius: 3px;
  padding: 0 0.4rem;
  font-size: 0.7rem;
  font-weight: 500;
  color: #fff;
  line-height: 1.35rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
}

.event-bar.continues-left {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.event-bar.continues-right {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

/* ---- Responsive ---- */

@media (max-width: 600px) {
  #app-view {
    padding: 0.5rem 0.5rem 2rem;
  }

  .hero-city {
    font-size: 1.5rem;
  }

  .cal-day-headers,
  .week-row,
  .event-row {
    font-size: 0.7rem;
  }

  .day-cell {
    padding: 0.2rem;
    font-size: 0.7rem;
  }

  .event-bar {
    font-size: 0.6rem;
    padding: 0 0.25rem;
  }

  .cal-nav h2 {
    font-size: 1rem;
    min-width: 8rem;
  }
}
