/* ═══════════════════════════════════════════════════════
   DomainCTRL v3 — Complete Stylesheet
   Fonts: Outfit (UI) + JetBrains Mono (code/numbers)
   ═══════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── CSS Variables ─────────────────────────────────────── */
:root {
  --bg:           #07080f;
  --surface:      #0c0f1c;
  --card:         #111627;
  --card-h:       #161d30;
  --border:       rgba(255,255,255,.06);
  --border-md:    rgba(255,255,255,.11);
  --border-hi:    rgba(255,255,255,.20);
  --text:         #edf0fb;
  --text2:        #8f9bbf;
  --muted:        #47506e;

  --accent:       #5b8fff;
  --accent-h:     #7aaaff;
  --accent-dim:   rgba(91,143,255,.13);
  --accent-glow:  0 0 32px rgba(91,143,255,.30);

  --green:        #00d97e;
  --green-dim:    rgba(0,217,126,.13);
  --green-border: rgba(0,217,126,.22);
  --green-glow:   0 0 28px rgba(0,217,126,.22);

  --red:          #ff4f6e;
  --red-dim:      rgba(255,79,110,.13);
  --red-border:   rgba(255,79,110,.22);

  --yellow:       #ffbe0b;
  --yellow-dim:   rgba(255,190,11,.11);
  --yellow-border:rgba(255,190,11,.22);

  --purple:       #9d74ff;
  --purple-dim:   rgba(157,116,255,.13);
  --purple-border:rgba(157,116,255,.22);

  --cyan:         #00e5cc;
  --cyan-dim:     rgba(0,229,204,.11);

  --orange:       #ff8c42;
  --orange-dim:   rgba(255,140,66,.11);

  --sidebar-w:    258px;
  --topbar-h:     60px;
  --radius:       10px;
  --radius-lg:    14px;
  --radius-xl:    20px;

  --font:         'Outfit', sans-serif;
  --mono:         'JetBrains Mono', monospace;

  --shadow:       0 4px 20px rgba(0,0,0,.5);
  --shadow-lg:    0 10px 50px rgba(0,0,0,.65);
  --trans:        .18s cubic-bezier(.4,0,.2,1);
}

/* ── Reset ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
a  { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font-family: inherit; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

/* ── Scrollbar ───────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.09); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.16); }

/* ════════════════════════════════════════════════════════
   LAYOUT — sidebar + main
   ════════════════════════════════════════════════════════ */
.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 300;
  transition: transform var(--trans);
  will-change: transform;
  overflow: hidden;
}

.sb-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 18px;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sb-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(91,143,255,.4);
}
.sb-icon svg { width: 17px; height: 17px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sb-brand { font-size: 15px; font-weight: 800; letter-spacing: -.3px; }
.sb-brand span { color: var(--accent-h); }

.sb-nav { flex: 1; padding: 14px 10px; overflow-y: auto; overflow-x: hidden; }

.sb-section {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 10px 10px 6px;
}

.sb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text2);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--trans), color var(--trans);
  margin-bottom: 1px;
  position: relative;
  white-space: nowrap;
}
.sb-item:hover  { background: rgba(255,255,255,.05); color: var(--text); }
.sb-item.active { background: var(--accent-dim); color: var(--accent-h); font-weight: 600; }
.sb-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 25%; bottom: 25%;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}

.sb-icon-sm {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0;
}
.sb-badge {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.sb-badge-blue   { background: var(--accent-dim);   color: var(--accent-h); }
.sb-badge-green  { background: var(--green-dim);     color: var(--green); }
.sb-badge-red    { background: var(--red-dim);       color: var(--red); }
.sb-badge-yellow { background: var(--yellow-dim);    color: var(--yellow); }

/* Sidebar mini stats */
.sb-mini {
  margin: 12px 4px 0;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px;
}
.sb-mini-title {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.sb-mini-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}
.sb-mini-label { font-size: 12px; color: var(--text2); }
.sb-mini-val   { font-size: 12px; font-weight: 700; font-family: var(--mono); }
.sb-mini-bar {
  height: 3px;
  background: rgba(255,255,255,.07);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}
.sb-mini-fill { height: 100%; border-radius: 2px; }

/* Sidebar footer */
.sb-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.user-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  overflow: hidden;
}
.user-av {
  width: 30px; height: 30px;
  border-radius: 7px;
  background: var(--accent-dim);
  border: 1px solid rgba(91,143,255,.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--accent-h);
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10.5px; color: var(--muted); }
.logout-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 5px; border-radius: 6px;
  transition: all var(--trans);
  display: flex; align-items: center;
  flex-shrink: 0;
}
.logout-btn:hover { color: var(--red); background: var(--red-dim); }
.logout-btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Overlay (mobile) ─────────────────────────────── */
.sb-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 290;
  backdrop-filter: blur(4px);
}
.sb-overlay.show { display: block; }

/* ── Main ─────────────────────────────────────────── */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--trans);
}

/* ── Topbar ───────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 200;
  height: var(--topbar-h);
  background: rgba(12,15,28,.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  flex-shrink: 0;
}
.topbar-menu {
  display: none; background: none; border: none;
  color: var(--text2); cursor: pointer; padding: 6px; border-radius: 7px;
  transition: all var(--trans);
}
.topbar-menu:hover { background: rgba(255,255,255,.07); color: var(--text); }
.topbar-menu svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.topbar-info {}
.topbar-title    { font-size: 15px; font-weight: 700; line-height: 1.2; }
.topbar-crumb    { font-size: 11px; color: var(--muted); }
.topbar-right    { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.live-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 20px;
  background: var(--green-dim); border: 1px solid var(--green-border);
  font-size: 11px; font-weight: 700; color: var(--green);
  white-space: nowrap;
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  animation: blink 2.4s infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.25} }

/* ── Page body ────────────────────────────────────── */
.page { flex: 1; padding: 26px 26px 40px; }

/* ════════════════════════════════════════════════════════
   COMPONENTS
   ════════════════════════════════════════════════════════ */

/* ── Stats row ────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--trans), transform var(--trans);
}
.stat-card:hover { border-color: var(--border-md); transform: translateY(-2px); }
/* top glow line via pseudo */
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--card-color, var(--accent)), transparent);
  opacity: .7;
}
.stat-card[data-c="blue"]   { --card-color: var(--accent); }
.stat-card[data-c="green"]  { --card-color: var(--green); }
.stat-card[data-c="red"]    { --card-color: var(--red); }
.stat-card[data-c="yellow"] { --card-color: var(--yellow); }
.stat-card[data-c="purple"] { --card-color: var(--purple); }
.stat-card[data-c="cyan"]   { --card-color: var(--cyan); }

.stat-ico {
  width: 38px; height: 38px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; margin-bottom: 13px;
  border: 1px solid var(--border-md);
}
.stat-lbl { font-size: 10.5px; font-weight: 700; color: var(--muted); letter-spacing: .09em; text-transform: uppercase; margin-bottom: 5px; }
.stat-val { font-size: 34px; font-weight: 800; font-family: var(--mono); line-height: 1; letter-spacing: -.02em; }
.stat-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ── Panel ────────────────────────────────────────── */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.panel-title { font-size: 14px; font-weight: 700; }
.panel-sub   { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.panel-body  { padding: 20px; }

/* ── Two-col grid ─────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 18px;
  align-items: start;
}
.side-stack { display: flex; flex-direction: column; gap: 14px; }

/* ── Forms ────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.form-label {
  display: block;
  font-size: 11px; font-weight: 700; color: var(--text2);
  letter-spacing: .06em; text-transform: uppercase;
  margin-bottom: 6px;
}
.form-ctrl {
  width: 100%;
  padding: 10px 13px;
  background: rgba(255,255,255,.045);
  border: 1px solid var(--border-md);
  border-radius: 8px;
  color: var(--text);
  font-size: 13.5px;
  outline: none;
  transition: border-color var(--trans), background var(--trans), box-shadow var(--trans);
  -webkit-appearance: none;
  appearance: none;
}
.form-ctrl:focus {
  border-color: var(--accent);
  background: rgba(91,143,255,.07);
  box-shadow: 0 0 0 3px rgba(91,143,255,.13);
}
.form-ctrl::placeholder { color: var(--muted); }
.form-ctrl option { background: #1a2035; }

/* password wrapper */
.pw-wrap { position: relative; }
.pw-wrap .form-ctrl { padding-right: 40px; }
.pw-eye {
  position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--muted); transition: color var(--trans);
  display: flex; align-items: center; padding: 3px;
}
.pw-eye:hover { color: var(--text2); }
.pw-eye svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Buttons ──────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px; border: none;
  font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: all var(--trans);
  white-space: nowrap; line-height: 1.4;
  -webkit-appearance: none; appearance: none;
}
.btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 4px 14px rgba(91,143,255,.35);
}
.btn-primary:hover { background: var(--accent-h); box-shadow: 0 6px 22px rgba(91,143,255,.45); transform: translateY(-1px); }
.btn-primary:active { transform: none; }

.btn-green  { background: var(--green-dim);  color: var(--green);  border: 1px solid var(--green-border); }
.btn-green:hover  { background: rgba(0,217,126,.22); }

.btn-red    { background: var(--red-dim);    color: var(--red);    border: 1px solid var(--red-border); }
.btn-red:hover    { background: rgba(255,79,110,.22); }

.btn-yellow { background: var(--yellow-dim); color: var(--yellow); border: 1px solid var(--yellow-border); }
.btn-yellow:hover { background: rgba(255,190,11,.2); }

.btn-ghost  { background: rgba(255,255,255,.05); color: var(--text2); border: 1px solid var(--border-md); }
.btn-ghost:hover  { background: rgba(255,255,255,.09); color: var(--text); }

.btn-purple { background: var(--purple-dim); color: var(--purple); border: 1px solid var(--purple-border); }
.btn-purple:hover { background: rgba(157,116,255,.22); }

.btn-cyan   { background: var(--cyan-dim); color: var(--cyan); border: 1px solid rgba(0,229,204,.22); }
.btn-cyan:hover   { background: rgba(0,229,204,.2); }

.btn-full   { width: 100%; }
.btn-sm     { padding: 6px 11px; font-size: 12px; border-radius: 7px; }
.btn-icon   { padding: 6px 7px; border-radius: 7px; line-height: 1; font-size: 13px; }

/* ── Badges ───────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 20px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .03em;
}
.badge-avail  { background: var(--green-dim);  color: var(--green);  border: 1px solid var(--green-border); }
.badge-used   { background: var(--red-dim);    color: var(--red);    border: 1px solid var(--red-border); }
.badge-online { background: var(--green-dim);  color: var(--green);  border: 1px solid var(--green-border); }
.badge-offline{ background: var(--red-dim);    color: var(--red);    border: 1px solid var(--red-border); }
.badge-unknown{ background: var(--yellow-dim); color: var(--yellow); border: 1px solid var(--yellow-border); }
.badge-stale  { background: var(--orange-dim); color: var(--orange); border: 1px solid rgba(255,140,66,.22); }
.badge-dot    { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: blink 2.4s infinite; }

/* ── Alerts ───────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 15px; border-radius: var(--radius);
  margin-bottom: 20px; font-size: 13.5px; font-weight: 500;
  animation: slideDown .22s ease;
}
@keyframes slideDown { from { opacity:0; transform:translateY(-7px); } to { opacity:1; transform:translateY(0); } }
.alert-ok  { background: var(--green-dim); color: var(--green); border: 1px solid var(--green-border); }
.alert-err { background: var(--red-dim);   color: var(--red);   border: 1px solid var(--red-border); }
.alert-ico { font-size: 15px; flex-shrink: 0; margin-top: 1px; }

/* ── Search / toolbar ─────────────────────────────── */
.toolbar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 13px 18px; border-bottom: 1px solid var(--border);
}
.search-wrap { position: relative; flex: 1; min-width: 180px; }
.search-ico {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
  display: flex; align-items: center;
}
.search-ico svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.search-ctrl {
  width: 100%; padding: 8px 12px 8px 33px;
  background: rgba(255,255,255,.045);
  border: 1px solid var(--border-md);
  border-radius: 8px; color: var(--text); font-size: 13px; outline: none;
  transition: border-color var(--trans), box-shadow var(--trans);
}
.search-ctrl:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(91,143,255,.12); }
.search-ctrl::placeholder { color: var(--muted); }
.search-clear {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 14px; line-height: 1; padding: 2px;
  transition: color var(--trans);
}
.search-clear:hover { color: var(--text2); }

.filter-tabs {
  display: flex; gap: 2px;
  background: rgba(255,255,255,.04);
  padding: 3px; border-radius: 8px;
  flex-shrink: 0;
}
.ftab {
  padding: 5px 12px; border-radius: 6px;
  font-size: 12px; font-weight: 600; color: var(--muted);
  background: none; border: none; cursor: pointer;
  transition: all var(--trans); white-space: nowrap;
  text-decoration: none; display: inline-block;
}
.ftab:hover  { color: var(--text2); }
.ftab.active { background: var(--card-h); color: var(--text); }

/* ── Table ────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 580px; }
thead tr { border-bottom: 1px solid var(--border); }
th {
  padding: 10px 16px;
  font-size: 10.5px; font-weight: 700; color: var(--muted);
  letter-spacing: .08em; text-transform: uppercase;
  text-align: left; white-space: nowrap;
  background: rgba(255,255,255,.018);
}
td {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-size: 13px; vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--trans); }
tbody tr:hover td { background: rgba(255,255,255,.016); }
.td-mono    { font-family: var(--mono); font-size: 12px; }
.td-muted   { color: var(--muted); }
.td-nowrap  { white-space: nowrap; }
.td-actions { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }

/* ── Table footer ─────────────────────────────────── */
.tbl-foot {
  padding: 9px 18px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; color: var(--muted);
}

/* ── Empty state ──────────────────────────────────── */
.empty {
  text-align: center; padding: 44px 20px; color: var(--muted);
}
.empty-icon { font-size: 38px; margin-bottom: 11px; opacity: .3; display: block; }
.empty-text { font-size: 13.5px; }
.empty-action { margin-top: 14px; }

/* ── Progress bar ─────────────────────────────────── */
.prog {
  height: 6px; background: rgba(255,255,255,.07); border-radius: 3px; overflow: hidden;
}
.prog-fill {
  height: 100%; border-radius: 3px;
  transition: width 1.2s cubic-bezier(.4,0,.2,1);
}

/* ── Password reveal ──────────────────────────────── */
.pass-cell { cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.pass-hidden { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: 2px; }
.pass-real   { font-family: var(--mono); font-size: 12px; display: none; }
.pass-eye    { font-size: 12px; color: var(--muted); }

/* ── Proxy chip ───────────────────────────────────── */
.proxy-chip {
  font-family: var(--mono); font-size: 11.5px;
  color: var(--purple); background: var(--purple-dim);
  border: 1px solid var(--purple-border);
  padding: 3px 9px; border-radius: 6px;
  white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
}
.copy-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 13px; transition: color var(--trans);
  padding: 2px; line-height: 1;
}
.copy-btn:hover { color: var(--text); }

/* Proxy validation states */
.val-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; }
.val-checking { color: var(--yellow); }
.val-online   { color: var(--green); }
.val-offline  { color: var(--red); }
.val-unknown  { color: var(--muted); }
.val-stale    { color: var(--orange); }
.spin {
  display: inline-block; width: 11px; height: 11px;
  border: 2px solid rgba(255,190,11,.3); border-top-color: var(--yellow);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Divider ──────────────────────────────────────── */
.hr { height: 1px; background: var(--border); margin: 18px 0; }

/* ════════════════════════════════════════════════════════
   MODAL
   ════════════════════════════════════════════════════════ */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.82);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; padding: 16px;
  backdrop-filter: blur(6px);
  animation: bgFade .18s ease;
}
@keyframes bgFade { from { opacity:0; } to { opacity:1; } }
.modal {
  background: var(--card);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 460px;
  box-shadow: var(--shadow-lg);
  animation: modalIn .22s cubic-bezier(.34,1.56,.64,1);
  max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
  overflow: hidden;
}
@keyframes modalIn { from { opacity:0; transform:scale(.93) translateY(-8px); } to { opacity:1; transform:scale(1) translateY(0); } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title { font-size: 15px; font-weight: 700; }
.modal-close {
  width: 28px; height: 28px; border-radius: 7px;
  background: rgba(255,255,255,.07); border: none; cursor: pointer;
  color: var(--text2); font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--trans);
}
.modal-close:hover { background: var(--red-dim); color: var(--red); }
.modal-body { padding: 22px; overflow-y: auto; }

/* ════════════════════════════════════════════════════════
   LOGIN PAGE
   ════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; padding: 20px;
  background: var(--bg); position: relative; overflow: hidden;
}
.login-bg  { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.bg-grid   {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(91,143,255,.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91,143,255,.028) 1px, transparent 1px);
  background-size: 54px 54px;
  animation: gridScroll 22s linear infinite;
}
@keyframes gridScroll { 0%{background-position:0 0} 100%{background-position:0 54px} }
.bg-orb {
  position: absolute; border-radius: 50%;
  filter: blur(70px); pointer-events: none;
}
.bg-orb1 { width: 520px; height: 520px; background: rgba(91,143,255,.07);  top:-120px; left:50%; transform:translateX(-50%); }
.bg-orb2 { width: 360px; height: 360px; background: rgba(0,217,126,.055);  bottom:-80px; right:-60px; }
.bg-orb3 { width: 280px; height: 280px; background: rgba(255,79,110,.045); bottom:100px; left:-50px; }

.login-wrap {
  position: relative; z-index: 1;
  width: 100%; max-width: 400px;
}
.login-card {
  background: var(--card);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), 0 0 80px rgba(91,143,255,.08);
  overflow: hidden;
  animation: modalIn .35s cubic-bezier(.34,1.56,.64,1);
}
.login-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-h), transparent);
}
.login-header { text-align: center; padding: 34px 30px 22px; }
.login-logo {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--accent-dim); border: 1px solid rgba(91,143,255,.3);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px; font-size: 22px;
  box-shadow: var(--accent-glow);
}
.login-title { font-size: 22px; font-weight: 800; letter-spacing: -.3px; margin-bottom: 4px; }
.login-sub   { font-size: 13px; color: var(--muted); }
.login-body  { padding: 6px 30px 32px; }
.login-err {
  display: flex; align-items: center; gap: 8px;
  background: var(--red-dim); border: 1px solid var(--red-border);
  color: var(--red); font-size: 13px; font-weight: 500;
  padding: 10px 13px; border-radius: 8px; margin-bottom: 16px;
  animation: shake .38s ease;
}
@keyframes shake {
  0%,100%{transform:translateX(0)} 20%{transform:translateX(-6px)}
  40%{transform:translateX(5px)}  60%{transform:translateX(-4px)} 80%{transform:translateX(3px)}
}
.login-foot {
  text-align: center; padding: 0 30px 22px;
  font-size: 11.5px; color: var(--muted);
}
.login-foot a { color: var(--accent-h); transition: color var(--trans); }
.login-foot a:hover { color: var(--accent); }

/* ════════════════════════════════════════════════════════
   PUBLIC INDEX PAGE
   ════════════════════════════════════════════════════════ */
.pub-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; height: 60px;
  border-bottom: 1px solid var(--border);
  background: rgba(7,8,15,.9);
  backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 50;
}
.pub-brand      { font-size: 15px; font-weight: 800; }
.pub-brand span { color: var(--accent-h); }

.pub-hero {
  text-align: center; padding: 70px 20px 54px;
  position: relative; overflow: hidden;
}
.pub-hero::before {
  content: '';
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 800px; height: 400px;
  background: radial-gradient(ellipse at top, rgba(91,143,255,.08) 0%, transparent 65%);
  pointer-events: none;
}
.pub-eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 14px; border-radius: 20px;
  background: var(--accent-dim); border: 1px solid rgba(91,143,255,.2);
  font-size: 11px; font-weight: 700; color: var(--accent-h);
  letter-spacing: .1em; text-transform: uppercase; margin-bottom: 18px;
}
.pub-h1 {
  font-size: clamp(36px, 7.5vw, 76px);
  font-weight: 900; line-height: 1.03; letter-spacing: -.04em; margin-bottom: 14px;
}
.pub-h1 em    { font-style: normal; color: var(--accent-h); }
.pub-desc     { font-size: clamp(14px,2.4vw,17px); color: var(--text2); max-width: 520px; margin: 0 auto 38px; }

/* Ring */
.ring-wrap {
  position: relative; width: 180px; height: 180px; margin: 0 auto 28px;
}
.ring-wrap svg { transform: rotate(-90deg); overflow: visible; }
.ring-track { fill: none; stroke: rgba(255,255,255,.07); stroke-width: 9; }
.ring-prog  { fill: none; stroke-width: 9; stroke-linecap: round;
  stroke-dasharray: 502; stroke-dashoffset: 502;
  transition: stroke-dashoffset 1.5s cubic-bezier(.4,0,.2,1);
}
.ring-inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ring-num  { font-size: 40px; font-weight: 900; font-family: var(--mono); line-height: 1; }
.ring-lbl  { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin-top: 2px; }

/* Pub grid */
.pub-section { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.pub-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 18px;
}
.pub-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px;
  transition: border-color var(--trans), transform var(--trans);
}
.pub-card:hover { border-color: var(--border-md); transform: translateY(-3px); }
.pub-clbl { font-size: 10.5px; font-weight: 700; color: var(--muted); letter-spacing: .09em; text-transform: uppercase; margin-bottom: 7px; }
.pub-cval { font-size: 36px; font-weight: 900; font-family: var(--mono); line-height: 1; }
.pub-csub { font-size: 11px; color: var(--muted); margin-top: 4px; }

.pub-extra {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 14px; margin-bottom: 48px;
}
.pub-xcard {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px;
  display: flex; align-items: center; gap: 16px;
}
.pub-xicon {
  width: 52px; height: 52px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
}
.pub-xlbl { font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 3px; }
.pub-xval { font-size: 28px; font-weight: 900; font-family: var(--mono); line-height: 1; }
.pub-xsub { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Prog card */
.prog-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  margin-bottom: 14px;
}
.prog-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 12px; gap: 12px;
}
.prog-title { font-size: 14px; font-weight: 700; }
.prog-pct   { font-size: 28px; font-weight: 900; font-family: var(--mono); }
.prog-legend { display: flex; gap: 16px; margin-top: 13px; flex-wrap: wrap; }
.prog-leg-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text2); }
.prog-leg-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Pub footer */
.pub-foot {
  text-align: center; padding: 24px 20px 32px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted);
}
.pub-foot a { color: var(--accent-h); transition: color var(--trans); }
.pub-foot a:hover { color: var(--accent); }

/* Animations */
@keyframes fadeUp { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }
.a1{animation:fadeUp .55s .0s both}
.a2{animation:fadeUp .55s .08s both}
.a3{animation:fadeUp .55s .16s both}
.a4{animation:fadeUp .55s .24s both}
.a5{animation:fadeUp .55s .32s both}

/* ════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════ */

/* 1200px — slightly narrower sidebar area */
@media (max-width: 1200px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

/* 960px — sidebar becomes a drawer */
@media (max-width: 960px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-260px); width: 260px; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar-menu { display: flex; }
  .two-col { grid-template-columns: 1fr; }
  .pub-stats { grid-template-columns: repeat(2, 1fr); }
}

/* 680px — tablet small */
@media (max-width: 680px) {
  .page { padding: 14px 14px 32px; }
  .topbar { padding: 0 14px; }
  .pub-nav { padding: 0 14px; }
  .pub-hero { padding: 44px 14px 36px; }
  .pub-section { padding: 0 14px; }
  .pub-extra { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .modal-head { padding: 16px 18px; }
  .modal-body { padding: 18px; }
  .login-header { padding: 26px 22px 18px; }
  .login-body   { padding: 6px 22px 26px; }
  .login-foot   { padding: 0 22px 18px; }
  th { padding: 9px 12px; }
  td { padding: 10px 12px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .toolbar { padding: 11px 14px; }
}

/* 440px — phone */
@media (max-width: 440px) {
  .stats-row { grid-template-columns: 1fr; }
  .pub-stats  { grid-template-columns: 1fr 1fr; }
  .filter-tabs { gap: 1px; }
  .ftab { padding: 4px 8px; font-size: 11px; }
  .pub-h1 { letter-spacing: -.03em; }
}
