:root {
  --navy: #002142;
  --navy-2: #014990;
  --red: #E71321;
  --gold: #FDD703;
  --ink: #111827;
  --muted: #5b6472;
  --paper: #ffffff;
  --soft: #f5f7fb;
  --line: #d9dee8;
  --radius: 18px;
  --orange: #C2410C;
  --green: #157A3A;
  --shadow: 0 12px 30px rgba(0, 33, 66, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: "Work Sans", system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--ink);
  background: var(--soft);
  line-height: 1.45;
}
button, a { font: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
.app {
  width: min(480px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--line);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--navy);
  color: #fff;
}
.top-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 10px;
}
.mark {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.titles { min-width: 0; flex: 1; }
.titles h1 {
  margin: 0;
  font-family: Oswald, "Work Sans", sans-serif;
  font-size: 1.22rem;
  font-weight: 600;
  letter-spacing: .04em;
  line-height: 1.05;
}
.home-link {
  color: var(--gold);
  font-size: .82rem;
  font-weight: 700;
  text-decoration: none;
}
.home-link:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.rule { height: 6px; background: var(--gold); }

.status-slot {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .28s ease;
}
.status-slot.is-open { grid-template-rows: 1fr; }
.status-clip { overflow: hidden; }
.status-bar {
  transform: translateY(-110%);
  transition: transform .28s ease;
  text-align: center;
  font-weight: 800;
  padding: 8px 12px;
  font-size: .92rem;
}
.status-slot.is-open .status-bar { transform: translateY(0); }
.status-bar.offline { background: var(--red); color: #fff; letter-spacing: .12em; }
.status-bar.unreachable { background: var(--orange); color: #fff; }
.status-bar.online { background: var(--green); color: #fff; }
.token-slot.is-open { grid-template-rows: 1fr; }
.token-bar {
  background: #3b1208;
  color: var(--gold);
  text-align: center;
  font-weight: 750;
  font-weight: 700;
  padding: 8px 12px;
  font-size: .86rem;
}

.screen { padding: 14px 14px 32px; }
.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.month-nav h2 {
  margin: 0;
  font-family: Oswald, "Work Sans", sans-serif;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: .01em;
}
.nav-btn, .today-btn, .install-chip, .install-wide, .sheet-close {
  border: 0;
  background: var(--soft);
  color: var(--navy);
}
.nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  font-size: 1.4rem;
  line-height: 1;
}
.today-btn {
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 800;
  font-size: .78rem;
}
.weekday, .month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.weekday span {
  text-align: center;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--muted);
  padding-bottom: 4px;
}
.day {
  aspect-ratio: 1;
  border: 0;
  border-radius: 10px;
  background: var(--soft);
  color: var(--navy);
  font-weight: 800;
  font-size: .82rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0;
}
.day.is-out { visibility: hidden; }
.day.is-today { box-shadow: inset 0 0 0 2px var(--gold); }
.day.is-selected { background: var(--navy); color: #fff; }
.day.has { background: #eef3fa; }
.dots { display: flex; gap: 2px; min-height: 5px; }
.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--navy-2); }
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 12px 0 4px;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
}
.legend li { display: flex; align-items: center; gap: 5px; }
.section-label {
  margin: 18px 0 8px;
  font-family: Oswald, "Work Sans", sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: .03em;
}
.day-group h3 {
  margin: 14px 0 8px;
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.event {
  width: 100%;
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px;
  margin: 0 0 8px;
  color: inherit;
}
.datebox {
  background: var(--navy);
  color: #fff;
  border-radius: 12px;
  text-align: center;
  padding: 8px 4px;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.datebox b {
  display: block;
  color: var(--gold);
  font-family: Oswald, "Work Sans", sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
}
.event strong { display: block; color: var(--navy); font-size: .98rem; }
.event small { display: block; color: var(--muted); font-size: .78rem; }
.pill {
  display: inline-block;
  margin-top: 4px;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.event.is-cancelled strong { text-decoration: line-through; }
.empty, .loading {
  background: var(--soft);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--muted);
  font-weight: 650;
  font-weight: 600;
}

dialog {
  border: 0;
  padding: 0;
  width: min(480px, 100%);
  max-height: min(88vh, 720px);
  margin: auto auto 0;
  border-radius: 22px 22px 0 0;
  color: var(--ink);
}
dialog::backdrop { background: rgba(0, 33, 66, .48); }
.sheet, .detail-card { padding: 14px 16px 28px; }
.sheet-head, .detail-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.sheet-head h2, .detail-card h2 {
  margin: 0;
  font-family: Oswald, "Work Sans", sans-serif;
  color: var(--navy);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.1;
}
.sheet-close {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  font-size: 1.4rem;
  line-height: 1;
}
.detail-card p { margin: 8px 0; }
.detail-card .when { color: var(--navy); font-weight: 700; }
.meta { color: var(--muted); margin: 4px 0; }
.meta b { color: var(--navy); }
.detail-body { white-space: pre-wrap; }

.install-chip {
  background: var(--gold);
  color: var(--navy);
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 800;
  font-size: .78rem;
}
.install-wide {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  margin: 8px 0;
  border-radius: 999px;
  background: var(--gold);
  color: var(--navy);
  font-weight: 800;
  text-decoration: none;
  border: 0;
}
.menu-dots { display: inline-block; vertical-align: -3px; }
.steps, .ios-steps { margin: 8px 0 0; padding: 0; list-style: none; }
.steps li, .ios-step {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin: 0 0 8px;
}
.ios-step { display: flex; align-items: center; gap: 12px; font-weight: 700; color: var(--navy); }
.ios-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--navy);
  color: var(--gold);
  flex: 0 0 auto;
}
.ios-other, .desktop-note { color: var(--navy); font-weight: 700; }
.page-intro { padding: 8px 0 4px; }
.page-intro h2 {
  margin: 0 0 6px;
  font-family: Oswald, "Work Sans", sans-serif;
  color: var(--navy);
  font-size: 1.8rem;
  line-height: 1;
  font-weight: 600;
}
.page-intro p { margin: 0; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .status-slot, .status-bar { transition: none; }
}
