:root {
  color-scheme: dark;
  --bg: #07070a;
  --surface: #111117;
  --surface-2: #17171f;
  --surface-3: #1d1d27;
  --line: #2a2932;
  --line-soft: #202028;
  --text: #f7f5fb;
  --text-2: #d6d1df;
  --muted: #928d9c;
  --muted-2: #85808f;
  --purple: #8b5cf6;
  --purple-soft: #c4b5fd;
  --purple-deep: #24183b;
  --green: #54d78a;
  --amber: #f2bd5b;
  --red: #ff7a86;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 10%, rgba(139, 92, 246, .15), transparent 28%),
    radial-gradient(circle at 80% 100%, rgba(196, 181, 253, .07), transparent 26%),
    var(--bg);
}

.login-card {
  width: min(430px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(17, 17, 23, .94);
  box-shadow: 0 28px 80px rgba(0,0,0,.45);
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--purple), #5f3ec0);
  color: white;
  font-weight: 950;
  font-size: 25px;
  box-shadow: 0 12px 32px rgba(139, 92, 246, .25);
}
.brand-mark.small { width: 38px; height: 38px; border-radius: 12px; font-size: 18px; }
.eyebrow { margin: 18px 0 5px; color: var(--purple-soft); font-size: 11px; font-weight: 900; letter-spacing: .16em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 31px; letter-spacing: -.04em; }
h2 { margin-bottom: 0; font-size: 28px; letter-spacing: -.035em; }
h3 { margin-bottom: 8px; font-size: 16px; }
.muted { color: var(--muted); }
.small-text { font-size: 12px; }
.stack { display: grid; gap: 14px; margin-top: 26px; }
label { display: grid; gap: 7px; color: var(--text-2); font-size: 12px; font-weight: 750; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0d0d12;
  color: var(--text);
  outline: none;
  padding: 11px 12px;
  transition: border-color .16s ease, box-shadow .16s ease;
}
textarea { min-height: 100px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(139,92,246,.13); }

.button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 9px 14px;
  background: var(--surface-3);
  color: var(--text);
  font-weight: 850;
}
.button:hover { filter: brightness(1.08); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.primary { background: var(--purple); color: white; }
.button.danger { background: rgba(255,122,134,.1); color: var(--red); border-color: rgba(255,122,134,.25); }
.button.ghost { background: transparent; border-color: var(--line); color: var(--text-2); }
.button.full { width: 100%; }
.form-error { margin: 12px 0 0; color: var(--red); font-size: 12px; }
.mfa-enrollment { padding: 12px; border: 1px solid #3a2e45; border-radius: 14px; background: #0d0d12; }
.mfa-qr { display: block; width: 180px; height: 180px; margin: 0 auto 12px; border: 8px solid white; border-radius: 10px; background: white; }
.mfa-secret { display: block; overflow-wrap: anywhere; padding: 9px 10px; border-radius: 9px; background: #050507; color: var(--purple-soft); font-size: 11px; user-select: all; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 242px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  border-right: 1px solid var(--line-soft);
  background: #0b0b0f;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 4px 7px 19px; }
.sidebar-brand strong { display: block; font-size: 14px; }
.sidebar-brand span { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.nav { display: grid; gap: 4px; }
.nav-item {
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 11px;
  padding: 10px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
}
.nav-item:hover { background: var(--surface); color: var(--text-2); }
.nav-item.active { background: var(--purple-deep); color: var(--purple-soft); }
.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.whoami { min-width: 0; padding: 0 4px 11px; }
.whoami span { display: block; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 10px; }
.whoami strong { display: inline-block; margin-top: 5px; color: var(--purple-soft); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }

.workspace { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 26px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(7,7,10,.9);
  backdrop-filter: blur(18px);
}
.topbar .eyebrow { margin: 0 0 4px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.content { padding: 24px 26px 42px; }

.grid { display: grid; gap: 14px; }
.grid.cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 17px;
}
.card.subtle { background: #0d0d12; }
.metric-label { color: var(--muted); font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.metric-value { margin-top: 9px; font-size: 28px; font-weight: 950; letter-spacing: -.04em; }
.metric-meta { margin-top: 4px; color: var(--muted-2); font-size: 10px; }
.section { margin-top: 18px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.section-head h3 { margin: 0; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 11px 13px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; font-size: 11px; }
th { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; background: #0e0e13; }
tr:last-child td { border-bottom: 0; }
td strong { font-size: 11px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; color: var(--text-2); }

.pill { display: inline-flex; align-items: center; gap: 5px; min-height: 23px; padding: 3px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 9px; font-weight: 850; }
.pill.green { background: rgba(84,215,138,.1); color: var(--green); }
.pill.red { background: rgba(255,122,134,.1); color: var(--red); }
.pill.amber { background: rgba(242,189,91,.1); color: var(--amber); }
.pill.purple { background: var(--purple-deep); color: var(--purple-soft); }

.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-bottom: 12px; }
.toolbar .grow { flex: 1 1 280px; }
.toolbar label { min-width: 150px; }
.empty { padding: 34px 20px; text-align: center; color: var(--muted); }
.loading { padding: 44px 20px; text-align: center; color: var(--muted); }

.funnel { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.funnel-step { position: relative; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }
.funnel-step span { display: block; color: var(--muted); font-size: 9px; text-transform: uppercase; font-weight: 850; }
.funnel-step strong { display: block; margin-top: 5px; font-size: 20px; }

.push-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); gap: 16px; align-items: start; }
.preview-phone { width: min(340px, 100%); margin: 0 auto; padding: 18px; border: 1px solid #3a3744; border-radius: 28px; background: #09090d; box-shadow: inset 0 0 0 6px #14141b; }
.preview-notch { width: 82px; height: 18px; margin: 0 auto 18px; border-radius: 0 0 12px 12px; background: #020203; }
.notification-preview { border-radius: 19px; padding: 13px; background: rgba(64,64,76,.72); backdrop-filter: blur(14px); }
.notification-preview .app-line { color: #ddd8e6; font-size: 9px; font-weight: 850; }
.notification-preview h4 { margin: 7px 0 2px; font-size: 13px; }
.notification-preview p { margin: 0; color: #e4dfeb; font-size: 11px; line-height: 1.35; }
.confirm-box { margin-top: 13px; padding: 12px; border: 1px solid rgba(242,189,91,.25); border-radius: 12px; background: rgba(242,189,91,.05); }
.confirm-box p { margin: 0 0 8px; color: var(--amber); font-size: 10px; line-height: 1.45; }

.inline-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.tiny-button { min-height: 30px; padding: 5px 9px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-3); color: var(--text-2); font-size: 9px; font-weight: 850; }
.tiny-button.danger { color: var(--red); border-color: rgba(255,122,134,.25); }
.tiny-button.good { color: var(--green); border-color: rgba(84,215,138,.25); }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  max-width: 360px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #17171f;
  color: var(--text);
  font-size: 11px;
  box-shadow: 0 14px 40px rgba(0,0,0,.45);
  transition: .18s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(255,122,134,.35); color: #ffd5d9; }

@media (max-width: 1050px) {
  .grid.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .push-layout { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nav-item { text-align: center; padding: 8px 5px; }
  .sidebar-footer { display: flex; align-items: center; gap: 8px; }
  .sidebar-footer .whoami { flex: 1; }
  .sidebar-footer .button { width: auto; }
  .topbar { position: static; padding: 15px 16px; }
  .content { padding: 16px; }
  .grid.cards, .grid.two, .funnel { grid-template-columns: 1fr; }
}
