/* ── Fonts & Reset ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #08080f;
  --bg2:         #0e0e1a;
  --surface:     rgba(255,255,255,0.04);
  --surface-h:   rgba(255,255,255,0.07);
  --border:      rgba(255,255,255,0.08);
  --border-h:    rgba(255,255,255,0.16);
  --primary:     #00d4ff;
  --primary-dim: rgba(0,212,255,0.15);
  --purple:      #a855f7;
  --purple-dim:  rgba(168,85,247,0.15);
  --grad:        linear-gradient(135deg, #00d4ff, #a855f7);
  --grad-r:      linear-gradient(135deg, #a855f7, #00d4ff);
  --text:        #f0f0f4;
  --text-2:      #9090a0;
  --text-3:      #505060;
  --success:     #22c55e;
  --error:       #ef4444;
  --warning:     #f59e0b;
  --radius:      14px;
  --radius-sm:   8px;
  --shadow:      0 8px 32px rgba(0,0,0,0.5);
  --shadow-lg:   0 16px 48px rgba(0,0,0,0.6);
  --font:        'Inter', system-ui, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ── Background mesh ───────────────────────────────────────────────────────── */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.bg-mesh::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(0,212,255,0.12) 0%, transparent 70%);
  top: -200px; left: -200px;
  animation: blob1 18s ease-in-out infinite alternate;
}
.bg-mesh::after {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(168,85,247,0.10) 0%, transparent 70%);
  bottom: -150px; right: -150px;
  animation: blob2 22s ease-in-out infinite alternate;
}
@keyframes blob1 { to { transform: translate(120px, 80px) scale(1.1); } }
@keyframes blob2 { to { transform: translate(-100px, -60px) scale(1.15); } }

/* ── Layout helpers ────────────────────────────────────────────────────────── */
.page { position: relative; z-index: 1; min-height: 100vh; }

/* ── Glass card ────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .2s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 0 20px rgba(0,212,255,0.25);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 0 32px rgba(0,212,255,0.45);
  transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-h);
  color: var(--text);
  border-color: var(--border-h);
}

.btn-danger {
  background: rgba(239,68,68,.12);
  color: var(--error);
  border: 1px solid rgba(239,68,68,.2);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(239,68,68,.22);
  border-color: rgba(239,68,68,.4);
}

.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-icon { padding: 8px; min-width: 36px; }
.btn-full { width: 100%; }

/* ── Input ─────────────────────────────────────────────────────────────────── */
.input-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.input-wrap label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.input-field {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
}
.input-field::placeholder { color: var(--text-3); }
.input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.12);
}
.input-field.error { border-color: var(--error); box-shadow: 0 0 0 3px rgba(239,68,68,0.12); }

/* ── Badge ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
}
.badge-ok   { background: rgba(34,197,94,.12); color: var(--success); }
.badge-ok .badge-dot { background: var(--success); box-shadow: 0 0 6px var(--success); }
.badge-err  { background: rgba(239,68,68,.12);  color: var(--error); }
.badge-err .badge-dot { background: var(--error); }
.badge-warn { background: rgba(245,158,11,.12); color: var(--warning); }
.badge-warn .badge-dot { background: var(--warning); }

/* ── Gradient text ─────────────────────────────────────────────────────────── */
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Spinner ───────────────────────────────────────────────────────────────── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ─────────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  backdrop-filter: blur(12px);
  animation: toast-in .3s ease;
  max-width: 360px;
}
.toast-ok  { background: rgba(34,197,94,.15);  border: 1px solid rgba(34,197,94,.3);  color: #86efac; }
.toast-err { background: rgba(239,68,68,.15);  border: 1px solid rgba(239,68,68,.3);  color: #fca5a5; }
.toast-inf { background: rgba(0,212,255,.12);  border: 1px solid rgba(0,212,255,.25); color: var(--primary); }
@keyframes toast-in { from { opacity:0; transform: translateY(10px); } to { opacity:1; transform: translateY(0); } }

/* ── Modal ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade-in .2s ease;
}
.modal-overlay.hidden { display: none; }
@keyframes fade-in { from { opacity:0; } to { opacity:1; } }

.modal {
  background: #111120;
  border: 1px solid var(--border-h);
  border-radius: calc(var(--radius) + 2px);
  padding: 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  animation: modal-up .25s ease;
}
@keyframes modal-up { from { opacity:0; transform: translateY(20px); } to { opacity:1; transform: translateY(0); } }

.modal-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 24px;
}
.modal-body { display: flex; flex-direction: column; gap: 16px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ── Table ─────────────────────────────────────────────────────────────────── */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-2);
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-2);
}
.empty-state svg { opacity: .3; margin-bottom: 16px; }
.empty-state p { font-size: 15px; }
.empty-state .hint { font-size: 13px; color: var(--text-3); margin-top: 6px; }

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

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── Utility ───────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-2); }
.text-err { color: var(--error); }
.mono { font-family: 'SF Mono', 'Fira Code', monospace; }

/* ── Animations ────────────────────────────────────────────────────────────── */
.fade-up {
  animation: fade-up .4s ease both;
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.delay-1 { animation-delay: .08s; }
.delay-2 { animation-delay: .16s; }
.delay-3 { animation-delay: .24s; }
