:root {
  color-scheme: dark;
  --bg: #0e1512;
  --sidebar: #0a100d;
  --topbar: #121b17;
  --surface: #16201b;
  --surface-2: #1b2822;
  --line: #2a3b33;
  --ink: #eef6f0;
  --muted: #8aa396;
  --accent: #25d366;
  --accent-2: #3ddc84;
  --accent-ink: #062113;
  --accent-soft: rgba(37, 211, 102, 0.14);
  --danger: #ff6b6b;
  --danger-ink: #2a0b0d;
  --warning: #f5c542;
  --info: #4ecdc4;
  --input: #101814;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  --radius: 12px;
  --sidebar-w: 248px;
  --sidebar-collapsed: 76px;
  --topbar-h: 60px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  font-size: 15px;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { color: #7eefb0; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.02em; }
h1 { font-size: 1.15rem; }
h2 { font-size: 1rem; }
h3 { font-size: 0.98rem; }
p { margin: 0; }

.app { min-height: 100vh; }
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 6, 0.55);
  z-index: 25;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  z-index: 30;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--topbar-h);
  padding: 0 16px;
  color: var(--ink);
  font-weight: 750;
  letter-spacing: -0.03em;
  border-bottom: 1px solid var(--line);
}
.brand:hover { color: #fff; }
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  flex: none;
}
.brand-text { white-space: nowrap; }
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 12px 8px;
  padding: 10px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-weight: 750;
  flex: none;
}
.sidebar-user small { display: block; color: var(--muted); font-size: 0.78rem; }
.nav {
  padding: 8px 10px 24px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-label {
  margin: 10px 10px 6px;
  color: #6f8178;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #c5d4cb;
  white-space: nowrap;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-2);
}
.nav-item svg {
  width: 18px;
  height: 18px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  background: var(--topbar);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-toggle {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  position: relative;
  flex: none;
}
.nav-toggle::before {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: 12px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  box-shadow: 0 6px 0 var(--ink), 0 12px 0 var(--ink);
}
.page {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: min(1180px, 100%);
}

.page-head, .panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.page-head { align-items: flex-start; }
.row-actions {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.page-head .row-actions { margin-left: auto; }
.eyebrow {
  color: var(--accent-2);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.lede, .hint, .muted, .login-box-msg { color: var(--muted); }
.lede { margin-top: 6px; max-width: 68ch; }
.panel > p + p, .panel > .lede + p { margin-top: 12px; }

.panel, .login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.panel > h2, .panel-head {
  margin: -20px -20px 16px;
  padding: 14px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
}
.subhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.narrow { max-width: 760px; }
.split { display: grid; grid-template-columns: 1.25fr 0.9fr; gap: 16px; align-items: start; }
.split.form-guide { grid-template-columns: minmax(0, 1fr) minmax(280px, 0.85fr); }
code {
  font-family: Consolas, "Segoe UI Mono", monospace;
  font-size: 0.86em;
  background: var(--input);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
  color: var(--accent-2);
}
.guide-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.guide-body h3 { font-size: 0.92rem; margin-bottom: 6px; }
.guide-body p, .guide-body li { color: var(--muted); font-size: 0.9rem; }
.guide-body p + p, .guide-body p + ul { margin-top: 8px; }
.guide-body ul {
  margin: 8px 0 0;
  padding-left: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.guide-body strong { color: var(--ink); font-weight: 650; }
.guide-body .table-wrap {
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.example {
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #075e3a;
  color: #e9fff3;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.example p { color: #e9fff3; }
.example span {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 2px;
  font-weight: 700;
}
.stack, .stack-panels { display: flex; flex-direction: column; gap: 12px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stats.compact { grid-template-columns: repeat(6, 1fr); margin-top: 16px; }
.stats article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: none;
}
.stats article span { color: var(--muted); font-size: 0.86rem; }
.stats article strong { display: block; font-size: 1.7rem; margin-top: 4px; letter-spacing: -0.03em; }
.stats article:nth-child(1) { border-top: 3px solid var(--info); }
.stats article:nth-child(2) { border-top: 3px solid var(--accent); }
.stats article:nth-child(3) { border-top: 3px solid var(--warning); }
.stats.compact article { border-top-width: 3px; }
.stats.compact article:nth-child(1) { border-top-color: var(--warning); }
.stats.compact article:nth-child(2) { border-top-color: var(--accent); }
.stats.compact article:nth-child(3) { border-top-color: var(--info); }
.stats.compact article:nth-child(4) { border-top-color: #7aa2ff; }
.stats.compact article:nth-child(5) { border-top-color: var(--danger); }
.stats.compact article:nth-child(6) { border-top-color: #c084fc; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 0.92rem; font-weight: 600; }
input, select, textarea, button { font: inherit; color: var(--ink); }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--input);
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 400;
}
input:focus, select:focus, textarea:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type="file"] { padding: 10px; background: var(--surface-2); }
textarea { resize: vertical; min-height: 88px; }
select option { background: #16201b; }
button, .button {
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  text-decoration: none;
}
button:hover, .button:hover { background: #1fbe5b; }
button.ghost, .button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
button.ghost:hover, .button.ghost:hover { background: var(--surface-2); border-color: #3d5248; }
button.danger { background: var(--danger); color: #fff; }
button.danger:hover { background: #ee5555; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.table-wrap { overflow-x: auto; }
.panel > .table-wrap,
.panel > h2 + .table-wrap,
.panel-head + .table-wrap {
  margin: 0 -20px -20px;
  width: calc(100% + 40px);
}
.panel > .hint + .table-wrap { margin-top: 14px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: top; }
th {
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-top: 0;
  font-weight: 700;
}
.panel > .table-wrap th,
.panel > h2 + .table-wrap th,
.panel-head + .table-wrap th,
.panel > .table-wrap td,
.panel > h2 + .table-wrap td,
.panel-head + .table-wrap td { padding-left: 20px; padding-right: 20px; }
tbody tr:hover { background: rgba(255, 255, 255, 0.025); }

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  background: #3a4740;
  color: #d5e4da;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.02em;
}
.pill.APPROVED, .pill.REINSTATED, .pill.done, .pill.read, .pill.delivered { background: var(--accent-soft); color: var(--accent-2); }
.pill.PENDING, .pill.IN_APPEAL, .pill.PENDING_DELETION, .pill.FLAGGED, .pill.queued, .pill.pending, .pill.running, .pill.sending, .pill.sent { background: rgba(245, 197, 66, 0.16); color: #f5c542; }
.pill.REJECTED, .pill.DISABLED, .pill.PAUSED, .pill.DELETED, .pill.LIMIT_EXCEEDED, .pill.ARCHIVED, .pill.LOCKED, .pill.failed, .pill.paused, .pill.cancelled, .pill.RED { background: rgba(255, 107, 107, 0.16); color: #ff8b8b; }
.pill.GREEN { background: var(--accent-soft); color: var(--accent-2); }
.pill.YELLOW { background: rgba(245, 197, 66, 0.16); color: #f5c542; }
.flash {
  border-radius: 10px;
  padding: 11px 13px;
  border: 1px solid transparent;
}
.flash.ok { background: var(--accent-soft); color: var(--accent-2); border-color: rgba(37, 211, 102, 0.28); }
.flash.error { background: rgba(255, 107, 107, 0.14); color: #ffb4b4; border-color: rgba(255, 107, 107, 0.28); }
.empty { color: var(--muted); padding: 8px 0; }
.empty-state {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 4px;
  color: var(--muted);
}
.account {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  background: var(--surface-2);
}
.account + .account { margin-top: 12px; }
.account header { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.account header p { color: var(--muted); margin-top: 2px; }
.account dl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 14px 0; }
.account dt { color: var(--muted); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.account dd { margin: 2px 0 0; }
.account-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin: 14px 0;
}
.account-meta dt { color: var(--muted); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.account-meta dd { margin: 2px 0 0; }
.profile-hero {
  display: flex;
  align-items: center;
  gap: 16px;
}
.profile-hero h2 { font-size: 1.25rem; }
.profile-hero p { color: var(--muted); margin: 4px 0 10px; }
.profile-photo {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--line);
  background: var(--surface-2);
  flex: none;
}
.profile-photo.placeholder {
  display: grid;
  place-items: center;
  font-weight: 750;
  color: var(--muted);
  font-size: 1.4rem;
}
.profile-photo-field {
  display: flex;
  align-items: center;
  gap: 16px;
}
.profile-photo-field label { flex: 1; }
details { margin-top: 12px; }
details summary {
  cursor: pointer;
  color: var(--accent-2);
  font-weight: 650;
}
details .stack { margin-top: 10px; }
.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  counter-reset: step;
}
.steps > li {
  position: relative;
  padding-left: 36px;
  counter-increment: step;
}
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-2);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 750;
}
.steps ul { margin: 8px 0 0; padding-left: 1.1rem; color: var(--muted); }
.steps + .hint { margin-top: 16px; }
.setup-title { margin-top: 22px; }
.setup-links { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.setup-links dt { color: var(--muted); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.setup-links dd { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 0; }
.setup-links button { flex: none; }
.setup-links code { flex: 1; min-width: 0; overflow-wrap: anywhere; padding: 6px 8px; }
.choices { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.choices legend { font-weight: 700; margin-bottom: 8px; padding: 0; }
.choice {
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  font-weight: 500;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: var(--input);
}
.choice input { width: auto; margin-top: 3px; accent-color: var(--accent); }
.choice small, small.block { display: block; color: var(--muted); font-weight: 400; }
small.warn { color: #ff8b98; }
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.button-row select { width: 170px; flex: none; }
.button-row input { flex: 1; min-width: 140px; }
.var-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 0;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(255, 255, 255, 0.02);
}
.var-block legend { font-weight: 700; padding: 0 4px; }
.var-block textarea { min-height: 72px; }
.token-row { display: flex; flex-wrap: wrap; gap: 8px; }
button.token {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.82rem;
  font-weight: 650;
}
button.token:hover { background: var(--surface-2); }
.progress {
  height: 8px;
  background: var(--input);
  border-radius: 999px;
  overflow: hidden;
}
.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #1fbe5b, var(--accent-2));
}
.progress-label { margin-top: 8px; color: var(--muted); }
.previews { display: flex; flex-direction: column; gap: 10px; }
.bubble {
  background: #075e3a;
  color: #e9fff3;
  border-radius: 12px 12px 4px 12px;
  padding: 12px 14px;
  max-width: 36ch;
}
.bubble strong, .bubble em { display: block; }
.bubble strong { margin-bottom: 6px; font-size: 0.8rem; opacity: 0.8; }
.bubble em { opacity: 0.75; font-style: normal; font-size: 0.82rem; margin-top: 8px; }

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 10%, rgba(37, 211, 102, 0.16), transparent 36%),
    radial-gradient(circle at 80% 90%, rgba(78, 205, 196, 0.1), transparent 32%),
    var(--bg);
}
.login-shell { width: min(400px, 100%); }
.login-card { padding: 28px; box-shadow: var(--shadow); }
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.login-logo { font-size: 1.55rem; font-weight: 750; letter-spacing: -0.03em; }
.login-box-msg { text-align: center; margin-bottom: 4px; }
.legal-page {
  width: min(760px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.legal-page h1 { font-size: 1.6rem; margin: 8px 0 10px; }
.legal-page h2 { font-size: 1rem; margin: 22px 0 8px; }
.legal-page p, .legal-page li { color: var(--muted); }
.legal-page ul { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 6px; }
.legal-page p + p { margin-top: 10px; }

@media (min-width: 992px) {
  .guide { position: sticky; top: 76px; }
  .sidebar, .app-main { transition: width 0.2s ease, margin-left 0.2s ease; }
  body.nav-collapsed .sidebar { width: var(--sidebar-collapsed); }
  body.nav-collapsed .app-main { margin-left: var(--sidebar-collapsed); }
  body.nav-collapsed .brand-text,
  body.nav-collapsed .sidebar-user-text,
  body.nav-collapsed .nav-label,
  body.nav-collapsed .nav-item span { display: none; }
  body.nav-collapsed .brand,
  body.nav-collapsed .nav-item,
  body.nav-collapsed .sidebar-user { justify-content: center; padding-inline: 0; }
  body.nav-collapsed .sidebar-user { margin-inline: 12px; }
}

@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-backdrop { display: block; }
  .app-main { margin-left: 0; }
  .split, .stats, .stats.compact, .two, .account dl, .account-meta { grid-template-columns: 1fr; }
  .profile-hero, .profile-photo-field { flex-direction: column; align-items: flex-start; }
  .button-row select, .button-row input { width: 100%; }
  .page { padding: 16px; width: 100%; }
  .topbar { padding: 0 12px; }
}

