/* Account / admin portal — same tokens as the app shell. */

:root {
  --bg: #0d0e11;
  --panel: #131519;
  --panel-2: #171a1f;
  --line: #23262d;
  --line-soft: #1c1f25;
  --text: #e6e8ec;
  --dim: #878d99;
  --dimmer: #5d636e;
  --accent: #6ea8fe;
  --good: #4ec98a;
  --warn: #e0b25c;
  --bad: #e06c6c;
  --radius: 8px;
  --sans: ui-sans-serif, -apple-system, "SF Pro Text", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

body.portal {
  display: block;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

.portal .top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
}
.portal .brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.portal .brand img { display: block; }
.portal .top-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.portal .top-nav a {
  padding: 5px 10px;
  border-radius: 6px;
  color: var(--dim);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}
.portal .top-nav a[aria-current="page"],
.portal .top-nav a:hover {
  color: var(--text);
  background: var(--panel-2);
  text-decoration: none;
}
.portal .top-nav a.hidden { display: none; }
.portal .top-nav .ghost {
  background: transparent;
  border: 0;
  color: var(--dim);
  cursor: pointer;
  font: inherit;
  padding: 5px 10px;
  border-radius: 6px;
}
.portal .top-nav .ghost:hover {
  color: var(--text);
  background: var(--panel-2);
}

/* Admin keeps a simple centered column */
.portal-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}
.portal-head { margin-bottom: 28px; }
.portal-head h1 {
  margin: 0 0 4px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.portal-head .dim,
.dim { color: var(--dim); }
.short { margin: 0 0 12px; font-size: 13px; }

.portal-section {
  margin-bottom: 32px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.portal-section h2 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.stat {
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.stat .label {
  display: block;
  color: var(--dim);
  font-size: 12px;
  margin-bottom: 4px;
}
.stat .value {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.table-wrap { overflow-x: auto; }
.portal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.portal-table th,
.portal-table td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.portal-table th {
  color: var(--dimmer);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: transparent;
}
.portal-table th.num,
.portal-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.portal-table tbody tr:hover td { background: rgba(255, 255, 255, 0.015); }
.portal-table a { color: var(--accent); text-decoration: none; }
.portal-table a:hover { text-decoration: underline; text-underline-offset: 2px; }
.portal-table .live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
  animation: portal-pulse 1.4s infinite;
}
@keyframes portal-pulse { 50% { opacity: .35; } }

.primary {
  background: var(--accent);
  border: 0;
  color: #0b1220;
  font-weight: 600;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  font: inherit;
}
.primary:hover { filter: brightness(1.08); }
.primary.hidden,
.pay-form.hidden,
.hidden { display: none !important; }

.pay-form { margin-top: 14px; }
.card-element {
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 10px;
}
.msg { margin-top: 8px; font-size: 13px; color: var(--dim); }
.msg.bad { color: var(--bad); }
.msg.good { color: var(--good); }
.msg.hidden { display: none !important; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.section-head h2 { margin: 0; }
.ghost-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--dim);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.ghost-btn:hover { color: var(--text); border-color: #2d323b; background: var(--panel-2); }
.ghost-btn.danger:hover {
  color: var(--bad);
  border-color: rgba(224, 108, 108, 0.45);
}

/* ---------- Account console ---------- */

.account-console .console {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: calc(100vh - 44px);
}

.console-nav {
  padding: 18px 12px 24px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 44px;
  height: calc(100vh - 44px);
  box-sizing: border-box;
}
.console-nav-label {
  margin: 2px 8px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dimmer);
}
.console-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.console-link {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--dim);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}
.console-link:hover {
  color: var(--text);
  background: var(--panel-2);
  text-decoration: none;
}
.console-link.active,
.console-link[aria-current="page"] {
  color: var(--text);
  background: #1d222b;
}
.console-foot {
  margin-top: auto;
  padding: 12px 8px 4px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.console-email {
  margin: 0;
  font-size: 12px;
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.console-docs {
  font-size: 12px;
  color: var(--dimmer);
  text-decoration: none;
}
.console-docs:hover { color: var(--accent); text-decoration: none; }

.console-main {
  padding: 28px 32px 72px;
  min-width: 0;
  max-width: 920px;
}
.console-panel[hidden] { display: none !important; }

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.panel-head h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.panel-head .lede {
  margin: 0;
  color: var(--dim);
  font-size: 13px;
  max-width: 46em;
  line-height: 1.5;
}
.panel-head code {
  font-family: var(--mono);
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}
.metric {
  padding: 14px 15px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 78px;
}
.metric .label {
  color: var(--dim);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.metric .value {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.metric .hint {
  color: var(--dimmer);
  font-size: 11px;
  margin-top: 2px;
}

.surface {
  margin-top: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.surface > .table-wrap { margin: 0; }
.surface-head {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.surface-head.row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.surface-head h2 {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 600;
}
.surface-head .dim {
  margin: 0;
  font-size: 12px;
}
.surface.card {
  padding: 16px 18px 18px;
}
.surface.card h2 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
}
.surface.card .dim { margin: 0; font-size: 13px; line-height: 1.5; }

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

.banner {
  margin: 0 0 16px;
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  border: 1px solid var(--line);
}
.banner.warn {
  background: rgba(224, 178, 92, 0.08);
  border-color: rgba(224, 178, 92, 0.28);
  color: #d8c08a;
}
.banner.bad {
  background: rgba(224, 108, 108, 0.08);
  border-color: rgba(224, 108, 108, 0.3);
  color: #e8a0a0;
}
.banner a { color: inherit; font-weight: 600; }

.kv {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
}
.kv > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}
.kv dt { color: var(--dim); }
.kv dd { margin: 0; font-weight: 500; font-variant-numeric: tabular-nums; }

.mono {
  font-family: var(--mono);
  font-size: 12px;
}
.amount-in { color: var(--good); }
.amount-out { color: var(--text); }
.ref {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-title { font-weight: 500; color: var(--text) !important; }
.row-title:hover { color: var(--accent) !important; }

.kind-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--dim);
  text-transform: capitalize;
}
.kind-unlock { color: #c9a86c; border-color: rgba(224, 178, 92, 0.3); }
.kind-compute { color: var(--accent); border-color: rgba(110, 168, 254, 0.3); }
.kind-credits,
.kind-topup,
.kind-grant,
.kind-opening,
.kind-refund { color: var(--good); border-color: rgba(78, 201, 138, 0.3); }

.job-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--dim);
  text-transform: capitalize;
}
.job-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dimmer);
}
.job-status.running .dot { background: var(--accent); animation: portal-pulse 1.4s infinite; }
.job-status.complete .dot { background: var(--good); }
.job-status.error .dot { background: var(--bad); }
.job-status.waiting .dot { background: var(--warn); }
.job-status.declined .dot { background: var(--dimmer); }

.status-live { color: var(--good); font-weight: 500; font-size: 12px; }
.status-revoked,
.status-off { color: var(--dimmer); font-size: 12px; }
.row-actions { text-align: right; white-space: nowrap; }

.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--dim);
  font-size: 13px;
}
.empty a { font-weight: 500; }

.reveal {
  margin-bottom: 16px;
  padding: 14px 16px;
  background: rgba(110, 168, 254, 0.07);
  border: 1px solid rgba(110, 168, 254, 0.26);
  border-radius: var(--radius);
}
.reveal-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
}
.reveal-copy strong { font-size: 13px; font-weight: 600; }
.reveal-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.reveal-row code {
  flex: 1;
  min-width: 0;
  padding: 9px 11px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-all;
}

.composer {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.composer .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 200px;
}
.composer .field span {
  font-size: 12px;
  color: var(--dim);
}
.composer input {
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
}
.composer input:focus {
  outline: none;
  border-color: rgba(110, 168, 254, 0.5);
}
.composer-actions { display: flex; gap: 8px; }

.filter-field select {
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.packs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 16px 16px;
}
.pack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 14px 15px;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.pack:hover:not(:disabled) {
  border-color: rgba(110, 168, 254, 0.45);
  background: #12151a;
}
.pack:disabled { opacity: 0.4; cursor: default; }
.pack-credit {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.pack-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pack-price { font-size: 12px; color: var(--dim); }
.pack-save { font-size: 11px; color: var(--good); font-weight: 500; }

#pack-msg { padding: 0 16px 14px; margin-top: 0; }

/* Usage explorer */
.account-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.strip-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 88px;
}
.strip-label {
  font-size: 11px;
  color: var(--dimmer);
  letter-spacing: 0.02em;
}
.strip-value {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.strip-value.warn { color: var(--warn); }
.strip-link {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}
.strip-link:hover { text-decoration: underline; }

.explorer-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.hero-label {
  margin: 0 0 2px;
  font-size: 12px;
  color: var(--dim);
  font-weight: 500;
}
.hero-value {
  margin: 0;
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}
.hero-sub { margin: 8px 0 0; font-size: 12px; }
.hero-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  padding-bottom: 2px;
}
.hero-delta {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.hero-peak {
  margin: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.delta-pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--line);
  background: var(--bg);
}
.delta-pill.up {
  color: var(--warn);
  border-color: rgba(224, 178, 92, 0.35);
  background: rgba(224, 178, 92, 0.08);
}
.delta-pill.down {
  color: var(--good);
  border-color: rgba(78, 201, 138, 0.35);
  background: rgba(78, 201, 138, 0.08);
}
.delta-pill.flat { color: var(--dim); }

.window-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--line-soft);
}
.summary-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: inherit;
  cursor: pointer;
  font: inherit;
}
.summary-chip:hover { border-color: #2d323b; }
.summary-chip.active {
  border-color: rgba(110, 168, 254, 0.5);
  background: rgba(110, 168, 254, 0.08);
}
.summary-label {
  font-size: 11px;
  color: var(--dim);
  font-weight: 500;
}
.summary-value {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.explorer-toolbar { align-items: center; }
.explorer-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.segment {
  display: inline-flex;
  padding: 2px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  gap: 2px;
}
.segment-btn {
  border: 0;
  background: transparent;
  color: var(--dim);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
}
.segment-btn:hover { color: var(--text); }
.segment-btn.active {
  background: var(--panel-2);
  color: var(--text);
}
.chart-wrap { padding: 10px 16px 8px; }
.chart-meta {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 4px;
  min-height: 18px;
}
.chart-hover { font-size: 12px; font-variant-numeric: tabular-nums; }
.usage-chart {
  display: block;
  width: 100%;
  height: auto;
  max-height: 280px;
}
.usage-chart .chart-base {
  stroke: var(--line);
  stroke-width: 1;
}
.usage-chart .chart-grid {
  stroke: var(--line-soft);
  stroke-width: 1;
}
.usage-chart .chart-y,
.usage-chart .chart-x {
  fill: var(--dimmer);
  font-size: 10px;
  font-family: var(--mono);
}
.usage-chart .bar {
  fill: rgba(110, 168, 254, 0.55);
}
.usage-chart .bar.hot {
  fill: var(--accent);
}
.chart-axis {
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
  font-size: 11px;
  color: var(--dimmer);
}
.chart-unit {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 800px) {
  .explorer-hero { flex-direction: column; align-items: flex-start; }
  .hero-side, .hero-delta { align-items: flex-start; text-align: left; }
  .account-strip .strip-link { margin-left: 0; }
  .explorer-controls { justify-content: flex-start; }
}

@media (max-width: 800px) {
  .account-console .console {
    grid-template-columns: 1fr;
  }
  .console-nav {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 12px;
  }
  .console-links {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .console-foot {
    margin-top: 10px;
    padding-top: 10px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .console-main { padding: 20px 14px 56px; }
  .panel-head { flex-direction: column; align-items: stretch; }
  .card-grid { grid-template-columns: 1fr; }
  .packs { grid-template-columns: 1fr; }
  .explorer-toolbar { flex-direction: column; align-items: stretch; }
  .explorer-controls { justify-content: flex-start; }
}

@media (max-width: 640px) {
  .portal-main { padding: 20px 14px 48px; }
  .portal .top { padding: 0 12px; }
  .portal-head h1 { font-size: 22px; }
}

/* ---------- Admin editors ---------- */

.admin-editor {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 560px;
  padding: 18px 20px;
}
.admin-editor .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}
.admin-editor .field > span:first-child {
  font-weight: 600;
  color: var(--text);
}
.admin-editor input,
.admin-editor select,
.admin-editor textarea {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
}
.admin-editor textarea { resize: vertical; min-height: 64px; }
.admin-editor .row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  text-align: left;
  white-space: normal;
}
.primary-btn {
  appearance: none;
  border: 1px solid transparent;
  background: var(--accent);
  color: #0b0d10;
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
}
.primary-btn:hover { filter: brightness(1.05); }
.msg.ok { color: var(--ok, #6bbf8a); }

.provider-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.provider-now {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}
.provider-now .label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dimmer);
}
.provider-now strong {
  font-size: 18px;
  font-weight: 650;
}
.field-label {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 600;
}
.provider-segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}
.provider-segment .segment-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  padding: 12px 14px;
  height: auto;
  white-space: normal;
}
.provider-segment .provider-name {
  font-weight: 650;
  font-size: 14px;
}
.provider-segment .provider-blurb {
  font-size: 12px;
  font-weight: 400;
}
.admin-models {
  max-width: 640px;
}


