:root{
  --bg:#06080d;
  --panel:#101720;
  --panel-soft:#17232c;
  --panel-deep:#0b1017;
  --ink:#f4fbf8;
  --muted:#9aa9ad;
  --faint:#68777d;
  --line:rgba(255,255,255,.12);
  --line-green:rgba(43,255,129,.34);
  --green:#35f07c;
  --green-2:#42d993;
  --cyan:#42c9ff;
  --magenta:#d86faf;
  --warn:#ff6b6b;
}
*{box-sizing:border-box}
html{background:var(--bg)}
body{
  margin:0;
  min-height:100vh;
  color:var(--ink);
  font-family:Inter,"Microsoft YaHei",system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  background:
    radial-gradient(circle at 15% 30%,rgba(0,211,202,.42),transparent 30%),
    radial-gradient(circle at 45% 58%,rgba(111,217,124,.34),transparent 26%),
    radial-gradient(circle at 82% 47%,rgba(168,68,112,.42),transparent 32%),
    radial-gradient(circle at 88% 90%,rgba(98,151,199,.32),transparent 32%),
    linear-gradient(180deg,#111218 0%,#071017 44%,#080a10 100%);
}
body:before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  background-image:
    linear-gradient(rgba(255,255,255,.055) 1px,transparent 1px),
    linear-gradient(90deg,rgba(255,255,255,.055) 1px,transparent 1px);
  background-size:42px 42px;
  opacity:.16;
}
body:after{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  background:linear-gradient(180deg,transparent 0 48%,rgba(70,255,138,.14) 50%,transparent 52%);
  background-size:100% 8px;
  opacity:.18;
}
button,input,select{font:inherit}
button{
  border:1px solid var(--line);
  border-radius:7px;
  background:linear-gradient(180deg,rgba(255,255,255,.12),rgba(255,255,255,.055));
  color:var(--ink);
  min-height:28px;
  padding:4px 10px;
  cursor:pointer;
  font-size:12px;
  font-weight:700;
  transition:transform .16s ease,border-color .16s ease,background .16s ease,filter .16s ease;
}
button:hover{transform:translateY(-1px);border-color:rgba(53,240,124,.45);filter:brightness(1.06)}
button.primary{
  background:linear-gradient(90deg,var(--green),var(--green-2));
  border-color:rgba(255,255,255,.2);
  color:#03110a;
  box-shadow:0 16px 34px rgba(53,240,124,.22);
}
button.secondary{
  color:#dce7e7;
  background:linear-gradient(180deg,rgba(255,255,255,.10),rgba(255,255,255,.045));
}
button.danger{
  color:#fff7ed;
  border-color:rgba(255,148,61,.55);
  background:linear-gradient(90deg,rgba(146,67,12,.82),rgba(104,48,13,.36));
}
button.wide{width:100%;min-height:36px;border-radius:10px;font-size:13px}
input,select{
  width:100%;
  margin-top:8px;
  border:1px solid rgba(255,255,255,.20);
  border-radius:12px;
  background:linear-gradient(180deg,rgba(255,255,255,.13),rgba(255,255,255,.065));
  color:var(--ink);
  min-height:36px;
  padding:9px 12px;
  outline:none;
  box-shadow:inset 0 1px rgba(255,255,255,.08),0 10px 22px rgba(0,0,0,.08);
  backdrop-filter:blur(12px);
}
input:focus,select:focus{border-color:rgba(53,240,124,.7);box-shadow:0 0 0 3px rgba(53,240,124,.11)}
input::placeholder{color:rgba(215,226,225,.42)}
label{display:block;margin:12px 0;color:#c0cccf;font-size:13px;font-weight:700}
table{width:100%;border-collapse:collapse}
th,td{padding:12px 14px;border-bottom:1px solid rgba(255,255,255,.07);font-size:13px;text-align:left;vertical-align:middle}
th{color:#9caeb3;font-size:12px;font-weight:800;background:rgba(255,255,255,.075)}
td{color:#dce7e7}
tbody tr{background:rgba(255,255,255,.018)}
tbody tr:hover{background:rgba(53,240,124,.055)}
tr:last-child td{border-bottom:0}

.hidden{display:none!important}
.app-logo{
  width:42px;
  height:42px;
  border-radius:12px;
  background:#020805 url("/assets/logo.png") center/86% no-repeat;
  border:1px solid rgba(53,240,124,.38);
  box-shadow:0 0 26px rgba(53,240,124,.34);
}
.brand-row{
  position:relative;
  z-index:1;
  display:flex;
  align-items:center;
  gap:14px;
  width:min(1180px,calc(100% - 48px));
  margin:18px auto 0;
}
.brand-row strong{display:block;font-size:24px;line-height:1;font-weight:900;letter-spacing:-.04em}
.brand-row span{display:block;margin-top:4px;color:#a8b3ba;font-size:12px;letter-spacing:.28em}
.auth-page{
  min-height:100vh;
  position:relative;
  overflow:hidden;
}
.auth-page:before{
  content:"";
  position:absolute;
  inset:-12%;
  pointer-events:none;
  background:
    radial-gradient(ellipse at 18% 32%,rgba(0,218,205,.58),transparent 31%),
    radial-gradient(ellipse at 44% 58%,rgba(120,229,114,.48),transparent 24%),
    radial-gradient(ellipse at 77% 42%,rgba(168,71,112,.54),transparent 34%),
    radial-gradient(ellipse at 78% 86%,rgba(81,137,185,.48),transparent 34%);
  filter:blur(18px);
  opacity:.74;
}
.auth-page:after{
  content:"";
  position:absolute;
  left:22%;
  right:22%;
  bottom:12%;
  height:90px;
  pointer-events:none;
  background:radial-gradient(ellipse,rgba(231,255,246,.55),rgba(87,185,161,.24) 34%,transparent 70%);
  filter:blur(18px);
  opacity:.76;
}
.auth-stage{
  position:relative;
  z-index:1;
  min-height:calc(100vh - 76px);
  display:grid;
  align-content:center;
  justify-items:center;
  gap:26px;
  padding:30px 20px 90px;
}
.auth-card{
  width:min(372px,calc(100vw - 34px));
  padding:18px 16px 17px;
  border-radius:18px;
  background:linear-gradient(180deg,rgba(13,31,32,.78),rgba(8,18,20,.88));
  border:1px solid rgba(53,240,124,.32);
  box-shadow:0 30px 90px rgba(0,0,0,.38),0 0 42px rgba(53,240,124,.12),inset 0 1px rgba(255,255,255,.08);
  backdrop-filter:blur(16px);
}
.auth-form{display:none}
.auth-form.active{display:block}
.auth-form h1{
  margin:0 0 14px;
  color:#35f07c;
  font-size:17px;
  font-weight:900;
}
.auth-links{
  display:flex;
  justify-content:center;
  gap:22px;
  margin-top:13px;
  min-height:22px;
}
.link-button{
  min-height:auto;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  color:#bdc8ca;
  font-size:14px;
  font-weight:700;
  box-shadow:none;
}
.link-button:hover{transform:none;color:#fff;filter:none;box-shadow:none}
.link-button.accent{color:#d7d46e}
.link-button.active{color:#35f07c}
.hero-metrics{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:0;
  width:min(380px,calc(100vw - 44px));
  color:#fff;
}
.hero-metrics div{text-align:center;border-right:1px solid rgba(255,255,255,.18)}
.hero-metrics div:last-child{border-right:0}
.hero-metrics b{display:block;font-size:28px;line-height:1;font-weight:900}
.hero-metrics span{display:block;margin-top:6px;color:#b6c0c3;font-size:13px}
.hero-line{
  margin:0;
  color:rgba(242,248,247,.68);
  font-size:31px;
  font-weight:900;
  letter-spacing:-.04em;
  text-align:center;
}

.workspace{position:relative;z-index:1;display:flex;min-height:100vh}
.side{
  width:248px;
  padding:18px 12px;
  background:rgba(5,10,15,.78);
  border-right:1px solid rgba(255,255,255,.12);
  backdrop-filter:blur(20px);
}
.side-brand{display:flex;align-items:center;gap:12px;padding:8px 8px 28px}
.side-brand strong{display:block;font-size:21px;font-weight:900;letter-spacing:-.04em}
.side-brand span{display:block;margin-top:4px;color:#8a989e;font-size:12px}
.nav{
  width:100%;
  justify-content:flex-start;
  text-align:left;
  min-height:34px;
  margin:4px 0;
  padding:6px 11px;
  border-radius:7px;
  color:#a9b7bb;
  background:transparent;
  font-size:13px;
}
.side .nav:hover{
  transform:none;
  color:#f4fff8;
  border-color:rgba(53,240,124,.38);
  background:linear-gradient(90deg,rgba(0,82,45,.72),rgba(0,54,38,.34));
  box-shadow:inset 0 1px rgba(255,255,255,.06),0 12px 28px rgba(0,50,31,.25);
  filter:none;
}
.nav:before{
  content:"";
  display:inline-block;
  width:7px;
  height:7px;
  margin-right:10px;
  border-radius:50%;
  background:#33414a;
}
.side .nav:hover:before{
  background:#35f07c;
  box-shadow:0 0 14px rgba(53,240,124,.78);
}
.nav.active{
  color:#fff;
  background:linear-gradient(90deg,rgba(0,92,50,.82),rgba(53,240,124,.10));
  border-color:rgba(53,240,124,.44);
  box-shadow:inset 0 1px rgba(255,255,255,.07),0 14px 34px rgba(0,62,38,.28);
}
.nav.active:before{background:#62ff88;box-shadow:0 0 14px rgba(98,255,136,.75)}
.nav.muted{margin-top:26px;color:#77858b}
.side .nav.muted:hover{
  color:#fff7ed;
  border-color:rgba(255,148,61,.68);
  background:linear-gradient(90deg,rgba(146,67,12,.86),rgba(104,48,13,.38));
  box-shadow:inset 0 1px rgba(255,255,255,.08),0 14px 34px rgba(150,73,18,.30);
}
.side .nav.muted:hover:before{
  background:#ff9f43;
  box-shadow:0 0 16px rgba(255,159,67,.82);
}
.main{flex:1;width:calc(100% - 248px);max-width:1680px;margin:0 auto;padding:24px 34px 42px}
.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:20px;
  margin-bottom:22px;
  min-height:66px;
  padding:0 4px;
}
.eyebrow{display:block;color:#8cff9c;font-size:12px;font-weight:900;letter-spacing:.26em}
.topbar h2{margin:8px 0 0;font-size:30px;line-height:1;font-weight:900;letter-spacing:-.04em}
.view{display:none}
.view.active{display:block}
.stats{display:grid;grid-template-columns:repeat(4,minmax(150px,1fr));gap:14px;margin-bottom:18px}
.stat{
  min-height:104px;
  padding:18px;
  border:1px solid rgba(255,255,255,.15);
  border-radius:18px;
  background:linear-gradient(155deg,rgba(255,255,255,.14),rgba(255,255,255,.055) 55%,rgba(67,126,116,.12));
  box-shadow:0 18px 50px rgba(0,0,0,.18),inset 0 1px rgba(255,255,255,.09);
  backdrop-filter:blur(18px) saturate(1.18);
}
.stat span{display:block;color:#91a0a7;font-size:13px;font-weight:800}
.stat b{display:block;margin-top:14px;font-size:30px;line-height:1;font-weight:900}
.panel{
  position:relative;
  overflow:hidden;
  padding:22px;
  margin-bottom:18px;
  border:1px solid rgba(255,255,255,.16);
  border-radius:20px;
  background:
    linear-gradient(145deg,rgba(255,255,255,.135),rgba(255,255,255,.055) 52%,rgba(47,102,91,.14)),
    linear-gradient(180deg,rgba(23,42,47,.54),rgba(11,18,22,.42));
  box-shadow:0 22px 70px rgba(0,0,0,.20),inset 0 1px rgba(255,255,255,.10);
  backdrop-filter:blur(22px) saturate(1.18);
}
.panel:before{
  content:"";
  position:absolute;
  left:0;
  right:0;
  top:0;
  height:1px;
  background:linear-gradient(90deg,transparent,rgba(255,255,255,.48),transparent);
  pointer-events:none;
}
.panel.narrow{max-width:520px}
.panel-head{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:16px}
h3{margin:0;font-size:20px;font-weight:900;letter-spacing:-.03em}
.toolbar{display:flex;gap:12px;margin-bottom:16px}
.toolbar select{max-width:180px}
.table-wrap{
  overflow:auto;
  border:1px solid rgba(255,255,255,.12);
  border-radius:14px;
  background:linear-gradient(180deg,rgba(255,255,255,.075),rgba(255,255,255,.035));
  box-shadow:inset 0 1px rgba(255,255,255,.06);
  backdrop-filter:blur(14px);
}
.admin-stats{
  grid-template-columns:repeat(4,minmax(132px,1fr));
  gap:12px;
  margin-bottom:16px;
}
.admin-stats .stat{
  min-height:82px;
  padding:14px 15px;
  border-radius:16px;
}
.admin-stats .stat span{font-size:12px}
.admin-stats .stat b{margin-top:10px;font-size:26px}
.admin-layout{
  display:grid;
  grid-template-columns:360px minmax(0,1fr);
  gap:18px;
  align-items:start;
}
.admin-data{
  min-width:0;
}
.admin-card{
  margin-bottom:0;
  min-height:0;
}
.admin-tools{
  position:sticky;
  top:24px;
  display:grid;
  gap:13px;
  padding:17px;
  border-color:rgba(53,240,124,.22);
  background:
    linear-gradient(160deg,rgba(255,255,255,.12),rgba(255,255,255,.055) 48%,rgba(20,96,63,.18)),
    linear-gradient(180deg,rgba(15,32,35,.58),rgba(7,13,17,.44));
}
.tools-title{
  padding:1px 4px 2px;
}
.tools-title span{
  display:block;
  color:#71f992;
  font-size:11px;
  font-weight:900;
  letter-spacing:.24em;
}
.tools-title h3{
  margin-top:6px;
  font-size:22px;
}
.tool-section{
  padding:14px;
  border:1px solid rgba(255,255,255,.12);
  border-radius:16px;
  background:
    linear-gradient(145deg,rgba(255,255,255,.105),rgba(255,255,255,.045)),
    rgba(6,14,17,.20);
  box-shadow:inset 0 1px rgba(255,255,255,.08),0 14px 34px rgba(0,0,0,.14);
}
.tool-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  margin-bottom:10px;
}
.tool-head strong{
  color:#f3fffa;
  font-size:15px;
  font-weight:900;
}
.tool-head em{
  color:#8fa0a3;
  font-size:12px;
  font-style:normal;
  white-space:nowrap;
}
.tool-section label{margin:8px 0;font-size:12px}
.tool-section input{min-height:34px;border-radius:10px}
.tool-section button{width:100%;min-height:30px;border-radius:8px}
.tool-section pre{
  min-height:36px;
  max-height:92px;
  margin-top:10px;
}
.users-card{
  min-height:560px;
}
.users-card .table-wrap{
  min-height:430px;
}
.admin-card .panel-head{margin-bottom:14px}
.panel-kicker{
  display:block;
  margin-bottom:8px;
  color:#71f992;
  font-size:11px;
  font-weight:900;
  letter-spacing:.24em;
}
.admin-page-card{
  width:min(720px,100%);
  min-height:360px;
  padding:26px;
}
.admin-page-card.wide{
  width:min(980px,100%);
}
.admin-form-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:2px 14px;
}
.admin-page-card .span2{grid-column:span 2}
.admin-page-card pre{
  min-height:92px;
  margin-top:16px;
}
.codes-page-card pre{
  max-height:150px;
}
.page-action{
  width:min(220px,100%);
  margin-top:10px;
}
.action-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
}
.action-row .page-action{
  margin-top:10px;
}
.panel-head button,.toolbar button{
  min-height:28px;
  padding:4px 10px;
  border-radius:7px;
}
.records-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:16px;
  margin:24px 0 12px;
}
.records-head h4{
  margin:0;
  font-size:18px;
  font-weight:900;
}
.records-head span{
  color:#8fa0a3;
  font-size:12px;
  font-weight:700;
}
.code-records{
  display:grid;
  gap:14px;
}
.code-day{
  overflow:hidden;
  border:1px solid rgba(255,255,255,.12);
  border-radius:16px;
  background:linear-gradient(180deg,rgba(255,255,255,.075),rgba(255,255,255,.035));
  backdrop-filter:blur(14px);
}
.code-day-head{
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding:13px 15px;
  border-bottom:1px solid rgba(255,255,255,.08);
  background:linear-gradient(90deg,rgba(53,240,124,.12),rgba(255,255,255,.035));
}
.code-day-head strong{
  color:#f4fff8;
  font-size:15px;
}
.code-day-head span{
  color:#9fb0b3;
  font-size:12px;
  font-weight:800;
}
.code-batch{
  padding:14px 15px;
  border-bottom:1px solid rgba(255,255,255,.07);
}
.code-batch:last-child{border-bottom:0}
.code-batch-main{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.code-batch-main > div:first-child{
  display:grid;
  gap:4px;
}
.code-batch-main b{
  color:#75ff98;
  font-size:14px;
  letter-spacing:.04em;
}
.code-batch-main span{
  color:#9dadb1;
  font-size:12px;
}
.small-action{
  min-height:26px;
  padding:3px 9px;
  border-radius:7px;
  font-size:12px;
}
.batch-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
}
.code-batch-meta{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:10px;
}
.code-batch-meta span{
  padding:5px 9px;
  border:1px solid rgba(255,255,255,.10);
  border-radius:999px;
  color:#dce7e7;
  background:rgba(255,255,255,.055);
  font-size:12px;
  font-weight:700;
}
.code-list{
  display:flex;
  flex-wrap:wrap;
  gap:7px;
  margin-top:12px;
}
.code-list span{
  padding:6px 9px;
  border:1px solid rgba(53,240,124,.18);
  border-radius:9px;
  color:#cfe8dc;
  background:rgba(7,18,16,.38);
  font-family:Consolas,"Microsoft YaHei",monospace;
  font-size:12px;
}
.empty-state,.record-hint{
  padding:16px;
  border:1px dashed rgba(255,255,255,.16);
  border-radius:14px;
  color:#9fb0b3;
  background:rgba(255,255,255,.04);
  font-size:13px;
}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 12px}
.form-grid.compact{gap:0 10px}
.span2{grid-column:span 2}
.rule-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 10px}
.panel-actions{margin-top:8px}
pre{
  margin:14px 0 0;
  min-height:42px;
  max-height:220px;
  overflow:auto;
  white-space:pre-wrap;
  color:#cfe8dc;
  background:linear-gradient(180deg,rgba(255,255,255,.08),rgba(255,255,255,.04));
  border:1px solid rgba(255,255,255,.12);
  border-radius:13px;
  padding:12px;
  font-size:12px;
}
.delta-plus{color:#56ff91;font-weight:900}
.delta-minus{color:#ff7474;font-weight:900}
#toast{
  position:fixed;
  right:22px;
  bottom:22px;
  z-index:20;
  max-width:360px;
  padding:13px 16px;
  border-radius:13px;
  color:#fff;
  background:rgba(10,17,22,.94);
  border:1px solid rgba(53,240,124,.28);
  box-shadow:0 20px 50px rgba(0,0,0,.36);
  opacity:0;
  transform:translateY(8px);
  pointer-events:none;
  transition:.18s ease;
}
#toast.show{opacity:1;transform:translateY(0)}

@media(max-width:1100px){
  .admin-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
  .admin-layout{grid-template-columns:1fr}
  .admin-tools{position:relative;top:auto}
  .rule-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .stats{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:760px){
  .workspace{display:block}
  .side{width:auto}
  .main{width:auto;padding:20px}
  .stats{grid-template-columns:1fr}
  .rule-grid{grid-template-columns:1fr}
  .users-card,.users-card .table-wrap{min-height:0}
  .toolbar{display:grid}
  .toolbar select{max-width:none}
  .hero-line{font-size:24px}
}
