/* AI Creator Licenses: the studio's look (dark, quiet, one accent: dark red). Every colour is a token. */
:root {
  --bg: #09090b; --panel: #111114; --panel-2: #17171b; --raise: #1d1d22; --line: #232328; --line-2: #2f2f36;
  --text: #ededf0; --text-2: #b6b6bf; --muted: #7d7d88;
  --red: #b8213a; --red-hi: #d93450; --red-soft: rgba(217, 52, 80, .12); --red-line: rgba(217, 52, 80, .35);
  --ok: #3fb27f; --okbg: rgba(63, 178, 127, .12); --warn: #e0a23a; --warnbg: rgba(224, 162, 58, .12); --bad: #ef5a6f; --badbg: rgba(239, 90, 111, .12);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "IBM Plex Mono", Menlo, monospace;
  --r: 14px; --r-sm: 9px; --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text); font: 14.5px/1.55 var(--sans); }
h1, h2, h3 { letter-spacing: -.02em; margin: 0; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 17px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.err { color: var(--bad); min-height: 1.2em; font-size: 13.5px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 99; padding: 10px 14px; border-radius: 8px; background: var(--red); color: #fff; }
.skip:focus { left: 12px; }
:focus-visible { outline: 2px solid var(--red-hi); outline-offset: 2px; }
[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); border-radius: var(--r-sm);
  padding: 8px 14px; font-weight: 550; transition: background .18s var(--ease), border-color .18s var(--ease), transform .12s var(--ease); }
button:hover { background: var(--raise); border-color: #3b3b44; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--red); border-color: var(--red); color: #fff; }
button.primary:hover { background: var(--red-hi); border-color: var(--red-hi); }
button.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
button.ghost:hover { background: var(--panel-2); color: var(--text); }
button.danger { color: var(--bad); }
button.danger:hover { background: var(--badbg); border-color: rgba(239, 90, 111, .35); }
button.small { padding: 5px 10px; font-size: 13px; }
button.icon { padding: 6px 10px; background: transparent; border-color: transparent; }
input, select, textarea { width: 100%; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 9px 11px; transition: border-color .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--red-line); box-shadow: 0 0 0 3px var(--red-soft); }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 550; color: var(--text-2); }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mark { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--red); color: #fff; font-weight: 750; letter-spacing: -.03em; }
.mark.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 12px; }

/* gate */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(900px 500px at 50% -10%, rgba(184, 33, 58, .16), transparent 60%), var(--bg); }
.gate-card { width: min(400px, 100%); display: grid; gap: 14px; padding: 30px 28px 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; }
.gate-card .mark { margin-bottom: 4px; }

/* shell */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 18px; padding: 12px 24px;
  background: rgba(9, 9, 11, .86); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 10px; align-items: center; font-weight: 650; letter-spacing: -.01em; }
.who { margin-left: auto; display: flex; gap: 10px; align-items: center; color: var(--text-2); }
.role { font-size: 11.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; background: var(--red-soft); color: var(--red-hi); border: 1px solid var(--red-line); }
.top-actions { display: flex; gap: 4px; }
.main { max-width: 1240px; margin: 0 auto; padding: 26px 24px 64px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.block, .stats, .stat { min-width: 0; }
.history li span { overflow-wrap: anywhere; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 16px 18px 15px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.stat .n { font: 600 26px/1.15 var(--sans); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 3px; }
.bar { height: 6px; border-radius: 3px; background: var(--raise); overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; background: var(--red-hi); border-radius: 3px; transition: width .4s var(--ease); }

.block { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 18px 14px; }
.block-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.search { width: 210px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; }
.seg button { border: 0; background: transparent; padding: 5px 11px; font-size: 13px; color: var(--text-2); border-radius: 7px; }
.seg button.on { background: var(--raise); color: var(--text); }

.reseller { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 18px; align-items: center; }
.reseller .pool .n { font-variant-numeric: tabular-nums; }
.add-reseller { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }

.table-wrap { overflow-x: auto; margin: 0 -6px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 550; color: var(--muted); font-size: 12.5px; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.table tbody tr { cursor: pointer; transition: background .12s; }
.table tbody tr:hover { background: var(--panel-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .name { font-weight: 600; }
.table .sub { color: var(--muted); font-size: 12.5px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: var(--okbg); }
.pill.warn { color: var(--warn); background: var(--warnbg); }
.pill.bad { color: var(--bad); background: var(--badbg); }
.pill.off { color: var(--muted); background: var(--raise); }
.empty { padding: 34px 12px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-weight: 600; margin-bottom: 4px; }

.history { list-style: none; margin: 0; padding: 0; display: grid; }
.history li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 14px; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.history li:last-child { border-bottom: 0; }
.history time { color: var(--muted); font-variant-numeric: tabular-nums; }
.history b { font-weight: 600; }

/* drawer */
.drawer { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); opacity: 0; transition: opacity .25s var(--ease); }
.drawer-panel { position: absolute; top: 0; right: 0; height: 100%; width: min(560px, 100%); background: var(--panel); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform .3s var(--ease); display: flex; flex-direction: column; }
.drawer.open { pointer-events: auto; }
.drawer.open .drawer-scrim { opacity: 1; }
.drawer.open .drawer-panel { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-body { padding: 18px 20px 40px; overflow: auto; display: grid; gap: 22px; align-content: start; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.fact { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; }
.fact .l { color: var(--muted); font-size: 12px; }
.fact .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.keys { display: grid; gap: 8px; }
.key { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel-2); }
.key .k { font-family: var(--mono); font-size: 13px; }
.key .k .pill { font-family: var(--sans); margin-left: 6px; }
.key .meta { color: var(--muted); font-size: 12.5px; }
.key .acts { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.newkey { padding: 14px; border-radius: var(--r-sm); background: var(--red-soft); border: 1px solid var(--red-line); display: grid; gap: 10px; }
.newkey code { font: 600 16px var(--mono); letter-spacing: .02em; word-break: break-all; }

dialog { border: 1px solid var(--line-2); border-radius: 16px; background: var(--panel); color: var(--text); padding: 22px; width: min(440px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; padding: 10px 16px; border-radius: 10px;
  background: var(--raise); border: 1px solid var(--line-2); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); font-size: 14px; }

@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reseller { grid-template-columns: 1fr; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top { padding: 10px 16px; gap: 10px; }
  .who { display: none; }
  .top-actions { margin-left: auto; }
  .top-actions button { padding: 6px 8px; font-size: 13px; white-space: nowrap; }
  .brand span:last-child { display: none; }
  .block-head .row { width: 100%; }
  .block-head .row .primary { margin-left: auto; }
  .main { padding: 18px 16px 48px; }
  .search { width: 100%; }
  .history li { grid-template-columns: 1fr; gap: 2px; }
  .two { grid-template-columns: 1fr; }
}
