:root {
  --bg: #070911;
  --panel: rgba(15, 20, 34, 0.78);
  --line: rgba(148, 163, 184, 0.13);
  --line2: rgba(148, 163, 184, 0.24);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --dim: #64748b;
  --cyan: #22d3ee;
  --violet: #a78bfa;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #fb7185;
  --grad: linear-gradient(135deg, #22d3ee 0%, #6366f1 55%, #a855f7 100%);
  --font: -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Display", "Segoe UI", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Consolas", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 14px;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: rgba(34, 211, 238, 0.1);
  color: var(--cyan);
  padding: 2px 7px;
  border-radius: 6px;
}

.aurora { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.aurora span { position: absolute; border-radius: 50%; filter: blur(120px); opacity: 0.45; }
.aurora .a1 { width: 600px; height: 600px; background: #1e3a8a; top: -200px; left: 100px; }
.aurora .a2 { width: 520px; height: 520px; background: #4c1d95; bottom: -200px; right: -100px; }
.aurora .a3 { width: 420px; height: 420px; background: #0e7490; top: 35%; left: 42%; opacity: 0.25; }

.glass {
  background: var(--panel);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  border: 1px solid var(--line);
}
.card { border-radius: 18px; box-shadow: 0 20px 55px -20px rgba(0,0,0,0.7); }
.pad { padding: 22px; }
.mt { margin-top: 18px; }
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.end { justify-content: flex-end; }
.gap { gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.pro {
  font-size: 10px; font-weight: 800; letter-spacing: .08em;
  padding: 2px 7px; border-radius: 6px; background: var(--grad); color: #070911;
}

/* Login Gate */
.login-gate {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 20px;
}
.login-gate[hidden], .layout[hidden], .modal[hidden] { display: none !important; }
.login-card {
  width: 440px; max-width: 100%; padding: 32px; border-radius: 22px;
}
.login-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.login-logo { width: 52px; height: 52px; object-fit: contain; }
.login-foot { text-align: center; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }

/* Layout */
.layout {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 260px 1fr; min-height: 100vh;
}
.sidebar {
  display: flex; flex-direction: column; padding: 24px 16px;
  background: rgba(8, 11, 20, 0.92); border-right: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 24px; }
.brand img { width: 42px; height: 42px; object-fit: contain; }
.brand-title { font-size: 18px; font-weight: 800; letter-spacing: .02em; }
.brand-sub { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 11px 14px;
  border-radius: 12px; color: var(--muted); font-weight: 500; text-align: left;
  transition: all .16s;
}
.nav-item:hover { color: var(--text); background: rgba(148,163,184,0.07); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(99,102,241,0.24), rgba(34,211,238,0.08));
  box-shadow: inset 0 0 0 1px rgba(129,140,248,0.28);
}
.badge {
  margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 99px; background: rgba(34,211,238,0.16); color: var(--cyan);
}

.side-footer {
  margin-top: auto; padding: 14px; border-radius: 14px;
  background: rgba(148,163,184,0.05); border: 1px solid var(--line);
}
.sf-live { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.led { width: 9px; height: 9px; border-radius: 50%; background: var(--dim); display: inline-block; }
.led.on { background: var(--green); box-shadow: 0 0 10px var(--green); }
.led.off { background: var(--dim); }

.main { padding: 24px 32px 48px; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-bottom: 20px; margin-bottom: 22px; border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }

.tab { display: none; }
.tab.active { display: block; animation: fadeIn .22s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* KPI Grid */
.kpi-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px;
}
.kpi { padding: 18px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.kpi span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.kpi b { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.kpi.ok b { color: var(--green); }
.kpi.cyan b { color: var(--cyan); }
.kpi.warn b { color: var(--amber); }
.kpi.danger b { color: var(--red); }
.kpi.violet b { color: var(--violet); }

.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* Buttons & Inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px; border-radius: 11px; font-weight: 600; font-size: 13.5px;
  transition: all .15s; white-space: nowrap;
}
.btn.sm { height: 31px; padding: 0 11px; font-size: 12px; border-radius: 9px; }
.btn.full { width: 100%; }
.btn.primary { background: var(--grad); color: #070911; font-weight: 700; box-shadow: 0 8px 22px -8px rgba(34,211,238,0.55); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: rgba(148,163,184,0.09); border: 1px solid var(--line2); color: var(--text); }
.btn.ghost:hover { border-color: var(--cyan); color: var(--cyan); }
.btn.ok { background: rgba(52,211,153,0.16); border: 1px solid rgba(52,211,153,0.4); color: var(--green); }
.btn.ok:hover { background: rgba(52,211,153,0.26); }
.btn.danger { background: rgba(251,113,133,0.15); border: 1px solid rgba(251,113,133,0.38); color: var(--red); }
.btn.danger:hover { background: rgba(251,113,133,0.26); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field input, .field textarea, .inp {
  height: 40px; padding: 0 13px; border-radius: 11px;
  background: rgba(2, 6, 23, 0.65); border: 1px solid var(--line2); color: var(--text); outline: none;
}
.field textarea { height: auto; padding: 10px 13px; resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus, .inp:focus { border-color: var(--cyan); }
.chk-row { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; }
.chk-row input { width: 17px; height: 17px; accent-color: #22d3ee; }

/* Toolbar & Segmented Controls */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 16px; flex-wrap: wrap; }
.seg { display: flex; background: rgba(2,6,23,0.6); padding: 4px; border-radius: 11px; border: 1px solid var(--line); gap: 4px; flex-wrap: wrap; }
.seg button { height: 32px; padding: 0 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.seg button.active { background: rgba(34,211,238,0.16); color: var(--cyan); }
.search-inp { min-width: 280px; }

/* Tables */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; text-align: left; }
.tbl th {
  padding: 13px 16px; font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--line2);
  background: rgba(2,6,23,0.4);
}
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13.5px; }
.tbl tr:hover td { background: rgba(148,163,184,0.04); }

/* Chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border-radius: 99px; font-size: 11.5px; font-weight: 700;
  background: rgba(148,163,184,0.12); color: var(--muted); text-decoration: none;
}
.chip.ok { background: rgba(52,211,153,0.15); color: var(--green); border: 1px solid rgba(52,211,153,0.3); }
.chip.warn { background: rgba(251,191,36,0.15); color: var(--amber); border: 1px solid rgba(251,191,36,0.3); }
.chip.danger { background: rgba(251,113,133,0.15); color: var(--red); border: 1px solid rgba(251,113,133,0.3); }

/* Pending & Feed Lists */
.pending-list, .feed-list { display: flex; flex-direction: column; gap: 8px; }
.pending-item, .feed-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: 13px; background: rgba(2,6,23,0.48); border: 1px solid var(--line);
}
.brand-bars { display: flex; flex-direction: column; gap: 10px; }
.b-row { display: flex; flex-direction: column; gap: 5px; }
.b-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; }
.b-track { height: 8px; border-radius: 99px; background: rgba(148,163,184,0.1); overflow: hidden; }
.b-fill { height: 100%; border-radius: 99px; background: var(--grad); }

.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kv > div { padding: 11px 14px; border-radius: 12px; background: rgba(2,6,23,0.45); border: 1px solid var(--line); }
.kv span { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.code-box {
  padding: 14px; border-radius: 12px; background: rgba(2,6,23,0.75); border: 1px solid var(--line);
  font: 12.5px/1.6 var(--mono); color: var(--cyan); overflow-x: auto;
}
.sep { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.err-box {
  padding: 10px 12px; border-radius: 10px; margin-bottom: 12px;
  background: rgba(251,113,133,0.14); border: 1px solid rgba(251,113,133,0.35); color: var(--red); font-size: 13px;
}

/* Modal & Toasts */
.modal {
  position: fixed; inset: 0; z-index: 150;
  display: grid; place-items: center; padding: 20px; background: rgba(2,6,23,0.72); backdrop-filter: blur(8px);
}
.modal-card { width: 520px; max-width: 100%; padding: 24px; border-radius: 20px; }
.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 16px; border-radius: 12px; background: rgba(15,23,42,0.95);
  border: 1px solid var(--line2); color: #fff; font-weight: 600; box-shadow: 0 12px 30px rgba(0,0,0,0.5);
}
.toast.ok { border-color: var(--green); }
.toast.error { border-color: var(--red); }

@media (max-width: 1300px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .dash-grid, .grid-2 { grid-template-columns: 1fr; }
}

