/* ==========================================================================
   ABC Tap Test กค Control Center
   Neon "cyber arena" theme matching the mobile app. Dark by default, light optional.
   ========================================================================== */

:root {
  --bg: #07090d;
  --bg-2: #0a0e14;
  --panel: #0f131b;
  --panel-2: #141a24;
  --panel-3: #1a2130;
  --line: #212938;
  --line-2: #2d3748;
  --text: #eef2f7;
  --muted: #8e98a6;
  --faint: #5f6977;
  --cyan: #00deed;
  --cyan-2: #00a8c2;
  --pink: #ff2e74;
  --yellow: #f2df20;
  --green: #00e85a;
  --purple: #b54bff;
  --orange: #ff9a3d;
  --on-accent: #02090b;
  --glow: rgba(0, 222, 237, .18);
  --shadow: 0 10px 40px -12px rgba(0, 0, 0, .6);
  --radius: 16px;
  --radius-sm: 11px;
  --sidebar: 264px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Chakra Petch", "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f2f5f9;
  --bg-2: #e9eef4;
  --panel: #ffffff;
  --panel-2: #f6f8fb;
  --panel-3: #edf1f6;
  --line: #e1e7ee;
  --line-2: #cfd8e3;
  --text: #0d1420;
  --muted: #586373;
  --faint: #8792a1;
  --cyan: #00929f;
  --cyan-2: #007a86;
  --pink: #d6004f;
  --yellow: #a08a00;
  --green: #00924a;
  --purple: #8a2be2;
  --orange: #d06a00;
  --on-accent: #ffffff;
  --glow: rgba(0, 146, 159, .14);
  --shadow: 0 10px 30px -14px rgba(15, 30, 50, .25);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 14px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(600px 400px at 85% -10%, var(--glow), transparent 70%),
    radial-gradient(500px 380px at -5% 105%, rgba(255, 46, 116, .07), transparent 70%),
    radial-gradient(circle, color-mix(in srgb, var(--cyan) 10%, transparent) 1px, transparent 1.4px) 0 0 / 22px 22px;
  z-index: 0;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--display); margin: 0; letter-spacing: .01em; line-height: 1.2; }
code, .mono { font-family: var(--mono); font-size: .9em; }
.ic { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 6px; }

/* ---------- Shell ---------- */
.shell { position: relative; z-index: 1; display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar);
  display: flex; flex-direction: column;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--line);
  z-index: 40;
  transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 18px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo { width: 40px; height: 40px; flex: none; filter: drop-shadow(0 0 10px var(--glow)); }
.brand b { display: block; font-family: var(--display); font-size: 17px; letter-spacing: .14em; }
.brand span { display: block; font-size: 11px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; }
.nav-label { margin: 16px 10px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin: 2px 0; border-radius: 12px;
  color: var(--muted); font-weight: 600;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav-item.active { color: var(--text); background: linear-gradient(90deg, color-mix(in srgb, var(--cyan) 16%, transparent), transparent); }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--cyan); box-shadow: 0 0 12px var(--cyan);
}
.nav-item.active .ic { color: var(--cyan); }
.nav-badge { margin-left: auto; min-width: 20px; padding: 1px 7px; border-radius: 20px; font-size: 11px; font-weight: 800; text-align: center; background: var(--yellow); color: #1c1a00; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--line); }
.me-card { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); }
.me-card .who { min-width: 0; flex: 1; }
.me-card .who b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-card .who a { color: var(--text); }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar); display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; min-width: 0; }
.crumbs b { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs .ic { width: 14px; height: 14px; }
.topbar .spacer { flex: 1; }
.content { padding: 26px 28px 60px; max-width: 1440px; width: 100%; }
.icon-btn.menu-btn { display: none; }
.scrim { display: none; }

/* ---------- Page head ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 28px; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--cyan); margin-bottom: 8px; }

/* ---------- Buttons ---------- */
.btn {
  --c: var(--cyan);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 12px;
  border: 1px solid transparent; cursor: pointer;
  font: 700 13.5px/1 var(--font); letter-spacing: .01em; white-space: nowrap;
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 70%, #fff));
  box-shadow: 0 6px 20px -8px var(--c);
  transition: transform .12s, box-shadow .15s, background .15s, opacity .15s;
}
.btn:hover { text-decoration: none; box-shadow: 0 8px 26px -8px var(--c); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn[disabled], .btn.is-busy { opacity: .6; pointer-events: none; }
.btn-ghost { color: var(--text); background: var(--panel-2); border-color: var(--line-2); box-shadow: none; }
.btn-ghost:hover { background: var(--panel-3); box-shadow: none; }
.btn-outline { color: var(--c); background: color-mix(in srgb, var(--c) 8%, transparent); border-color: color-mix(in srgb, var(--c) 55%, transparent); box-shadow: none; }
.btn-outline:hover { background: color-mix(in srgb, var(--c) 14%, transparent); box-shadow: none; }
.btn-danger { --c: var(--pink); }
.btn-warn { --c: var(--yellow); }
.btn-green { --c: var(--green); }
.btn-purple { --c: var(--purple); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 10px; }
.btn-icon { width: 36px; padding: 0; height: 36px; }
.btn-icon.btn-sm { width: 32px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
}
.icon-btn:hover { color: var(--text); background: var(--panel-3); border-color: var(--line-2); text-decoration: none; }
.icon-btn.danger:hover { color: var(--pink); border-color: color-mix(in srgb, var(--pink) 50%, transparent); }

/* ---------- Cards ---------- */
.card {
  position: relative;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 15.5px; display: flex; align-items: center; gap: 10px; }
.card-head h3 .ic { color: var(--cyan); }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.card-body { padding: 18px 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.card.glow { border-color: color-mix(in srgb, var(--cyan) 45%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--cyan) 12%, transparent), 0 18px 50px -20px var(--glow); }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty .orb { margin: 0 auto 12px; }
.empty h4 { color: var(--text); font-size: 16px; margin-bottom: 6px; }

.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.g-form { grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); align-items: start; }
.stack { display: grid; gap: 18px; }
.row { display: flex; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.mt { margin-top: 18px; }
.mt-s { margin-top: 10px; }
.sticky { position: sticky; top: 86px; }

/* ---------- KPI tiles ---------- */
.kpi { padding: 18px; display: flex; gap: 14px; align-items: flex-start; overflow: hidden; }
.kpi::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--tone, var(--cyan)) 22%, transparent), transparent 70%);
  pointer-events: none;
}
.kpi .label { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.kpi .value { font-family: var(--display); font-size: 30px; font-weight: 700; line-height: 1.15; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--faint); }
.kpi .sub .up { color: var(--green); font-weight: 700; }
.orb {
  --tone: var(--cyan);
  display: grid; place-items: center; flex: none;
  width: 44px; height: 44px; border-radius: 14px;
  color: var(--tone);
  background: color-mix(in srgb, var(--tone) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone) 30%, transparent);
  font-size: 22px; line-height: 1;
}
.orb.lg { width: 56px; height: 56px; border-radius: 18px; font-size: 28px; }
.orb.sm { width: 36px; height: 36px; border-radius: 11px; font-size: 18px; }
.orb.round { border-radius: 50%; }
.tone-cyan { --tone: var(--cyan); }
.tone-pink { --tone: var(--pink); }
.tone-yellow { --tone: var(--yellow); }
.tone-green { --tone: var(--green); }
.tone-purple { --tone: var(--purple); }
.tone-orange { --tone: var(--orange); }

/* ---------- Pills, chips, tags ---------- */
.pill {
  --c: var(--muted);
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 30px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 22%, transparent);
}
.pill .ic { width: 12px; height: 12px; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.pill-cyan { --c: var(--cyan); }
.pill-pink { --c: var(--pink); }
.pill-yellow { --c: var(--yellow); }
.pill-green { --c: var(--green); }
.pill-purple { --c: var(--purple); }
.pill-orange { --c: var(--orange); }
.pill-muted { --c: var(--muted); }
.tag { display: inline-block; padding: 3px 8px; border-radius: 7px; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; background: var(--yellow); color: #1c1a00; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 9px; font-size: 12px; font-weight: 600; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.chip.on { color: var(--text); border-color: color-mix(in srgb, var(--cyan) 40%, transparent); background: color-mix(in srgb, var(--cyan) 9%, transparent); }
.swatch { display: inline-block; width: 16px; height: 16px; border-radius: 5px; border: 1px solid var(--line-2); vertical-align: middle; }

/* ---------- Avatars ---------- */
.avatar {
  --h: 190;
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 12px;
  font: 700 13px/1 var(--display); letter-spacing: .02em;
  color: hsl(var(--h) 90% 72%);
  background: hsl(var(--h) 70% 50% / .16);
  border: 1px solid hsl(var(--h) 70% 55% / .3);
}
[data-theme="light"] .avatar { color: hsl(var(--h) 70% 32%); }
.avatar.sm { width: 30px; height: 30px; border-radius: 10px; font-size: 11px; }
.avatar.xl { width: 72px; height: 72px; border-radius: 22px; font-size: 24px; }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person .t { min-width: 0; }
.person b { display: block; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.person small { display: block; color: var(--faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.person:hover { text-decoration: none; }
a.person:hover b { color: var(--cyan); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; padding: 11px 16px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--faint); background: var(--panel-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--cyan) 3.5%, transparent); }
.table .right { text-align: right; }
.table .shrink { width: 1%; white-space: nowrap; }
.table tr.dragging { opacity: .45; }
.table tr.drop-before td { box-shadow: inset 0 2px 0 var(--cyan); }
.grip { cursor: grab; color: var(--faint); display: inline-grid; place-items: center; }
.grip:active { cursor: grabbing; }
.strike { text-decoration: line-through; color: var(--faint); font-size: 12px; margin-left: 6px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .end { margin-left: auto; text-align: right; }
.rank { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font: 700 12px var(--display); background: var(--panel-3); color: var(--muted); flex: none; }
.rank.r1 { background: color-mix(in srgb, var(--yellow) 20%, transparent); color: var(--yellow); }
.rank.r2 { background: color-mix(in srgb, var(--cyan) 15%, transparent); color: var(--cyan); }
.rank.r3 { background: color-mix(in srgb, var(--orange) 18%, transparent); color: var(--orange); }

/* ---------- Toolbar / filters / tabs ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar .grow { flex: 1; min-width: 200px; }
.search { position: relative; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 16px; height: 16px; }
.search .input { padding-left: 38px; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px; color: var(--muted); font-weight: 650; font-size: 13px; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { background: var(--panel); color: var(--text); box-shadow: 0 2px 10px -4px rgba(0, 0, 0, .4); border: 1px solid var(--line-2); }
.tab .count { font-size: 11px; padding: 0 7px; border-radius: 10px; background: var(--panel-3); color: var(--muted); }
.tab.active .count { background: color-mix(in srgb, var(--cyan) 18%, transparent); color: var(--cyan); }
.bulkbar {
  display: none; align-items: center; gap: 10px; padding: 10px 16px;
  background: color-mix(in srgb, var(--cyan) 9%, var(--panel)); border-bottom: 1px solid var(--line);
}
.bulkbar.show { display: flex; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; align-content: start; margin-bottom: 16px; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.label { font-size: 12.5px; font-weight: 700; color: var(--text); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 8px; }
.label .opt { color: var(--faint); font-weight: 500; }
.hint { font-size: 12px; color: var(--faint); }
.err { font-size: 12px; color: var(--pink); font-weight: 600; }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 13px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text);
  font: 14px var(--font); transition: border-color .15s, box-shadow .15s, background .15s;
  min-width: 0;
}
.textarea { height: auto; min-height: 110px; padding: 11px 13px; resize: vertical; line-height: 1.55; }
.select { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 18px, calc(100% - 13px) 18px; background-size: 5px 5px; background-repeat: no-repeat; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--cyan); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cyan) 18%, transparent); background: var(--panel); }
.is-invalid { border-color: var(--pink) !important; }
.input-group { display: flex; }
.input-group .input { border-radius: 12px 0 0 12px; }
.input-group .addon { white-space: nowrap; display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line-2); border-left: 0; border-radius: 0 12px 12px 0; background: var(--panel-2); color: var(--muted); font-weight: 700; font-size: 12.5px; }
.input-group .addon.btnish { cursor: pointer; }
.input-group .addon.btnish:hover { color: var(--cyan); }
.input-sm { height: 34px; border-radius: 10px; font-size: 13px; }
.input.mono { font-family: var(--mono); font-size: 13px; }
input[type="color"].input { padding: 4px; width: 56px; cursor: pointer; }
.form-row { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-section { padding: 20px; border-bottom: 1px solid var(--line); }
.form-section:last-child { border-bottom: 0; }
.form-section h4 { font-size: 13.5px; margin-bottom: 14px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }

/* Option cards (radio/checkbox) */
.options { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.option { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.option:hover { border-color: var(--faint); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option .tick { margin-left: auto; width: 20px; height: 20px; border-radius: 7px; border: 1.5px solid var(--line-2); display: grid; place-items: center; color: transparent; flex: none; transition: all .15s; }
.option .tick .ic { width: 13px; height: 13px; }
.option b { display: block; font-size: 13.5px; }
.option small { display: block; color: var(--faint); font-size: 12px; margin-top: 2px; line-height: 1.4; }
.option:has(input:checked) { border-color: var(--cyan); background: color-mix(in srgb, var(--cyan) 7%, var(--bg-2)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cyan) 12%, transparent); }
.option:has(input:checked) .tick { background: var(--cyan); border-color: var(--cyan); color: var(--on-accent); }
.option:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.option:has(input:focus-visible) { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* Switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { position: relative; width: 44px; height: 26px; border-radius: 30px; background: var(--panel-3); border: 1px solid var(--line-2); transition: background .2s, border-color .2s, box-shadow .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform .22s cubic-bezier(.3, 1.4, .5, 1), background .2s; }
.switch input:checked + .track { background: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 16px -2px var(--glow); }
.switch input:checked + .track::after { transform: translateX(18px); background: var(--on-accent); }
.switch input:focus-visible + .track { outline: 2px solid var(--cyan); outline-offset: 2px; }
.switch.pink input:checked + .track { background: var(--pink); border-color: var(--pink); }
.switch.yellow input:checked + .track { background: var(--yellow); border-color: var(--yellow); }
.switch.busy { opacity: .6; pointer-events: none; }
.toggle-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.toggle-row:last-child { border-bottom: 0; }
.toggle-row .txt { flex: 1; min-width: 0; }
.toggle-row b { display: block; font-size: 14px; }
.toggle-row small { color: var(--faint); font-size: 12.5px; }

/* ---------- Status hero (dashboard & control) ---------- */
.status-hero { display: flex; align-items: center; gap: 18px; padding: 20px; flex-wrap: wrap; }
.status-hero .beacon { position: relative; width: 58px; height: 58px; flex: none; display: grid; place-items: center; border-radius: 50%; color: var(--tone); background: color-mix(in srgb, var(--tone) 14%, transparent); }
.status-hero .beacon::before, .status-hero .beacon::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--tone); opacity: 0; animation: sonar 2.4s ease-out infinite; }
.status-hero .beacon::after { animation-delay: 1.2s; }
.status-hero .beacon .ic { width: 26px; height: 26px; }
.status-hero h2 { font-size: 22px; }
.status-hero .meta { display: flex; gap: 20px; flex-wrap: wrap; margin-left: auto; align-items: center; }
.meta-item small { display: block; font-size: 11px; color: var(--faint); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.meta-item b { font-family: var(--display); font-size: 16px; }
@keyframes sonar { 0% { transform: scale(.8); opacity: .7; } 100% { transform: scale(1.7); opacity: 0; } }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: url(#barGrad); transition: opacity .15s; }
.chart .bar:hover { opacity: .75; }
.chart .grid-line { stroke: var(--line); stroke-dasharray: 3 4; }
.chart .axis { fill: var(--faint); font: 600 10.5px var(--font); }
.chart .line { fill: none; stroke: var(--yellow); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--yellow) 50%, transparent)); }
.chart .pt { fill: var(--panel); stroke: var(--yellow); stroke-width: 2; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.meter { height: 8px; border-radius: 6px; background: var(--panel-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--cyan-2), var(--cyan)); }
.mode-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; padding: 9px 0; }
.mode-row .meter { grid-column: 1 / -1; }

/* ---------- Phone preview ---------- */
.phone {
  position: relative; width: 280px; max-width: 100%; margin: 0 auto; aspect-ratio: 9 / 18.5;
  border-radius: 38px; padding: 12px; background: #050608;
  border: 1px solid #2a3140; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .7), inset 0 0 0 2px #10141b;
}
.phone .screen { position: relative; height: 100%; border-radius: 28px; overflow: hidden; background: #080b0e; color: #f8f9fc; }
.phone .screen::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle, rgba(0, 222, 237, .09) 1px, transparent 1.4px) 0 0 / 18px 18px, radial-gradient(260px 200px at 80% 0%, rgba(0, 222, 237, .18), transparent 70%); }
.phone .notch { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 84px; height: 20px; border-radius: 20px; background: #000; z-index: 3; }
.phone .fake-app { position: absolute; inset: 44px 16px 16px; display: grid; align-content: start; gap: 10px; opacity: .55; }
.phone .fake-app .bar { height: 30px; border-radius: 10px; background: #10131b; border: 1px solid #272e3e; }
.phone .fake-app .hero { height: 90px; width: 90px; margin: 10px auto; border-radius: 50%; border: 2px solid #00deed; box-shadow: 0 0 30px rgba(0, 222, 237, .3); }
.phone .dim { position: absolute; inset: 0; background: rgba(0, 0, 0, .62); display: grid; place-items: center; padding: 18px; z-index: 2; }
.app-dialog { width: 100%; border-radius: 22px; padding: 18px 16px 14px; background: #161b26; border: 1px solid rgba(0, 222, 237, .4); box-shadow: 0 0 40px -10px rgba(0, 222, 237, .4); text-align: center; animation: pop .35s cubic-bezier(.2, 1.4, .4, 1); }
.app-dialog .type { display: inline-block; font: 800 9.5px var(--font); letter-spacing: .12em; padding: 3px 8px; border-radius: 6px; margin-bottom: 10px; }
.app-dialog img { width: 100%; max-height: 110px; object-fit: cover; border-radius: 14px; margin-bottom: 10px; display: block; }
.app-dialog h5 { margin: 0 0 6px; font: 800 16px var(--font); color: #f8f9fc; word-break: break-word; }
.app-dialog p { margin: 0 0 14px; font-size: 12px; line-height: 1.5; color: #a4aeba; white-space: pre-line; word-break: break-word; max-height: 120px; overflow: hidden; }
.app-dialog .cta { display: block; padding: 11px; border-radius: 12px; font: 900 12px var(--font); letter-spacing: .08em; color: #02090b; background: linear-gradient(90deg, #00deed, #4ee8f2); }
.app-dialog .later { display: block; margin-top: 8px; font-size: 11.5px; color: #939ca8; font-weight: 700; }
@keyframes pop { from { transform: scale(.88); opacity: 0; } to { transform: none; opacity: 1; } }

/* App-style shop tile preview */
.tile-preview { display: grid; place-items: center; padding: 26px; border-radius: 18px; background: #080b0e; border: 1px solid #272e3e; }
.pack-tile { position: relative; width: 170px; padding: 16px 14px 14px; border-radius: 18px; background: #10131b; border: 1.2px solid #272e3e; text-align: center; color: #f8f9fc; }
.pack-tile.featured { border-color: rgba(0, 222, 237, .7); box-shadow: 0 0 30px -8px rgba(0, 222, 237, .45); }
.pack-tile.gold { border-color: rgba(242, 223, 32, .7); box-shadow: 0 0 30px -8px rgba(242, 223, 32, .4); }
.pack-tile .badge { position: absolute; top: -9px; left: 10px; padding: 3px 8px; border-radius: 7px; font: 900 9.5px var(--font); letter-spacing: .08em; color: #02090b; background: #00deed; }
.pack-tile.gold .badge { background: #f2df20; }
.pack-tile .em { width: 54px; height: 54px; margin: 6px auto 10px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; background: radial-gradient(circle, rgba(0, 222, 237, .32), rgba(0, 222, 237, .08)); border: 1px solid rgba(0, 222, 237, .35); }
.pack-tile .amt { font: 900 26px var(--display); color: #f2df20; }
.pack-tile .unit { font-size: 10px; letter-spacing: .16em; font-weight: 800; color: #939ca8; }
.pack-tile .price { margin-top: 10px; padding: 9px; border-radius: 11px; font: 900 13px var(--font); color: #02090b; background: linear-gradient(90deg, #00deed, #4ee8f2); }
.pack-tile.gold .price { background: linear-gradient(90deg, #f2df20, #f8ea70); }
.pack-tile .was { display: block; margin-top: 5px; font-size: 11px; color: #68727f; text-decoration: line-through; min-height: 15px; }
.arena-tile { width: 180px; padding: 10px; border-radius: 18px; background: #10131b; border: 1.2px solid var(--a, #00deed); box-shadow: 0 0 30px -10px var(--a, #00deed); color: #f8f9fc; }
.arena-tile .art { height: 120px; border-radius: 13px; position: relative; overflow: hidden; background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--a) 40%, transparent), transparent 70%), radial-gradient(circle, color-mix(in srgb, var(--a) 28%, transparent) 1px, transparent 1.3px) 0 0 / 14px 14px, var(--b, #080b0e); }
.arena-tile .art::after { content: ""; position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px; border-radius: 50%; border: 2px solid var(--a); box-shadow: 0 0 18px var(--a), inset 0 0 0 9px var(--b), inset 0 0 0 16px var(--a); }
.arena-tile b { display: block; margin-top: 10px; font-size: 14px; color: var(--a); }
.arena-tile small { display: block; color: #939ca8; font-size: 11px; }
.arena-tile .price { margin-top: 10px; padding: 8px; border-radius: 10px; text-align: center; font: 900 12px var(--font); color: #02090b; background: #00deed; }

/* ---------- Popup cards ---------- */
.popup-card { overflow: hidden; display: flex; flex-direction: column; }
.popup-card .band { height: 6px; background: linear-gradient(90deg, var(--tone), color-mix(in srgb, var(--tone) 40%, transparent)); }
.popup-card .body { padding: 18px 18px 14px; flex: 1; }
.popup-card h4 { font-size: 16px; margin: 10px 0 6px; }
.popup-card p { margin: 0; color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.popup-card .when { margin-top: 12px; display: flex; gap: 8px; align-items: center; color: var(--faint); font-size: 12px; }
.popup-card .when .ic { width: 14px; height: 14px; }
.popup-card .foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }

/* ---------- Markdown editor & prose ---------- */
.md-toolbar { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: var(--panel-2); }
.md-toolbar button { min-width: 34px; height: 32px; padding: 0 9px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--muted); font: 700 13px var(--font); cursor: pointer; }
.md-toolbar button:hover { background: var(--panel-3); color: var(--text); border-color: var(--line-2); }
.md-toolbar .sep { width: 1px; background: var(--line-2); margin: 4px 4px; }
.md-split { display: grid; grid-template-columns: 1fr 1fr; min-height: 560px; }
.md-split .textarea { border: 0; border-radius: 0; min-height: 560px; height: 100%; font: 13.5px/1.7 var(--mono); background: transparent; resize: none; padding: 18px 20px; }
.md-split .textarea:focus { box-shadow: none; }
.md-split .pane { border-left: 1px solid var(--line); padding: 18px 24px; overflow-y: auto; max-height: 72vh; }
.prose { color: var(--text); line-height: 1.75; font-size: 15px; }
.prose h2 { font-size: 21px; margin: 28px 0 10px; }
.prose h3 { font-size: 17px; margin: 22px 0 8px; }
.prose h4, .prose h5 { font-size: 15px; margin: 18px 0 6px; }
.prose p { margin: 0 0 14px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 14px; }
.prose li { margin: 4px 0; }
.prose blockquote { margin: 0 0 14px; padding: 10px 16px; border-left: 3px solid var(--cyan); background: color-mix(in srgb, var(--cyan) 6%, transparent); border-radius: 0 10px 10px 0; color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--line-2); margin: 24px 0; }
.prose code { padding: 2px 6px; border-radius: 6px; background: var(--panel-3); }
.prose > :first-child { margin-top: 0; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; top: 18px; right: 18px; z-index: 100; display: grid; gap: 10px; width: min(380px, calc(100vw - 36px)); }
.toast {
  --c: var(--cyan);
  position: relative; overflow: hidden; display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 14px 16px; border-radius: 16px;
  background: color-mix(in srgb, var(--panel) 86%, transparent); backdrop-filter: blur(18px);
  border: 1px solid color-mix(in srgb, var(--c) 50%, transparent);
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .55), 0 0 30px -12px var(--c);
  animation: toast-in .45s cubic-bezier(.2, 1.3, .4, 1);
  cursor: pointer;
}
.toast.out { animation: toast-out .25s ease-in forwards; }
.toast .ti { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); }
.toast b { display: block; color: var(--c); font-size: 13.5px; margin-bottom: 1px; }
.toast span { font-size: 13px; color: var(--text); line-height: 1.4; word-break: break-word; }
.toast .life { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--c); animation: life linear forwards; }
.toast-success { --c: var(--green); }
.toast-error { --c: var(--pink); }
.toast-warn { --c: var(--yellow); }
@keyframes toast-in { from { transform: translateY(-20px) scale(.94); opacity: 0; } }
@keyframes toast-out { to { transform: translateX(30px); opacity: 0; } }
@keyframes life { from { width: 100%; } to { width: 0; } }

/* ---------- Dialog ---------- */
dialog.modal {
  border: 1px solid color-mix(in srgb, var(--c, var(--cyan)) 40%, transparent); border-radius: 22px; padding: 0; width: min(420px, calc(100vw - 32px));
  background: var(--panel); color: var(--text); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7), 0 0 50px -20px var(--c, var(--cyan));
}
dialog.modal[open] { animation: pop .3s cubic-bezier(.2, 1.3, .4, 1); }
dialog.modal::backdrop { background: rgba(3, 6, 10, .7); backdrop-filter: blur(4px); }
.modal-body { padding: 26px 24px 18px; text-align: center; }
.modal-body .orb { margin: 0 auto 14px; }
.modal-body h3 { font-size: 19px; margin-bottom: 8px; }
.modal-body p { margin: 0; color: var(--muted); }
.modal-actions { display: flex; gap: 10px; padding: 0 24px 22px; }
.modal-actions .btn { flex: 1; }

/* ---------- Pagination ---------- */
.pager { display: flex; gap: 6px; justify-content: center; padding: 16px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 36px; height: 36px; padding: 0 10px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font-weight: 700; font-size: 13px; }
.pager a:hover { color: var(--text); border-color: var(--line-2); text-decoration: none; }
.pager .cur { background: var(--cyan); color: var(--on-accent); border-color: var(--cyan); }

/* ---------- Misc ---------- */
.copy { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); font: 12px var(--mono); color: var(--text); cursor: pointer; max-width: 100%; }
.copy:hover { border-color: var(--cyan); }
.copy .ic { width: 13px; height: 13px; color: var(--faint); }
.copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--c, var(--cyan)) 35%, transparent); background: color-mix(in srgb, var(--c, var(--cyan)) 7%, transparent); font-size: 13px; color: var(--muted); }
.callout .ic { color: var(--c, var(--cyan)); margin-top: 1px; }
.callout b { color: var(--text); }
.callout.warn { --c: var(--yellow); }
.callout.danger { --c: var(--pink); }
.anchor-nav { display: grid; gap: 4px; }
.anchor-nav a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 11px; color: var(--muted); font-weight: 650; }
.anchor-nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.anchor-nav a.active { background: color-mix(in srgb, var(--cyan) 10%, transparent); color: var(--cyan); }
.savebar { position: sticky; bottom: 16px; z-index: 20; margin-top: 18px; display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 18px; border-radius: 16px; background: color-mix(in srgb, var(--panel) 90%, transparent); backdrop-filter: blur(14px); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.savebar .dirty { color: var(--yellow); font-weight: 700; font-size: 13px; display: none; align-items: center; gap: 8px; }
.savebar.is-dirty .dirty { display: inline-flex; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.days div { padding: 8px 0; border-radius: 10px; text-align: center; background: var(--panel-2); border: 1px solid var(--line); }
.days b { display: block; font: 700 14px var(--display); color: var(--yellow); }
.days small { font-size: 10px; color: var(--faint); font-weight: 700; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; font-size: 13px; }
.kv dt { color: var(--faint); font-weight: 600; }
.kv dd { margin: 0; text-align: right; font-weight: 600; }
details.menu { position: relative; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu .menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 25; width: 270px; padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow); text-align: left; }
.perm-chips .chip { font-size: 11.5px; padding: 3px 8px; }
.member { display: flex; flex-direction: column; }
.member .top { display: flex; gap: 14px; align-items: flex-start; padding: 18px; }
.member .perm-chips { padding: 0 18px 16px; }
.member .foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); margin-top: auto; font-size: 12px; color: var(--faint); }
.roles-explain .role { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.roles-explain .role:last-child { border-bottom: 0; }
.roles-explain b { display: block; }
.roles-explain small { color: var(--muted); }
.legal-card { display: flex; flex-direction: column; }
.legal-card .card-body { flex: 1; }

/* ---------- Auth page ---------- */
.auth { position: relative; z-index: 1; min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 44px; border-right: 1px solid var(--line); background: radial-gradient(600px 500px at 30% 40%, rgba(0, 222, 237, .14), transparent 70%), linear-gradient(160deg, #06090d, #0b1018); color: #eef2f7; }
.auth-hero .rings { position: absolute; left: 50%; top: 48%; width: 520px; height: 520px; transform: translate(-50%, -50%); pointer-events: none; }
.auth-hero .rings i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(0, 222, 237, .5); animation: ring 4.5s linear infinite; opacity: 0; }
.auth-hero .rings i:nth-child(2) { animation-delay: 1.5s; }
.auth-hero .rings i:nth-child(3) { animation-delay: 3s; }
.auth-hero .core { position: absolute; left: 50%; top: 48%; width: 170px; height: 170px; transform: translate(-50%, -50%); }
.auth-hero .copy-block { position: relative; z-index: 1; max-width: 440px; }
.auth-hero h1 { font-size: 40px; letter-spacing: .06em; }
.auth-hero h1 span { color: #00deed; text-shadow: 0 0 24px rgba(0, 222, 237, .6); }
.auth-hero p { color: #8e98a6; font-size: 15px; margin: 10px 0 0; }
.auth-hero .feat { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.auth-hero .feat span { padding: 7px 12px; border-radius: 30px; font-size: 12px; font-weight: 700; color: #c9d1db; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .09); backdrop-filter: blur(6px); }
@keyframes ring { 0% { transform: scale(.25); opacity: 0; } 15% { opacity: .9; } 100% { transform: scale(1); opacity: 0; } }
.auth-panel { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: min(400px, 100%); }
.auth-card h2 { font-size: 26px; }
.auth-card .muted { margin: 8px 0 26px; }
.auth-foot { margin-top: 26px; text-align: center; font-size: 12px; color: var(--faint); }
.pw-toggle { cursor: pointer; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .g-main, .g-form { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .md-split { grid-template-columns: 1fr; }
  .md-split .pane { border-left: 0; border-top: 1px solid var(--line); max-height: none; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); box-shadow: 30px 0 60px rgba(0, 0, 0, .5); }
  .nav-open .sidebar { transform: none; }
  .nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .55); }
  .main { margin-left: 0; }
  .icon-btn.menu-btn { display: inline-grid; }
  .topbar { padding: 12px 16px; }
  .content { padding: 20px 16px 50px; }
  .auth { grid-template-columns: 1fr; }
  .auth-hero { min-height: 300px; padding: 28px; border-right: 0; border-bottom: 1px solid var(--line); }
  .auth-hero .rings { width: 360px; height: 360px; }
  .auth-hero .core { width: 120px; height: 120px; }
  .auth-hero h1 { font-size: 30px; }
  .hide-sm { display: none !important; }
}
@media (max-width: 620px) {
  .g-2, .g-3, .g-4, .form-row, .form-row.three { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 23px; }
  .status-hero .meta { margin-left: 0; }
  .topbar .pill-label { display: none; }
  .kpi .value { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
