:root {
  --navy: #0b1d33;
  --navy-2: #102944;
  --sky: #4daeeb;
  --yellow: #ffcb2e;
  --mint: #00d9ba;
  --coral: #ff6b6b;
  --white: #ffffff;
  --muted: #a9bfd2;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-strong: rgba(255, 255, 255, 0.13);
  --line: rgba(255, 255, 255, 0.16);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  font-family: "Poppins", "Inter", "Avenir Next", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--white);
  background:
    linear-gradient(135deg, rgba(77, 174, 235, 0.16), transparent 34%),
    linear-gradient(180deg, #071728 0%, var(--navy) 55%, #081623 100%);
  font-family: "Poppins", "Inter", "Avenir Next", Arial, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.dashboard-shell {
  width: min(100%, 1920px);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(10px, 1vw, 19px);
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  gap: clamp(8px, 0.85vw, 16px);
}

.topbar,
.location-hero,
.bottom-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.topbar {
  padding-bottom: clamp(8px, 0.85vw, 16px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 330px;
}

.brand-mark {
  width: clamp(50px, 3.75vw, 68px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: var(--navy);
  background: var(--yellow);
  font-size: clamp(34px, 3vw, 48px);
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 0 0 5px rgba(255, 203, 46, 0.14);
}

.brand strong {
  display: block;
  color: var(--sky);
  font-size: clamp(22px, 1.7vw, 33px);
  line-height: 1.05;
}

.brand strong span {
  color: var(--white);
}

.brand small,
.clock-panel small,
.strip-label,
.section-label,
.kpi-label,
.kpi-goal,
.trend-label {
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0;
}

.brand small {
  display: block;
  margin-top: 6px;
  font-size: clamp(11px, 0.8vw, 15px);
  color: #dbeaf7;
}

.location-tabs {
  display: flex;
  gap: 10px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.location-tabs a {
  min-width: clamp(130px, 12vw, 190px);
  padding: clamp(12px, 1vw, 18px) clamp(14px, 1.2vw, 22px);
  border-radius: 6px;
  text-align: center;
  color: #d9e8f6;
  font-size: clamp(15px, 1.05vw, 20px);
  font-weight: 800;
}

.location-tabs a.active {
  color: var(--navy);
  background: var(--sky);
}

.topbar-actions {
  min-width: 300px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.update-today-link {
  padding: clamp(8px, 0.7vw, 12px) clamp(10px, 0.9vw, 14px);
  border: 1px solid rgba(219, 234, 247, 0.22);
  border-radius: 6px;
  color: #dbeaf7;
  background: rgba(255, 255, 255, 0.045);
  font-size: clamp(11px, 0.72vw, 14px);
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.update-today-link:hover,
.update-today-link:focus-visible {
  border-color: rgba(77, 174, 235, 0.55);
  color: var(--white);
  background: rgba(77, 174, 235, 0.12);
}

.update-today-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(77, 174, 235, 0.22);
}

.clock-panel {
  min-width: 210px;
  text-align: right;
}

.clock-panel span {
  display: block;
  font-size: clamp(28px, 2.6vw, 48px);
  font-weight: 800;
  line-height: 1;
}

.clock-panel small {
  display: block;
  margin-top: 6px;
  font-size: clamp(12px, 0.9vw, 17px);
}

.section-label {
  margin: 0 0 6px;
  color: var(--sky);
  font-size: clamp(13px, 1vw, 18px);
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--white);
  font-size: clamp(36px, 3.15vw, 60px);
  line-height: 0.98;
  letter-spacing: 0;
}

.summary-pill {
  min-width: clamp(220px, 22vw, 360px);
  padding: clamp(14px, 1.05vw, 20px) clamp(18px, 2vw, 34px);
  border: 1px solid rgba(0, 217, 186, 0.45);
  border-radius: 8px;
  color: var(--mint);
  background: rgba(0, 217, 186, 0.08);
  text-align: center;
  font-size: clamp(20px, 1.8vw, 36px);
  font-weight: 900;
}

.summary-pill.watch {
  border-color: rgba(255, 203, 46, 0.48);
  color: var(--yellow);
  background: rgba(255, 203, 46, 0.09);
}

.summary-pill.behind {
  border-color: rgba(255, 107, 107, 0.48);
  color: var(--coral);
  background: rgba(255, 107, 107, 0.09);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 1.25vw, 24px);
}

.kpi-grid.rcm-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(12px, 1.25vw, 24px);
}

.kpi-card {
  --status-color: var(--yellow);
  min-height: clamp(220px, 22vh, 318px);
  padding: clamp(12px, 0.9vw, 18px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(10px, 0.8vw, 16px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel-strong), var(--panel));
  box-shadow: var(--shadow);
}

.rcm-grid .kpi-card {
  min-height: clamp(238px, 23vh, 330px);
}

.rcm-grid .kpi-value {
  font-size: clamp(45px, 3.8vw, 73px);
}

.kpi-card.win {
  border-top: 7px solid var(--status-color, var(--mint));
}

.kpi-card.watch {
  border-top: 7px solid var(--status-color, var(--yellow));
}

.kpi-card.behind {
  border-top: 7px solid var(--status-color, var(--coral));
}

.kpi-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.kpi-label {
  margin: 0;
  color: #dbeaf7;
  font-size: clamp(17px, 1.12vw, 24px);
  line-height: 1.15;
}

.kpi-head-actions {
  display: grid;
  justify-items: end;
  gap: 7px;
  flex: 0 0 auto;
}

.verification-badge {
  max-width: 118px;
  padding: 5px 7px;
  border-radius: 6px;
  color: var(--navy);
  background: var(--yellow);
  font-size: clamp(8px, 0.55vw, 11px);
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.verification-badge.verified {
  background: var(--mint);
}

.verification-badge.needs-review {
  color: var(--white);
  background: var(--coral);
}

.kpi-icon {
  width: clamp(44px, 3.4vw, 64px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(77, 174, 235, 0.5);
  border-radius: 8px;
  color: var(--sky);
  background: rgba(77, 174, 235, 0.09);
}

.kpi-icon svg {
  width: 58%;
  height: 58%;
  stroke: currentColor;
  stroke-width: 2.25;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kpi-main {
  align-self: center;
}

.kpi-value {
  margin: 0;
  font-size: clamp(50px, 4.2vw, 84px);
  font-weight: 900;
  line-height: 0.9;
}

.kpi-goal {
  margin-top: clamp(8px, 0.75vw, 14px);
  font-size: clamp(15px, 1vw, 22px);
}

.combo-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(10px, 0.8vw, 16px);
}

.combo-metric {
  min-width: 0;
  padding: clamp(10px, 0.75vw, 14px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-top: 5px solid var(--status-color, var(--yellow));
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.combo-metric span,
.combo-metric small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-weight: 900;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combo-metric span {
  color: #dbeaf7;
  font-size: clamp(11px, 0.78vw, 15px);
  text-transform: uppercase;
}

.combo-metric strong {
  display: block;
  margin-top: clamp(8px, 0.6vw, 12px);
  color: var(--status-color, var(--yellow));
  font-size: clamp(36px, 3vw, 62px);
  font-weight: 900;
  line-height: 0.9;
}

.combo-metric small {
  margin-top: 8px;
  font-size: clamp(10px, 0.7vw, 14px);
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.status-badge {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: clamp(14px, 1vw, 19px);
  font-weight: 900;
  text-transform: uppercase;
}

.win .status-badge,
.watch .status-badge {
  color: var(--navy);
  background: var(--status-color, var(--mint));
}

.behind .status-badge {
  color: var(--white);
  background: var(--status-color, var(--coral));
}

.trend-label {
  font-size: clamp(12px, 0.78vw, 16px);
}

.progress-track {
  height: clamp(13px, 1vw, 18px);
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
}

.progress-fill {
  background: var(--status-color, var(--yellow));
}

.sparkline {
  width: 100%;
  height: clamp(30px, 2.5vw, 48px);
  margin-top: 10px;
}

.sparkline path {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sparkline path {
  stroke: var(--status-color, var(--yellow));
}

.week-strip,
.bottom-strip {
  padding: clamp(10px, 0.75vw, 14px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.week-strip {
  display: grid;
  grid-template-columns: minmax(230px, 0.42fr) minmax(0, 2fr);
  align-items: center;
  gap: clamp(14px, 1.25vw, 24px);
  overflow: hidden;
}

.week-heading strong {
  display: block;
  font-size: clamp(18px, 1.35vw, 26px);
  line-height: 1.1;
}

.week-heading small {
  display: inline-block;
  margin-top: 9px;
  padding: 6px 10px;
  border: 1px solid rgba(77, 174, 235, 0.42);
  border-radius: 6px;
  color: var(--sky);
  background: rgba(77, 174, 235, 0.08);
  font-size: clamp(11px, 0.78vw, 14px);
  font-weight: 900;
  text-transform: uppercase;
}

.week-rotator {
  position: relative;
  min-height: clamp(136px, 8.8vw, 166px);
  perspective: 1200px;
}

.week-face {
  position: absolute;
  inset: 0;
  display: grid;
  align-items: stretch;
  backface-visibility: hidden;
  transition:
    transform 1250ms ease,
    opacity 900ms ease;
}

.week-days-face {
  transform: rotateX(0deg) translateY(0);
  opacity: 1;
}

.week-tally-face {
  transform: rotateX(-78deg) translateY(12px);
  opacity: 0;
  pointer-events: none;
}

.week-strip.show-tally .week-days-face {
  transform: rotateX(78deg) translateY(-12px);
  opacity: 0;
  pointer-events: none;
}

.week-strip.show-tally .week-tally-face {
  transform: rotateX(0deg) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.week-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: clamp(8px, 0.85vw, 16px);
}

.day-card,
.help-qr-card {
  min-height: clamp(98px, 7vw, 126px);
  padding: clamp(8px, 0.65vw, 12px);
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 5px;
  border: 1px solid var(--line);
  border-top: 5px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.help-qr-card {
  border-top-color: var(--sky);
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 3px;
}

.help-qr-card .day-name {
  justify-self: start;
}

.help-qr-card strong {
  color: var(--white);
  font-size: clamp(11px, 0.78vw, 14px);
  line-height: 1;
}

.help-qr-card img {
  width: clamp(76px, 4.6vw, 88px);
  aspect-ratio: 1;
  display: block;
  padding: 5px;
  border-radius: 6px;
  background: var(--white);
  object-fit: contain;
}

.help-qr-card.missing-qr img {
  display: none;
}

.help-qr-card.missing-qr::after {
  content: "QR image needed";
  display: grid;
  place-items: center;
  width: min(74px, 5vw);
  aspect-ratio: 1;
  padding: 6px;
  border: 1px dashed rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  color: var(--muted);
  font-size: clamp(9px, 0.62vw, 12px);
  font-weight: 900;
  line-height: 1.1;
}

.day-card.win {
  border-top-color: var(--mint);
}

.day-card.watch,
.day-card.pending {
  border-top-color: var(--yellow);
}

.day-card.behind {
  border-top-color: var(--coral);
}

.day-name {
  color: var(--sky);
  font-size: clamp(12px, 0.85vw, 16px);
  font-weight: 900;
  text-transform: uppercase;
}

.day-card strong {
  color: var(--white);
  font-size: clamp(14px, 0.92vw, 18px);
  line-height: 1;
}

.day-card small,
.day-pending {
  color: var(--muted);
  font-size: clamp(9px, 0.62vw, 12px);
  font-weight: 800;
}

.day-metrics {
  display: grid;
  gap: 4px;
  margin-top: 2px;
}

.day-metric {
  --status-color: var(--yellow);
  display: grid;
  grid-template-columns: minmax(38px, 0.9fr) minmax(42px, 0.8fr);
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.day-metric span,
.day-metric b,
.day-metric small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-metric span {
  color: #dbeaf7;
  font-size: clamp(9px, 0.62vw, 12px);
  font-weight: 900;
}

.day-metric b {
  color: var(--white);
  font-size: clamp(11px, 0.78vw, 15px);
  line-height: 1;
}

.day-metric.win b,
.day-metric.watch b,
.day-metric.behind b {
  color: var(--status-color, var(--yellow));
}

.day-pending {
  padding-top: 5px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.day-card.win strong {
  color: var(--mint);
}

.day-card.watch strong,
.day-card.pending strong {
  color: var(--yellow);
}

.day-card.behind strong {
  color: var(--coral);
}

.weekly-tally {
  display: grid;
  grid-template-columns: minmax(190px, 0.75fr) repeat(4, minmax(0, 1fr));
  gap: clamp(8px, 0.85vw, 16px);
}

.tally-scoreboard,
.tally-stat {
  min-height: clamp(98px, 7vw, 126px);
  padding: clamp(10px, 0.75vw, 14px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.tally-scoreboard {
  display: grid;
  align-content: center;
  border-top: 5px solid var(--mint);
  background:
    linear-gradient(135deg, rgba(0, 217, 186, 0.14), rgba(77, 174, 235, 0.07)),
    rgba(255, 255, 255, 0.05);
}

.tally-scoreboard strong {
  color: var(--mint);
  font-size: clamp(34px, 2.55vw, 48px);
  font-weight: 900;
  line-height: 0.92;
}

.tally-scoreboard > span,
.tally-stat > span {
  color: var(--sky);
  font-size: clamp(11px, 0.78vw, 14px);
  font-weight: 900;
  text-transform: uppercase;
}

.tally-scoreboard small,
.tally-stat small {
  color: var(--muted);
  font-size: clamp(10px, 0.68vw, 13px);
  font-weight: 800;
}

.tally-stat {
  --tally-color: var(--yellow);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 6px;
  border-top: 5px solid var(--tally-color);
}

.tally-stat strong {
  align-self: center;
  color: var(--tally-color);
  font-size: clamp(25px, 1.9vw, 36px);
  font-weight: 900;
  line-height: 0.95;
}

.tally-total {
  color: #dbeaf7;
  font-size: 0.62em;
}

.tally-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
}

.tally-fill {
  height: 100%;
  width: var(--fill-width);
  border-radius: inherit;
  background: var(--tally-color);
}

.week-strip.show-tally .tally-count {
  animation: tallyPop 640ms ease both;
}

@keyframes tallyPop {
  0% {
    transform: translateY(8px) scale(0.95);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

.bottom-strip > div {
  min-width: 0;
}

.rcm-footer {
  display: grid;
  grid-template-columns: minmax(380px, 1fr) minmax(360px, 0.85fr) minmax(210px, 0.35fr);
}

.rcm-footer img {
  width: 100%;
  height: clamp(62px, 5vw, 96px);
  display: block;
  border: 1px solid rgba(77, 174, 235, 0.3);
  border-radius: 8px;
  background: var(--white);
  object-fit: cover;
  object-position: bottom center;
}

.strip-label {
  display: block;
  margin-bottom: 6px;
  color: var(--sky);
  font-size: clamp(12px, 0.9vw, 16px);
  text-transform: uppercase;
}

.bottom-strip strong {
  display: block;
  font-size: clamp(17px, 1.3vw, 26px);
  line-height: 1.18;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px 20px;
  color: #dbeaf7;
  font-size: clamp(14px, 1vw, 18px);
  font-weight: 800;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 12px;
  aspect-ratio: 1;
  border-radius: 50%;
}

.dot.win {
  background: var(--mint);
}

.dot.watch {
  background: var(--yellow);
}

.dot.behind {
  background: var(--coral);
}

@media (max-width: 980px) {
  .dashboard-shell {
    min-height: auto;
  }

  .topbar,
  .location-hero,
  .week-strip,
  .bottom-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .brand,
  .topbar-actions,
  .clock-panel,
  .summary-pill {
    min-width: 0;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .clock-panel {
    text-align: left;
  }

  .location-tabs {
    width: 100%;
  }

  .location-tabs a {
    min-width: 0;
    flex: 1;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .kpi-grid.rcm-grid,
  .rcm-footer {
    grid-template-columns: 1fr;
  }

  .week-strip {
    display: flex;
  }

  .week-rotator {
    min-height: 760px;
  }

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

  .weekly-tally {
    grid-template-columns: 1fr;
  }

  .kpi-card {
    min-height: 320px;
  }

  .legend {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .week-face,
  .week-strip.show-tally .tally-count {
    transition: none;
    animation: none;
  }
}
