/* Kiddy Coder Licensing — admin. Glass UI, mobile first, no build step. */
:root {
  --bg: #0b1020;
  --bg2: #111a33;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-strong: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --text: #eef2ff;
  --muted: #a3acc9;
  --faint: #6f7897;
  --brand: #7c9cff;
  --brand-2: #5eead4;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --info: #60a5fa;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 40px rgba(3, 6, 20, 0.45);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { background: #0e1630; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: radial-gradient(1200px 800px at 10% -10%, #1d2b5c 0%, transparent 60%),
    radial-gradient(900px 700px at 110% 10%, #0f3d45 0%, transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.blob { position: fixed; border-radius: 50%; filter: blur(80px); opacity: 0.35; pointer-events: none; z-index: 0; }
.blob.b1 { width: 380px; height: 380px; background: #4f6bff; top: -120px; left: -80px; }
.blob.b2 { width: 320px; height: 320px; background: #14b8a6; bottom: -120px; right: -60px; }
.blob.b3 { width: 240px; height: 240px; background: #a855f7; top: 40%; left: 55%; opacity: 0.18; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.45rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: 0.95rem; font-weight: 600; }
p { margin: 0; }
.icon { flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 0.84rem; }
.mono { font-family: var(--mono); letter-spacing: 0.02em; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow);
}

/* ── shell ── */
.shell { position: relative; z-index: 1; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; margin: 0;
  border-radius: 0; border-width: 0 0 1px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #0b1020;
}
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: 0.72rem; margin-top: -2px; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40; width: 270px; max-width: 86vw;
  padding: 18px 14px; display: flex; flex-direction: column; gap: 18px;
  border-radius: 0 var(--radius) var(--radius) 0;
  transform: translateX(-105%); transition: transform 0.25s ease;
  background: rgba(13, 19, 40, 0.92);
}
.nav-open .sidebar { transform: none; }
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 35; display: none; }
.nav-open .scrim { display: block; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  color: var(--muted); font-weight: 550;
}
.nav a:hover { background: var(--glass); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--glass-strong); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.nav a.active .icon { color: var(--brand-2); }
.nav-label { color: var(--faint); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; padding: 8px 12px 2px; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--glass); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--glass-strong); color: var(--brand-2); }

.main { padding: 18px 16px 60px; display: flex; flex-direction: column; gap: 18px; max-width: 1240px; margin: 0 auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head .crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.85rem; margin-bottom: 6px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

@media (min-width: 1024px) {
  .topbar { display: none; }
  .sidebar { transform: none; inset: 14px auto 14px 14px; border-radius: var(--radius); width: 250px; }
  .scrim { display: none !important; }
  .main { margin-left: 264px; padding: 28px 32px 60px; max-width: none; }
}

/* ── cards & grid ── */
.card { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h2 { display: flex; align-items: center; gap: 10px; }
.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.two { grid-template-columns: 1fr; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .two { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }
.stat { padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.stat .label { color: var(--muted); font-size: 0.8rem; display: flex; align-items: center; gap: 8px; }
.stat .value { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
.stat .hint { color: var(--faint); font-size: 0.78rem; }
.stat.alert .value { color: var(--bad); }

/* ── buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--glass-strong); color: var(--text); font: inherit; font-weight: 600;
  cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.05s; min-height: 42px;
}
.btn:hover { background: rgba(255, 255, 255, 0.16); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn.primary { background: linear-gradient(135deg, #6d8bff, #4fd1c5); color: #081021; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { border-color: rgba(251, 113, 133, 0.5); color: #fecdd3; background: rgba(251, 113, 133, 0.12); }
.btn.danger:hover { background: rgba(251, 113, 133, 0.22); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.sm { padding: 6px 10px; min-height: 34px; font-size: 0.85rem; border-radius: 10px; }
.btn.icon-only { padding: 0; width: 42px; }
.btn.sm.icon-only { width: 34px; }
.btn.block { width: 100%; }

/* ── forms ── */
.form { display: flex; flex-direction: column; gap: 14px; }
.row { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .row.cols-2 { grid-template-columns: 1fr 1fr; } .row.cols-3 { grid-template-columns: 1fr 1fr 1fr; } }
label, .label-text { display: block; font-size: 0.84rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.input, select, textarea {
  width: 100%; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(8, 12, 28, 0.55); color: var(--text); font: inherit; min-height: 44px;
}
textarea { min-height: 90px; resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
input[type='date'] { color-scheme: dark; }
.input::placeholder, textarea::placeholder { color: var(--faint); }
.error { color: var(--bad); font-size: 0.82rem; margin-top: 6px; }
.help { color: var(--faint); font-size: 0.8rem; margin-top: 6px; }
.checks { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.check {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(8, 12, 28, 0.35); cursor: pointer; margin: 0; color: var(--text); font-weight: 500;
}
.check input { accent-color: var(--brand-2); width: 18px; height: 18px; }
.segmented { display: inline-flex; padding: 4px; border-radius: 12px; background: rgba(8, 12, 28, 0.5); border: 1px solid var(--line); gap: 4px; }
.segmented label { margin: 0; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; padding: 7px 14px; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 600; }
.segmented input:checked + span { background: var(--glass-strong); color: var(--text); }
.segmented input:focus-visible + span { outline: 2px solid var(--brand); }
[hidden] { display: none !important; }

/* ── tables / lists ── */
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { text-align: left; color: var(--faint); font-weight: 600; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 12px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.025); }
.cell-title { font-weight: 600; color: var(--text); }
.cell-sub { color: var(--faint); font-size: 0.8rem; }

/* Cards instead of rows on phones */
@media (max-width: 719px) {
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { border: 0; padding: 3px 0; }
  table.stack td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 96px; color: var(--faint); font-size: 0.78rem; }
  .table-wrap { margin: 0; padding: 0; }
}

.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.list-item:last-child { border-bottom: 0; }
.dot { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--glass-strong); color: var(--muted); flex: none; }
.dot.ok { color: var(--ok); background: rgba(52, 211, 153, 0.12); }
.dot.bad { color: var(--bad); background: rgba(251, 113, 133, 0.12); }
.dot.warn { color: var(--warn); background: rgba(251, 191, 36, 0.12); }
.dot.info { color: var(--info); background: rgba(96, 165, 250, 0.12); }

/* ── badges ── */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 650; border: 1px solid transparent; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.active { color: var(--ok); background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.3); }
.badge.expired { color: var(--warn); background: rgba(251, 191, 36, 0.12); border-color: rgba(251, 191, 36, 0.3); }
.badge.revoked { color: var(--bad); background: rgba(251, 113, 133, 0.12); border-color: rgba(251, 113, 133, 0.3); }
.badge.scheduled { color: var(--info); background: rgba(96, 165, 250, 0.12); border-color: rgba(96, 165, 250, 0.3); }
.badge.plain { color: var(--muted); background: var(--glass); border-color: var(--line); }
.badge.plain::before { display: none; }

/* ── meters ── */
meter { width: 100%; height: 8px; border-radius: 99px; border: 0; background: rgba(255, 255, 255, 0.08); display: block; }
meter::-webkit-meter-bar { background: rgba(255, 255, 255, 0.08); border-radius: 99px; border: 0; height: 8px; }
meter::-webkit-meter-optimum-value { background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 99px; }
meter::-webkit-meter-suboptimum-value { background: var(--warn); border-radius: 99px; }
meter::-webkit-meter-even-less-good-value { background: var(--bad); border-radius: 99px; }
meter:-moz-meter-optimum::-moz-meter-bar { background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 99px; }
meter:-moz-meter-sub-optimum::-moz-meter-bar { background: var(--warn); border-radius: 99px; }
meter:-moz-meter-sub-sub-optimum::-moz-meter-bar { background: var(--bad); border-radius: 99px; }
.seats { display: flex; flex-direction: column; gap: 6px; min-width: 110px; }

/* ── alerts ── */
.flash { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--glass); }
.flash.ok { border-color: rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.08); }
.flash.ok .icon { color: var(--ok); }
.flash.bad { border-color: rgba(251, 113, 133, 0.35); background: rgba(251, 113, 133, 0.08); }
.flash.bad .icon { color: var(--bad); }
.flash.warn { border-color: rgba(251, 191, 36, 0.35); background: rgba(251, 191, 36, 0.08); }
.flash.warn .icon { color: var(--warn); }
.flash ul { margin: 0; padding-left: 18px; }

/* ── the key card ── */
.keycard {
  padding: 20px; border-radius: var(--radius); display: flex; flex-direction: column; gap: 12px;
  background: linear-gradient(135deg, rgba(109, 139, 255, 0.18), rgba(79, 209, 197, 0.14));
  border: 1px solid rgba(124, 156, 255, 0.45);
}
.keyline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.keytext { font-family: var(--mono); font-size: 1.35rem; font-weight: 700; letter-spacing: 0.08em; padding: 10px 14px; border-radius: 12px; background: rgba(8, 12, 28, 0.6); border: 1px dashed var(--line-strong); user-select: all; word-break: break-all; }
@media (min-width: 640px) { .keytext { font-size: 1.6rem; } }

.kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 8px 16px; font-size: 0.9rem; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; color: var(--text); word-break: break-word; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .input, .toolbar select { width: auto; flex: 1 1 180px; }
.search { position: relative; flex: 2 1 240px; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search .input { padding-left: 38px; width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: 0.84rem; font-weight: 600; }
.chip:hover { text-decoration: none; color: var(--text); background: var(--glass); }
.chip.on { background: var(--glass-strong); color: var(--text); border-color: var(--line-strong); }

.empty { text-align: center; padding: 32px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .icon { color: var(--faint); }

pre.code { margin: 0; padding: 14px; border-radius: 12px; background: rgba(8, 12, 28, 0.7); border: 1px solid var(--line); overflow-x: auto; font-family: var(--mono); font-size: 0.82rem; line-height: 1.55; color: #d6defa; white-space: pre; }

details.panel { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
details.panel summary { cursor: pointer; font-weight: 600; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 8px; }
details.panel summary::-webkit-details-marker { display: none; }
details.panel[open] summary { color: var(--text); margin-bottom: 14px; }
details.panel summary .icon { transition: transform 0.2s; }
details.panel[open] summary .icon { transform: rotate(90deg); }

.pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 14px; }
.pagination a, .pagination span { min-width: 38px; height: 38px; padding: 0 10px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.pagination a:hover { background: var(--glass); color: var(--text); text-decoration: none; }
.pagination .on { background: var(--glass-strong); color: var(--text); border-color: var(--line-strong); }
.pagination .off { opacity: 0.4; }

/* ── auth pages ── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; position: relative; z-index: 1; }
.auth-card { width: 100%; max-width: 410px; padding: 28px 24px; display: flex; flex-direction: column; gap: 20px; }
.auth-card .brand { justify-content: center; }
.auth-title { text-align: center; }
.auth-title p { color: var(--muted); margin-top: 6px; font-size: 0.9rem; }
.qr { background: #fff; padding: 10px; border-radius: 14px; width: 220px; height: 220px; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font-family: var(--mono); }
.codes span { padding: 8px; text-align: center; border-radius: 10px; background: rgba(8, 12, 28, 0.6); border: 1px solid var(--line); }
.copied { color: var(--ok) !important; border-color: rgba(52, 211, 153, 0.5) !important; }
.grow { flex: 1; min-width: 0; }
.card > * + .chips, .card > * + .table-wrap, .card > * + form { margin-top: 14px; }
.mt { margin-top: 14px; }
