@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@500&display=swap');

:root {
  --bg: #0b1220;
  --bg-elevated: #111827;
  --surface: rgba(22, 32, 51, 0.85);
  --surface-solid: #162033;
  --surface2: #1c2a42;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.28);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --muted2: #64748b;
  --accent: #3b82f6;
  --accent-2: #06b6d4;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --accent-hover: #2563eb;
  --good: #34d399;
  --good-soft: rgba(52, 211, 153, 0.14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.14);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --font: "DM Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1100px 520px at 8% -8%, rgba(59, 130, 246, 0.22), transparent 55%),
    radial-gradient(900px 480px at 96% 4%, rgba(6, 182, 212, 0.14), transparent 45%),
    radial-gradient(700px 400px at 50% 100%, rgba(52, 211, 153, 0.06), transparent 50%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 28px 22px 72px; }

/* ——— Top bar ——— */
.topbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; margin-bottom: 22px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  display: grid; place-items: center; font-weight: 800; font-size: 18px;
  color: white; letter-spacing: -0.5px;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35);
  flex-shrink: 0;
}
.brand h1 {
  margin: 0; font-size: 1.35rem; font-weight: 700;
  letter-spacing: -0.03em; line-height: 1.2;
}
.brand .tagline { margin: 4px 0 0; color: var(--muted); font-size: 0.88rem; }
.meta {
  color: var(--muted); font-size: 0.82rem; text-align: right;
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
}
.meta .as-of { font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 16px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 0.9rem; cursor: pointer; font-family: inherit;
  background: linear-gradient(135deg, #3b82f6, #2563eb); color: white;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(37, 99, 235, 0.4); text-decoration: none; }
.btn-ghost {
  background: transparent; border-color: var(--border-strong); color: var(--text);
  box-shadow: none; padding: 8px 14px; font-size: 0.82rem;
}
.btn-ghost:hover { background: var(--surface2); transform: none; box-shadow: none; }

/* ——— Banner ——— */
.banner {
  background: linear-gradient(105deg, rgba(59, 130, 246, 0.16), rgba(6, 182, 212, 0.08));
  border: 1px solid rgba(59, 130, 246, 0.28);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.banner-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.2);
  flex-shrink: 0;
}
.banner-text { font-size: 0.98rem; font-weight: 560; letter-spacing: -0.01em; }
.banner-date { color: var(--muted); font-size: 0.85rem; margin-left: auto; }

/* ——— KPI cards ——— */
.cards {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 22px;
}
.card {
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}
.card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--accent);
  opacity: 0.7;
}
.card.good::before { background: var(--good); }
.card.bad::before { background: var(--bad); }
.card.warn::before { background: var(--warn); }
.card .label {
  color: var(--muted); font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.card .value {
  font-size: 2rem; font-weight: 700; margin-top: 6px;
  letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1.1;
}
.card .sub { color: var(--muted); font-size: 0.8rem; margin-top: 6px; }
.card.good .value { color: var(--good); }
.card.bad .value { color: var(--bad); }
.card.warn .value { color: var(--warn); }

/* ——— Charts + Orders row ——— */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 16px;
  margin-bottom: 22px;
}
.panel {
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}
.panel-h {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}
.panel-h h2 { margin: 0; font-size: 1.05rem; font-weight: 700; letter-spacing: -0.02em; }
.panel-h p { margin: 0; color: var(--muted); font-size: 0.82rem; }

.chart-row {
  display: flex; align-items: center; gap: 28px; flex-wrap: wrap;
}
.donut-wrap { position: relative; width: 150px; height: 150px; flex-shrink: 0; }
.donut-wrap svg { width: 150px; height: 150px; transform: rotate(-90deg); }
.donut-center {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  pointer-events: none;
}
.donut-center .big {
  font-size: 1.55rem; font-weight: 700; letter-spacing: -0.04em; line-height: 1;
}
.donut-center .small { color: var(--muted); font-size: 0.72rem; margin-top: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.legend { display: flex; flex-direction: column; gap: 12px; flex: 1; min-width: 140px; }
.legend-item { display: flex; align-items: center; gap: 10px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.swatch.good { background: var(--good); }
.swatch.bad { background: var(--bad); }
.legend-label { color: var(--muted); font-size: 0.85rem; flex: 1; }
.legend-val { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 0.95rem; }

/* ——— Orders ——— */
.order-list { display: flex; flex-direction: column; gap: 16px; }
.order {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.order-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 10px; flex-wrap: wrap;
}
.order-title { font-weight: 700; font-size: 1rem; letter-spacing: -0.02em; }
.order-meta { color: var(--muted); font-size: 0.85rem; }
.order-badge {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 999px; font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.03em; text-transform: uppercase;
}
.order-badge.done { background: var(--good-soft); color: var(--good); }
.order-badge.progress { background: var(--accent-soft); color: #93c5fd; }
.progress {
  height: 10px; border-radius: 999px; background: rgba(148, 163, 184, 0.15);
  overflow: hidden; margin-top: 8px;
}
.progress > span {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #3b82f6, #06b6d4);
}
.progress.done > span { background: linear-gradient(90deg, #059669, #34d399); }
.order-foot {
  display: flex; justify-content: space-between; gap: 8px;
  margin-top: 8px; font-size: 0.8rem; color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ——— Sections / tables ——— */
.section {
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 18px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}
.section-h {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.section-h h2 { margin: 0; font-size: 1.05rem; font-weight: 700; letter-spacing: -0.02em; }
.section-h p { margin: 0; color: var(--muted); font-size: 0.85rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--border); }
th {
  color: var(--muted); font-weight: 600; font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.05em; background: rgba(0,0,0,0.18);
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.12s ease; }
tr:hover td { background: rgba(255,255,255,0.025); }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 0.74rem; font-weight: 650;
}
.badge.active { background: var(--good-soft); color: var(--good); }
.badge.turndown { background: var(--bad-soft); color: #fca5a5; }

.filters {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 12px 18px; border-bottom: 1px solid var(--border);
}
.chip {
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  padding: 6px 13px; border-radius: 999px; font-size: 0.8rem; cursor: pointer;
  font-family: inherit; font-weight: 560; transition: all 0.12s ease;
}
.chip.on, .chip:hover {
  background: var(--accent-soft); color: #bfdbfe; border-color: rgba(59, 130, 246, 0.45);
}

.note {
  padding: 12px 18px; color: var(--muted); font-size: 0.85rem;
  border-top: 1px solid var(--border); background: rgba(0,0,0,0.15);
}
.footer {
  color: var(--muted2); font-size: 0.78rem; text-align: center; margin-top: 10px;
}

/* ——— Login ——— */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--surface);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 20px; padding: 36px 32px;
  box-shadow: var(--shadow);
}
.login-card .logo { margin-bottom: 18px; }
.login-card h1 { margin: 0 0 4px; font-size: 1.45rem; letter-spacing: -0.03em; }
.login-card .sub { color: var(--muted); margin: 0 0 26px; font-size: 0.9rem; }
label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 6px; font-weight: 560; }
input[type=password], input[type=text] {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text);
  font-size: 1rem; margin-bottom: 16px; font-family: inherit;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}
.error {
  background: var(--bad-soft); border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca; padding: 10px 12px; border-radius: 10px; margin-bottom: 16px; font-size: 0.9rem;
}
.hint { color: var(--muted2); font-size: 0.78rem; margin-top: 18px; text-align: center; }

@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .wrap { padding: 18px 14px 56px; }
  .brand h1 { font-size: 1.15rem; }
  .meta { text-align: left; align-items: flex-start; width: 100%; }
  .banner-date { margin-left: 0; }
  .card .value { font-size: 1.55rem; }
  th:nth-child(3), td:nth-child(3) { display: none; }
  #cases th:nth-child(6), #cases td:nth-child(6) { display: none; }
}
@media (max-width: 480px) {
  .cards { grid-template-columns: 1fr 1fr; gap: 10px; }
}
