:root {
  --bg: #f4efe6;
  --panel: rgba(255, 252, 247, 0.92);
  --text: #1d2430;
  --muted: #5e6877;
  --line: #d8cfbe;
  --accent: #0b5f75;
  --shadow: 0 20px 50px rgba(44, 49, 64, 0.08);
  --red: #d83a3a;
  --yellow: #d9a404;
  --green: #2d8f58;
  --slate: #4c5a72;
  --gray: #7d7d7d;
  --other: #8d5cf6;
  --error: #222222;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(11, 95, 117, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(217, 164, 4, 0.18), transparent 26%),
    linear-gradient(180deg, #f7f1e8 0%, #efe6d7 100%);
  font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 32px auto 56px;
}

.card {
  background: var(--panel);
  border: 1px solid rgba(216, 207, 190, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.hero {
  padding: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 700;
}

h1,
h2,
h3,
.meta-label {
  font-family: "Avenir Next", "Futura", sans-serif;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.05;
}

.lead {
  max-width: 760px;
  color: var(--muted);
  font-size: 17px;
}

.hero-grid,
.grid {
  display: grid;
  gap: 18px;
}

.hero-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin: 28px 0 20px;
}

.grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  margin: 22px 0;
}

.grid .card,
.section-heading {
  padding: 0;
}

.grid .card {
  padding: 22px;
}

h2,
h3 {
  margin-top: 0;
}

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

.error {
  color: var(--red);
  min-height: 1.4em;
}

.latest-raw {
  font-size: 28px;
  font-weight: 800;
  margin: 10px 0 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 14px;
  color: white;
  font-weight: 700;
  font-size: 14px;
}

.badge-red { background: var(--red); }
.badge-yellow { background: var(--yellow); color: #2b2200; }
.badge-green { background: var(--green); }
.badge-closed { background: var(--slate); }
.badge-hidden { background: var(--gray); }
.badge-other { background: var(--other); }
.badge-fetch_error { background: var(--error); }

.summary-table,
.history-table,
.calendar-table {
  width: 100%;
  border-collapse: collapse;
}

.summary-table th,
.summary-table td,
.calendar-table th,
.calendar-table td,
.history-table th,
.history-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

.bar {
  width: 100%;
  height: 10px;
  background: rgba(29, 36, 48, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.grouped-summary {
  display: block;
  overflow-x: auto;
}

.ratio-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 88px;
}

.ratio-cell strong {
  font-size: 14px;
}

.ratio-cell span {
  color: var(--muted);
  font-size: 12px;
}

.mini-bar {
  width: 100%;
  height: 6px;
  margin-top: 6px;
  background: rgba(29, 36, 48, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.mini-bar span {
  display: block;
  height: 100%;
}

.section-heading {
  padding: 22px 22px 0;
}

.legend-table,
.alert-card table {
  width: 100%;
  border-collapse: collapse;
}

.legend-table th,
.legend-table td,
.alert-card th,
.alert-card td {
  border-bottom: 1px solid var(--line);
  padding: 12px 22px;
  text-align: left;
  vertical-align: top;
}

.legend-table th {
  width: 180px;
}

.calendar-card {
  overflow: hidden;
}

.calendar-table th {
  background: rgba(11, 95, 117, 0.08);
  font-size: 13px;
}

.calendar-day {
  width: 14.28%;
  padding: 0;
}

.calendar-day a {
  display: flex;
  min-height: 88px;
  padding: 12px 10px;
  flex-direction: column;
  justify-content: space-between;
  text-decoration: none;
  color: inherit;
  font-weight: 700;
}

.calendar-day span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.calendar-red a { background: rgba(216, 58, 58, 0.14); }
.calendar-yellow a { background: rgba(217, 164, 4, 0.16); }
.calendar-green a { background: rgba(45, 143, 88, 0.14); }
.calendar-closed a { background: rgba(76, 90, 114, 0.14); }
.calendar-hidden a { background: rgba(125, 125, 125, 0.12); }
.calendar-other a { background: rgba(141, 92, 246, 0.12); }
.calendar-fetch_error a { background: rgba(34, 34, 34, 0.14); color: #fff; }
.calendar-empty a { background: rgba(29, 36, 48, 0.04); }
.calendar-day.is-selected a {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.calendar-day.is-outside a {
  opacity: 0.38;
}

.history-table {
  display: block;
  overflow-x: auto;
}

.history-table tbody,
.history-table thead,
.history-table tr {
  width: 100%;
}

.empty {
  color: var(--muted);
  padding: 0 22px 22px;
}

a {
  color: var(--accent);
}

@media (max-width: 700px) {
  .shell {
    width: min(100% - 20px, 1180px);
    margin-top: 20px;
  }

  .hero,
  .grid .card,
  .card {
    border-radius: 20px;
  }

  .hero {
    padding: 20px;
  }

  .latest-raw {
    font-size: 24px;
  }

  .calendar-day a {
    min-height: 72px;
    padding: 10px 8px;
  }
}
