:root {
  --bg: #070d15;
  --bg2: #0b1420;
  --panel: #0f1a28;
  --panel2: #132134;
  --line: rgba(255, 255, 255, 0.08);
  --line2: rgba(255, 255, 255, 0.14);
  --text: #e8eef4;
  --muted: #8a9bb0;
  --green: #169b45;
  --green2: #1fbf58;
  --red: #e11d2e;
  --gold: #f5b82e;
  --r: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at -10% -10%, rgba(22, 155, 69, 0.16), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(225, 29, 46, 0.12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 14px/1.45 'Inter', system-ui, sans-serif;
}
[hidden] { display: none !important; }
h1, h2, h3, .brand b, .stat b, .login-k { font-family: 'Archivo', sans-serif; font-stretch: 112%; }
h2 { font-size: 17px; margin: 0; letter-spacing: 0.01em; }
small { color: var(--muted); font-weight: 500; }
a { color: inherit; }

/* buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text);
  font: 600 13px 'Inter', sans-serif; cursor: pointer; text-decoration: none; white-space: nowrap; transition: .15s;
}
.btn:hover { border-color: rgba(255,255,255,.28); background: #182a40; }
.btn.primary { background: linear-gradient(135deg, var(--green2), var(--green)); border-color: transparent; color: #fff; box-shadow: 0 6px 18px -8px rgba(31,191,88,.7); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: #ff8a94; border-color: rgba(225,29,46,.4); }
.btn.danger:not(.ghost) { background: rgba(225,29,46,.12); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn.wide { width: 100%; height: 42px; }
.btn:disabled { opacity: .55; cursor: progress; }
.link { background: none; border: 0; color: var(--green2); cursor: pointer; font: inherit; padding: 0; }
.link:hover { text-decoration: underline; }
input, select, textarea {
  width: 100%; background: var(--bg2); color: var(--text); border: 1px solid var(--line2); border-radius: 9px;
  padding: 9px 11px; font: 14px 'Inter', sans-serif; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--green2); box-shadow: 0 0 0 3px rgba(31,191,88,.18); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--green2); }
input[type=color] { padding: 2px; height: 36px; width: 46px; cursor: pointer; }
textarea { resize: vertical; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; margin-bottom: 12px; }
.ar-in { font-family: 'Cairo', sans-serif; font-size: 16px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 0 0 12px; }
.err { color: #ff8a94; min-height: 1em; margin: 6px 0; font-size: 13px; }
.grow { flex: 1; }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: min(400px, 100%); background: linear-gradient(160deg, rgba(22,155,69,.14), rgba(15,26,40,.95) 40%); border: 1px solid var(--line2);
  border-radius: 20px; padding: 32px 28px 22px; box-shadow: 0 30px 80px -30px #000; text-align: center;
}
.login-card label { text-align: left; }
.login-logo { width: 92px; filter: drop-shadow(0 8px 20px rgba(0,0,0,.5)); }
.login-k { font-size: 11px; letter-spacing: .18em; color: var(--muted); margin-top: 10px; font-weight: 700; }
.login-card h1 { margin: 4px 0 22px; font-size: 26px; }
.login-pw { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; margin-top: 8px; }
.login-pw img { height: 30px; }

/* top bar */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 22px; padding: 10px 22px;
  background: rgba(7,13,21,.82); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
}
.top::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--red); opacity: .7; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 38px; }
.brand small { display: block; font-size: 10px; letter-spacing: .16em; font-weight: 700; }
.brand b { font-size: 15px; letter-spacing: .01em; }
.tabs { display: flex; gap: 4px; background: var(--bg2); padding: 4px; border-radius: 11px; border: 1px solid var(--line); }
.tabs button { background: none; border: 0; color: var(--muted); font: 600 13px 'Inter'; padding: 7px 14px; border-radius: 8px; cursor: pointer; }
.tabs button.on { background: var(--panel2); color: #fff; box-shadow: inset 0 0 0 1px var(--line2); }
.me { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.view { padding: 22px; max-width: 1500px; margin: 0 auto; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; position: relative; overflow: hidden; cursor: pointer; transition: .15s; }
.stat:hover { border-color: var(--line2); }
.stat.on { border-color: var(--c, var(--green2)); box-shadow: inset 0 0 0 1px var(--c, var(--green2)); }
.stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c, var(--green2)); }
.stat b { display: block; font-size: 24px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 12px; font-weight: 600; }

/* toolbar */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar select { width: auto; min-width: 150px; }
.search { position: relative; flex: 0 1 340px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; fill: var(--muted); }
.search input { padding-left: 36px; }
.bulk { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; background: linear-gradient(90deg, rgba(31,191,88,.16), rgba(31,191,88,.04)); border: 1px solid rgba(31,191,88,.35); border-radius: var(--r); margin-bottom: 12px; }
.bulk b { margin-right: 6px; }

/* table */
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: auto; }
.grid { width: 100%; border-collapse: collapse; min-width: 900px; }
.grid th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 11px 12px; border-bottom: 1px solid var(--line); background: var(--bg2); position: sticky; top: 0; }
.grid td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tr:last-child td { border-bottom: 0; }
.grid tbody tr { cursor: pointer; transition: background .12s; }
.grid tbody tr:hover { background: rgba(255,255,255,.025); }
.grid tbody tr.sel { background: rgba(31,191,88,.07); }
.ck { width: 36px; }
.thumb { width: 38px; height: 48px; border-radius: 7px; object-fit: cover; background: var(--panel2); display: block; box-shadow: 0 0 0 1px var(--line2); }
.thumb.none { display: grid; place-items: center; color: #ffb347; font-size: 16px; }
.nm b { display: block; font-family: 'Archivo'; font-stretch: 110%; letter-spacing: .01em; }
.nm small { font-size: 12px; }
.nm .code { font-family: 'Archivo'; font-weight: 700; font-size: 11px; letter-spacing: .1em; color: var(--muted); }
.nm .ar { font-family: 'Cairo'; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: color-mix(in srgb, var(--c) 18%, transparent); color: color-mix(in srgb, var(--c) 70%, #fff); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); white-space: nowrap; }
.fn { font-size: 13px; } .fn small { display: flex; align-items: center; gap: 6px; font-size: 12px; } .fn img { width: 18px; border-radius: 2px; }
.zmini { display: flex; gap: 3px; flex-wrap: wrap; max-width: 190px; }
.zmini span { width: 20px; height: 20px; border-radius: 4px; display: grid; place-items: center; font: 800 11px 'Archivo'; color: #0b1530; }
.zmini span.sp { background: transparent !important; color: #fff; box-shadow: inset 0 0 0 1.5px #fff; }
.zmini span.off { opacity: .14; }
.vd { font-size: 12.5px; white-space: nowrap; } .vd small { display: block; }
.st { font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.st::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--green2); box-shadow: 0 0 8px var(--green2); }
.st.revoked { color: #ff8a94; } .st.revoked::before { background: var(--red); box-shadow: 0 0 8px var(--red); }
.st + small { display: block; font-size: 11.5px; }
.rowact { display: flex; gap: 6px; justify-content: flex-end; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty img { width: 90px; opacity: .55; }
.empty h3 { color: var(--text); margin: 10px 0 4px; }

/* setup lists */
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.panel-h.mt { margin-top: 20px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; align-items: center; background: var(--bg2); border: 1px solid var(--line); border-radius: 11px; padding: 10px; }
.item.zone { grid-template-columns: 46px 64px 1fr 110px auto; }
.item input, .item select { margin: 0; }
.item .dz { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 5px; }
.item .acts { display: flex; gap: 6px; }

/* zone toggles */
.ztog { display: flex; flex-wrap: wrap; gap: 7px; }
.zt { display: inline-flex; align-items: center; gap: 8px; padding: 6px 11px 6px 6px; border-radius: 9px; border: 1px solid var(--line2); background: var(--bg2); cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); user-select: none; transition: .12s; }
.zt i { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; font: 900 13px 'Archivo'; font-style: normal; color: #0b1530; background: var(--z); opacity: .3; transition: .12s; }
.zt.sp i { background: transparent; color: #fff; box-shadow: inset 0 0 0 2px #fff; }
.zt.on { color: #fff; border-color: color-mix(in srgb, var(--z) 70%, transparent); background: color-mix(in srgb, var(--z) 14%, var(--bg2)); }
.zt.sp.on { border-color: #fff; background: rgba(255,255,255,.08); }
.zt.on i { opacity: 1; }
.zt.mini { padding: 3px; } .zt.mini i { width: 22px; height: 22px; font-size: 12px; }

/* drawer editor */
.drawer { position: fixed; inset: 0; z-index: 50; background: rgba(3,6,10,.72); backdrop-filter: blur(6px); display: flex; justify-content: flex-end; animation: fade .18s; }
.drawer-in { width: min(1180px, 100%); height: 100%; background: var(--bg); border-left: 1px solid var(--line2); display: grid; grid-template-columns: minmax(380px, 520px) 1fr; animation: slide .25s cubic-bezier(.2,.8,.2,1); }
@keyframes fade { from { opacity: 0 } }
@keyframes slide { from { transform: translateX(40px); opacity: 0 } }
.ed-form { overflow: auto; padding: 20px 22px; border-right: 1px solid var(--line); }
.ed-h { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.ed-h small { font-family: 'Archivo'; letter-spacing: .14em; font-weight: 700; font-size: 11px; }
.ed-h h2 { font-size: 21px; margin-top: 2px; }
.x { background: none; border: 0; color: var(--muted); font-size: 28px; line-height: 1; cursor: pointer; }
.x:hover { color: #fff; }
.ed-photo { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.drop { position: relative; width: 104px; height: 130px; flex: none; border-radius: 12px; border: 1.5px dashed var(--line2); background: var(--bg2); display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 12.5px; font-weight: 600; overflow: hidden; cursor: pointer; transition: .15s; }
.drop:hover, .drop.over { border-color: var(--green2); color: #fff; background: rgba(31,191,88,.06); }
.drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.fs { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 12px; background: rgba(255,255,255,.015); }
.fs-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 13px; }
.fs-h span { font-size: 12.5px; color: var(--muted); }
.fs label { margin-bottom: 4px; }
.ed-actions { display: flex; gap: 8px; align-items: center; position: sticky; bottom: -20px; background: var(--bg); padding: 14px 0 20px; border-top: 1px solid var(--line); margin-top: 8px; }

.preview-pane { display: flex; flex-direction: column; min-height: 0; padding: 18px; background: radial-gradient(600px 400px at 50% 30%, rgba(255,255,255,.035), transparent 70%); }
.pv-h { font: 700 12px 'Inter'; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.pv-tag { text-transform: none; letter-spacing: 0; font-weight: 600; background: var(--panel2); border: 1px solid var(--line); border-radius: 99px; padding: 2px 9px; }
.pv-frame { flex: 1; min-height: 0; position: relative; }
.pv-frame iframe { position: absolute; left: 50%; top: 0; border: 0; transform-origin: top center; background: transparent; }

.cols-ev { display: grid; grid-template-columns: minmax(380px, 560px) 1fr; gap: 18px; align-items: start; }
.cols-ev .preview-pane { position: sticky; top: 80px; height: calc(100vh - 110px); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.sponsors { display: flex; flex-wrap: wrap; gap: 10px; }
.spn { position: relative; background: #fff; border-radius: 10px; padding: 18px 12px 26px; height: 92px; display: grid; place-items: center; }
.spn img { max-height: 40px; max-width: 130px; }
.spn button.del { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--red); color: #fff; cursor: pointer; font-weight: 700; }

/* dialog & toast */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line2); border-radius: 16px; padding: 20px; width: min(520px, calc(100vw - 32px)); box-shadow: 0 30px 80px -20px #000; }
dialog::backdrop { background: rgba(3,6,10,.7); backdrop-filter: blur(4px); }
dialog h3 { margin: 0 0 14px; }
.dlg-a { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 30px); background: var(--panel2); border: 1px solid var(--line2); padding: 11px 18px; border-radius: 11px; font-weight: 600; opacity: 0; pointer-events: none; transition: .25s; z-index: 99; box-shadow: 0 12px 30px -10px #000; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: rgba(225,29,46,.6); color: #ffb3ba; }
.spin { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg) } }

@media (max-width: 1000px) {
  .drawer-in { grid-template-columns: 1fr; overflow: auto; }
  .ed-form { overflow: visible; border-right: 0; }
  .ed-preview { height: 560px; flex: none; }
  .cols2, .cols-ev { grid-template-columns: 1fr; }
  .cols-ev .preview-pane { position: static; height: 560px; }
}
@media (max-width: 700px) {
  .top { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
  .view { padding: 16px; }
  .f2 { grid-template-columns: 1fr; }
  .search { flex: 1 1 100%; }
  .item.zone { grid-template-columns: 46px 56px 1fr; }
  .item.zone select { grid-column: 2 / 4; }
}

/* admins */
.adm { grid-template-columns: 40px 1fr auto; }
.adm .av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font: 800 15px 'Archivo'; background: linear-gradient(135deg, var(--green2), var(--green)); color: #fff; }
.adm b { display: block; } .adm small { display: block; font-size: 12px; }
.you { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; color: var(--green2); margin-left: 6px; }
.pwbox { display: flex; gap: 8px; align-items: center; background: var(--bg2); border: 1px dashed var(--green2); border-radius: 10px; padding: 12px; font: 700 18px 'Inter'; letter-spacing: .04em; }
.pwbox code { flex: 1; user-select: all; }

.spn .rank { position: absolute; top: 4px; left: 8px; font: 700 9.5px 'Inter'; color: #5b6b7c; letter-spacing: .04em; text-transform: uppercase; }
.spn .mv { position: absolute; bottom: 4px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.spn .mv button { border: 0; background: #e8edf2; color: #0b1530; border-radius: 6px; width: 26px; height: 18px; font-size: 10px; cursor: pointer; }
.spn .mv button:hover { background: #cfd8e1; }
