:root {
  --bg: #08111f;
  --bg-2: #0d1728;
  --card: #111d33;
  --card-2: #15233d;
  --border: #22314e;
  --text: #e7edf7;
  --muted: #8ea2c0;
  --accent: #38bdf8;
  --accent-2: #22d3ee;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #fb7185;
  --violet: #a78bfa;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --mono: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(56, 189, 248, 0.12), transparent 60%),
    radial-gradient(700px 400px at 98% 2%, rgba(167, 139, 250, 0.10), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); text-align: center; padding: 30px 12px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 28px;
  background: rgba(8, 17, 31, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(34, 49, 78, 0.8);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #2563eb);
  color: #04111f;
  font-weight: 900;
  font-size: 19px;
  box-shadow: 0 8px 22px rgba(56, 189, 248, 0.30);
}
.brand-title { font-weight: 800; letter-spacing: 0.08em; font-size: 13px; }
.brand-sub { color: var(--muted); font-size: 11px; margin-top: 1px; }

.nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav a {
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}
.nav a:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.nav a.active { color: var(--text); background: rgba(56, 189, 248, 0.12); }
.nav a.logout { color: #fda4af; }
.nav a.logout:hover { background: rgba(251, 113, 133, 0.10); }

.page { max-width: 1480px; margin: 0 auto; padding: 26px 28px 50px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -0.03em; }
.page-head p { margin: 6px 0 0; }

.range-switch, .filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.range-switch button, .filter-row select, .filter-row input, button.ghost, button.primary {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 12px;
  outline: none;
}
.range-switch button { cursor: pointer; color: var(--muted); }
.range-switch button.active { color: #04111f; background: var(--accent); border-color: var(--accent); font-weight: 700; }
.range-switch button.ghost, button.ghost { color: var(--muted); cursor: pointer; }
button.primary {
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), #2563eb);
  border: 0;
  color: #04111f;
  font-weight: 800;
}
button.primary:hover { filter: brightness(1.06); }
button:disabled { opacity: 0.55; cursor: wait; }
.filter-row select, .filter-row input { min-width: 150px; }
.filter-row.compact select { min-width: 180px; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.kpi {
  background: linear-gradient(180deg, rgba(21, 35, 61, 0.96), rgba(17, 29, 51, 0.96));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.kpi-label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.kpi-value { font-size: 27px; font-weight: 800; letter-spacing: -0.03em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.kpi-sub { color: var(--muted); font-size: 12px; margin-top: 5px; }

.section { margin-top: 26px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-size: 18px; }

.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.provider-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(21, 35, 61, 0.98), rgba(17, 29, 51, 0.98));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.provider-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--provider-color, var(--accent));
  opacity: 0.9;
}
.provider-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.provider-name { display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: -0.01em; }
.provider-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--provider-color, var(--accent)); box-shadow: 0 0 12px var(--provider-color, var(--accent)); }
.provider-status { font-size: 11px; color: var(--muted); border: 1px solid var(--border); padding: 3px 8px; border-radius: 999px; }
.provider-balance { font-size: 28px; font-weight: 800; margin-top: 14px; font-variant-numeric: tabular-nums; }
.provider-balance .currency { font-size: 13px; color: var(--muted); font-weight: 600; margin-left: 5px; }
.provider-usd { color: var(--muted); font-size: 12px; margin-top: 4px; }
.provider-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.provider-metric { background: rgba(255,255,255,0.025); border: 1px solid rgba(34, 49, 78, 0.7); border-radius: 10px; padding: 8px 9px; }
.provider-metric .label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.provider-metric .value { font-weight: 700; font-size: 13px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.provider-note { margin-top: 12px; font-size: 11px; color: var(--amber); line-height: 1.4; }
.provider-links { margin-top: 12px; display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--muted); }
.provider-links a { color: var(--accent); }

.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 26px; }
.chart-card.wide { grid-column: 1 / -1; }
.card {
  background: linear-gradient(180deg, rgba(21, 35, 61, 0.96), rgba(17, 29, 51, 0.96));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.chart-card { padding: 16px 18px 12px; min-height: 330px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card-head h3 { margin: 0; font-size: 15px; }
.chart-card canvas { width: 100% !important; }

.table-card { overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.data-table th, .data-table td { padding: 11px 13px; border-bottom: 1px solid rgba(34, 49, 78, 0.65); text-align: left; vertical-align: middle; }
.data-table th { position: sticky; top: 0; background: #111d33; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; z-index: 2; }
.data-table tbody tr:hover { background: rgba(56, 189, 248, 0.035); }
.data-table td { font-size: 12.5px; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.price-table { min-width: 1100px; }
.price-table td.model { font-family: var(--mono); font-size: 11.5px; }
.tag { display: inline-block; padding: 2px 7px; border-radius: 999px; font-size: 10px; font-weight: 700; background: rgba(56, 189, 248, 0.12); color: var(--accent); border: 1px solid rgba(56, 189, 248, 0.22); }
.tag.warn { background: rgba(251, 191, 36, 0.12); color: var(--amber); border-color: rgba(251, 191, 36, 0.25); }
.tag.good { background: rgba(52, 211, 153, 0.12); color: var(--green); border-color: rgba(52, 211, 153, 0.25); }
.tag.bad { background: rgba(251, 113, 133, 0.12); color: var(--red); border-color: rgba(251, 113, 133, 0.25); }

.login-body { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card {
  width: min(390px, 100%);
  background: linear-gradient(180deg, rgba(21, 35, 61, 0.98), rgba(17, 29, 51, 0.98));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 30px 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
.login-logo {
  width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #2563eb); color: #04111f; font-weight: 900; font-size: 26px;
  margin-bottom: 18px;
}
.login-card h1 { margin: 0; font-size: 22px; }
.login-card p { margin: 8px 0 22px; }
.login-card label { display: block; color: var(--muted); font-size: 12px; font-weight: 700; margin-bottom: 7px; }
.login-card input {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: #0b1424; color: var(--text); outline: none; margin-bottom: 14px;
}
.login-card input:focus { border-color: var(--accent); }
.login-card button {
  width: 100%; padding: 11px; border: 0; border-radius: 10px; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), #2563eb); color: #04111f; font-weight: 800;
}
.alert { background: rgba(251, 113, 133, 0.10); border: 1px solid rgba(251, 113, 133, 0.28); color: #fecdd3; padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; font-size: 13px; }

.footer {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 18px 28px 26px; color: var(--muted); font-size: 11px;
  border-top: 1px solid rgba(34, 49, 78, 0.6);
}

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-grid { grid-template-columns: 1fr; }
  .chart-card.wide { grid-column: auto; }
}
@media (max-width: 720px) {
  .topbar { padding: 12px 16px; align-items: flex-start; }
  .brand-sub { display: none; }
  .page { padding: 20px 16px 40px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .kpi-grid { grid-template-columns: 1fr; }
  .provider-metrics { grid-template-columns: repeat(3, 1fr); }
  .nav a { padding: 7px 9px; font-size: 12px; }
}
