:root {
  color-scheme: dark;
  --bg: #0d131a;
  --bg-top: #131b24;
  --panel: #151d27;
  --panel-strong: #121923;
  --panel-soft: #192230;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --text: #e7edf4;
  --muted: #93a1b3;
  --muted-strong: #cad3de;
  --blue: #9bb0ca;
  --blue-deep: #7f95b0;
  --gold: #b9aa87;
  --mint: #90b7a2;
  --rose: #d59b9b;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-top) 100%);
}

.shell {
  width: min(1480px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.hero,
.panel,
.auth-panel,
.glass-card,
.summary-card,
.status-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-radius: 10px;
  padding: 12px 14px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 124px;
  height: 28px;
  object-fit: contain;
  object-position: left center;
}

.brand-lockup {
  display: grid;
  gap: 2px;
}

.brand-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted-strong);
  letter-spacing: 0.02em;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.eyebrow,
.panel-label,
.card-label {
  margin: 0 0 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
  font-weight: 600;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

.lede,
.panel-meta,
.identity-meta,
.auth-copy {
  color: var(--muted);
}

.hero-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.hero-aside {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero-tool {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
}

.glass-card {
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--panel-soft);
}

.auth-top-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-top-row {
  justify-content: flex-end;
}

.toolbar-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.language-select-wrap {
  display: inline-flex;
  align-items: center;
}

.language-select {
  appearance: none;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-strong);
  padding: 6px 28px 6px 12px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted-strong) 50%),
    linear-gradient(135deg, var(--muted-strong) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 1px),
    calc(100% - 11px) calc(50% - 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.language-select:focus {
  outline: 2px solid rgba(155, 176, 202, 0.55);
  outline-offset: 2px;
}

.identity-email {
  font-size: 0.95rem;
  font-weight: 700;
  min-width: 0;
  overflow-wrap: anywhere;
}

.identity-meta {
  margin-top: 4px;
  line-height: 1.3;
  font-size: 0.84rem;
}

.button {
  border: 0;
  border-radius: 6px;
  padding: 8px 13px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button-primary {
  background: #d7dde5;
  color: #111821;
}

.button-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid var(--border);
}

.button-ghost {
  background: transparent;
  color: var(--muted-strong);
  border: 1px solid var(--border);
}

.button-danger {
  background: #d3a0a0;
  color: #1d0f10;
}

.button-small {
  padding: 7px 11px;
  font-size: 0.84rem;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.status-panel {
  margin-top: 18px;
  border-radius: 8px;
  padding: 9px 12px;
  min-height: 42px;
  display: flex;
  align-items: center;
  color: var(--muted-strong);
}

.status-panel.status-error {
  border-color: rgba(255, 157, 157, 0.24);
  color: var(--rose);
}

.status-panel.status-success {
  border-color: rgba(156, 231, 191, 0.24);
  color: var(--mint);
}

.status-panel.status-info {
  border-color: rgba(142, 219, 255, 0.22);
  color: var(--blue);
}

.auth-panel {
  margin: 64px auto 0;
  width: min(360px, 100%);
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
  background: var(--panel-strong);
}

.auth-panel-inner {
  padding: 18px 18px;
  display: grid;
  gap: 6px;
  text-align: center;
}

.auth-kicker {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
}

.auth-title {
  font-size: 0.96rem;
  line-height: 1.2;
  letter-spacing: 0;
  font-weight: 600;
}

.auth-copy {
  line-height: 1.45;
  font-size: 0.82rem;
}

.auth-panel .button {
  margin-top: 4px;
  width: 100%;
  border-radius: 6px;
}

.dashboard {
  margin-top: 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.summary-card {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  padding: 14px;
}

.summary-value {
  margin-top: 10px;
  font-size: clamp(1.35rem, 1.8vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.summary-detail {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.summary-users {
  border-color: rgba(142, 219, 255, 0.22);
}

.summary-projects {
  border-color: rgba(156, 231, 191, 0.22);
}

.summary-ai {
  border-color: rgba(255, 196, 125, 0.22);
}

.summary-paid {
  border-color: rgba(206, 184, 255, 0.18);
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(20rem, 1fr);
  gap: 16px;
  margin-top: 18px;
  align-items: start;
}

.admin-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(22rem, 0.95fr);
}

.panel {
  margin-top: 18px;
  border-radius: 10px;
  padding: 16px;
}

.panel-grid > .panel {
  margin-top: 0;
}

.panel-header,
.subsection-header,
.feature-head,
.tier-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  flex-wrap: wrap;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-top: 16px;
  align-items: end;
}

.search-input-wrap {
  display: grid;
  gap: 8px;
}

.search-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.text-input,
.text-area {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #101722;
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.text-input:focus,
.text-area:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 4px rgba(142, 219, 255, 0.08);
}

.text-area {
  min-height: 108px;
  resize: vertical;
}

.search-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.integration-card {
  margin-top: 16px;
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--panel-soft);
}

.integration-copy {
  color: var(--muted);
  line-height: 1.55;
}

.inspector-empty {
  min-height: 18rem;
  display: grid;
  place-items: center;
  padding: 18px;
  border-radius: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
}

.inspector-stack {
  display: grid;
  gap: 18px;
}

.inspector-heading {
  display: grid;
  gap: 4px;
}

.inspector-title {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.inspector-subtitle {
  color: var(--muted);
  line-height: 1.55;
}

.inspector-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.detail-card {
  border-radius: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
}

.detail-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-value {
  margin-top: 8px;
  line-height: 1.5;
  font-weight: 600;
  word-break: break-word;
}

.provider-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.delete-card {
  border-radius: 8px;
  padding: 16px;
  border: 1px solid rgba(255, 157, 157, 0.18);
  background: var(--panel-soft);
}

.support-card {
  border-color: rgba(142, 219, 255, 0.16);
  background: var(--panel-soft);
}

.delete-copy {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.form-stack {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.checkbox-row {
  display: flex;
  gap: 10px;
  align-items: start;
  color: var(--muted-strong);
  line-height: 1.5;
}

.checkbox-row input {
  margin-top: 4px;
}

.danger-note {
  color: var(--rose);
}

.panel h2 {
  font-size: 1.02rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.subsection {
  margin-top: 16px;
}

.compact-subsection {
  margin-top: 18px;
}

.compact-subsection h3 {
  font-size: 0.96rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.mini-metric {
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
}

.mini-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.mini-value {
  margin-top: 6px;
  font-size: 0.96rem;
  font-weight: 600;
  word-break: break-word;
}

.feature-list,
.tier-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.feature-row,
.tier-row {
  display: grid;
  gap: 12px;
}

.feature-head,
.tier-head {
  margin-bottom: 2px;
}

.empty-state,
.table-empty,
.user-subtext {
  color: var(--muted);
}

.meter {
  width: 100%;
  height: 7px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 2px;
}

.meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #94a8c1, #bcab8b);
}

.tier-chip,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
}

.table-wrap {
  margin-top: 18px;
  overflow-x: auto;
}

.compact-table-wrap {
  margin-top: 12px;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

td {
  font-size: 0.92rem;
}

tr.is-selected {
  background: rgba(142, 219, 255, 0.06);
}

tbody tr[data-user-id] {
  cursor: pointer;
}

tbody tr[data-user-id]:hover {
  background: rgba(255, 255, 255, 0.03);
}

.user-name {
  font-weight: 700;
}

.user-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.badge.free {
  color: var(--muted-strong);
}

.badge.pro {
  color: var(--blue);
}

.badge.studio {
  color: var(--gold);
}

.badge.status-active,
.badge.status-trialing,
.badge.status-grace-period {
  color: var(--mint);
}

.badge.status-past-due,
.badge.status-paused {
  color: var(--gold);
}

.badge.status-canceled,
.badge.status-expired,
.badge.status-refunded,
.badge.status-revoked {
  color: var(--rose);
}

.badge.auth-google,
.badge.auth-apple,
.badge.auth-kakao {
  color: var(--blue);
}

.badge.auth-email {
  color: var(--muted-strong);
}

.badge.state-signup-complete {
  color: var(--mint);
}

.badge.state-bootstrap-only,
.badge.state-profile-ready {
  color: var(--gold);
}

.row-action {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.kpi-embed-shell {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #0f151e;
}

.kpi-embed-frame {
  display: block;
  width: 100%;
  min-height: 520px;
  border: 0;
  background: #0f151e;
}

.panel-meta,
.integration-copy,
.user-subtext,
.detail-value,
.delete-copy,
.auth-copy,
.identity-meta {
  overflow-wrap: anywhere;
}

@media (max-width: 1180px) {
  .panel-grid,
  .admin-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-aside {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .hero-tool,
  .auth-top-row {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .search-form {
    grid-template-columns: 1fr;
  }

  .inspector-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 24px, 100%);
    padding-top: 20px;
  }

  .hero,
  .panel,
  .auth-panel {
    width: 100%;
  }

  .panel,
  .auth-panel-inner {
    padding: 16px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-aside {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-tool,
  .auth-top-row {
    width: 100%;
  }

  .brand-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .search-actions,
  .integration-card {
    flex-direction: column;
    align-items: stretch;
  }

  .kpi-embed-frame {
    min-height: 420px;
  }
}
