:root {
  --bg: #f6f7fb;
  --bg-2: #eef1f8;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #94a3b8;
  --line: #e6e9f2;
  --accent: #5b5bd6;
  --accent-2: #8b5cf6;
  --good: #0f9d76;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px -12px rgba(15, 23, 42, .12);
  --shadow-lg: 0 24px 60px -20px rgba(15, 23, 42, .28);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #e8e6ff 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #e0f2fe 0%, transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ---------- login ---------- */
.login {
  min-height: 100vh; display: grid; grid-template-columns: 1.15fr .85fr;
}
.login-art {
  position: relative; overflow: hidden; padding: 64px;
  background: linear-gradient(150deg, #1e1b4b 0%, #312e81 45%, #4c1d95 100%);
  color: #fff; display: flex; align-items: center;
}
.login-art::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.14) 1px, transparent 1px);
  background-size: 22px 22px; opacity: .35;
}
.orb { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; animation: float 14s ease-in-out infinite; }
.orb-a { width: 420px; height: 420px; background: #6366f1; top: -120px; right: -80px; }
.orb-b { width: 360px; height: 360px; background: #22d3ee; bottom: -120px; left: -60px; animation-delay: -6s; }
@keyframes float { 0%,100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(0,-24px,0) scale(1.06); } }
.login-copy { position: relative; z-index: 2; max-width: 460px; }
.login-copy h1 { font-size: 44px; line-height: 1.06; letter-spacing: -.03em; margin: 28px 0 14px; }
.login-copy h1 span { background: linear-gradient(90deg,#c7d2fe,#a5f3fc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-copy p { color: #c7d2fe; font-size: 16px; }
.art-list { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.art-list li { display: flex; gap: 10px; align-items: center; color: #e0e7ff; font-size: 14.5px; }
.dot { width: 7px; height: 7px; border-radius: 99px; background: #22d3ee; box-shadow: 0 0 0 4px rgba(34,211,238,.18); }
.login-card {
  margin: auto; width: min(420px, 86vw); background: var(--card); border-radius: 22px;
  padding: 38px; box-shadow: var(--shadow-lg); display: grid; gap: 16px;
  animation: rise .5s cubic-bezier(.2,.7,.3,1) both;
}
.login-card h2 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.login-card p { margin: -8px 0 6px; }
label { display: grid; gap: 7px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
input, select, textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px;
  background: #fbfcfe; color: var(--ink); font: inherit; font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: #a5b4fc; background: #fff; box-shadow: 0 0 0 4px rgba(99,102,241,.14);
}
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 10px 16px; border-radius: 11px; font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .12s, box-shadow .15s, background .15s, border-color .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #fff; box-shadow: 0 10px 24px -10px rgba(91,91,214,.7);
}
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: #fecaca; background: #fff5f5; }
.btn.sm { padding: 7px 11px; font-size: 12.5px; border-radius: 9px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.error { color: var(--bad); font-size: 13px; background: #fef2f2; border: 1px solid #fee2e2; padding: 9px 12px; border-radius: 10px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 22px 16px;
  background: rgba(255,255,255,.72); backdrop-filter: blur(14px);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 22px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  font-weight: 800; font-size: 19px; box-shadow: 0 8px 20px -8px rgba(91,91,214,.9);
}
.brand-mark.lg { width: 52px; height: 52px; border-radius: 16px; font-size: 26px; }
.brand-text { display: grid; line-height: 1.15; }
.brand-text strong { font-size: 15.5px; letter-spacing: -.01em; }
.brand-text span { font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .09em; }
nav { display: grid; gap: 3px; }
nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 10px;
  color: var(--ink-2); font-size: 13.8px; font-weight: 500; position: relative;
  transition: background .15s, color .15s, transform .15s;
}
nav a:hover { background: #f1f2fa; color: var(--ink); transform: translateX(2px); }
nav a.active { background: #eef0ff; color: #4338ca; font-weight: 650; }
nav a.active::before {
  content: ""; position: absolute; left: -16px; top: 9px; bottom: 9px; width: 3px;
  border-radius: 0 3px 3px 0; background: linear-gradient(var(--accent), var(--accent-2));
}
nav i { width: 18px; height: 18px; display: block; opacity: .75; }
nav i svg { width: 18px; height: 18px; }
.sidebar-foot {
  margin-top: auto; display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--ink-3); padding: 10px 8px 0; border-top: 1px solid var(--line);
}
.status-dot { width: 8px; height: 8px; border-radius: 99px; background: #cbd5e1; }
.status-dot.ok { background: var(--good); box-shadow: 0 0 0 4px rgba(15,157,118,.14); }
.status-dot.bad { background: var(--bad); box-shadow: 0 0 0 4px rgba(220,38,38,.13); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 16px 30px; background: rgba(246,247,251,.8); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.crumbs { font-weight: 650; letter-spacing: -.01em; font-size: 15px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.month-picker { display: flex; align-items: center; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 3px; }
.month-picker input { border: 0; background: transparent; padding: 6px 4px; width: 128px; font-size: 13px; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent;
  color: var(--ink-2); display: grid; place-items: center; font-size: 17px;
}
.icon-btn:hover { background: #eef0f7; color: var(--ink); }
.avatar {
  width: 32px; height: 32px; border-radius: 99px; display: grid; place-items: center;
  background: linear-gradient(135deg,#c7d2fe,#ddd6fe); color: #4338ca; font-weight: 700; font-size: 13px;
}
.view { padding: 28px 30px 60px; max-width: 1240px; width: 100%; }

/* ---------- blocks ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0 0 5px; font-size: 25px; letter-spacing: -.025em; }
.page-head p { margin: 0; color: var(--ink-2); font-size: 13.5px; }

.grid { display: grid; gap: 16px; }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .grid.c4 { grid-template-columns: repeat(2, 1fr); } .grid.c3, .grid.c2 { grid-template-columns: 1fr; } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.card.pad-lg { padding: 24px; }
.card-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title h3 { margin: 0; font-size: 14.5px; letter-spacing: -.01em; }
.card-title .sub { font-size: 12px; color: var(--ink-3); }

.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
  animation: rise .45s cubic-bezier(.2,.7,.3,1) both;
}
.stat::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), #22d3ee);
  opacity: .9;
}
.stat .label { font-size: 12px; color: var(--ink-3); font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
.stat .value { font-size: 28px; font-weight: 750; letter-spacing: -.03em; margin: 8px 0 4px; }
.stat .delta { font-size: 12px; color: var(--ink-2); }
.stat .delta.good { color: var(--good); }
.stat .delta.bad { color: var(--bad); }
.stat .spark { position: absolute; right: 12px; bottom: 10px; opacity: .5; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

/* tables */
.table-wrap { overflow: auto; border-radius: 12px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3); font-weight: 650; padding: 10px 12px; border-bottom: 1px solid var(--line);
  background: #fbfcfe; position: sticky; top: 0;
}
td { padding: 12px; border-bottom: 1px solid #f1f3f9; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .13s; }
tbody tr:hover { background: #fafbff; }
td.right, th.right { text-align: right; }
td.mono { font-size: 12.5px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; background: #f1f5f9; color: var(--ink-2);
  white-space: nowrap; flex: 0 0 auto; line-height: 1.4;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; align-items: center; flex: 0 0 auto; }
.pill.good { background: #e8f7f1; color: #0b7a5c; }
.pill.warn { background: #fff7e8; color: #a15c00; }
.pill.bad { background: #fdecec; color: #b91c1c; }
.pill.indigo { background: #eef0ff; color: #4338ca; }
.pill.dot::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: currentColor; }

.bar { height: 7px; border-radius: 99px; background: #eef1f8; overflow: hidden; min-width: 70px; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .6s cubic-bezier(.2,.7,.3,1); }
.bar.gpu > i { background: linear-gradient(90deg,#0ea5e9,#22d3ee); }

.actions { display: flex; gap: 6px; }
.empty { text-align: center; color: var(--ink-3); padding: 44px 16px; font-size: 13.5px; }
.empty strong { display: block; color: var(--ink-2); font-size: 15px; margin-bottom: 6px; }

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 12px; }
.section-head h2 { font-size: 16px; margin: 0; letter-spacing: -.01em; }

/* chart */
.chart { display: grid; gap: 9px; }
.chart-row { display: grid; grid-template-columns: 150px 1fr 84px; align-items: center; gap: 12px; font-size: 13px; }
.chart-row .name { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-row .track { height: 10px; border-radius: 99px; background: #f1f3f9; overflow: hidden; }
.chart-row .fill {
  height: 100%; border-radius: 99px; transform-origin: left;
  background: linear-gradient(90deg, #818cf8, #a78bfa);
  animation: grow .7s cubic-bezier(.2,.7,.3,1) both;
}
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.chart-row .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* modal */
.overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.35); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 22px; z-index: 80; animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(560px, 96vw); background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg);
  padding: 24px; animation: scaleIn .2s cubic-bezier(.2,.7,.3,1) both; max-height: 90vh; overflow: auto;
}
.modal h3 { margin: 0 0 4px; font-size: 18px; letter-spacing: -.02em; }
.modal .sub { margin: 0 0 18px; color: var(--ink-2); font-size: 13px; }
.modal form { display: grid; gap: 14px; }
.modal .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 100; }
.toast {
  background: #0f172a; color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 13px;
  box-shadow: var(--shadow-lg); animation: toastIn .25s cubic-bezier(.2,.7,.3,1) both;
  max-width: 380px;
}
.toast.good { background: #065f46; }
.toast.bad { background: #991b1b; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* misc */
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 10px 16px; font-size: 13.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 550; }
.copy { display: inline-flex; align-items: center; gap: 6px; }
.code {
  background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 12px 14px; font-size: 12.5px;
  overflow: auto; font-family: ui-monospace, Menlo, Consolas, monospace;
}
.toggle { display: inline-flex; align-items: center; gap: 8px; }
.switch { position: relative; width: 38px; height: 22px; border-radius: 99px; background: #dbe1ee; transition: background .2s; border: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 99px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch.on { background: linear-gradient(135deg,var(--accent),var(--accent-2)); }
.switch.on::after { transform: translateX(16px); }
.hr { height: 1px; background: var(--line); margin: 18px 0; }
.tag { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: #f1f5f9; color: var(--ink-2); }
.wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.link { color: var(--accent); font-weight: 600; }
.loader { height: 3px; background: linear-gradient(90deg,#eef0f7,#c7d2fe,#eef0f7); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: 99px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
