:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --ink: #121318;
  --muted: #6a6f7a;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.88);
  --stroke: rgba(255, 255, 255, 0.7);
  --shadow: 0 20px 60px rgba(38, 45, 71, 0.12);
  --national: #0a84ff;
  --regional: #af52de;
  --provincial: #ff9f0a;
  --local: #ff375f;
  --weekend: #9ca3af;
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, system-ui, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(10, 132, 255, 0.18), transparent 34%),
    radial-gradient(circle at top right, rgba(175, 82, 222, 0.16), transparent 30%),
    linear-gradient(180deg, #fafbff 0%, #f3f4f8 100%);
  overflow-x: hidden;
}

button,
select {
  font: inherit;
}

button {
  border: 0;
}

.ambient {
  position: fixed;
  z-index: 0;
  border-radius: 999px;
  filter: blur(32px);
  pointer-events: none;
}

.ambient-one {
  top: -110px;
  left: -80px;
  width: 260px;
  height: 260px;
  background: rgba(10, 132, 255, 0.18);
}

.ambient-two {
  right: -120px;
  top: 120px;
  width: 280px;
  height: 280px;
  background: rgba(255, 55, 95, 0.12);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 560px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.77rem;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 5vw, 2.1rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.icon-button,
.nav-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 10px 25px rgba(38, 45, 71, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  cursor: pointer;
}

.icon-button svg,
.nav-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button,
.nav-button,
.ghost-button,
.primary-button,
.location-chip {
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.icon-button:active,
.nav-button:active,
.ghost-button:active,
.primary-button:active,
.location-chip:active {
  transform: scale(0.96);
}

.icon-button.subtle {
  width: 38px;
  height: 38px;
  background: rgba(245, 246, 250, 0.9);
  box-shadow: none;
}

.hero-card,
.calendar-card,
.legend-card {
  border: 1px solid var(--stroke);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
}

.hero-card {
  border-radius: var(--radius-xl);
  padding: 14px;
  margin-bottom: 14px;
}

.month-navigation {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 12px;
}

.selection-summary {
  text-align: center;
}

.selection-summary h2 {
  margin-bottom: 4px;
  font-size: clamp(1.2rem, 4.4vw, 1.55rem);
  letter-spacing: -0.03em;
}

.selection-summary p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.selection-summary p strong {
  color: var(--ink);
  font-weight: 650;
}

.calendar-card {
  border-radius: var(--radius-xl);
  padding: 16px 12px 12px;
}

.calendar-card.month-refresh {
  animation: calendar-settle 220ms ease;
}

.weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekdays {
  margin-bottom: 10px;
}

.weekday {
  color: var(--muted);
  text-align: center;
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
}

.calendar-grid {
  gap: 8px;
}

.calendar-card.is-loading {
  overflow: hidden;
}

.calendar-card.is-loading .day-cell {
  pointer-events: none;
}

.calendar-card.is-loading .day-cell::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.62) 48%, transparent 76%);
  transform: translateX(-100%);
  animation: shimmer 1.2s infinite;
}

.day-cell {
  position: relative;
  min-height: 63px;
  padding: 9px 6px 8px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.58);
  color: var(--ink);
  text-align: left;
  cursor: default;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.day-cell.is-current-month {
  cursor: pointer;
}

.day-cell.is-current-month:hover,
.day-cell.is-current-month:focus-visible {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 22px rgba(38, 45, 71, 0.08);
}

.day-cell.is-muted {
  color: rgba(18, 19, 24, 0.32);
}

.day-cell.is-weekend .day-number {
  color: var(--weekend);
}

.day-cell.is-today {
  background: rgba(10, 132, 255, 0.11);
  border-color: rgba(10, 132, 255, 0.26);
}

.day-cell.has-holiday {
  background: rgba(255, 255, 255, 0.86);
}

.day-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  min-height: 22px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
}

.day-cell.is-today .day-number {
  color: white;
  background: var(--national);
}

.holiday-dots {
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 8px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.holiday-dot,
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.national {
  background: var(--national);
}

.regional {
  background: var(--regional);
}

.provincial {
  background: var(--provincial);
}

.local {
  background: var(--local);
}

.legend-card {
  margin-top: 14px;
  border-radius: var(--radius-lg);
  padding: 16px;
}

.legend-card h3 {
  margin-bottom: 12px;
  font-size: 0.92rem;
}

.legend-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.overlay {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: max(16px, env(safe-area-inset-top)) 16px 16px;
  background: rgba(18, 19, 24, 0.16);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.overlay[hidden] {
  display: none;
}

.floating-panel,
.detail-sheet {
  width: min(100%, 520px);
  border: 1px solid rgba(255, 255, 255, 0.82);
  background: var(--surface-strong);
  box-shadow: 0 28px 80px rgba(38, 45, 71, 0.2);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
}

.floating-panel {
  margin-top: 38px;
  border-radius: 30px;
  padding: 10px 16px 16px;
}

.detail-overlay {
  align-items: flex-end;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.detail-sheet {
  border-radius: 30px;
  padding: 10px 16px 18px;
}

.panel-handle {
  width: 44px;
  height: 5px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: rgba(18, 19, 24, 0.14);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-heading h2 {
  margin-bottom: 0;
  font-size: 1.3rem;
  letter-spacing: -0.03em;
}

.panel-heading.compact {
  margin-bottom: 12px;
}

form {
  display: grid;
  gap: 12px;
}

.quick-locations {
  display: grid;
  gap: 8px;
}

.field-label-row {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.location-chip {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--ink);
  background: rgba(18, 19, 24, 0.06);
  cursor: pointer;
}

.location-chip:hover,
.location-chip:focus-visible {
  background: rgba(10, 132, 255, 0.12);
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

input,
select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid rgba(18, 19, 24, 0.08);
  border-radius: 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  outline: none;
}

.search-field {
  position: relative;
}

.search-field svg {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: translateY(-50%);
}

.search-field input {
  padding-left: 42px;
}

.helper-text {
  margin: -1px 0 0;
  font-size: 0.76rem;
  font-weight: 500;
}

input:focus,
select:focus {
  border-color: rgba(10, 132, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.12);
}

.panel-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.ghost-button,
.primary-button {
  min-height: 48px;
  border-radius: 16px;
  cursor: pointer;
}

.ghost-button {
  color: var(--ink);
  background: rgba(18, 19, 24, 0.06);
}

.primary-button {
  color: white;
  background: linear-gradient(135deg, #0a84ff, #0071e3);
  box-shadow: 0 14px 28px rgba(10, 132, 255, 0.24);
}

.primary-button:disabled {
  opacity: 0.48;
  box-shadow: none;
  cursor: not-allowed;
}

.detail-content {
  display: grid;
  gap: 10px;
}

.holiday-detail {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
}

.holiday-detail-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.holiday-detail h3 {
  margin: 0;
  font-size: 1rem;
}

.holiday-detail p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.source-link {
  color: #0071e3;
  font-size: 0.88rem;
  text-decoration: none;
}

.source-link:hover {
  text-decoration: underline;
}

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 14px;
  border-radius: 999px;
  color: white;
  background: rgba(18, 19, 24, 0.88);
  box-shadow: 0 18px 30px rgba(18, 19, 24, 0.18);
  font-size: 0.88rem;
}

.install-card {
  position: fixed;
  z-index: 9;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 16px;
  display: grid;
  gap: 14px;
  width: min(calc(100% - 32px), 528px);
  margin: 0 auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 22px 50px rgba(38, 45, 71, 0.18);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.install-card[hidden] {
  display: none;
}

.install-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1rem;
}

.install-card p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.install-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ghost-button.compact,
.primary-button.compact {
  min-height: 42px;
}

@media (min-width: 620px) {
  .app-shell {
    padding-top: 28px;
  }

  .calendar-card {
    padding: 20px 16px 16px;
  }

  .day-cell {
    min-height: 74px;
  }

  .legend-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}


@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

@keyframes calendar-settle {
  from {
    opacity: 0.7;
    transform: translateY(4px);
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
