
:root{
  --bg1:#070A12; --bg2:#0B1630; --glass:rgba(255,255,255,.08); --stroke:rgba(255,255,255,.14);
  --text:rgba(255,255,255,.92);
  --muted:rgba(255,255,255,.65);
  --accent:rgba(120,160,255,.95);
}
html[data-theme="light"]{
  --bg1:#f7f8ff; --bg2:#e9ecff; --glass:rgba(0,0,0,.05); --stroke:rgba(0,0,0,.10);
  --text:rgba(15,23,42,.92);
  --muted:rgba(15,23,42,.62);
  --accent:rgba(79,70,229,.95);
}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color:var(--text);
  background:
    radial-gradient(1200px 800px at 20% 10%, var(--bg2), transparent 60%),
    radial-gradient(900px 700px at 80% 30%, rgba(90,120,255,.25), transparent 55%),
    linear-gradient(180deg, var(--bg1), var(--bg1));
  min-height:100vh;
}
a{ color:inherit; text-decoration:none; }
.container{ max-width:1100px; margin:0 auto; padding:24px 16px 48px; }
.glass{
  background:var(--glass);
  border:1px solid var(--stroke);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 80px rgba(0,0,0,.30);
}

.neon{
  box-shadow: 0 0 0 1px rgba(120,160,255,.18), 0 30px 90px rgba(80,120,255,.12);
}
.card{ border-radius:24px; padding:18px; }
.row{ display:flex; gap:14px; flex-wrap:wrap; }
.col{ flex:1; min-width:240px; }

.topbar{
  display:flex; align-items:center; justify-content:space-between;
  border-radius:26px; padding:14px 14px;
  margin-bottom:18px;
}
.brand{ display:flex; align-items:center; gap:12px; }
.brand-badge{
  width:42px; height:42px; border-radius:18px;
  background: linear-gradient(135deg, rgba(59,130,246,.35), rgba(168,85,247,.30));
  border:1px solid rgba(255,255,255,.14);
}
.brand img{ width:42px; height:42px; border-radius:18px; object-fit:cover; border:1px solid rgba(255,255,255,.18);}
.brand-title{ font-weight:700; letter-spacing:.2px; }
.brand-sub{ font-size:12px; color:var(--muted); margin-top:2px; }

.nav{ display:flex; align-items:center; gap:10px; flex-wrap:wrap;}
.nav-item{
  padding:10px 16px;
  border-radius:16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  transition: .25s ease;
  font-size:14px;
}
html[data-theme="light"] .nav-item{ background: rgba(0,0,0,.03); border-color: rgba(0,0,0,.10);}
.nav-item:hover{
  background: rgba(120,160,255,0.20);
  transform: translateY(-2px);
  box-shadow: 0 10px 40px rgba(120,160,255,0.20);
}

.btn{
  padding:10px 14px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  cursor:pointer;
  transition:.2s ease;
  color:var(--text);
}
html[data-theme="light"] .btn{ border-color: rgba(0,0,0,.12); background: rgba(0,0,0,.03); }
.btn:hover{ transform: translateY(-1px); background: rgba(120,160,255,.18); }
.btn-danger:hover{ background: rgba(239,68,68,.18); }
.btn-primary{ background: rgba(120,160,255,.18); border-color: rgba(120,160,255,.28); }
.btn-primary:hover{ background: rgba(120,160,255,.26); }

.input, select, textarea{
  width:100%;
  box-sizing:border-box;
  padding:11px 12px;
  border-radius:16px;
  background: rgba(20,25,40,0.80);
  border:1px solid rgba(255,255,255,.18);
  color: var(--text);
  outline:none;
}
html[data-theme="light"] .input, html[data-theme="light"] select, html[data-theme="light"] textarea{
  background: rgba(255,255,255,.85);
  border-color: rgba(0,0,0,.10);
  color: rgba(15,23,42,.92);
}
select option{
  background:#0f172a;
  color:#fff;
}
html[data-theme="light"] select option{
  background:#fff;
  color:#111;
}
label{ display:block; font-size:12px; color:var(--muted); margin:0 0 6px 2px; }
.form-grid{ display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap:14px; }
@media (max-width: 760px){ .form-grid{ grid-template-columns:1fr; } }

.table{ width:100%; border-collapse: collapse; font-size:14px; }
.table th, .table td{ padding:12px 10px; text-align:left; border-top:1px solid rgba(255,255,255,.10); }
html[data-theme="light"] .table th, html[data-theme="light"] .table td{ border-top:1px solid rgba(0,0,0,.08); }
.badge{
  padding:6px 10px; border-radius:999px; font-size:12px; display:inline-flex; align-items:center; gap:7px;
  border:1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.05);
}
html[data-theme="light"] .badge{ border-color: rgba(0,0,0,.10); background: rgba(0,0,0,.03); }

.flash{ margin: 0 0 16px; padding: 12px 14px; border-radius:18px; }

.modal-backdrop{
  position:fixed; inset:0; background: rgba(0,0,0,.62);
  display:flex; align-items:center; justify-content:center; padding:16px;
}
.modal{ width:100%; max-width:520px; border-radius:26px; padding:18px; }
.muted{ color:var(--muted); }
.h1{ font-size:22px; font-weight:700; }
.h2{ font-size:16px; font-weight:700; }
.small{ font-size:12px; }
.kpi{ font-size:22px; font-weight:800; margin-top:6px;}
.kpi-card{ border-radius:22px; padding:14px;}
hr.sep{ border:none; border-top:1px solid rgba(255,255,255,.10); margin:14px 0; }
html[data-theme="light"] hr.sep{ border-top:1px solid rgba(0,0,0,.08); }

.switch{
  position:relative; width:56px; height:28px; border-radius:999px;
  background: rgba(255,255,255,.10); border:1px solid rgba(255,255,255,.18);
  cursor:pointer;
}
/* ====== MODAL FIX (Always top) ====== */
.modal-backdrop{
  position: fixed;
  inset: 0;
  z-index: 99999;         /* <-- MOST IMPORTANT */
  background: rgba(0,0,0,.62);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px;
}

/* nicer modal layout */
.modal{
  width:100%;
  max-width:520px;
  border-radius:26px;
  padding:18px;
  position: relative;
  animation: modalIn .18s ease-out;
}

@keyframes modalIn{
  from{ transform: translateY(-8px); opacity:0; }
  to{ transform: translateY(0); opacity:1; }
}

/* header row with close */
.modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.modal-x{
  border:none;
  background: transparent;
  color: var(--muted);
  cursor:pointer;
  padding:6px 10px;
  border-radius:12px;
}
.modal-x:hover{
  background: rgba(255,255,255,.08);
  color: var(--text);
}
html[data-theme="light"] .modal-x:hover{
  background: rgba(0,0,0,.06);
}

/* copy box */
.modal-copybox{
  margin-top:12px;
  padding:12px 12px;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.05);
  word-break: break-all;
}
html[data-theme="light"] .modal-copybox{
  border-color: rgba(0,0,0,.10);
  background: rgba(0,0,0,.03);
}
.modal-copytext{
  margin-top:6px;
  font-weight:800;
}

/* actions row */
.modal-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:16px;
  flex-wrap:wrap;
}

/* copy feedback */
.copy-btn.copied{
  background: rgba(34,197,94,.18);
  border-color: rgba(34,197,94,.30);
}
html[data-theme="light"] .switch{ background: rgba(0,0,0,.04); border-color: rgba(0,0,0,.10); }
.switch-dot{
  position:absolute; top:3px; left:3px; width:22px; height:22px; border-radius:999px;
  background: rgba(255,255,255,.92);
  transition: .25s ease;
}
html[data-theme="light"] .switch-dot{ background: rgba(15,23,42,.88); }

button.nav-item{ cursor:pointer; font-family:inherit; }
