:root {
  color-scheme: dark;
  --ink: #eff8f2;
  --muted: #a6beb3;
  --canvas: #031811;
  --panel: #0b2c22;
  --panel-soft: #102f26;
  --line: #31584a;
  --lime: #b7f43d;
  --coral: #ff9987;
  --amber: #ffd787;
  --good: #8ce0ae;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: radial-gradient(1000px 600px at 20% -10%, #174b39 0%, transparent 62%), var(--canvas);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid #c9ff63; outline-offset: 3px; }

.loading, .auth-card { max-width: 620px; margin: 15vh auto; padding: 44px; border: 1px solid var(--line); border-radius: 22px; background: #0a281f; box-shadow: 0 30px 100px #0009; }
.loading { color: var(--muted); }
.eyebrow { margin: 0 0 12px; color: var(--lime); font: 700 14px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(34px, 5vw, 62px); letter-spacing: -.065em; line-height: .93; }
h2 { margin-bottom: 8px; font-size: 23px; letter-spacing: -.04em; }
h3 { margin: 0; font-size: 17px; }
.lede, .muted { color: var(--muted); line-height: 1.5; }
.notice { margin: 24px 0; padding: 14px 16px; border: 1px solid #57682d; border-radius: 12px; color: #ddf7a6; background: #24351a; line-height: 1.45; }
.error { margin: 18px 0 0; padding: 12px 14px; border: 1px solid #8e4437; border-radius: 10px; color: #ffc2b8; background: #341f1a; line-height: 1.4; }
.field { display: grid; gap: 8px; margin: 16px 0; color: var(--muted); font-size: 14px; }
input, select { width: 100%; padding: 13px 14px; color: var(--ink); border: 1px solid #527264; border-radius: 10px; background: #071e16; }
.primary, .secondary, .danger, .compact {
  border-radius: 10px; padding: 12px 16px; border: 1px solid transparent; font-weight: 750;
}
.primary { color: #10200b; background: var(--lime); }
.secondary, .compact { color: var(--ink); border-color: #527264; background: transparent; }
.danger { color: #ffc2b8; border-color: #8e4437; background: transparent; }
.compact { padding: 8px 10px; font-size: 13px; }
.primary[disabled], .secondary[disabled], .compact[disabled] { cursor: wait; opacity: .6; }

.shell { max-width: 1600px; margin: 0 auto; padding: 42px clamp(20px, 4vw, 64px) 80px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; margin-bottom: 36px; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.identity { color: var(--muted); align-self: center; font: 600 14px ui-monospace, SFMono-Regular, Menlo, monospace; }
.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin: 0 0 22px; }
.metric, .panel, .user-row { border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(145deg, #11372b, #09251d); }
.metric { padding: 18px; }
.metric span { display: block; color: var(--muted); font-size: 13px; }
.metric strong { display: block; margin-top: 8px; font-size: 34px; letter-spacing: -.06em; }
.layout { display: grid; grid-template-columns: minmax(0, 1.38fr) minmax(340px, .88fr); gap: 22px; align-items: start; }
.panel { padding: 24px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-head p { margin: 0; }
.search { max-width: 280px; padding: 9px 11px; }
.users { display: grid; gap: 12px; }
.user-row { overflow: hidden; }
.user-summary { width: 100%; display: grid; grid-template-columns: minmax(0, 1.4fr) .55fr .65fr 30px; align-items: center; gap: 14px; padding: 17px 18px; border: 0; color: inherit; text-align: left; background: transparent; }
.user-summary:hover { background: #163c2f; }
.user-name { display: grid; gap: 5px; min-width: 0; }
.user-name strong, .user-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-name span, .micro { color: var(--muted); font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.user-meta { color: var(--muted); font-size: 13px; }
.chevron { color: var(--lime); font-size: 20px; transition: transform .15s ease; }
.user-row.open .chevron { transform: rotate(90deg); }
.user-detail { display: none; padding: 0 18px 18px; border-top: 1px solid #34594c; }
.user-row.open .user-detail { display: block; }
.connection { margin-top: 14px; padding: 15px; border: 1px solid #31584a; border-radius: 12px; background: #09231b; }
.connection-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.connection-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.tag { display: inline-flex; align-items: center; border: 1px solid #54722e; border-radius: 99px; padding: 4px 8px; color: #d9ff88; background: #1d351b; font: 700 11px ui-monospace, SFMono-Regular, Menlo, monospace; }
.tag.muted { border-color: #527264; color: #cadbd3; background: #163429; }
.diag { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.diag div { padding: 10px; border-radius: 9px; background: #102e24; }
.diag span { display: block; color: var(--muted); font-size: 11px; }
.diag strong { display: block; margin-top: 4px; font-size: 13px; overflow-wrap: anywhere; }
.interaction-list { display: grid; gap: 8px; margin: 15px 0 0; }
.interaction { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; gap: 9px; align-items: start; padding: 9px 0; border-top: 1px solid #27463b; }
.interaction:first-child { border-top: 0; }
.status-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--good); }
.interaction.error .status-dot { background: var(--coral); }
.interaction strong { display: block; font-size: 13px; }
.interaction p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.event-list { display: grid; gap: 2px; max-height: 720px; overflow: auto; }
.event { display: grid; grid-template-columns: 9px minmax(0, 1fr); gap: 10px; padding: 12px 0; border-bottom: 1px solid #27463b; }
.event-body { min-width: 0; }
.event-title { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.event-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-body p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.event time { color: #9cb7ab; font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
.empty { padding: 28px 0; color: var(--muted); text-align: center; }
.footer-note { margin: 18px 0 0; color: #91ab9f; font-size: 12px; line-height: 1.5; }
.promo-panel { margin-top: 22px; }
.promo-form { display: grid; grid-template-columns: minmax(190px, 1.1fr) minmax(150px, .7fr) minmax(180px, 1fr) minmax(180px, 1fr) auto; align-items: end; gap: 12px; padding: 16px; border: 1px solid #31584a; border-radius: 12px; background: #09231b; }
.promo-form .field { margin: 0; }
.promo-form .field .muted { font-weight: 400; }
.promo-notice { margin-bottom: 0; }
.promo-list { display: grid; gap: 12px; margin-top: 16px; }
.promo-code { padding: 15px; border: 1px solid #31584a; border-radius: 12px; background: #09231b; }
.promo-code-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.promo-code-head > div:first-child { display: grid; gap: 5px; }
.promo-code-head code { color: #d9ff88; font: 800 16px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
.promo-code-head strong { font-size: 14px; }
.promo-code-head span:not(.tag) { color: var(--muted); font-size: 12px; }
.promo-code-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.promo-redemptions { display: grid; gap: 7px; margin-top: 14px; padding-top: 12px; border-top: 1px solid #27463b; }
.promo-redemption { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.promo-redemption > div { display: grid; gap: 3px; min-width: 0; }
.promo-redemption strong { font-size: 13px; }
.promo-redemption span, .promo-redemption time { color: var(--muted); font-size: 12px; }
.promo-redemption time { white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.promo-empty { margin: 0; font-size: 13px; }

@media (max-width: 1120px) { .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .layout { grid-template-columns: 1fr; } }
@media (max-width: 680px) {
  .shell { padding: 26px 16px 56px; }
  .topbar { display: block; }
  .actions { justify-content: flex-start; margin-top: 20px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:last-child { grid-column: span 2; }
  .panel { padding: 18px; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .search { max-width: none; }
  .promo-form { grid-template-columns: 1fr; }
  .promo-code-head, .promo-redemption { align-items: flex-start; flex-direction: column; }
  .promo-code-actions { justify-content: flex-start; }
  .user-summary { grid-template-columns: minmax(0, 1fr) 24px; }
  .user-summary > .user-meta { display: none; }
  .diag { grid-template-columns: 1fr; }
  .event-title { display: block; }
  .event time { display: block; margin-top: 4px; }
}
