:root {
  color-scheme: dark;
  --theme-bg: #050914;
  --theme-bg-secondary: #080e19;
  --theme-surface: #0d1523;
  --theme-surface-raised: #111b2c;
  --theme-surface-glass: rgba(13, 21, 35, 0.72);
  --theme-text: #eaf8fb;
  --theme-copy: #9baac1;
  --theme-muted: #71819a;
  --theme-cyan: #39d5f4;
  --theme-cyan-soft: #a5edf8;
  --theme-violet: #a68cff;
  --theme-border: rgba(165, 237, 248, 0.12);
  --theme-border-strong: rgba(57, 213, 244, 0.28);
  --theme-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  --theme-shadow-hover: 0 28px 80px rgba(20, 190, 230, 0.12);
  --theme-radius-sm: 0.75rem;
  --theme-radius-md: 1.25rem;
  --theme-radius-lg: 2rem;
  --theme-content: 96rem;
  --font-interface: "Instrument Sans", "Segoe UI", sans-serif;
  --font-editorial: "Playfair Display", Georgia, serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--theme-text);
  background:
    radial-gradient(circle at 12% 8%, rgba(57, 213, 244, 0.12), transparent 32rem),
    radial-gradient(circle at 88% 32%, rgba(166, 140, 255, 0.11), transparent 34rem),
    var(--theme-bg);
  font: 14px/1.5 var(--font-interface);
}
body, button, input, textarea, select { font-family: var(--font-interface); }
a { color: inherit; }

.dashboard-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 18rem minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem 0.8rem;
  border-right: 1px solid var(--theme-border);
  background: rgba(5, 9, 20, 0.86);
  backdrop-filter: blur(16px);
}
.sidebar-brand {
  display: grid;
  grid-template-columns: 2.35rem minmax(0, 1fr);
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 0.75rem 1.15rem;
  color: var(--theme-text);
  text-decoration: none;
  border-bottom: 1px solid var(--theme-border);
}
.sidebar-brand-icon {
  width: 2.35rem;
  height: 2.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.7rem;
  color: #03111c;
  background:
    radial-gradient(circle at 25% 20%, #48ffc7 0 18%, transparent 19%),
    linear-gradient(135deg, var(--theme-cyan), var(--theme-violet));
  box-shadow: 0 0 24px rgba(57, 213, 244, 0.22);
}
.sidebar-brand strong { display: block; font-size: 1.1rem; }
.sidebar-brand small {
  display: block;
  color: var(--theme-muted);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sidebar-status span, .sidebar-status small {
  color: var(--theme-muted);
  font-size: 0.82rem;
}
.sidebar-section-label {
  padding: 0.2rem 0.75rem 0;
  color: var(--theme-muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.side-nav {
  display: grid;
  gap: 0.35rem;
}
.side-nav a, .sidebar button {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  color: var(--theme-copy);
  background: transparent;
  border: 1px solid transparent;
  padding: 0.68rem 0.85rem;
  text-decoration: none;
  border-radius: 0.42rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.side-nav a {
  gap: 0.7rem;
}
.nav-icon {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 0.45rem;
  color: var(--theme-muted);
  background: rgba(255,255,255,0.045);
}
.side-nav a:hover .nav-icon,
.side-nav a:focus-visible .nav-icon {
  color: #04111a;
  background: var(--theme-cyan);
}
.side-nav a:hover, .sidebar button:hover,
.side-nav a:focus-visible, .sidebar button:focus-visible {
  color: var(--theme-text);
  background: rgba(57, 213, 244, 0.09);
  border-color: var(--theme-border-strong);
  outline: none;
}
.sidebar-status {
  margin-top: auto;
  display: grid;
  gap: 0.15rem;
  padding: 0.9rem;
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-md);
  background: rgba(57, 213, 244, 0.06);
}
.sidebar-status i { color: var(--theme-cyan); }
.sidebar-status strong {
  color: var(--theme-cyan-soft);
  font-size: 0.95rem;
}
.sidebar-logout button { width: 100%; justify-content: center; gap: 0.5rem; }
.dashboard-main {
  min-width: 0;
  padding: 0 0 0;
  background: rgba(2, 6, 12, 0.18);
}
.dashboard-topbar {
  width: 100%;
  margin: 0 0 1.3rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, auto);
  align-items: center;
  gap: 1rem;
  padding: 1rem max(1rem, calc((100% - var(--theme-content)) / 2));
  border: 1px solid var(--theme-border);
  border-width: 0 0 1px;
  border-radius: 0;
  background: rgba(13, 21, 35, 0.88);
  box-shadow: none;
}
.dashboard-topbar h1 {
  margin-bottom: 0.25rem;
  font-size: clamp(1.3rem, 2vw, 1.9rem);
}
.dashboard-topbar h1 > i { color: var(--theme-cyan); font-size: 0.9em; }
.dashboard-topbar p { margin: 0; max-width: 64ch; }
.eyebrow {
  margin-bottom: 0.35rem !important;
  color: var(--theme-cyan-soft);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.topbar-status {
  display: grid;
  gap: 0.55rem;
  min-width: 15rem;
}
.topbar-status span {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-sm);
  color: var(--theme-copy);
  background: rgba(5, 9, 20, 0.38);
}
.topbar-status strong { color: var(--theme-cyan-soft); }

.login {
  min-height: 100vh;
}
.login-page {
  width: min(70rem, calc(100% - 2rem));
  min-height: min(45rem, calc(100vh - 3rem));
  display: grid;
  grid-template-columns: minmax(20rem, 0.82fr) minmax(24rem, 1fr);
  margin: 1.5rem auto;
  overflow: hidden;
  border: 1px solid var(--theme-border-strong);
  border-radius: var(--theme-radius-lg);
  background: rgba(255,255,255,0.04);
  box-shadow: var(--theme-shadow);
}
.login-info {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2rem, 4vw, 3.6rem);
  background:
    linear-gradient(165deg, rgba(57, 213, 244, 0.16), rgba(166, 140, 255, 0.15)),
    var(--theme-bg-secondary);
}
.login-info::after {
  content: "";
  position: absolute;
  inset: 1.1rem;
  border: 1px solid rgba(234, 248, 251, 0.1);
  border-radius: var(--theme-radius-md);
  pointer-events: none;
}
.login-eyebrow, .login-panel-kicker {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1.1rem;
  padding: 0.48rem 0.7rem;
  border: 1px solid rgba(57, 213, 244, 0.24);
  border-radius: 999px;
  color: var(--theme-cyan-soft);
  background: rgba(57, 213, 244, 0.09);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.login-eyebrow span {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--theme-cyan);
  box-shadow: 0 0 0 0.28rem rgba(57, 213, 244, 0.18);
}
.login-brand-mark {
  width: 4.2rem;
  height: 4.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.1rem;
  border-radius: 1rem;
  color: #03111c;
  background: linear-gradient(135deg, var(--theme-cyan), var(--theme-violet));
  box-shadow: 0 18px 34px rgba(57, 213, 244, 0.18);
  font-size: 1.55rem;
}
.login-info h2 {
  max-width: 10ch;
  font-size: clamp(2.2rem, 4.7vw, 4.8rem);
  line-height: 0.92;
}
.login-info p {
  max-width: 28rem;
  margin: 0;
  color: rgba(234, 248, 251, 0.78);
}
.login-highlights {
  display: grid;
  gap: 0.65rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}
.login-highlights li {
  min-height: 2.35rem;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid rgba(234, 248, 251, 0.1);
  border-radius: 0.65rem;
  color: rgba(234, 248, 251, 0.9);
  background: rgba(255,255,255,0.06);
}
.login-highlights i { width: 1rem; color: var(--theme-cyan); text-align: center; }
.login-security-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 1.1rem;
}
.login-security-strip span {
  padding: 0.8rem;
  border: 1px solid rgba(234, 248, 251, 0.1);
  border-radius: 0.7rem;
  color: var(--theme-copy);
  background: rgba(0,0,0,0.18);
}
.login-security-strip strong { display: block; color: var(--theme-text); }
.login-container {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2rem, 5vw, 4rem);
  background:
    linear-gradient(135deg, rgba(57, 213, 244, 0.05), transparent 42%),
    var(--theme-bg-secondary);
}
.login-container::before {
  content: "";
  position: absolute;
  top: 2rem;
  right: 2rem;
  width: 4.4rem;
  height: 4.4rem;
  border-top: 2px solid rgba(57, 213, 244, 0.28);
  border-right: 2px solid rgba(57, 213, 244, 0.28);
}
.login-header h1 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: clamp(2rem, 3vw, 3.1rem);
}
.login-header h1 i {
  width: 3rem;
  height: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 0.85rem;
  color: #03111c;
  background: linear-gradient(145deg, var(--theme-cyan), var(--theme-violet));
}
.login-header p { margin: 0.6rem 0 0; }
.flash-message {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 1.2rem 0 0;
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  font-weight: 700;
}
.error-message {
  color: #ffb3b3;
  border: 1px solid rgba(255, 120, 120, 0.28);
  background: rgba(255, 100, 100, 0.09);
}
.login-form {
  margin-top: 1.5rem;
}
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
  color: var(--theme-copy);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.input-icon-wrap {
  position: relative;
}
.input-icon-wrap > i {
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--theme-cyan);
}
.form-group input {
  min-height: 3.35rem;
  padding-left: 2.8rem;
  padding-right: 3rem;
  border-radius: 0.78rem;
  background: var(--theme-surface-raised);
}
.password-toggle {
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.1rem;
  height: 2.1rem;
  min-height: 0;
  padding: 0;
  color: var(--theme-copy);
  border-radius: 0.55rem;
  background: transparent;
}
.password-toggle:hover { color: var(--theme-cyan); background: rgba(255,255,255,0.06); }
.btn {
  width: 100%;
  min-height: 3.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  border-radius: 0.78rem;
  background: linear-gradient(135deg, var(--theme-cyan), var(--theme-violet));
  box-shadow: 0 0 24px rgba(57, 213, 244, 0.18);
}
.login-submit-note {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.8rem;
  color: var(--theme-muted);
  font-size: 0.83rem;
}
.login-submit-note i { margin-top: 0.2rem; color: var(--theme-cyan); }
.login-footer {
  margin-top: auto;
  padding-top: 1.75rem;
  color: var(--theme-muted);
  text-align: center;
  font-size: 0.8rem;
}
.panel, .theme-card {
  width: min(var(--theme-content), calc(100% - 2rem));
  margin: 1.25rem auto;
  padding: clamp(1.15rem, 2.4vw, 2rem);
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-md);
  background: linear-gradient(145deg, rgba(17, 27, 44, 0.88), rgba(8, 14, 25, 0.72));
  box-shadow: var(--theme-shadow);
}

h1, h2, h3, h4 {
  margin: 0 0 1rem;
  color: var(--theme-text);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.08;
}
h1 { font-size: clamp(2.2rem, 5vw, 4.5rem); }
h2 { font-size: clamp(1.45rem, 2.5vw, 2.35rem); }
h3 { font-size: 1.08rem; color: var(--theme-cyan-soft); }
p { color: var(--theme-copy); }
.type-accent {
  color: var(--theme-cyan);
  font-family: var(--font-editorial);
  font-style: italic;
  font-weight: 500;
}
.bad { color: #ff9c9c; }
.flash {
  border: 1px solid rgba(57, 213, 244, 0.22);
  border-radius: var(--theme-radius-sm);
  padding: 0.8rem 1rem;
  color: var(--theme-cyan-soft);
  background: rgba(57, 213, 244, 0.08);
}

label {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  color: var(--theme-copy);
  font-size: 0.86rem;
  font-weight: 650;
}
input, select, textarea {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.68rem 0.78rem;
  color: var(--theme-text);
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-sm);
  background: rgba(5, 9, 20, 0.72);
}
input[type="checkbox"] {
  width: 1rem;
  min-height: 1rem;
  accent-color: var(--theme-cyan);
}
button {
  min-height: 2.75rem;
  color: #021019;
  background: linear-gradient(135deg, var(--theme-cyan), var(--theme-cyan-soft));
  border: 0;
  border-radius: 999px;
  padding: 0.72rem 1rem;
  font-weight: 750;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(57, 213, 244, 0.26);
  outline-offset: 2px;
}

.metrics {
  width: min(var(--theme-content), calc(100% - 2rem));
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.25rem auto;
}
.metrics div {
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-md);
  padding: 1.1rem;
  background: rgba(17, 27, 44, 0.7);
}
.metrics strong { display: block; color: var(--theme-cyan); font-size: 2rem; }
.metrics span { color: var(--theme-copy); }

.dashboard-page-head {
  width: min(var(--theme-content), calc(100% - 2rem));
  margin: 1.8rem auto 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
}
.dashboard-page-head h1 {
  margin-bottom: 0.45rem;
  font-size: clamp(2rem, 4vw, 3.6rem);
}
.dashboard-page-head p { max-width: 68ch; margin: 0; }
.settings-link {
  min-height: 2.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.78rem 1rem;
  color: #021019;
  background: linear-gradient(135deg, var(--theme-cyan), var(--theme-cyan-soft));
  border-radius: 0.55rem;
  font-weight: 800;
  text-decoration: none;
}
.overview-showcase {
  width: min(var(--theme-content), calc(100% - 2rem));
  margin: 1rem auto;
  display: grid;
  grid-template-columns: minmax(22rem, 1.55fr) repeat(3, minmax(13rem, 0.72fr));
  gap: 1rem;
}
.hero-stat-card, .provider-stat-card {
  border: 1px solid var(--theme-border);
  border-radius: 0.95rem;
  background: linear-gradient(145deg, rgba(17, 27, 44, 0.88), rgba(10, 16, 27, 0.82));
  box-shadow: var(--theme-shadow);
}
.hero-stat-card {
  min-height: 16.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  padding: clamp(1.25rem, 2.6vw, 2rem);
  position: relative;
  overflow: hidden;
}
.hero-stat-card::after {
  content: "";
  position: absolute;
  right: 2rem;
  bottom: 1.4rem;
  width: 9rem;
  height: 9rem;
  border-radius: 2rem;
  background:
    linear-gradient(135deg, rgba(57, 213, 244, 0.18), rgba(166, 140, 255, 0.18)),
    radial-gradient(circle at 35% 35%, rgba(57, 213, 244, 0.28), transparent 44%),
    radial-gradient(circle at 68% 62%, rgba(166, 140, 255, 0.28), transparent 48%);
  opacity: 0.8;
  transform: rotate(-8deg);
}
.hero-stat-card h2 { font-size: clamp(1.45rem, 2.6vw, 2.4rem); }
.hero-stat-number {
  display: grid;
  align-content: start;
  text-align: right;
  z-index: 1;
}
.hero-stat-number strong {
  color: var(--theme-cyan);
  font-size: clamp(2.4rem, 5vw, 4.8rem);
  line-height: 0.9;
}
.hero-stat-number span, .provider-stat-card small { color: var(--theme-copy); }
.hero-stat-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  z-index: 1;
  margin-top: auto;
}
.hero-stat-grid span {
  padding: 0.75rem;
  border: 1px solid var(--theme-border);
  border-radius: 0.7rem;
  color: var(--theme-copy);
  background: rgba(5, 9, 20, 0.42);
}
.hero-stat-grid b {
  display: block;
  color: var(--theme-text);
  font-size: 1.35rem;
}
.provider-stat-card {
  min-height: 16.5rem;
  display: grid;
  align-content: space-between;
  gap: 0.7rem;
  padding: 1.1rem;
}
.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--theme-copy);
  font-weight: 750;
}
.stat-card-top b { color: #8cffc5; }
.provider-stat-card > strong {
  color: var(--theme-text);
  font-size: clamp(2rem, 3vw, 3.1rem);
  line-height: 1;
}
.spark-bars {
  height: 5.2rem;
  display: flex;
  align-items: end;
  gap: 0.38rem;
  padding-top: 0.8rem;
}
.spark-bars i {
  flex: 1;
  height: var(--h, 12%);
  min-height: 0.4rem;
  border-radius: 999px 999px 0.25rem 0.25rem;
  background: linear-gradient(180deg, var(--theme-cyan), rgba(57, 213, 244, 0.22));
}
.ops-grid {
  width: min(var(--theme-content), calc(100% - 2rem));
  margin: 1rem auto;
  display: grid;
  grid-template-columns: minmax(20rem, 0.82fr) minmax(0, 1.68fr);
  gap: 1rem;
}
.panel-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.panel-title h2 { margin: 0; }
.panel-title span { color: var(--theme-muted); font-weight: 700; }
.status-donut-panel, .delivery-chart-panel {
  margin-top: 0;
  margin-bottom: 0;
}
.large-donut {
  width: min(20rem, 80vw);
  margin-block: 2rem;
}
.legend-list {
  display: grid;
  gap: 0.85rem;
}
.legend-list span, .chart-legend span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--theme-copy);
}
.legend-list b { color: var(--theme-text); margin-left: auto; }
.legend-list i, .chart-legend i {
  width: 0.75rem;
  height: 0.75rem;
  display: inline-block;
  border-radius: 50%;
}
.legend-ok { background: var(--theme-cyan); }
.legend-bad { background: #ff7b9b; }
.legend-warn { background: var(--theme-violet); }
.axis-chart {
  min-height: 21rem;
  display: flex;
  align-items: end;
  gap: clamp(0.55rem, 1.1vw, 1rem);
  padding: 1rem 0 0.5rem;
  border-bottom: 1px solid rgba(234, 248, 251, 0.55);
}
.axis-day {
  flex: 1;
  min-width: 2.2rem;
  display: grid;
  gap: 0.6rem;
  text-align: center;
  color: var(--theme-copy);
}
.dual-bar {
  height: 16.5rem;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 0.28rem;
}
.dual-bar i, .dual-bar b {
  width: min(1.25rem, 44%);
  height: var(--h, 0%);
  min-height: 0.25rem;
  border-radius: 999px 999px 0.25rem 0.25rem;
}
.dual-bar i {
  background: linear-gradient(180deg, var(--theme-cyan), rgba(57, 213, 244, 0.35));
}
.dual-bar b {
  background: linear-gradient(180deg, #ff7b9b, rgba(255, 123, 155, 0.35));
}
.chart-legend {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 1rem;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}
th, td {
  text-align: left;
  border-bottom: 1px solid var(--theme-border);
  padding: 0.8rem;
  vertical-align: top;
}
th { color: var(--theme-cyan-soft); background: rgba(57, 213, 244, 0.06); }
td { color: var(--theme-copy); }
code, pre {
  color: var(--theme-cyan-soft);
  background: rgba(5, 9, 20, 0.72);
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-sm);
}
code { padding: 0.12rem 0.35rem; }
pre { padding: 1rem; overflow: auto; }
.badge, .pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  color: var(--theme-copy);
  border: 1px solid var(--theme-border);
  background: rgba(255,255,255,0.04);
  font-size: 0.78rem;
  font-weight: 750;
}
.badge.active, .pill.good { color: #9effc3; border-color: rgba(90,255,160,0.28); }
.badge.disabled { color: var(--theme-muted); }

.page-hero {
  width: min(var(--theme-content), calc(100% - 2rem));
  margin: 1.6rem auto 1rem;
}
.page-hero p { max-width: 66ch; margin: 0; }
.scenario-grid, .provider-grid, .field-grid, .quick-grid {
  display: grid;
  gap: 1rem;
}
.scenario-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.provider-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.performance-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.chart-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(18rem, 0.6fr); gap: 1rem; }
.explain-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0; }
.field-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.quick-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 1rem 0; }
.scenario-card, .provider-card, .mini-card, .performance-card, .chart-card, .explain-card {
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-md);
  padding: 1rem;
  background: rgba(5, 9, 20, 0.38);
}
.scenario-card.is-active {
  border-color: var(--theme-border-strong);
  box-shadow: inset 0 0 0 1px rgba(57, 213, 244, 0.16);
}
.scenario-card h3, .provider-card h3 { margin-bottom: 0.45rem; }
.scenario-card p, .mini-card p { margin: 0; font-size: 0.9rem; }
.provider-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.provider-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.provider-actions form { margin: 0; }
.provider-save { margin-top: 1rem; }
.order-list {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0;
}
.order-list .order-item {
  display: grid;
  grid-template-columns: 3rem minmax(8rem, 1fr) minmax(8rem, 0.8fr) auto auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem;
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-md);
  background: rgba(5, 9, 20, 0.42);
  cursor: grab;
}
.order-item.dragging {
  opacity: 0.6;
  border-color: var(--theme-border-strong);
}
.sortable-provider-grid {
  align-items: start;
  margin-top: 1rem;
}
.provider-card.order-item {
  cursor: grab;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
.provider-card.order-item:hover {
  transform: translateY(-2px);
  border-color: var(--theme-border-strong);
  box-shadow: var(--theme-shadow-hover);
}
.provider-title {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
}
.provider-title h3 { margin-bottom: 0.3rem; }
.provider-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
}
.provider-head-actions button {
  min-height: 2.25rem;
  padding: 0.45rem 0.7rem;
  color: var(--theme-cyan-soft);
  border: 1px solid var(--theme-border);
  background: rgba(255,255,255,0.04);
}
.provider-card .pill { min-height: 2.25rem; }
.order-save-form {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}
.order-rank {
  width: 2.3rem;
  height: 2.3rem;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #021019;
  background: var(--theme-cyan);
  font-weight: 800;
}
.order-list .order-item small {
  color: var(--theme-muted);
}
.reveal-all-form {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) minmax(8rem, 0.5fr) auto;
  align-items: end;
  gap: 0.75rem;
  margin: 1rem 0;
}
.secret-box {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid rgba(255, 190, 120, 0.24);
  border-radius: var(--theme-radius-md);
  background: rgba(255, 160, 60, 0.07);
}
.class-pills {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}
.class-pills label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.45rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-sm);
  background: rgba(255,255,255,0.035);
}
.performance-card strong {
  color: var(--theme-cyan);
  font-size: 2rem;
}
.bar-row {
  display: grid;
  grid-template-columns: minmax(7rem, 1fr) minmax(8rem, 2fr) minmax(4.5rem, auto);
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem 0;
  color: var(--theme-copy);
}
.bar {
  height: 0.7rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
}
.bar i {
  display: block;
  width: var(--bar, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--theme-cyan), var(--theme-violet));
}
.warning {
  border: 1px solid rgba(255, 190, 120, 0.22);
  border-radius: var(--theme-radius-sm);
  padding: 0.75rem;
  color: #ffd4a8;
  background: rgba(255, 160, 60, 0.08);
}
.timeline-chart {
  min-height: 14rem;
  display: flex;
  align-items: end;
  gap: 0.6rem;
  padding-top: 1rem;
}
.day-bar {
  flex: 1;
  min-width: 1.8rem;
  display: grid;
  gap: 0.5rem;
  align-items: end;
  text-align: center;
  color: var(--theme-muted);
  font-size: 0.78rem;
}
.bar-stack {
  height: 12rem;
  display: flex;
  flex-direction: column;
  justify-content: end;
  gap: 0.15rem;
}
.bar-stack i,
.bar-stack b {
  display: block;
  min-height: 0.15rem;
  border-radius: 999px 999px 0 0;
}
.bar-stack i {
  height: var(--sent, 0%);
  background: linear-gradient(180deg, var(--theme-cyan), rgba(57, 213, 244, 0.35));
}
.bar-stack b {
  height: var(--failed, 0%);
  background: linear-gradient(180deg, #ff9c9c, rgba(255, 156, 156, 0.35));
}
.donut {
  width: min(14rem, 70vw);
  aspect-ratio: 1;
  margin: 1rem auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--theme-cyan) var(--ok, 0%), rgba(255,156,156,0.62) 0);
  position: relative;
}
.donut::after {
  content: "";
  position: absolute;
  inset: 1.3rem;
  border-radius: inherit;
  background: var(--theme-surface);
}
.donut strong,
.donut span {
  position: relative;
  z-index: 1;
  grid-area: 1 / 1;
}
.donut strong { margin-top: -1rem; color: var(--theme-cyan); font-size: 2.3rem; }
.donut span { margin-top: 2.4rem; color: var(--theme-copy); }
.footer {
  margin: 2rem 0 0;
  padding: 0;
  color: var(--theme-copy);
  background: transparent;
}
.footer-top, .copyright {
  width: min(var(--theme-content), calc(100% - 2rem));
  margin-inline: auto;
}
.footer-top {
  margin-top: 2.5rem;
  padding: clamp(1.875rem, 4vw, 3.125rem);
  border: 1px solid var(--theme-border);
  border-radius: clamp(1.25rem, 4vw, 3.125rem);
  background: var(--theme-bg-secondary);
  box-shadow: var(--theme-shadow);
}
.footer-layout {
  display: grid;
  grid-template-columns: minmax(16rem, 1.5fr) minmax(9rem, 0.65fr) minmax(9rem, 0.65fr) minmax(13rem, 0.9fr);
  gap: 1.5rem;
}
.footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.55rem; }
.footer a { color: var(--theme-copy); text-decoration: none; }
.footer a:hover, .footer a:focus-visible { color: var(--theme-cyan); outline: none; }
.copyright {
  min-height: 4.625rem;
  margin-top: 1.5rem;
  margin-bottom: 1.25rem;
  padding-inline: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--theme-muted);
  background: rgba(13, 21, 35, 0.86);
  text-align: center;
}
.copyright a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.2rem;
  color: inherit;
  text-decoration: none;
}
.copyright .sitename {
  color: var(--theme-text);
  font-family: var(--font-editorial);
  font-size: 1.25rem;
  font-style: italic;
}
@media (max-width: 68rem) {
  .dashboard-shell { grid-template-columns: 1fr; }
  .login-page {
    min-height: auto;
    grid-template-columns: 1fr;
  }
  .login-info {
    min-height: 22rem;
  }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--theme-border);
  }
  .side-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .sidebar-status { margin-top: 0; }
  .dashboard-topbar { grid-template-columns: 1fr; }
  .dashboard-page-head, .overview-showcase, .ops-grid { grid-template-columns: 1fr; }
  .hero-stat-card { min-height: auto; }
  .scenario-grid, .provider-grid, .quick-grid, .performance-grid, .explain-grid, .chart-grid { grid-template-columns: 1fr 1fr; }
  .field-grid { grid-template-columns: 1fr 1fr; }
  .footer-layout { grid-template-columns: 1fr 1fr; }
  .footer-about, .footer-contact { grid-column: 1 / -1; }
}
@media (max-width: 44rem) {
  .login-page {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    border-radius: 0;
  }
  .login-info, .login-container {
    padding: 1.5rem;
  }
  .login-info {
    min-height: 19rem;
  }
  .login-info::after,
  .login-container::before {
    display: none;
  }
  .login-security-strip {
    grid-template-columns: 1fr;
  }
  .login-header h1 {
    align-items: flex-start;
    font-size: 1.85rem;
  }
  .login-header h1 i {
    width: 2.6rem;
    height: 2.6rem;
  }
  .sidebar { padding: 0.8rem; }
  .side-nav { grid-template-columns: 1fr 1fr; }
  .side-nav a, .sidebar button { min-height: 2.55rem; padding: 0.58rem 0.65rem; }
  .dashboard-main { padding-top: 0.8rem; }
  .dashboard-topbar { width: min(100% - 1rem, var(--theme-content)); border-radius: var(--theme-radius-md); }
  .dashboard-page-head {
    width: min(100% - 1rem, var(--theme-content));
    margin-top: 1rem;
  }
  .settings-link { width: 100%; }
  .overview-showcase, .ops-grid { width: min(100% - 1rem, var(--theme-content)); }
  .hero-stat-card { grid-template-columns: 1fr; }
  .hero-stat-card::after { width: 6rem; height: 6rem; right: 1rem; bottom: 1rem; }
  .hero-stat-number { text-align: left; }
  .hero-stat-grid { grid-template-columns: 1fr 1fr; }
  .axis-chart { overflow-x: auto; align-items: end; }
  .axis-day { min-width: 2.8rem; }
  .panel-title { display: grid; }
  .metrics, .scenario-grid, .provider-grid, .field-grid, .quick-grid, .performance-grid, .explain-grid, .chart-grid, .footer-layout { grid-template-columns: 1fr; }
  .panel, .theme-card { width: min(100% - 1rem, var(--theme-content)); padding: 1rem; }
  table { font-size: 0.82rem; }
  th, td { padding: 0.6rem; }
  .bar-row { grid-template-columns: 1fr; gap: 0.35rem; }
  .order-list .order-item, .reveal-all-form { grid-template-columns: 1fr; }
  .provider-head, .provider-title, .provider-head-actions { align-items: flex-start; flex-direction: column; }
  .provider-head-actions { width: 100%; }
  .provider-head-actions button, .provider-head-actions .pill { width: 100%; justify-content: center; }
  .order-save-form { justify-content: stretch; }
  .order-save-form button { width: 100%; }
  .timeline-chart { overflow-x: auto; align-items: end; }
  .day-bar { min-width: 2.5rem; }
  .footer-top, .copyright { border-radius: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
