[data-theme="matops"] {
  --bg: #0b0c0e;
  --bg-alt: #0f1114;
  --card: #13161a;
  --card-soft: #171b20;
  --ink: #f4f2ec;
  --muted: #b2aca1;
  --line: rgba(244, 242, 236, 0.14);
  --olive: #d5b015;
  --olive-2: #f0cd4a;
  --sand: rgba(213, 176, 21, 0.12);
  --present: rgba(70, 128, 90, 0.32);
  --absent: rgba(158, 62, 62, 0.36);
  --sick: rgba(172, 141, 33, 0.34);
  --late: rgba(56, 109, 168, 0.34);
  --ir: rgba(109, 82, 152, 0.34);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

[data-theme="ams"] {
  --bg: #0b0c0e;
  --bg-alt: #0f1114;
  --card: #13161a;
  --card-soft: #171b20;
  --ink: #f4f2ec;
  --muted: #c3b6b8;
  --line: rgba(244, 242, 236, 0.14);
  --olive: #a61f2a;
  --olive-2: #dc5965;
  --sand: rgba(166, 31, 42, 0.14);
  --present: rgba(70, 128, 90, 0.32);
  --absent: rgba(166, 31, 42, 0.34);
  --sick: rgba(172, 141, 33, 0.34);
  --late: rgba(56, 109, 168, 0.34);
  --ir: rgba(109, 82, 152, 0.34);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

html {
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, var(--sand), transparent 45%),
    radial-gradient(circle at 70% 10%, color-mix(in srgb, var(--olive-2) 12%, transparent), transparent 50%),
    linear-gradient(145deg, #090a0c, #0e1014 55%, #0b0c0e);
}

button,
input {
  font: inherit;
}

.page {
  width: min(1480px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.hero,
.event-bar,
.grid {
  width: min(100%, 980px);
}

.hero {
  margin-bottom: 18px;
}

.hero-subline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.eyebrow,
.prototype-tag,
.event-label {
  margin: 0 0 8px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--olive);
}

.hero h1,
.event-bar h2,
.prototype h2 {
  margin: 0;
  font-family: "Bebas Neue", "Arial Narrow", sans-serif;
  letter-spacing: 0.02em;
}

.hero h1 {
  font-size: clamp(2.5rem, 5vw, 4.3rem);
  line-height: 0.95;
}

.lede,
.prototype-copy,
.event-bar p,
.late-head p {
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.card-lite {
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.event-bar,
.prototype {
  padding: 18px;
}

.event-bar {
  display: grid;
  gap: 18px;
  align-items: start;
  margin-bottom: 16px;
}

.event-key {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.control-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.theme-inline {
  align-items: flex-end;
  flex: 0 0 auto;
}

.theme-inline .button-group {
  justify-content: flex-end;
}

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

.event-clock-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.event-clock,
.event-stamp {
  color: var(--muted);
  font-size: 0.86rem;
}

.toggle-btn,
.chip,
.ghost,
.solid,
.weight-btn,
.exception-btn,
.stack-btn,
.correction-btn {
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
}

.toggle-btn,
.ghost,
.weight-btn,
.exception-btn,
.correction-btn {
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 12px;
}

.toggle-btn.is-active,
.solid {
  background: linear-gradient(120deg, var(--olive), var(--olive-2));
  border-color: transparent;
  color: #1b1a14;
  box-shadow: 0 12px 24px color-mix(in srgb, var(--olive) 28%, transparent);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
  box-shadow: none;
}

.chip,
.stack-btn {
  background: var(--card-soft);
}

.chip {
  min-width: 38px;
  padding: 7px 10px;
  font-weight: 800;
}

.chip.is-active,
.detail-chips .ghost.is-active-chip {
  border-color: var(--olive);
  box-shadow: inset 0 0 0 1px var(--olive);
}

.stack-btn {
  padding: 12px 10px;
  font-weight: 800;
  font-size: 0.95rem;
}

.key-item {
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid var(--line);
  background: var(--card-soft);
}

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

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

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

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

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

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.prototype {
  min-height: 720px;
}

.prototype.is-hidden {
  display: none;
}

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

.prototype-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.prototype-key {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.inline-guide-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.mini-key {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  flex: 0 0 auto;
}

.mini-key-item {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid var(--line);
  background: var(--card-soft);
  white-space: nowrap;
}

.stat {
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.2rem;
  font-weight: 700;
}

.roster-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roster-row {
  display: grid;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card-soft);
  padding: 10px;
}

.compact .roster-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.slim .roster-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.row-shell {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.row-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: start;
}

.name {
  font-weight: 700;
}

.name-row,
.stack-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.status-cluster,
.row-actions,
.exception-bar,
.detail-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.mini-status {
  padding: 6px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  text-align: center;
  justify-content: center;
}

.mini-status-empty {
  min-width: 88px;
  background: transparent;
  border: 1px dashed var(--line);
  color: transparent;
}

.exception-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 6px 6px 0;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--olive-2);
}

.detail-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.detail-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stack-card,
.late-corrections,
.stack-roster {
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.stack-card {
  border: 1px solid var(--line);
  background: var(--card-soft);
  padding: 18px;
  margin-bottom: 14px;
}

.late-corrections,
.stack-roster {
  border: 1px dashed var(--line);
}

.stack-roster {
  margin-top: 14px;
}

.stack-name {
  font-size: 1.5rem;
  font-weight: 700;
}

.stack-meta {
  color: var(--muted);
  margin-bottom: 12px;
}

.stack-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.correction-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roster-row.is-focused {
  border-color: var(--olive);
  box-shadow: inset 0 0 0 1px var(--olive);
  background: linear-gradient(135deg, color-mix(in srgb, var(--olive) 18%, transparent), rgba(19, 22, 26, 0.94));
}

.weight-drawer {
  display: none;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}

.weight-drawer.is-open {
  display: flex;
}

.weight-drawer input {
  width: 96px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-alt);
  color: var(--ink);
  padding: 8px 10px;
}

.hint {
  color: var(--muted);
  font-size: 0.82rem;
}

[data-theme="matops"] .present,
[data-theme="ams"] .present {
  color: #78d98a;
}

[data-theme="matops"] .absent {
  color: #ff8c86;
}

[data-theme="ams"] .absent {
  color: #ff7f89;
}

[data-theme="matops"] .late,
[data-theme="ams"] .late {
  color: #7ec4ff;
}

[data-theme="matops"] .sick,
[data-theme="ams"] .sick {
  color: #ffd96f;
}

[data-theme="matops"] .ir,
[data-theme="ams"] .ir {
  color: #c3a0ff;
}

[data-theme="matops"] .exception-chip.present,
[data-theme="matops"] .chip.present,
[data-theme="matops"] .mini-status.present,
[data-theme="ams"] .exception-chip.present,
[data-theme="ams"] .chip.present,
[data-theme="ams"] .mini-status.present {
  border-color: rgba(120, 217, 138, 0.28);
}

[data-theme="matops"] .exception-chip.absent,
[data-theme="matops"] .chip.absent,
[data-theme="matops"] .mini-status.absent {
  border-color: rgba(255, 140, 134, 0.3);
}

[data-theme="ams"] .exception-chip.absent,
[data-theme="ams"] .chip.absent,
[data-theme="ams"] .mini-status.absent {
  border-color: rgba(255, 127, 137, 0.3);
}

[data-theme="matops"] .exception-chip.late,
[data-theme="matops"] .chip.late,
[data-theme="matops"] .mini-status.late,
[data-theme="ams"] .exception-chip.late,
[data-theme="ams"] .chip.late,
[data-theme="ams"] .mini-status.late {
  border-color: rgba(126, 196, 255, 0.28);
}

[data-theme="matops"] .exception-chip.sick,
[data-theme="matops"] .chip.sick,
[data-theme="matops"] .mini-status.sick,
[data-theme="ams"] .exception-chip.sick,
[data-theme="ams"] .chip.sick,
[data-theme="ams"] .mini-status.sick {
  border-color: rgba(255, 217, 111, 0.3);
}

@media (max-width: 720px) {
  .page {
    width: min(100% - 18px, 720px);
    padding-top: 16px;
  }

  .hero-subline,
  .event-topline,
  .event-bar,
  .prototype-head {
    display: flex;
    flex-direction: column;
    align-items: start;
  }

  .event-bar,
  .prototype {
    padding: 14px;
  }

  .event-key,
  .control-group,
  .button-group,
  .toggle-btn {
    width: 100%;
  }

  .prototype-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .theme-inline,
  .theme-inline .button-group,
  .event-clock-group {
    align-items: stretch;
  }

  .inline-guide-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .mini-key {
    justify-content: flex-start;
  }

  .compact .roster-row,
  .slim .roster-row {
    grid-template-columns: 1fr;
  }
}
