@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap");

/* ---------- Design tokens ---------- */
:root {
  --bg: #090b0e;
  --bg-sidebar: #0c0e12;
  --bg-card: #111419;
  --bg-card-hover: #141820;
  --bg-input: #0d1015;
  --bg-elev: #171b22;
  --border: #1d2229;
  --border-strong: #2a3039;
  --border-hover: #3a414c;
  --text: #e8eaed;
  --text-muted: #8b919a;
  --text-dim: #5b6270;
  --nav-active: #181d25;
  --green: #2fd1a3;
  --blue: #4f8ff7;
  --yellow: #e9b949;
  --red: #e5484d;
  --orange: #f08c3a;
  --purple: #a78bfa;
  --radius: 10px;
  --radius-sm: 7px;
  --sidebar-w: 224px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  background-image: radial-gradient(1200px 500px at 70% -10%, rgba(79,143,247,.06), transparent 60%),
                    radial-gradient(900px 400px at 10% 110%, rgba(47,209,163,.05), transparent 60%);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
::selection { background: rgba(79,143,247,.35); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #20262e; border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #2c343e; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Keyframes ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(47,209,163,.45); } 70% { box-shadow: 0 0 0 7px rgba(47,209,163,0); } }
@keyframes shimmer { from { background-position: -400px 0; } to { background-position: 400px 0; } }
@keyframes growX { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes growBar { from { width: 0; } }
@keyframes drawLine { to { stroke-dashoffset: 0; } }
@keyframes float { 0%, 100% { transform: translate(-50%, -50%) translateY(0); } 50% { transform: translate(-50%, -50%) translateY(-10px); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes glow { 0%, 100% { opacity: .6; } 50% { opacity: 1; } }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: margin-left .35s var(--ease), opacity .25s;
  z-index: 10;
}
.sidebar.collapsed { margin-left: calc(-1 * var(--sidebar-w)); opacity: 0; }

.brand { display: flex; align-items: center; gap: 10px; padding: 16px 14px 12px; }
.brand-logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: #15181e; border: 1px solid var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .3s var(--spring);
}
.brand-logo img { width: 20px; height: 20px; object-fit: contain; display: block; }
.brand:hover .brand-logo { transform: rotate(-8deg) scale(1.06); }
.brand-name { font-weight: 700; font-size: 13.5px; letter-spacing: -.01em; }

.nav { padding: 4px 8px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; position: relative; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text-muted); cursor: pointer; user-select: none;
  background: transparent; border: 0; text-align: left; width: 100%;
  transition: color .15s, background .15s, transform .2s var(--ease);
  animation: fadeUp .4s var(--ease) both;
}
.nav-item:hover { background: #12161c; color: var(--text); transform: translateX(2px); }
.nav-item.active { background: var(--nav-active); color: var(--text); }
.nav-item::before {
  content: ""; position: absolute; left: -8px; top: 50%; width: 3px; height: 0; border-radius: 3px;
  background: var(--yellow); transform: translateY(-50%); transition: height .25s var(--ease);
}
.nav-item.active::before { height: 16px; }
.nav-item svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; transition: transform .25s var(--spring), color .15s; }
.nav-item:hover svg { transform: scale(1.12); }
.nav-item.active svg { color: var(--yellow); }
.nav-item .kbd-hint { margin-left: auto; opacity: 0; transition: opacity .15s; }
.nav-item:hover .kbd-hint { opacity: 1; }

.sidebar-footer { margin-top: auto; border-top: 1px solid var(--border); padding: 12px 14px; }
.user { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #1f2630, #141820); border: 1px solid var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text-muted); position: relative;
}
.avatar::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px; border-radius: 50%; background: var(--green); border: 2px solid var(--bg-sidebar); }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: none; }
.avatar.has-img img { display: block; }
.user-name { font-weight: 600; font-size: 12.5px; }
.user-role { font-size: 10.5px; color: var(--text-muted); }
.footer-actions { display: flex; gap: 6px; margin-top: 10px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 48px; display: flex; align-items: center; gap: 12px;
  padding: 0 18px; border-bottom: 1px solid var(--border);
  background: rgba(9,11,14,.75); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 5;
}
.page-title { font-size: 14.5px; font-weight: 700; margin: 0; animation: fadeIn .3s; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 12px; }
.live-pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: 999px; background: rgba(47,209,163,.08); border: 1px solid rgba(47,209,163,.25); color: var(--green); font-weight: 600; font-size: 11.5px; transition: all .3s; }
.live-pill.offline { background: rgba(229,72,77,.08); border-color: rgba(229,72,77,.25); color: var(--red); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: pulse 2s infinite; }
.live-pill.offline .live-dot { background: var(--red); animation: none; }

.banner { display: flex; gap: 14px; align-items: center; border-color: rgba(233,185,73,.35); background: linear-gradient(90deg, rgba(233,185,73,.07), var(--bg-card) 60%); }
.banner-icon { width: 38px; height: 38px; border-radius: 10px; background: rgba(233,185,73,.12); color: var(--yellow); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.banner-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.banner-title { font-weight: 700; margin-bottom: 2px; }

.content.quiet > *, .content.quiet tbody tr, .content.quiet .list-item, .content.quiet .tier-bar, .content.quiet .bar > span, .content.quiet .bars .b, .content.quiet .chart .line, .content.quiet .chart .area, .content.quiet .stat-spark .line { animation: none !important; opacity: 1; stroke-dashoffset: 0 !important; }
.search-trigger {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: var(--radius-sm);
  background: var(--bg-input); border: 1px solid var(--border-strong); color: var(--text-muted); cursor: pointer; font-size: 12px;
  transition: border-color .15s, color .15s;
}
.search-trigger:hover { border-color: var(--border-hover); color: var(--text); }
@media (max-width: 900px) { .search-trigger { display: none; } }

.content { padding: 18px; display: flex; flex-direction: column; gap: 16px; position: relative; z-index: 1; }
.content > * { animation: fadeUp .45s var(--ease) both; }
.content > *:nth-child(1) { animation-delay: 0s; }
.content > *:nth-child(2) { animation-delay: .06s; }
.content > *:nth-child(3) { animation-delay: .12s; }
.content > *:nth-child(4) { animation-delay: .18s; }
.content > *:nth-child(5) { animation-delay: .24s; }
.content.leaving > * { animation: none; opacity: 0; transform: translateY(-6px); transition: opacity .12s, transform .12s; }

.watermark {
  position: fixed; left: 50%; top: 55%; transform: translate(-50%, -50%);
  pointer-events: none; z-index: 0;
  margin-left: calc(var(--sidebar-w) / 2); animation: float 7s ease-in-out infinite;
}
.watermark img { width: 220px; opacity: .035; display: block; }

/* ---------- Login ---------- */
body.locked .app, body.locked .watermark { display: none; }
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; z-index: 30;
  background: radial-gradient(800px 500px at 50% 0%, rgba(233,185,73,.06), transparent 60%), var(--bg); }
.login-card { width: min(420px, 100%); background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: 14px; padding: 30px 28px 26px; box-shadow: 0 30px 80px -30px rgba(0,0,0,.9); animation: scaleIn .35s var(--spring) both; text-align: center; }
.login-logo { width: 64px; height: 64px; object-fit: contain; margin: 0 auto 12px; display: block; filter: drop-shadow(0 6px 18px rgba(255,255,255,.12)); }
.login-title { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.login-sub { font-size: 12.5px; color: var(--text-muted); margin: 4px 0 20px; }
.login .form { text-align: left; }
.login .field.full { grid-column: 1 / -1; }
.login-error { color: var(--red); font-size: 12.5px; margin-top: 10px; min-height: 16px; }
.login-user { display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 14px; }
.login-user img { width: 44px; height: 44px; border-radius: 50%; background: #1b2027; }
.login-user .n { font-weight: 700; } .login-user .u { font-size: 11.5px; color: var(--text-muted); }
.login-code { font-family: var(--mono); font-size: 26px; font-weight: 700; letter-spacing: .08em; padding: 12px; border-radius: 10px; background: #0d1015; border: 1px dashed var(--border-hover); margin: 6px 0 12px; user-select: all; }
.login-status { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); min-height: 20px; margin-bottom: 14px; }
.login-divider { display: flex; align-items: center; gap: 10px; color: var(--text-dim); font-size: 11px; margin: 14px 0; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.login-steps { text-align: left; font-size: 12.5px; color: var(--text-muted); margin: 0 0 12px; padding-left: 18px; }
.login-steps li { margin: 3px 0; }

/* ---------- Controls ---------- */
.icon-btn {
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted); cursor: pointer; font-size: 14px; transition: all .15s;
}
.icon-btn:hover { background: #13171d; color: var(--text); border-color: var(--border); }
.icon-btn:active { transform: scale(.92); }

.btn {
  background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 6px 12px; cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--text);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .15s var(--spring), box-shadow .15s;
}
.btn:hover { background: #1c212a; border-color: var(--border-hover); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.97); }
.btn.primary { background: #fff; color: #0b0d10; border-color: #fff; box-shadow: 0 2px 10px rgba(255,255,255,.12); }
.btn.primary:hover { background: #eef0f3; box-shadow: 0 4px 16px rgba(255,255,255,.18); }
.btn.danger { color: var(--red); border-color: rgba(229,72,77,.35); }
.btn.danger:hover { background: rgba(229,72,77,.12); border-color: rgba(229,72,77,.6); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn.ghost:hover { background: #13171d; color: var(--text); }

.select, .input {
  background: var(--bg-input); border: 1px solid var(--border-strong); color: var(--text);
  border-radius: var(--radius-sm); padding: 6px 10px; font-size: 12.5px; outline: none;
  min-height: 30px; transition: border-color .15s, box-shadow .15s;
}
.select { padding-right: 26px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238b919a' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; }
.input:focus, .select:focus { border-color: #4a5260; box-shadow: 0 0 0 3px rgba(79,143,247,.15); }
.input::placeholder { color: var(--text-dim); }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 999px;
  background: #171b21; border: 1px solid var(--border-strong); font-size: 11px; font-weight: 600;
  transition: transform .15s var(--spring);
}
.chip.green { color: var(--green); border-color: rgba(47,209,163,.3); background: rgba(47,209,163,.08); }
.chip.red { color: var(--red); border-color: rgba(229,72,77,.3); background: rgba(229,72,77,.08); }
.chip.yellow { color: var(--yellow); border-color: rgba(233,185,73,.3); background: rgba(233,185,73,.08); }
.chip.blue { color: var(--blue); border-color: rgba(79,143,247,.3); background: rgba(79,143,247,.08); }
.chip.purple { color: var(--purple); border-color: rgba(167,139,250,.3); background: rgba(167,139,250,.08); }
.chip.muted { color: var(--text-muted); }

.toggle {
  position: relative; width: 36px; height: 20px; border-radius: 999px; background: #232931;
  border: 1px solid var(--border-strong); cursor: pointer; transition: background .25s, border-color .25s;
  flex: 0 0 auto; display: inline-block;
}
.toggle::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #8b919a; transition: transform .3s var(--spring), background .25s, box-shadow .25s;
}
.toggle:hover::after { box-shadow: 0 0 0 4px rgba(139,145,154,.15); }
.toggle.on { background: rgba(47,209,163,.22); border-color: rgba(47,209,163,.55); }
.toggle.on::after { transform: translateX(16px); background: var(--green); box-shadow: 0 0 10px rgba(47,209,163,.5); }
.toggle.busy { opacity: .6; pointer-events: none; }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 14px; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.span-2 { grid-column: span 2; }
@media (max-width: 1000px) { .grid.two, .grid.three { grid-template-columns: 1fr; } .span-2 { grid-column: span 1; } }

.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); position: relative;
  transition: border-color .2s, transform .25s var(--ease), box-shadow .25s;
}
.card:hover { border-color: var(--border-strong); }
.card.lift:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0,0,0,.4), 0 16px 32px -12px rgba(0,0,0,.7); }
.card.flush { padding: 0; }
.card.flush .card-title { padding: 12px 14px 0; }
.card-title { font-size: 11px; color: var(--text-muted); font-weight: 500; margin-bottom: 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 10px; }
.card-head .card-title { margin: 0; }

.stat { display: flex; align-items: flex-start; gap: 12px; }
.stat-icon {
  width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  background: #171b22; color: var(--text-muted); flex: 0 0 auto; transition: transform .3s var(--spring);
}
.card:hover .stat-icon { transform: scale(1.08) rotate(-4deg); }
.stat-icon svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stat-icon.green { color: var(--green); background: rgba(47,209,163,.1); }
.stat-icon.blue { color: var(--blue); background: rgba(79,143,247,.1); }
.stat-icon.yellow { color: var(--yellow); background: rgba(233,185,73,.1); }
.stat-icon.red { color: var(--red); background: rgba(229,72,77,.1); }
.stat-icon.purple { color: var(--purple); background: rgba(167,139,250,.1); }
.stat-body { flex: 1; min-width: 0; }
.stat-value { font-size: 21px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.stat-delta { font-size: 11px; margin-left: 7px; font-weight: 600; }
.stat-delta.up { color: var(--green); }
.stat-delta.down { color: var(--red); }
.stat-spark { width: 70px; height: 28px; margin-left: auto; align-self: center; opacity: .9; }

/* Tier bars */
.tiers { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 4px; }
.tier { display: flex; flex-direction: column; gap: 6px; align-items: center; cursor: default; }
.tier-bar { width: 100%; height: 3px; border-radius: 2px; transform-origin: left; animation: growX .8s var(--ease) both; transition: height .2s, box-shadow .2s; }
.tier:hover .tier-bar { height: 5px; box-shadow: 0 0 12px currentColor; }
.tier:nth-child(1) .tier-bar { animation-delay: .05s; } .tier:nth-child(2) .tier-bar { animation-delay: .1s; }
.tier:nth-child(3) .tier-bar { animation-delay: .15s; } .tier:nth-child(4) .tier-bar { animation-delay: .2s; }
.tier:nth-child(5) .tier-bar { animation-delay: .25s; } .tier:nth-child(6) .tier-bar { animation-delay: .3s; }
.tier:nth-child(7) .tier-bar { animation-delay: .35s; }
.tier-name { font-size: 10px; color: var(--text-muted); }
.tier-count { font-size: 12px; font-weight: 600; min-height: 16px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  text-align: left; font-size: 11px; color: var(--text-muted); font-weight: 600;
  padding: 9px 12px; border-bottom: 1px solid var(--border); user-select: none; white-space: nowrap;
}
thead th.sortable { cursor: pointer; transition: color .15s; }
thead th.sortable:hover { color: var(--text); }
thead th .sort-ind { display: inline-block; margin-left: 4px; opacity: 0; transition: opacity .15s, transform .2s; font-size: 9px; }
thead th.sorted .sort-ind { opacity: 1; }
thead th.sorted.desc .sort-ind { transform: rotate(180deg); }
tbody tr { animation: fadeUp .35s var(--ease) both; transition: background .12s; }
tbody tr:nth-child(1) { animation-delay: .02s; } tbody tr:nth-child(2) { animation-delay: .05s; }
tbody tr:nth-child(3) { animation-delay: .08s; } tbody tr:nth-child(4) { animation-delay: .11s; }
tbody tr:nth-child(5) { animation-delay: .14s; } tbody tr:nth-child(6) { animation-delay: .17s; }
tbody tr:nth-child(7) { animation-delay: .2s; } tbody tr:nth-child(n+8) { animation-delay: .23s; }
tbody td { padding: 10px 12px; border-bottom: 1px solid #151920; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #141820; }
tbody tr.flash td { background: rgba(47,209,163,.12); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono { font-family: var(--mono); font-size: 11.5px; color: var(--text-muted); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; opacity: .55; transition: opacity .15s; }
tr:hover .row-actions { opacity: 1; }
.empty { text-align: center; color: var(--text-muted); padding: 34px 10px; font-size: 12.5px; }
.empty-icon { font-size: 26px; margin-bottom: 6px; opacity: .4; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid #151920; align-items: baseline; animation: fadeUp .35s var(--ease) both; }
.list-item:nth-child(1) { animation-delay: .05s; } .list-item:nth-child(2) { animation-delay: .1s; } .list-item:nth-child(3) { animation-delay: .15s; }
.list-item:nth-child(4) { animation-delay: .2s; } .list-item:nth-child(5) { animation-delay: .25s; }
.list-item:last-child { border-bottom: 0; }
.list-time { color: var(--text-dim); font-size: 11px; min-width: 56px; font-variant-numeric: tabular-nums; }
.list-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border-hover); flex: 0 0 auto; align-self: center; }
.list-dot.green { background: var(--green); } .list-dot.red { background: var(--red); } .list-dot.yellow { background: var(--yellow); } .list-dot.blue { background: var(--blue); }

/* ---------- Forms ---------- */
.form { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.field.full { grid-column: 1 / -1; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }

.bar { height: 6px; background: #1b2027; border-radius: 3px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--green); border-radius: 3px; animation: growBar .9s var(--ease) both; }
.bar.warn > span { background: var(--yellow); }
.bar.full > span { background: var(--red); }

/* ---------- Charts ---------- */
.chart-wrap { position: relative; }
.chart { width: 100%; height: 170px; display: block; overflow: visible; }
.chart .line { stroke-dasharray: 2000; stroke-dashoffset: 2000; animation: drawLine 1.6s var(--ease) forwards; }
.chart .area { opacity: 0; animation: fadeIn .8s .6s forwards; }
.chart .cursor { opacity: 0; transition: opacity .15s; }
.chart-wrap:hover .cursor { opacity: 1; }
.chart-tip {
  position: absolute; top: 0; left: 0; pointer-events: none; background: var(--bg-elev); border: 1px solid var(--border-strong);
  border-radius: 6px; padding: 4px 8px; font-size: 11px; white-space: nowrap; opacity: 0; transform: translate(-50%, -120%);
  transition: opacity .15s; box-shadow: var(--shadow);
}
.chart-wrap:hover .chart-tip { opacity: 1; }
.chart-tip b { font-variant-numeric: tabular-nums; }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 10px; }
.bars .bcol { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .b { width: 100%; border-radius: 4px 4px 2px 2px; background: linear-gradient(to top, rgba(79,143,247,.35), var(--blue)); transform-origin: bottom; animation: growY .8s var(--ease) both; transition: filter .15s; }
.bars .bcol:hover .b { filter: brightness(1.25); }
.bars .bl { font-size: 10px; color: var(--text-muted); }
@keyframes growY { from { transform: scaleY(0); } }

.config-row { display: grid; grid-template-columns: 1.2fr 2fr auto; gap: 14px; align-items: center; padding: 11px 0; border-bottom: 1px solid #151920; transition: background .12s; }
.config-row:last-child { border-bottom: 0; }
.config-key { font-family: var(--mono); font-size: 12px; }
.config-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.config-value { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }

/* ---------- Skeleton ---------- */
.skeleton { display: flex; flex-direction: column; gap: 14px; }
.sk { border-radius: var(--radius); background: linear-gradient(90deg, #111419 0%, #171b22 40%, #111419 80%); background-size: 800px 100%; animation: shimmer 1.3s linear infinite; border: 1px solid var(--border); }
.sk.row { height: 76px; }
.sk.tall { height: 240px; }
.sk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

/* ---------- Toast ---------- */
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; pointer-events: none; }
.toast {
  background: var(--bg-elev); border: 1px solid var(--border-strong); color: var(--text);
  padding: 9px 14px; border-radius: var(--radius-sm); font-size: 12.5px; display: flex; align-items: center; gap: 9px;
  animation: toastIn .3s var(--spring) both; box-shadow: var(--shadow); transition: opacity .25s, transform .25s;
}
.toast.out { opacity: 0; transform: translateX(16px); }
.toast .t-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.toast.warn .t-dot { background: var(--yellow); }
.toast.error .t-dot { background: var(--red); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(5,6,8,.6); backdrop-filter: blur(4px); z-index: 40;
  display: flex; align-items: center; justify-content: center; animation: fadeIn .2s both; padding: 20px;
}
.modal-backdrop.closing { animation: fadeIn .18s reverse both; }
.modal {
  width: min(560px, 100%); background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.9); animation: scaleIn .28s var(--spring) both; overflow: hidden;
}
.modal-backdrop.closing .modal { animation: scaleIn .18s reverse both; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 13.5px; font-weight: 700; }
.modal-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.modal-body { padding: 18px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: #0f1217; }

/* ---------- Command palette ---------- */
.palette { width: min(540px, 100%); background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.9); animation: scaleIn .22s var(--spring) both; overflow: hidden; align-self: flex-start; margin-top: 12vh; }
.palette input { width: 100%; border: 0; background: transparent; padding: 14px 16px; font-size: 14px; color: var(--text); outline: none; border-bottom: 1px solid var(--border); }
.palette-list { max-height: 320px; overflow-y: auto; padding: 6px; }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; cursor: pointer; color: var(--text-muted); }
.palette-item svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.palette-item.active, .palette-item:hover { background: var(--nav-active); color: var(--text); }
.palette-item .pk { margin-left: auto; }

/* ---------- Misc ---------- */
.kbd { font-family: var(--mono); background: #1b2027; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; font-size: 10.5px; color: var(--text-muted); }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.hint { font-size: 11.5px; color: var(--text-muted); }
.mono { font-family: var(--mono); }
.spinner { width: 14px; height: 14px; border: 2px solid var(--border-strong); border-top-color: var(--text); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
.tick { display: inline-block; transition: color .3s; }
.tick.up { color: var(--green); } .tick.down { color: var(--red); }
.region-pill { display: inline-flex; align-items: center; gap: 6px; }
.region-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: glow 2s infinite; }
