:root {
  color-scheme: light;
  --accent: #b5122b;
  --accent-dark: #8f0e22;
  --ink: #17202a;
  --muted: #64717d;
  --line: #dfe4e8;
  --soft: #f3f5f6;
  --white: #ffffff;
  --success: #146c43;
  --warning-bg: #fff4d6;
  --warning-text: #6e4d00;
  --danger-bg: #fff0f1;
  --shadow: 0 10px 32px rgba(23, 32, 42, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--soft);
  color: var(--ink);
  min-width: 280px;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.site-header {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 28px;
}

.brand {
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  letter-spacing: .04em;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--white);
  background: var(--accent);
  border-radius: 8px;
  font-weight: 850;
  font-size: 23px;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 12px; letter-spacing: .01em; }

.quiet-link, .text-button {
  color: var(--muted);
  font-weight: 650;
  font-size: 14px;
  text-decoration: none;
}

.quiet-link:hover, .text-button:hover { color: var(--accent); }
.public-header-actions { display: flex; align-items: center; gap: 22px; }

.public-shell {
  width: min(100% - 40px, 920px);
  margin: 28px auto 56px;
}

.current-card {
  min-height: 360px;
  padding: clamp(28px, 6vw, 58px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: var(--white);
  background: var(--accent);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.current-card.cancelled { background: #4f5961; }

.eyebrow {
  margin: 0 0 22px;
  color: rgba(255,255,255,.82);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.eyebrow.dark { color: var(--accent); margin-bottom: 6px; }

.current-card h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(42px, 8vw, 76px);
  line-height: 1.02;
  letter-spacing: -.045em;
}

.current-dates {
  margin: 22px 0 0;
  font-size: clamp(21px, 3vw, 28px);
  font-weight: 650;
}

.current-time { margin: 32px 0 8px; font-size: 17px; }
.current-tasks { margin: 0; color: rgba(255,255,255,.8); font-size: 15px; }
.current-tasks span { padding: 0 7px; }
.loading-block { font-size: 22px; color: rgba(255,255,255,.8); }
.empty-card h1 { font-size: clamp(34px, 6vw, 58px); }
.empty-card p { margin: 18px 0 0; font-size: 18px; color: rgba(255,255,255,.8); }

.upcoming-section {
  margin-top: 48px;
  padding: 32px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
}

.section-heading h2 { margin: 0; font-size: clamp(24px, 4vw, 32px); letter-spacing: -.025em; }
.text-button { border: 0; padding: 10px 0; background: transparent; cursor: pointer; }

.next-duty-card { min-height: 100px; display: grid; grid-template-columns: 1.2fr 1fr auto; align-items: center; gap: 20px; margin-bottom: 28px; padding: 20px; background: var(--soft); border-left: 4px solid var(--accent); border-radius: 10px; }
.next-duty-card p { margin: 9px 0 0; color: var(--muted); font-size: 14px; }
.next-duty-card h3 { margin: 0; font-size: 23px; }
.later-title { margin: 0; padding-bottom: 13px; font-size: 16px; }
.upcoming-list { border-top: 1px solid var(--line); }
.upcoming-row {
  min-height: 74px;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(150px, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
}

.upcoming-row:first-child { min-height: 86px; }
.upcoming-date { color: var(--muted); font-size: 15px; }
.upcoming-name { font-size: 18px; font-weight: 750; }
.next-label, .changed-label {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.next-label { color: var(--accent); background: var(--danger-bg); }
.changed-label { color: var(--warning-text); background: var(--warning-bg); }
.cancelled-label { align-self: flex-start; padding: 5px 8px; color: #8f0e22; background: var(--danger-bg); border-radius: 5px; font-size: 11px; font-weight: 800; text-transform: uppercase; }

.empty-state { padding: 28px 4px 6px; color: var(--muted); }
.month-list { display: grid; gap: 30px; }
.month-group { display: grid; gap: 0; overflow: hidden; background: #fafbfb; border: 1px solid #d6dce0; border-radius: 13px; box-shadow: 0 5px 16px rgba(23,32,42,.05); }
.month-title { margin: 0; padding: 15px 18px; color: var(--ink); background: var(--danger-bg); border-bottom: 1px solid #e4cdd2; border-left: 6px solid var(--accent); font-size: 20px; letter-spacing: -.01em; }
.month-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 16px; }
.schedule-tile { min-height: 126px; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; padding: 17px; background: var(--white); border: 2px solid var(--line); border-radius: 10px; }
.schedule-tile.cancelled { background: #fff8f8; border-color: #d9a7af; border-style: dashed; }
.schedule-tile .tile-date { margin: 0; color: var(--muted); font-size: 13px; }
.schedule-tile .tile-name { margin: 0; font-size: 19px; line-height: 1.2; }
.schedule-tile .changed-label { align-self: flex-start; }
.public-footer { display: flex; justify-content: space-between; gap: 20px; padding: 16px 4px; color: var(--muted); font-size: 13px; }
.inline-error { color: var(--accent); font-weight: 650; }

@media (max-width: 640px) {
  .site-header { height: 68px; padding: 0 18px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand strong { font-size: 14px; }
  .quiet-link { font-size: 13px; }
  .public-header-actions { gap: 12px; }
  .viewer-actions > a[href="/admin"] { display: none; }
  .public-shell { width: min(100% - 24px, 920px); margin-top: 12px; }
  .current-card { min-height: 350px; padding: 30px 24px; border-radius: 14px; }
  .upcoming-section { margin-top: 24px; padding: 24px 18px; border-radius: 14px; }
  .upcoming-row { grid-template-columns: 1fr auto; gap: 6px 12px; padding: 15px 0; }
  .next-duty-card { grid-template-columns: 1fr auto; gap: 9px 12px; }
  .next-duty-card h3 { grid-row: 2; }
  .upcoming-date { grid-column: 1 / -1; }
  .current-tasks span { padding: 0 3px; }
  .public-footer { flex-direction: column; gap: 6px; }
  .month-tiles { grid-template-columns: 1fr; }
  .schedule-tile { min-height: 108px; }
}

@media (min-width: 641px) and (max-width: 840px) {
  .month-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: no-preference) {
  button, a { transition: color .15s ease, background-color .15s ease, border-color .15s ease; }
}
