:root {
  --bg-1: #160722;
  --bg-2: #2b0d48;
  --bg-3: #1d1135;
  --panel: rgba(32, 15, 58, 0.74);
  --panel-border: rgba(197, 160, 255, 0.18);
  --text: #f4eeff;
  --muted: #cbbbe7;
  --accent: #a855f7;
  --accent-2: #60a5fa;
  --accent-3: #f472b6;
  --success: #34d399;
  --shadow: 0 20px 60px rgba(11, 5, 24, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "IBM Plex Sans", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(168, 85, 247, 0.38), transparent 28%),
    radial-gradient(circle at top right, rgba(96, 165, 250, 0.26), transparent 22%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2) 52%, var(--bg-3));
}

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

.hero,
.filters,
.panel,
.metric,
.login-card {
  backdrop-filter: blur(18px);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 28px;
  border-radius: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #f9a8d4;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  font-family: "Space Grotesk", sans-serif;
}

h1,
h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

h1 {
  font-size: clamp(2.1rem, 4vw, 3.8rem);
  max-width: 12ch;
}

.subhead,
.panel-head p,
.hero-actions a,
.filters span,
.leader-item small,
#reports small {
  color: var(--muted);
}

.hero-actions {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.ghost,
#refresh,
.login-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.4), rgba(96, 165, 250, 0.2));
  text-decoration: none;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.ghost:hover,
#refresh:hover,
.login-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.35);
}

.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
  padding: 18px;
  border-radius: 24px;
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.register-form {
  display: grid;
  gap: 12px;
}

.register-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filters input,
.filters select,
.register-form input {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(7, 7, 10, 0.92);
  color: #ffffff;
  min-height: 46px;
  border-radius: 14px;
  padding: 0 14px;
}

.filters input::placeholder,
.register-form input::placeholder {
  color: rgba(255, 255, 255, 0.62);
}

.filters select,
.register-form input,
.filters input {
  appearance: none;
  -webkit-appearance: none;
}

.filters select option {
  background: #050507;
  color: #ffffff;
}

.filters input:focus,
.filters select:focus,
.register-form input:focus {
  outline: none;
  border-color: rgba(168, 85, 247, 0.78);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.18);
}

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

.metric {
  padding: 22px;
  border-radius: 24px;
}

.metric .label {
  font-size: 0.92rem;
  color: var(--muted);
}

.metric .value {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.8rem, 3vw, 2.7rem);
  font-family: "Space Grotesk", sans-serif;
}

.metric .meta {
  margin-top: 6px;
  font-size: 0.95rem;
  color: #f9a8d4;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.panel {
  border-radius: 24px;
  padding: 20px;
  min-height: 320px;
}

.wide {
  grid-column: span 2;
}

.panel-head {
  margin-bottom: 16px;
}

.panel-head h2 {
  font-size: 1.25rem;
}

#leaders,
#reports,
#users,
#register-result {
  display: grid;
  gap: 12px;
}

.result-card code,
.result-card pre {
  display: block;
  margin-top: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(8, 5, 18, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px;
  color: #e9ddff;
  font-size: 0.88rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  text-decoration: none;
}

.management-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.management-toolbar label,
.inline-editor label {
  display: grid;
  gap: 6px;
}

.management-toolbar span,
.inline-editor span {
  color: var(--muted);
  font-size: 0.9rem;
}

.management-toolbar input,
.management-toolbar select,
.inline-editor input,
.quota-input {
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(7, 7, 10, 0.92);
  color: #ffffff;
  padding: 0 12px;
}

.quota-input {
  width: 110px;
}

.danger-button {
  border-color: rgba(244, 114, 182, 0.3);
  background: rgba(244, 114, 182, 0.12);
}

.leader-item,
.report-row,
.user-row,
.result-card {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
}

.leader-item strong,
.report-row strong,
.user-row strong,
.result-card strong {
  display: block;
  font-family: "Space Grotesk", sans-serif;
}

.inline-editor {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(8, 5, 18, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.pagination-size {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.pagination-size select {
  min-height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(7, 7, 10, 0.92);
  color: #ffffff;
  padding: 0 12px;
}

.pagination-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(520px, 100%);
  padding: 32px;
  border-radius: 32px;
}

.login-card h1 {
  max-width: none;
  margin-bottom: 12px;
}

.login-button {
  margin-top: 18px;
  width: 100%;
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-form label {
  display: grid;
  gap: 8px;
}

.login-form input {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(7, 7, 10, 0.92);
  color: #ffffff;
  min-height: 46px;
  border-radius: 14px;
  padding: 0 14px;
}

.portal-shell {
  padding-bottom: 80px;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.portal-auth-switch {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

#portal-plan-cycles {
  margin-bottom: 18px;
}

.portal-auth-standalone {
  grid-column: 1 / -1;
  max-width: 720px;
  margin: 0 auto;
}

#portal-guide-card {
  min-height: 0;
  padding-top: 18px;
  padding-bottom: 14px;
}

.portal-centered-card {
  grid-column: 1 / -1;
  width: min(100%, 720px);
  justify-self: center;
}

.portal-centered-card .panel-head {
  text-align: center;
  margin-bottom: 8px;
}

.portal-centered-card .leaders,
.portal-centered-card .portal-guide {
  width: 100%;
}

.portal-summary-card {
  grid-column: span 1;
  width: 100%;
  justify-self: stretch;
}

.portal-summary-card .panel-head {
  text-align: left;
}

.portal-auth-form {
  display: none;
}

.portal-auth-form.is-active {
  display: grid;
}

.portal-auth-form button,
.portal-google {
  min-height: 52px;
  border-radius: 16px;
  font-size: 1rem;
  font-weight: 600;
}

#portal-login-button,
#portal-register-button {
  margin-top: 6px;
  box-shadow: 0 16px 34px rgba(96, 165, 250, 0.18);
}

.ghost.mini {
  min-height: 38px;
  padding: 0 14px;
}

.ghost.mini.active {
  border-color: rgba(255, 255, 255, 0.34);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.58), rgba(96, 165, 250, 0.28));
}

.portal-divider {
  display: grid;
  place-items: center;
  margin: 16px 0;
  color: var(--muted);
}

.portal-divider span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 42px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.portal-google {
  width: 100%;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.plan-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(168, 85, 247, 0.1));
  color: var(--text);
  border-radius: 22px;
  padding: 18px;
  text-align: left;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.plan-card:hover,
.plan-card.selected {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 18px 40px rgba(8, 5, 18, 0.32);
}

.plan-card strong {
  display: block;
  margin-top: 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.15rem;
}

.plan-card small {
  display: block;
  min-height: 42px;
  margin-top: 8px;
  color: var(--muted);
}

.plan-highlight {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(244, 114, 182, 0.16);
  color: #ffd7ea;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.plan-meta {
  margin-top: 10px;
  color: var(--muted);
}

.plan-price {
  margin-top: 14px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.35rem;
}

.portal-order-builder {
  display: grid;
  gap: 12px;
  height: 100%;
}

#portal-checkout-card,
#portal-orders-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

#portal-checkout-card .panel-head,
#portal-orders-card .panel-head {
  margin-bottom: 14px;
}

#portal-orders {
  display: grid;
  gap: 12px;
}

#portal-order-builder,
#portal-orders {
  flex: 1;
}

#portal-order-builder .result-card {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

#portal-order-builder .result-card strong {
  font-size: 1.28rem;
}

#portal-order-builder .result-card small {
  font-size: 1rem;
  line-height: 1.65;
}

#portal-order-builder .result-card,
#portal-orders .leader-item {
  min-height: 120px;
}

.service-card {
  display: grid;
  gap: 14px;
}

.service-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.service-status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(168, 85, 247, 0.16);
  color: #efe3ff;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

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

.service-metric {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.04), rgba(96, 165, 250, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.service-metric span,
.service-progress-labels,
.service-footnote {
  color: var(--muted);
}

.service-metric strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
}

.service-progress-block {
  display: grid;
  gap: 8px;
}

.service-progress-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.92rem;
}

.service-plan-windows {
  display: grid;
  gap: 6px;
}

.service-plan-windows-title {
  color: var(--muted);
  font-size: 0.88rem;
}

.service-plan-window-item {
  color: var(--muted);
  line-height: 1.5;
}

.service-link-box {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.service-link-box-title {
  color: var(--muted);
  font-size: 0.88rem;
}

.service-link-textarea {
  width: 100%;
  min-height: 92px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(8, 13, 28, 0.92);
  color: #f8fafc;
  resize: vertical;
  box-sizing: border-box;
  font: 0.88rem/1.45 "IBM Plex Sans", sans-serif;
}

.service-progress-track {
  position: relative;
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.service-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a855f7, #60a5fa);
}

.service-progress-fill.is-full {
  background: linear-gradient(90deg, #fb7185, #f59e0b);
}

.payment-submit-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.payment-submit-form .quota-input {
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
}

.payment-submit-form textarea.quota-input {
  padding: 12px;
  resize: vertical;
}

.payment-submit-form .action-row {
  justify-content: flex-start;
  align-items: center;
}

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

.portal-guide-disclosure {
  margin-top: 2px;
}

.portal-guide-summary {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  list-style: none;
  width: 100%;
  padding: 1px 0 0;
  line-height: 1;
  background: transparent;
  border: 0;
}

.portal-guide-summary::-webkit-details-marker {
  display: none;
}

.portal-guide-summary-caret {
  width: 14px;
  height: 14px;
  border-right: 2.5px solid #efe3ff;
  border-bottom: 2.5px solid #efe3ff;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 180ms ease;
  opacity: 0.92;
}

.portal-guide-disclosure[open] .portal-guide-summary-caret {
  transform: rotate(225deg) translateY(-1px);
}

.portal-guide-disclosure-body {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.guide-block {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(96, 165, 250, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.guide-block strong {
  font-family: "Space Grotesk", sans-serif;
}

.guide-block small {
  color: var(--muted);
  line-height: 1.65;
}

.portal-guide-links {
  margin-top: 10px;
  padding: 14px;
  border-radius: 20px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(168, 85, 247, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.portal-guide-links-title {
  margin: 0 0 12px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.portal-guide-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.guide-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.68), rgba(96, 165, 250, 0.36));
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.guide-link-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(8, 5, 18, 0.24);
}

.guide-link-button.secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.portal-import-demo {
  margin-top: 10px;
  padding: 14px;
  border-radius: 20px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.04), rgba(96, 165, 250, 0.1));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.portal-import-demo .panel-head {
  margin-bottom: 10px;
}

.portal-import-demo .panel-head h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
}

.portal-import-demo .panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.import-demo-window {
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #f3f4f6;
  box-shadow: 0 18px 36px rgba(8, 5, 18, 0.24);
}

.import-demo-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #ffffff;
  color: #111827;
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
}

.import-demo-app {
  font-weight: 600;
}

.import-demo-actions {
  display: flex;
  gap: 10px;
}

.import-demo-actions span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #d1d5db;
}

.import-demo-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #f8fafc;
}

.import-demo-address {
  flex: 1;
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 10px;
  background: #ffffff;
  color: #9ca3af;
  border: 1px solid rgba(17, 24, 39, 0.08);
}

.import-demo-toggle {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #fff;
}

.import-demo-proxy {
  color: #374151;
  font-weight: 500;
}

.import-demo-button {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 0;
  background: #60a5fa;
  color: #fff;
  font-weight: 600;
}

.import-demo-plus-wrap {
  position: relative;
  padding: 4px;
  border: 3px solid #ef4444;
  border-radius: 10px;
}

.import-demo-plus-wrap::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 16px;
  border: 2px solid rgba(239, 68, 68, 0.4);
  pointer-events: none;
}

.import-demo-plus {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 0;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
}

code {
  display: block;
  margin-top: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  border-radius: 14px;
  padding: 12px;
  background: rgba(7, 7, 10, 0.92);
  color: #ffffff;
}

.community-qr-wrap {
  margin-top: 14px;
  display: flex;
  justify-content: center;
}

.community-qr-image {
  width: min(260px, 100%);
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  padding: 10px;
  box-shadow: 0 18px 40px rgba(3, 7, 18, 0.24);
}

@media (max-width: 960px) {
  .filters,
  .metrics,
  .grid,
  .portal-grid,
  .plan-grid,
  .portal-guide,
  .service-meta-grid {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: span 1;
  }

  .portal-summary-card {
    grid-column: 1 / -1;
  }

  .hero {
    flex-direction: column;
  }

  .hero-actions {
    flex-wrap: wrap;
  }
}
