:root{
  --bg:#050817;
  --bg2:#070a1f;
  --card: rgba(255,255,255,.06);
  --card2: rgba(255,255,255,.08);
  --line: rgba(255,255,255,.10);
  --text:#eef2ff;
  --muted: rgba(238,242,255,.65);

  --p1:#ff2d8d;
  --p2:#ff7a18;
  --p3:#6d5cff;
  --good:#21c55d;
  --warn:#f59e0b;
  --bad:#ef4444;

  --shadow: 0 22px 60px rgba(0,0,0,.45);
  --radius: 18px;
  --radius2: 22px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:Poppins,system-ui,-apple-system,Segoe UI,Arial;
  color:var(--text);
  background:
    radial-gradient(1100px 700px at 18% 10%, rgba(109,92,255,.18), transparent 60%),
    radial-gradient(900px 700px at 85% 15%, rgba(255,45,141,.14), transparent 62%),
    radial-gradient(900px 700px at 55% 110%, rgba(255,122,24,.10), transparent 55%),
    linear-gradient(180deg, var(--bg), var(--bg2));
}

/* soft grid */
body:before{
  content:"";
  position:fixed; inset:0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity:.06;
  pointer-events:none;
}

/* ===== Topbar ===== */
.topbar{
  position:sticky; top:0; z-index:10;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(5,8,23,.55);
  border-bottom: 1px solid var(--line);
}
.topbar-inner{
  max-width:1200px;
  margin:0 auto;
  padding:16px 18px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:14px;
}

.brand{display:flex; align-items:center; gap:12px}
.brand-mark{
  width:44px;height:44px;border-radius:14px;
  display:grid; place-items:center;
  background: linear-gradient(135deg, var(--p1), var(--p2), var(--p3));
  box-shadow: 0 18px 45px rgba(0,0,0,.45);
  font-weight:800;
}
.brand-title{font-weight:800; letter-spacing:.2px; line-height:1.1}
.brand-sub{font-size:12px; color:var(--muted); margin-top:2px}

.top-actions{display:flex; align-items:center; gap:10px; flex-wrap:wrap}
.pill{
  display:flex; align-items:center; gap:10px;
  padding:9px 12px;
  border-radius:999px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.05);
}
.pill span{font-size:12px; color:var(--muted)}
.pill strong{font-size:13px}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  border:1px solid transparent;
  cursor:pointer;
  padding:10px 14px;
  border-radius:14px;
  font-weight:700;
  text-decoration:none;
  color:var(--text);
  transition: transform .12s ease, opacity .18s ease, border-color .18s ease;
}
.btn:hover{transform: translateY(-1px); opacity:.95}
.btn:disabled{opacity:.55; cursor:not-allowed; transform:none}

.btn-primary{
  background: linear-gradient(90deg, var(--p1), var(--p2));
  box-shadow: 0 16px 40px rgba(255,45,141,.12);
}
.btn-ghost{
  background: rgba(255,255,255,.05);
  border-color: var(--line);
}
.btn-danger{
  background: rgba(239,68,68,.10);
  border-color: rgba(239,68,68,.25);
}

/* ===== Shell ===== */
.shell{
  max-width:1200px;
  margin:18px auto 50px;
  padding:0 18px;
  display:grid;
  grid-template-columns: 260px 1fr;
  gap:18px;
}

.sidebar{
  position:sticky;
  top:92px;
  height: calc(100dvh - 110px);
  border-radius: var(--radius2);
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.side-top{
  padding:18px 16px 12px;
  border-bottom:1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.06), transparent);
}
.side-top .small{font-size:12px;color:var(--muted)}
.side-top .big{font-size:14px;font-weight:800;margin-top:4px}

.nav{
  padding:10px;
}
.nav a{
  display:flex;
  align-items:center;
  gap:10px;
  padding:12px 12px;
  border-radius:14px;
  text-decoration:none;
  color:var(--text);
  border:1px solid transparent;
  background: transparent;
  transition: .16s;
  margin-bottom:8px;
}
.nav a:hover{
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.08);
}
.nav a.active{
  background: radial-gradient(circle at top left, rgba(109,92,255,.20), rgba(255,45,141,.10));
  border-color: rgba(109,92,255,.35);
}
.nav .disabled{opacity:.45; pointer-events:none}

.content{padding:2px}

/* ===== Cards ===== */
.card{
  border-radius: var(--radius2);
  background: rgba(255,255,255,.06);
  border:1px solid var(--line);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.card-hd{
  padding:18px 18px 14px;
  border-bottom:1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.06), transparent);
}
.card-hd h1{
  margin:0;
  font-size:22px;
  letter-spacing:.2px;
}
.card-hd p{margin:6px 0 0; color:var(--muted); font-size:13px}

.card-bd{padding:18px}

/* ===== KPI ===== */
.kpi-grid{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:12px;
  margin-top:14px;
}
.kpi{
  padding:14px;
  border-radius: var(--radius);
  border:1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.18);
}
.kpi .label{font-size:12px;color:var(--muted)}
.kpi .val{font-size:26px;font-weight:900;margin-top:6px; letter-spacing:.2px}
.kpi .hint{font-size:12px;color:var(--muted); margin-top:4px}

hr.sep{
  border:0;
  border-top:1px solid var(--line);
  margin:16px 0;
}

/* ===== Forms ===== */
.form-row{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}
.field label{
  display:block;
  font-size:12px;
  color:var(--muted);
  margin-bottom:6px;
}
.input{
  width:100%;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.22);
  color:var(--text);
  outline:none;
  transition:.18s;
}
.input:focus{
  border-color: rgba(109,92,255,.55);
  box-shadow: 0 0 0 3px rgba(109,92,255,.18);
}
.toggle{
  display:flex; align-items:center; gap:10px;
  padding:10px 12px;
  border-radius:14px;
  background: rgba(0,0,0,.18);
  border:1px solid rgba(255,255,255,.08);
}
.toggle span{font-size:13px;color:var(--text)}
.toggle small{color:var(--muted)}

/* ===== Table ===== */
.table-wrap{overflow:auto; border-radius: var(--radius); border:1px solid rgba(255,255,255,.08)}
table{
  width:100%;
  border-collapse:collapse;
  min-width: 840px;
}
th,td{
  padding:12px 12px;
  border-bottom:1px solid rgba(255,255,255,.08);
  text-align:left;
  font-size:13px;
  vertical-align:top;
}
th{
  font-size:12px;
  color:rgba(238,242,255,.75);
  text-transform:uppercase;
  letter-spacing:.08em;
  background: rgba(0,0,0,.20);
}
tr:hover td{background: rgba(255,255,255,.03)}
code{
  background: rgba(0,0,0,.25);
  border:1px solid rgba(255,255,255,.10);
  padding:2px 6px;
  border-radius:10px;
  color:rgba(238,242,255,.92);
}

/* badges */
.badge{
  display:inline-flex;
  align-items:center;
  padding:5px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  border:1px solid transparent;
}
.ok{background:rgba(33,197,93,.14); border-color:rgba(33,197,93,.28); color:#bbf7d0}
.warn{background:rgba(245,158,11,.14); border-color:rgba(245,158,11,.28); color:#fde68a}
.bad{background:rgba(239,68,68,.14); border-color:rgba(239,68,68,.28); color:#fecaca}

/* alerts */
.alert{
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
  color: var(--text);
  margin-top:12px;
}
.alert.err{
  border-color: rgba(239,68,68,.25);
  background: rgba(239,68,68,.08);
  color:#fecaca;
}
.alert.ok{
  border-color: rgba(33,197,93,.25);
  background: rgba(33,197,93,.08);
  color:#bbf7d0;
}

/* login */
.login-wrap{
  max-width:460px;
  margin:80px auto;
  padding:0 18px;
}
.login-card{
  border-radius: var(--radius2);
  background: rgba(255,255,255,.06);
  border:1px solid var(--line);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.login-inner{padding:18px}
.login-hd{padding:18px; border-bottom:1px solid var(--line); background: rgba(0,0,0,.12)}
.login-hd h1{margin:0; font-size:20px}
.login-hd p{margin:6px 0 0; color:var(--muted); font-size:13px}

/* responsive */
@media(max-width:980px){
  .shell{grid-template-columns:1fr}
  .sidebar{position:relative; top:auto; height:auto}
  .kpi-grid{grid-template-columns: repeat(2, minmax(0,1fr))}
  .form-row{grid-template-columns:1fr}
}
