:root{
  --bg:#f6f8ff;
  --bg2:#f7f8fb;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --line:rgba(15,23,42,.10);
  --primary:#2563eb;
  --primary2:#6d28d9;
  --ok:#16a34a;
  --warn:#0284c7;
  --bad:#ef4444;
  --shadow-sm: 0 6px 18px rgba(15,23,42,.08);
  --shadow: 0 12px 38px rgba(15,23,42,.10);
  --shadow-lg: 0 22px 70px rgba(15,23,42,.12);
  --radius: 18px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--sans);
  color:var(--text);
  background:
    radial-gradient(800px 300px at 20% 0%, rgba(37,99,235,.14), transparent 60%),
    radial-gradient(900px 340px at 80% 10%, rgba(109,40,217,.10), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
}
a{color:inherit;text-decoration:none}
.container{max-width:1180px;margin:0 auto;padding:28px 24px}

/* Topbar */
.topbar{
  position:sticky; top:0; z-index:20;
  backdrop-filter:saturate(160%) blur(12px);
  background: rgba(246,248,255,.72);
  border-bottom:1px solid var(--line);
}
.topbar__inner{
  max-width:1180px;margin:0 auto;padding:14px 24px;
  display:flex;align-items:center;gap:18px;
}
.brand{display:flex;align-items:center;gap:12px;min-width:260px}
.brand__meta{display:flex;flex-direction:column;gap:2px}
.logo{
  width:44px;height:44px;border-radius:16px;
  display:flex;align-items:center;justify-content:center;
  background: linear-gradient(135deg, rgba(37,99,235,1), rgba(109,40,217,1));
  color:#fff;font-weight:900;letter-spacing:.4px;
  box-shadow: var(--shadow-sm);
}
.logo.big{width:64px;height:64px;border-radius:24px;font-size:24px}
.tag{font-size:12px;color:var(--muted);line-height:1.2}
.nav{display:flex;gap:8px;flex:1;flex-wrap:wrap;align-items:center}
.nav__sep{width:1px;height:22px;background:var(--line);margin:0 6px;border-radius:999px}
.nav__link{
  padding:9px 12px;border-radius:14px;color:var(--muted);
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.nav__link:hover{background:rgba(37,99,235,.08);color:var(--text)}
.nav__link.is-active{
  background: linear-gradient(135deg, rgba(37,99,235,.14), rgba(109,40,217,.10));
  color:var(--text);
  box-shadow: 0 0 0 1px rgba(37,99,235,.18) inset;
}
.logout{margin:0}
.footer{padding:22px 24px;color:var(--muted);text-align:center}

/* Typography */
.pagehead{margin:12px 0 18px}
h1{margin:0 0 6px;font-size:30px;letter-spacing:-.4px}
h3{margin:0 0 10px;font-size:16px}
.muted{color:var(--muted)}
.small{font-size:12px}
.big-num{font-size:40px;font-weight:900;margin:8px 0}
.mono{font-family:var(--mono)}
.clip{max-width:520px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* Layout */
.grid{display:grid;gap:16px}
.grid--2{grid-template-columns: 1fr 1fr}
.grid--3{grid-template-columns: 1fr 1fr 1fr}
@media (max-width: 900px){
  .grid--2,.grid--3{grid-template-columns:1fr}
  .brand{min-width:auto}
}

/* Cards */
.card{
  background: linear-gradient(180deg, rgba(255,255,255,1), rgba(255,255,255,.96));
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow: var(--shadow-sm);
  padding:18px;
}
.card:hover{box-shadow: var(--shadow);}
.card__head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:8px}
.card__head .right{display:flex;gap:10px;align-items:center}
.link{color:var(--primary);font-weight:800}
.link:hover{filter:brightness(.95)}

.kpi{
  background: linear-gradient(180deg, rgba(255,255,255,1), rgba(255,255,255,.92));
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow: var(--shadow-sm);
  padding:18px;
}
.kpi__title{color:var(--muted);font-size:12px}
.kpi__value{font-size:26px;font-weight:900;margin-top:8px}

/* Forms */
.form{display:flex;flex-direction:column;gap:12px}
.field{display:flex;flex-direction:column;gap:6px}
.field span{font-size:12px;color:var(--muted)}
input, select{
  padding:12px 12px;
  border-radius:14px;
  border:1px solid rgba(15,23,42,.12);
  background:#fff;
  font:inherit;
  outline:none;
}
input:focus, select:focus{border-color:rgba(37,99,235,.55); box-shadow:0 0 0 4px rgba(37,99,235,.12)}
.hint{font-size:12px;color:var(--muted);margin-top:6px}

/* Buttons */
.btn{
  display:inline-flex;align-items:center;justify-content:center;
  padding:10px 14px;border-radius:14px;border:1px solid var(--line);
  background:#fff;color:var(--text);font-weight:800;
  cursor:pointer;
  transition: transform .12s ease, filter .12s ease, background .12s ease;
}
.btn:active{transform: translateY(1px)}
.btn--primary{
  background: linear-gradient(135deg, rgba(37,99,235,1), rgba(109,40,217,1));
  border-color: transparent;
  color:#fff;
  box-shadow: 0 12px 28px rgba(37,99,235,.18);
}
.btn--primary:hover{filter:brightness(.98)}
.btn--ghost{background:rgba(37,99,235,.06);border-color:rgba(37,99,235,.15);color:var(--primary)}
.btn--ghost:hover{background:rgba(37,99,235,.1)}
.btn--tiny{padding:8px 10px;border-radius:12px;font-size:12px;font-weight:900}

/* Code */
.code{
  background: linear-gradient(180deg, #0b1020, #0a0f1d);
  color:#dbeafe;
  border-radius:16px;
  padding:14px;
  overflow:auto;
  font-family:var(--mono);
  font-size:12px;
  line-height:1.45;
  border:1px solid rgba(255,255,255,.06);
  box-shadow: 0 16px 50px rgba(11,16,32,.25);
}

/* Table */
.table{width:100%;border-collapse:separate;border-spacing:0}
.table th,.table td{
  padding:10px 8px;
  border-bottom:1px solid rgba(15,23,42,.08);
  vertical-align:top;
  font-size:13px;
}
.table th{color:var(--muted);text-align:left;font-size:12px}
.table tr:last-child td{border-bottom:none}
.num{text-align:right}

/* Alerts / Pills */
.alert{
  background: rgba(239,68,68,.10);
  border:1px solid rgba(239,68,68,.25);
  color:#991b1b;
  padding:10px 12px;
  border-radius:14px;
  margin:10px 0 14px;
}
.pill{display:inline-flex;align-items:center;gap:8px;padding:7px 10px;border-radius:999px;font-size:12px;font-weight:900;white-space:nowrap}
.pill__dot{width:8px;height:8px;border-radius:999px;background:currentColor;opacity:.9}
.pill--ok{background:rgba(22,163,74,.12);color:var(--ok);border:1px solid rgba(22,163,74,.22)}
.pill--bad{background:rgba(239,68,68,.12);color:var(--bad);border:1px solid rgba(239,68,68,.22)}
.pill--info{background:rgba(2,132,199,.12);color:var(--warn);border:1px solid rgba(2,132,199,.22)}
.pill--muted{background:rgba(100,116,139,.10);color:rgba(100,116,139,.95);border:1px solid rgba(100,116,139,.18)}

.kv{display:flex;gap:10px;justify-content:space-between;border-bottom:1px dashed rgba(15,23,42,.12);padding:10px 0}
.kv:last-child{border-bottom:none}
.check{display:flex;gap:10px;align-items:flex-start}
.check input{margin-top:4px}

/* Auth */
.auth{display:flex;align-items:center;justify-content:center;padding:24px;min-height: calc(100vh - 120px)}
.auth-card{
  width:440px;max-width:95vw;
  background: linear-gradient(180deg, rgba(255,255,255,1), rgba(255,255,255,.96));
  border:1px solid var(--line);
  border-radius:24px;
  box-shadow: var(--shadow-lg);
  padding:26px;
}
.auth-sub{margin:10px 0 16px;color:var(--muted)}

/* Toast */
.toast{
  position:fixed;left:50%;bottom:24px;transform:translateX(-50%);
  background:#0b1020;color:#fff;
  padding:10px 14px;border-radius:999px;
  opacity:0;transition:.18s;
  box-shadow: var(--shadow);
  font-size:13px;
}
.toast.show{opacity:1}

/* Counter status block */
.counter{
  display:flex;gap:12px;align-items:center;justify-content:space-between;
}
.counter__left{display:flex;flex-direction:column;gap:4px}
.counter__hint{font-size:12px;color:var(--muted)}
.counter__actions{display:flex;gap:10px;align-items:center}
