:root {
  --bg: #000;
  --card: rgba(255, 255, 255, 0.03);
  --line: rgba(255, 255, 255, 0.08);
  --line-hi: rgba(255, 255, 255, 0.16);
  --text: #c6c6ca;
  --muted: #8a8a90;
  --dim: #6e6e74;
  --accent: #ececef;
  --ink: #0a0a0b;
  --danger: #e8a39a;
  --ok: #c8d8c8;
  --radius: 0;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: #000;
  color: var(--text);
  font: 15px/1.5 "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; }
img { display: block; max-width: 100%; }

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 80;
  padding: 8px 12px;
  background: var(--accent);
  color: var(--ink);
  border-radius: 8px;
}
.skip:focus { top: 12px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.kicker {
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #9a9aa0;
  margin-bottom: 12px;
}

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
  width: 100%;
  padding-inline: max(20px, calc((100% - 1120px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.brand img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.nav {
  display: flex;
  gap: 18px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
}
.nav a { text-decoration: none; }
.nav a:hover { color: var(--text); }

.wrap {
  width: min(1120px, calc(100% - 40px));
  margin: 28px auto 72px;
  flex: 1;
}

.boot {
  width: min(1120px, calc(100% - 40px));
  margin: 48px auto;
  color: var(--dim);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 11px;
}

/* ----- HUD panel ----- */

.panel {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 28px;
}
.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  pointer-events: none;
}
.panel::before {
  top: -1px;
  left: -1px;
  border-right: 0;
  border-bottom: 0;
}
.panel::after {
  right: -1px;
  bottom: -1px;
  border-left: 0;
  border-top: 0;
}

h1 {
  font-size: clamp(32px, 5vw, 48px);
  letter-spacing: -0.055em;
  line-height: 0.98;
  font-weight: 800;
  color: #d8d8dc;
  margin-bottom: 10px;
}
h2 {
  font-size: 22px;
  letter-spacing: -0.04em;
  font-weight: 700;
  color: #d4d4d8;
}
.sub {
  color: var(--muted);
  margin-bottom: 22px;
  max-width: 46ch;
  font-size: 16px;
}

.hint {
  margin-top: 18px;
  color: var(--dim);
  font-size: 13px;
}
.hint a {
  color: var(--text);
  text-underline-offset: 3px;
}

label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 16px 0 8px;
}
label:first-child { margin-top: 0; }

input, textarea, select {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: 0;
  border: 1px solid var(--line-hi);
  background: #0a0a0c;
  color: var(--text);
  font: inherit;
  transition: border-color 160ms var(--ease);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.4);
}
textarea { height: 88px; padding: 10px 14px; resize: vertical; }

.btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 46px;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  font: 650 14px/1.1 inherit;
  letter-spacing: -0.02em;
  cursor: pointer;
  background: var(--accent);
  color: var(--ink);
  transition: transform 160ms var(--ease), background 160ms var(--ease);
}
.btn:hover { background: #fff; transform: translateY(-1px); }
.btn[disabled] { opacity: 0.45; cursor: default; transform: none; }
.btn small {
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 500;
  color: #5c5c62;
}
.btn.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line-hi);
}
.btn.ghost:hover { background: rgba(255, 255, 255, 0.04); }
.btn.danger {
  background: transparent;
  color: var(--danger);
  border-color: rgba(232, 163, 154, 0.35);
}
.btn.full { width: 100%; margin-top: 22px; }
.btn.sm {
  min-height: 32px;
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  flex-direction: row;
}

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spread {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.badge.on { color: var(--ok); border-color: rgba(200, 216, 200, 0.28); }
.badge.off { color: var(--dim); }
.badge.bad { color: var(--danger); border-color: rgba(232, 163, 154, 0.3); }

.muted { color: var(--muted); }
.danger { color: var(--danger); }

/* ----- auth ----- */

.auth-shell {
  flex: 1;
  display: grid;
  place-items: center;
  position: relative;
  padding: 24px 20px 72px;
  isolation: isolate;
}
.auth-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 18%, rgba(190, 190, 198, 0.12) 0%, transparent 52%),
    linear-gradient(180deg, #000 0%, #08080a 55%, #000 100%);
}
.auth-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 68px 68px;
  mask-image: radial-gradient(ellipse at 50% 40%, #000 12%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 12%, transparent 72%);
}

.auth {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  gap: 48px 56px;
  align-items: center;
}

.auth-copy .auth-mark {
  height: 52px;
  width: auto;
  margin-bottom: 28px;
}
.auth-copy .sub { margin-bottom: 0; }

/* ----- account ----- */

.hero-acct { margin-bottom: 18px; }
.hero-acct .sub { margin-bottom: 0; }

.welcome-flag {
  margin: 0 0 16px;
  padding: 12px 16px;
  border: 1px solid rgba(200, 216, 200, 0.22);
  color: var(--ok);
  font-size: 14px;
}

.next-panel { margin-bottom: 14px; }
.next-panel h2 { margin-bottom: 4px; }
.next-panel .btn { margin-top: 4px; }

.steps {
  list-style: none;
  display: grid;
  gap: 16px;
  margin: 22px 0 24px;
}
.steps li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 14px;
  align-items: start;
}
.steps .n {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line-hi);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.steps strong {
  display: block;
  color: #d8d8dc;
  font-size: 15px;
  letter-spacing: -0.02em;
}
.steps p {
  margin-top: 2px;
  color: var(--dim);
  font-size: 13px;
  max-width: 62ch;
}

.feat {
  list-style: none;
  margin: 16px 0 0;
}
.feat li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}
.feat li:last-child { border-bottom: 0; }
.feat li::before {
  content: "— ";
  color: var(--dim);
}

.acct-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.acct-grid:has(#upgrade-card[hidden]) {
  grid-template-columns: 1fr;
}
.acct-grid .panel h2 { margin-bottom: 8px; }
.acct-grid .panel .muted { margin-bottom: 12px; max-width: 42ch; }
.plan-actions { margin: 18px 0 8px; }
.pay-panel { margin-top: 14px; }
.danger-panel { margin-top: 14px; }
.danger-panel h2 { margin-bottom: 8px; }
.danger-panel .btn { margin-top: 18px; }

.legal .panel { margin-top: 14px; }
.legal .panel h2 { margin-bottom: 12px; font-size: 20px; }
.legal .panel p + p { margin-top: 12px; }
.legal ul {
  margin: 0;
  padding-left: 1.15em;
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 15px;
}
.legal li { padding-left: 4px; }

.foot-legal {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.foot-legal a {
  color: var(--dim);
  text-decoration: none;
  font-size: 12px;
}
.foot-legal a:hover { color: var(--text); }

.foot-by {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.foot-by-av {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  object-fit: cover;
  flex: 0 0 auto;
}
.foot-by-txt {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.15;
}
.foot-by-txt small {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.32);
}
.foot-by-txt b {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #d8d8dc;
}
.foot-by:hover .foot-by-av { border-color: rgba(255, 255, 255, 0.28); }
.foot-by:hover .foot-by-txt b { color: #fff; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  color: var(--dim);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }
.empty {
  color: var(--dim);
  padding: 28px 10px !important;
  text-align: center;
}

/* ----- admin ----- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
.stat {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 18px 16px 16px;
}
.stat b {
  display: block;
  font-size: 26px;
  letter-spacing: -0.05em;
  font-weight: 800;
  color: #d8d8dc;
}
.stat span {
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tabs {
  display: flex;
  gap: 0;
  margin: 0 0 18px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}
.tabs button {
  height: 42px;
  padding: 0 16px;
  border: 0;
  border-bottom: 1px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  letter-spacing: 0.04em;
}
.tabs button.on {
  color: var(--text);
  border-bottom-color: #ececef;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.toolbar input, .toolbar select { max-width: 280px; }
.toolbar .btn { margin-left: auto; }

.sheet-bg {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, 0.62);
}
.sheet {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 71;
  width: min(440px, 100%);
  overflow: auto;
  padding: 28px 22px 48px;
  background: #0b0b0d;
  border-left: 1px solid var(--line);
}
.sheet h2 { margin: 4px 0 8px; font-size: 28px; letter-spacing: -0.04em; }
.sheet-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
}
.sheet-form label { margin-top: 12px; }
.sheet-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
}
.sheet-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.user-mail { color: var(--dim); font-size: 12px; }
.pill {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.form-narrow { max-width: 560px; }
.form-narrow .btn.full { margin-top: 22px; }

.pane[hidden] { display: none !important; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #111114;
  border: 1px solid var(--line-hi);
  padding: 12px 18px;
  z-index: 50;
  font-size: 14px;
  max-width: min(90vw, 420px);
  text-align: center;
}
.toast.bad { border-color: rgba(232, 163, 154, 0.4); color: var(--danger); }

.foot {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 22px 0 32px;
  color: var(--dim);
  font-size: 12px;
}
.foot-inner {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.foot-inner img:not(.foot-by-av) {
  height: 22px;
  width: auto;
  object-fit: contain;
}
.foot-disc {
  color: #c8c8cc;
  text-decoration: none;
}
.foot-disc:hover { color: #fff; }

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; gap: 28px; }
  .acct-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .wrap, .foot-inner { width: min(1120px, calc(100% - 32px)); }
  .top { padding-inline: 16px; }
}

@media (max-width: 560px) {
  h1 { font-size: 32px; }
  .stats { grid-template-columns: 1fr; }
}
