:root {
  color-scheme: light;
  --primary: #00113a;
  --primary-container: #002366;
  --secondary: #904d00;
  --secondary-container: #fd8b00;
  --surface: #faf8ff;
  --surface-low: #f4f3f9;
  --surface-container: #efedf3;
  --surface-card: #ffffff;
  --text-main: #1a1b20;
  --text-soft: #444650;
  --text-faint: #757682;
  --outline: rgba(197, 198, 210, 0.24);
  --shadow-soft: 0 8px 32px rgba(0, 17, 58, 0.06);
  --state: #00300e;
  --state-ink: #002108;
  --state-bg: #dbf7e4;
  --state-glow: rgba(67, 91, 159, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at 12% 8%, rgba(0, 35, 102, 0.14), transparent 30%),
    radial-gradient(circle at 85% 16%, rgba(253, 139, 0, 0.16), transparent 24%),
    linear-gradient(180deg, var(--surface), var(--surface-low));
}

body[data-state="critical"] {
  --state: #ba1a1a;
  --state-ink: #93000a;
  --state-bg: #ffdad6;
}

body[data-state="warning"] {
  --state: #904d00;
  --state-ink: #2f1500;
  --state-bg: #ffdcc3;
}

body[data-state="good"],
body[data-state="ideal"] {
  --state: #00300e;
  --state-ink: #002108;
  --state-bg: #d5f6df;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: color-mix(in srgb, var(--surface) 84%, white);
  backdrop-filter: blur(14px);
}

.top-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-brand h1 {
  margin: 0;
  font-family: "Lexend", "Segoe UI", sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-family: "Lexend", "Segoe UI", sans-serif;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-container));
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-container);
  color: var(--text-faint);
  font-size: 1.2rem;
}

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

.dashboard {
  display: grid;
  gap: 20px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 22px;
  align-items: center;
}

.hero-copy {
  display: grid;
  gap: 12px;
}

.meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.subtle-badge,
.state-pill,
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.subtle-badge {
  background: var(--surface-container);
  color: var(--text-soft);
}

.subtle-badge--live,
.subtle-badge--loading,
.subtle-badge--stale {
  gap: 8px;
}

.subtle-badge--live::before,
.subtle-badge--loading::before,
.subtle-badge--stale::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.subtle-badge--live::before {
  background: #00a643;
}

.subtle-badge--loading::before {
  background: var(--secondary-container);
}

.subtle-badge--stale::before {
  background: #ba1a1a;
}

.state-pill {
  justify-self: start;
  background: var(--state-bg);
  color: var(--state-ink);
}

h2,
h3,
.attendee-count,
.attendee-capacity,
#training-date,
#days-left,
#training-time {
  margin: 0;
  font-family: "Lexend", "Segoe UI", sans-serif;
}

h2 {
  font-size: clamp(1.8rem, 2.2vw, 2.8rem);
  line-height: 1.02;
  color: var(--primary);
}

h3 {
  font-size: 1.1rem;
  color: var(--primary);
}

.support-copy {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.55;
  max-width: 54ch;
}

.ring-wrap {
  position: relative;
  width: min(360px, 100%);
  margin-inline: auto;
}

.count-ring {
  --fill: 0%;
  aspect-ratio: 1;
  border-radius: 999px;
  padding: 14px;
  background:
    radial-gradient(circle at center, transparent 62%, var(--surface-card) 62% 64%, transparent 64%),
    conic-gradient(var(--state) var(--fill), rgba(197, 198, 210, 0.4) 0);
  box-shadow: var(--shadow-soft);
}

.count-ring__inner {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  background: var(--surface-card);
}

.count-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.attendee-count {
  font-size: clamp(3rem, 8vw, 4.8rem);
  font-weight: 900;
  line-height: 0.95;
  color: var(--primary);
}

.attendee-slash {
  font-size: 2.1rem;
  color: var(--text-faint);
}

.attendee-capacity {
  font-size: 2rem;
  color: var(--text-faint);
}

.attendee-label {
  margin-top: 8px;
  font-family: "Lexend", "Segoe UI", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 700;
}

.checkin-btn {
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 999px;
  font-size: 1.8rem;
  line-height: 1;
  color: #fff;
  background: var(--secondary-container);
  box-shadow: var(--shadow-soft);
}

.next-drill {
  background: linear-gradient(135deg, var(--primary), var(--primary-container));
  color: #fff;
  border-radius: 20px;
  padding: 24px;
  min-height: 210px;
  display: grid;
  gap: 20px;
  align-content: space-between;
  box-shadow: 0 20px 40px rgba(0, 17, 58, 0.18);
}

.chip {
  justify-self: start;
  background: rgba(179, 197, 255, 0.2);
  color: #dbe1ff;
}

#training-date {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.6rem, 2.6vw, 2.4rem);
  font-weight: 800;
}

.next-meta {
  display: flex;
  align-items: center;
  gap: 18px;
}

.meta-block {
  display: grid;
  gap: 2px;
}

#days-left,
#training-time {
  font-size: clamp(1.6rem, 2vw, 2.2rem);
  font-weight: 800;
}

#days-left-copy,
#training-venue {
  color: #b3c5ff;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.meta-divider {
  width: 2px;
  height: 44px;
  background: rgba(179, 197, 255, 0.4);
}

.threshold-card,
.roster-panel {
  background: var(--surface-card);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow-soft);
}

.threshold-head,
.roster-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.progress-track {
  position: relative;
  margin-top: 16px;
  height: 14px;
  border-radius: 999px;
  background: rgba(197, 198, 210, 0.35);
  overflow: hidden;
}

.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-container));
}

.progress-marker {
  position: absolute;
  top: -24px;
  transform: translateX(-50%);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-faint);
}

.progress-marker--minimum { left: 50%; }
.progress-marker--good { left: 83.3333%; }
.progress-marker--ideal { left: 100%; transform: translateX(-100%); }

.data-notice {
  margin: 10px 0 0;
  border-radius: 10px;
  padding: 12px;
  background: var(--surface-container);
  color: var(--text-soft);
}

.attendee-list {
  margin-top: 16px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.attendee-card {
  position: relative;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, #f8f7fc);
  padding: 14px;
  min-height: 84px;
  display: grid;
  gap: 8px;
}

.attendee-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 16px 0 0 16px;
  background: color-mix(in srgb, var(--state) 84%, white);
}

.attendee-card--reserve::before {
  background: color-mix(in srgb, var(--secondary-container) 70%, white);
}

.attendee-card--placeholder {
  background: linear-gradient(90deg, #f5f4fa, #eceaf2, #f5f4fa);
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
}

.attendee-card--placeholder::before {
  display: none;
}

.attendee-name {
  font-family: "Lexend", "Segoe UI", sans-serif;
  font-weight: 700;
}

.attendee-note {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.92rem;
  line-height: 1.4;
}

.attendee-tags {
  display: flex;
  gap: 8px;
}

.attendee-tag {
  border-radius: 8px;
  min-height: 26px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  background: #ffdcc3;
  color: #6e3900;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.empty-state {
  border-radius: 14px;
  padding: 16px;
  background: var(--surface-container);
}

.empty-state strong {
  font-family: "Lexend", "Segoe UI", sans-serif;
}

.is-loading .count-ring,
.is-loading .threshold-card {
  filter: saturate(0.8);
}

@keyframes shimmer {
  0% { background-position: 0 50%; }
  100% { background-position: 220% 50%; }
}

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .ring-wrap {
    order: -1;
  }
}

@media (max-width: 640px) {
  .top-bar {
    padding: 14px 14px;
  }

  .page-shell {
    width: min(100% - 16px, 100%);
  }

  .next-meta {
    align-items: flex-start;
  }

  .threshold-head,
  .roster-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .checkin-btn {
    right: 0;
  }

  .attendee-list {
    grid-template-columns: 1fr;
  }
}
