:root {
  --bg: #0e1722;
  --card: #182332;
  --ink: #e8eef6;
  --support: #93a4b8;
  --muted: #6d7f95;
  --line: #283548;
  --blue: #2563eb;
  --blue-hot: #3b82f6;
  --wash: rgba(37, 99, 235, 0.16);
  --ok: #34d399;
  --wait: #fbbf24;
  --bad: #fb7185;
  --fast: 120ms;
  --move: 200ms;
  --slow: 280ms;
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue-hot); }
.hidden { display: none !important; }

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}
.gate-box {
  width: min(340px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 16px 16px;
  animation: rise var(--slow) var(--ease-out);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.mark-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--blue);
  box-shadow: 0 0 0 3px var(--wash);
  flex: none;
}
.support { color: var(--support); margin: 6px 0 14px; font-size: 13px; }
label { display: block; margin: 10px 0 4px; color: var(--support); font-size: 12px; }
input, select {
  width: 100%;
  background: #101a27;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
input:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.btn, .btn-line {
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.btn { background: var(--blue); color: #fff; }
.btn:hover { background: var(--blue-hot); }
.btn:active, .btn-line:active { transform: scale(0.98); }
.btn-line { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-line:hover { border-color: var(--blue); }
.btn.wide, .btn-line.wide { width: 100%; margin-top: 12px; }
.btn-line.slim { padding: 6px 10px; }
.error { color: var(--bad); min-height: 16px; margin: 6px 0 0; font-size: 12px; }
.kicker {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}

.shell { display: grid; grid-template-columns: 176px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: #121c2a;
  border-right: 1px solid var(--line);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.side nav { display: grid; gap: 2px; }
.side button {
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--support);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.side button.on { background: var(--wash); color: #fff; }
.side button:hover { color: #fff; }
.side-foot { margin-top: auto; padding: 10px 8px 0; border-top: 1px solid var(--line); }
.side-foot p { margin: 6px 0; color: var(--support); font-size: 12px; }
.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line);
  margin-right: 6px;
}
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.15); }
.only-mobile { display: none; }

.workspace {
  min-width: 0;
  width: min(1080px, 100%);
  padding: 16px 18px 28px;
}
.top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-end; }
.top h1 { margin: 0; font-size: 20px; line-height: 1.15; font-weight: 600; letter-spacing: -0.03em; }
.top p { margin: 4px 0 0; color: var(--support); font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.text-link { font-weight: 600; text-decoration: none; font-size: 13px; }
.banner {
  margin-top: 12px;
  padding: 8px 10px;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 8px;
  color: #fde68a;
  font-size: 13px;
}
.rise { animation: rise var(--move) var(--ease-out); }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0 0; }
.toolbar input { max-width: 280px; }
.filters { display: flex; gap: 4px; flex-wrap: wrap; }
.filters button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--support);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.filters button.on { color: #fff; background: var(--wash); border-color: rgba(59, 130, 246, 0.45); }
.toolbar .btn { margin-left: auto; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.metric {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px 10px;
  animation: rise var(--move) var(--ease-out) both;
}
.metric:nth-child(2) { animation-delay: 30ms; }
.metric:nth-child(3) { animation-delay: 60ms; }
.metric:nth-child(4) { animation-delay: 90ms; }
.metric span { display: block; color: var(--support); font-size: 11px; }
.metric b {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.metric.mark { box-shadow: inset 2px 0 0 var(--blue); }

.table-wrap { overflow: auto; margin-top: 8px; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 7px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr.clickable { cursor: pointer; }
tr.clickable td { transition: background var(--fast) var(--ease); }
tr.clickable:hover td { background: rgba(255, 255, 255, 0.03); }
.who { display: flex; align-items: center; gap: 8px; }
.who strong { display: block; font-weight: 600; }
.who small, .muted { color: var(--support); }
.avatar {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--wash);
  color: #bfdbfe;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  flex: none;
}
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--support); }
.num { font-variant-numeric: tabular-nums; }
.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  background: #101a27;
  border: 1px solid var(--line);
  color: var(--support);
}
.badge.active, .badge.sent { color: var(--ok); border-color: rgba(52, 211, 153, 0.4); }
.badge.pending, .badge.queued { color: var(--wait); border-color: rgba(251, 191, 36, 0.4); }
.badge.expired, .badge.failed, .badge.waiting { color: var(--bad); border-color: rgba(251, 113, 133, 0.4); }
.empty { padding: 28px 8px; color: var(--support); text-align: center; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 100%);
  background: var(--card);
  border-left: 1px solid var(--line);
  padding: 16px;
  overflow: auto;
  z-index: 6;
  box-shadow: -16px 0 40px rgba(0, 0, 0, 0.35);
  animation: slide var(--slow) var(--ease-out);
}
.drawer h2 { margin: 6px 0 0; font-size: 18px; font-weight: 600; }
.drawer dl { display: grid; grid-template-columns: 72px 1fr; gap: 6px 10px; margin: 14px 0; }
.drawer dt { color: var(--support); }
.drawer dd { margin: 0; }
.stack { display: grid; gap: 6px; margin-top: 10px; }
.stack .toolbar { margin: 0; }
.rule { height: 1px; background: var(--line); border: 0; margin: 14px 0; }

.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.plan {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: var(--card);
  transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.plan:hover { border-color: #3a4d66; }
.plan.pick { border-color: var(--blue); box-shadow: inset 0 2px 0 var(--blue); }
.tag {
  display: inline-block;
  background: var(--wash);
  color: #bfdbfe;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}
.price { margin: 8px 0 2px; font-size: 26px; line-height: 1; font-weight: 600; letter-spacing: -0.03em; }
.price small { font-size: 13px; font-weight: 500; color: var(--support); }
.checks { list-style: none; padding: 0; margin: 10px 0; }
.checks li { padding: 6px 0 6px 12px; border-top: 1px solid var(--line); position: relative; color: var(--support); }
.plan-kicker { min-height: 18px; margin-bottom: 6px; }
.checks li::before { content: ""; position: absolute; left: 0; top: 12px; width: 4px; height: 4px; border-radius: 50%; background: var(--blue-hot); }

.subscribe { max-width: 860px; margin: 0 auto; padding: 20px 16px 40px; animation: rise var(--slow) var(--ease-out); }
.steps { display: flex; gap: 12px; color: var(--support); margin: 12px 0 4px; font-size: 13px; }
.steps b { color: var(--ink); font-weight: 600; }
.checkout { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 16px; margin-top: 8px; }
.summary { border-left: 1px solid var(--line); padding-left: 16px; }
.summary .price { font-size: 24px; }
.back { background: none; border: 0; color: var(--blue-hot); padding: 0; margin-bottom: 8px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes slide {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 900px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .plans, .checkout { grid-template-columns: 1fr; }
  .summary { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 12px; }
}

@media (max-width: 760px) {
  .shell { display: block; padding-bottom: 62px; }
  .side {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    height: auto;
    z-index: 5;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: 1px solid var(--line);
  }
  .side .brand, .side-foot, .side .btn-line { display: none; }
  .side nav { display: flex; width: 100%; }
  .side button {
    flex: 1;
    text-align: center;
    font-size: 11px;
    padding: 8px 2px;
    border-radius: 8px;
  }
  .only-mobile { display: inline-flex; }
  .workspace { padding: 12px 12px 20px; }
  .top { align-items: center; }
  .top h1 { font-size: 18px; }
  .top p { display: none; }
  .toolbar .btn { margin-left: 0; }
  .table-wrap { overflow: visible; }
  table, tbody { display: grid; gap: 8px; }
  thead { display: none; }
  tr {
    display: block;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 10px;
  }
  td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border: 0;
    padding: 3px 0;
    text-align: right;
  }
  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    text-align: left;
  }
  td:first-child { display: block; text-align: left; padding-bottom: 6px; }
  td:first-child::before { display: none; }
  .drawer { width: 100%; border-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
