/* ============================================================
   Component styles
   依賴 tokens.css 的 CSS variables。
   ============================================================ */

/* ─── TopBar ─── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-0);
  gap: 16px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-meta {
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-logo {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.topbar-brand-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}
.topbar-brand-domain {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}
.topbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}
.topbar-role {
  display: flex;
  align-items: center;
  gap: 8px;
}
.role-chip {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.actor-name {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}
.actor-layer {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 640px) {
  .topbar {
    flex-wrap: nowrap;
    gap: 8px;
    padding: 10px 12px;
    align-items: center;
  }
  .topbar-meta { flex-wrap: nowrap; gap: 8px; min-width: 0; flex: 1; }
  .topbar-brand { flex-shrink: 0; }
  .topbar-brand-domain { display: none; }
  .topbar-divider { display: none; }
  .topbar-role { min-width: 0; }
  .role-chip { padding: 3px 7px; font-size: 10px; flex-shrink: 0; }
  .topbar-right { flex-shrink: 0; }
  .topbar-right .btn { padding: 6px 12px; font-size: 11px; }
}

/* ─── StatCard ─── */
.stat-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, border-color 0.15s;
}
.stat-card:hover {
  transform: translateY(-1px);
  border-color: color-mix(in oklab, var(--accent) 30%, var(--border));
}
.stat-card.hero-card {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  border: 1px solid var(--accent);
}
.stat-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.stat-card.hero-card .stat-label {
  color: rgba(255, 255, 255, 0.85);
}
.stat-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-muted);
}
.stat-value {
  font-size: 30px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat-card.hero-card .stat-value { color: #fff; }
.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}
.stat-card.hero-card .stat-sub { color: rgba(255, 255, 255, 0.8); }

.stat-sparkline {
  position: absolute;
  right: 12px;
  bottom: 12px;
  opacity: 0.85;
  pointer-events: none;
}

@media (max-width: 640px) {
  .stat-card { padding: 14px; }
  .stat-card .stat-value { font-size: 22px; }
}

/* ─── Card ─── */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.card-action {
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-body { padding: 20px; }
.card-body.unpadded { padding: 0; }

@media (max-width: 640px) {
  .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .card-header > div:first-child { white-space: normal !important; }
  .card-header .card-action {
    flex-wrap: wrap;
  }
  .card-header input[type="text"], .card-header .search-input {
    flex: 1 1 auto; min-width: 0; width: 100% !important;
  }
}

/* ─── Buttons ─── */
.btn {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 7px;
  cursor: pointer;
  border: 1px solid;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  transition: filter 0.15s;
  font-family: inherit;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Inputs ─── */
.input {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  width: 100%;
  font-family: inherit;
}
.input:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.input::placeholder { color: #9ca3af; }

select.input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%239ca3af' d='M0 0h10L5 6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.field {
  margin-bottom: 14px;
}
.field-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.field-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}
.required-mark { color: #ef4444; margin-left: 2px; }

/* ─── StatusBadge ─── */
.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 500;
  display: inline-block;
}
.badge-verified { background: color-mix(in oklab, #10b981 15%, transparent); color: #10b981; }
.badge-pending  { background: color-mix(in oklab, #f59e0b 15%, transparent); color: #f59e0b; }
.badge-rejected { background: color-mix(in oklab, #ef4444 15%, transparent); color: #ef4444; }
.badge-none     { background: rgba(0, 0, 0, 0.05); color: var(--text-muted); }

/* ─── Search input ─── */
.search-input-wrap {
  position: relative;
  display: inline-block;
}
.search-input {
  padding: 7px 10px 7px 28px;
  font-size: 12px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  width: 200px;
  font-family: inherit;
  outline: none;
}
.search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* ─── InviteCard (legacy macro, kept for tests) ─── */
.invite-card {
  display: flex;
  padding: 18px;
  gap: 18px;
  align-items: flex-start;
}
.invite-card .qr {
  width: 124px;
  height: 124px;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.invite-card .qr svg {
  width: 100%;
  height: 100%;
  display: block;
}
.invite-card .invite-body {
  flex: 1;
  min-width: 0;
}
.invite-card .invite-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.invite-card .invite-url {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 10px 12px;
  border-radius: 8px;
  word-break: break-all;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}
.invite-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.invite-actions button { white-space: nowrap; }

@media (max-width: 640px) {
  .invite-card { flex-direction: column; align-items: center; padding: 20px; }
  .invite-card .invite-body { width: 100%; }
}

/* ─── AgentTable (desktop table) ─── */
.agent-table-wrap {
  overflow-x: auto;
}
.agent-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.agent-table thead th {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 16px;
  text-align: left;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.agent-table thead th.numeric { text-align: right; }
.agent-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.agent-table tbody td.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.agent-table tbody tr.is-self { background: rgba(124, 92, 255, 0.04); }
.agent-table tbody tr:last-child td { border-bottom: none; }

.agent-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.agent-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), color-mix(in oklab, var(--accent) 60%, #000));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.agent-name { color: var(--text); font-weight: 500; }
.agent-ref {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--text-muted);
}
.layer-chip {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: color-mix(in oklab, var(--accent) 15%, transparent);
  color: var(--accent);
  font-weight: 600;
  display: inline-block;
}

/* ─── AgentTable (mobile cards) ─── */
.agent-list-mobile { display: none; }
.agent-card-mobile {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.agent-card-mobile:last-child { border-bottom: none; }
.agent-card-mobile .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.agent-card-mobile .stats {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.agent-card-mobile .stats strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
}

@media (max-width: 640px) {
  .agent-table-wrap { display: none; }
  .agent-list-mobile { display: block; }
}

/* ─── Phase B placeholders ─── */
.chart-placeholder, .phase-b-placeholder {
  min-height: 220px;
  border: 1px dashed color-mix(in oklab, var(--accent) 30%, var(--border));
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 12px;
  background: rgba(124, 92, 255, 0.04);
}
.chart-placeholder .label,
.phase-b-placeholder .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 600;
}

.date-range-placeholder {
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px dashed color-mix(in oklab, var(--accent) 30%, var(--border));
  color: var(--text-muted);
  font-size: 11px;
  background: rgba(124, 92, 255, 0.04);
}

/* ─── DateRangePicker ─── */
.date-range-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}
.preset-row {
  display: flex;
  gap: 2px;
  background: var(--surface-1);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border);
  flex-wrap: wrap;
}
.preset-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.preset-btn:hover { color: var(--text); }
.preset-btn.active {
  background: var(--accent);
  color: #fff;
}
.custom-range {
  display: none;
  align-items: center;
  gap: 6px;
  background: var(--surface-1);
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.custom-range.show { display: flex; }
.custom-range input[type="date"] {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 12px;
  padding: 4px 6px;
  width: auto;
  font-family: inherit;
}
.custom-range button { padding: 4px 10px; font-size: 11px; }

@media (max-width: 640px) {
  .date-range-picker { width: 100%; align-items: stretch; }
  .preset-row { flex-wrap: wrap; }
  .preset-btn { flex: 1 1 calc(33.333% - 4px); padding: 7px 4px; min-width: 0; }
  .custom-range { flex-wrap: wrap; }
}

/* ─── Alerts / banners ─── */
.alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
  border: 1px solid;
}
.alert-error {
  background: color-mix(in oklab, #ef4444 12%, transparent);
  border-color: color-mix(in oklab, #ef4444 35%, transparent);
  color: #fca5a5;
}
.alert-warn {
  background: color-mix(in oklab, #f59e0b 14%, transparent);
  border-color: color-mix(in oklab, #f59e0b 40%, transparent);
  color: #fcd34d;
}
.alert-info {
  background: color-mix(in oklab, var(--accent) 12%, transparent);
  border-color: color-mix(in oklab, var(--accent) 35%, transparent);
  color: #c7b8ff;
}

/* ─── Hero block (earnings spotlight) ─── */
.hero-block {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}
.hero-earnings { flex: 1; min-width: 240px; }
.hero-actions { flex-shrink: 0; }
.hero-block .eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.hero-block .hero-value {
  font-size: clamp(40px, 6vw, 56px);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.hero-block .hero-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 12px;
}

@media (max-width: 640px) {
  .hero-block { padding: 22px; gap: 18px; }
  .hero-actions { width: 100%; }
}

/* ─── TeamTree ─── */
.team-tree-desktop {
  display: block;
  position: relative;
}
.team-tree-scroll {
  overflow-x: auto;
  max-width: 100%;
}
.team-tree-mobile {
  display: none;
}
.tree-node rect { transition: stroke-width 0.15s; }
.tree-node:hover rect { stroke-width: 2; }

@media (max-width: 640px) {
  .team-tree-desktop { display: none; }
  .team-tree-mobile { display: block; }
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}
.tree-row:first-child { border-top: none; }
.tree-row.is-self {
  background: color-mix(in oklab, var(--accent) 15%, transparent);
}
.tree-glyph {
  width: 14px;
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
}
.tree-avatar {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  flex-shrink: 0;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.tree-meta {
  flex: 1;
  min-width: 0;
}
.tree-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}
.tree-ref {
  font-size: 10px;
  color: var(--text-muted);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  margin-top: 2px;
}
.tree-amount {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}


/* ============================================================
   Phase E — Sunset light redesign
   ============================================================ */

/* ─── Typography helpers ─── */
.display { font-family: var(--font-display); letter-spacing: -0.02em; }
.money   { font-family: var(--font-money); font-variant-numeric: tabular-nums; letter-spacing: -0.04em; }
.eyebrow {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  font-weight: 600; color: var(--muted);
  white-space: nowrap;
}

/* ─── Card helpers ─── */
.card-flat {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 18px 22px;
  position: relative;
}
@media (max-width: 720px) { .card-flat { padding: 14px 16px; } }

/* ─── Money Hero (purple-orange gradient + count-up) ─── */
.money-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(155deg,
    var(--primary) 0%,
    color-mix(in oklab, var(--primary) 70%, var(--blush) 30%) 70%,
    var(--blush) 130%);
  color: #fff;
  border-radius: var(--r-xl);
  box-shadow: 0 30px 60px -28px var(--primary);
  border: none;
}
.money-hero::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.15) 1.5px, transparent 1.5px);
  background-size: 24px 24px; opacity: 0.4; pointer-events: none;
}
.money-hero-blob {
  position: absolute; top: -50px; right: -50px;
  width: 280px; height: 280px; border-radius: 50%;
  background: rgba(255,255,255,0.15); filter: blur(40px); pointer-events: none;
}
.money-hero-inner {
  position: relative;
  padding: 36px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 180px;
}
@media (min-width: 720px) {
  .money-hero-inner { padding: 48px 36px; gap: 28px; min-height: 220px; }
}
.money-hero-text {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 12px;
}
.money-hero-amount-wrap {
  flex-shrink: 0;
  text-align: right;
}
.money-hero-eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: rgba(255,255,255,0.85);
  margin: 0;
}
.money-hero-amount {
  display: inline-block;
  font-family: var(--font-money);
  font-size: clamp(40px, 13vw, 84px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #fff;
  white-space: nowrap;
}
.money-hero-amount-prefix {
  font-size: 0.42em; font-weight: 600; opacity: 0.75; margin-right: 4px;
  vertical-align: top; display: inline-block; margin-top: 0.18em;
}
.money-hero-headline {
  font-family: var(--font-display);
  font-size: clamp(15px, 3.6vw, 22px);
  font-weight: 700; line-height: 1.25;
  color: #fff;
  word-break: keep-all;
  margin: 0;
}
.money-hero-sub {
  font-size: 12px; color: rgba(255,255,255,0.9);
  margin: 0;
}
.money-hero-spark { display: none; }

/* ─── Stat tile ─── */
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 4px;
  transition: transform .2s, box-shadow .2s;
}
.stat-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-tile.accent {
  color: #fff;
  background: linear-gradient(150deg, var(--primary) 0%,
    color-mix(in oklab, var(--primary) 75%, var(--blush)) 100%);
  border-color: var(--primary);
}
.stat-tile.accent .eyebrow { color: rgba(255,255,255,0.85); }
.stat-tile-value {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700; line-height: 1.1;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat-tile-prefix {
  font-size: 0.55em; font-weight: 600; opacity: 0.7; margin-right: 3px;
}
.stat-tile-sub {
  font-size: 11px; color: var(--muted); margin-top: 3px;
}
.stat-tile.accent .stat-tile-sub { color: rgba(255,255,255,0.85); }
.stat-tile-spark {
  margin-top: auto; opacity: 0.85; height: 30px;
}
@media (max-width: 720px) { .stat-tile-spark { display: none; } }

/* ─── Agent card list (mobile-friendly) ─── */
.agent-card-row {
  display: grid; grid-template-columns: 40px 1fr auto;
  gap: 12px; align-items: center;
  padding: 14px 14px;
  border-top: 1px solid var(--hairline);
}
.agent-card-row:first-child { border-top: none; }
.agent-avatar-sunset {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 14px;
}
.agent-card-name {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 15px;
  color: var(--ink);
}
.agent-card-ref {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--muted); margin-top: 4px;
}
.agent-card-stats {
  display: flex; gap: 18px; align-items: center; text-align: right;
}
.agent-stat-num {
  font-weight: 800; font-size: 22px; line-height: 1; white-space: nowrap;
  font-family: var(--font-display);
}
.agent-stat-num.invited { color: var(--primary); }
.agent-stat-num.verified { color: var(--mint); }
.agent-stat-label {
  font-size: 11px; color: var(--muted); margin-top: 4px; font-weight: 600;
}

/* ─── Layer chip ─── */
.layer-chip-tag {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--muted);
  font-size: 11px; font-weight: 600; white-space: nowrap;
}

/* ─── Funnel card ─── */
.funnel-step { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.funnel-step:last-child { margin-bottom: 0; }
.funnel-step-row {
  display: flex; justify-content: space-between;
  font-size: 13px;
}
.funnel-step-label { font-weight: 600; color: var(--ink); }
.funnel-step-value { font-weight: 700; color: var(--ink); }
.funnel-bar {
  height: 12px; background: var(--surface-2);
  border-radius: var(--r-pill); overflow: hidden;
}
.funnel-bar-fill {
  height: 100%; border-radius: var(--r-pill);
  transition: width .8s cubic-bezier(.2,.8,.2,1);
}
.funnel-conv-rate {
  margin-top: 8px; font-size: 12px; color: var(--muted);
}
.funnel-conv-rate b { color: var(--ink); }

/* ─── Ranking row ─── */
.ranking-row {
  display: grid; grid-template-columns: 32px 1fr auto auto;
  gap: 12px; align-items: center;
  margin-bottom: 14px;
}
.ranking-row:last-child { margin-bottom: 0; }
.ranking-rank {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
}
.ranking-rank.top {
  background: var(--gold); color: #fff;
}
.ranking-rank.rest {
  background: var(--surface-2); color: var(--muted);
}
.ranking-name {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700;
}
.ranking-progress {
  height: 6px; margin-top: 8px;
  background: var(--surface-2); border-radius: var(--r-pill); overflow: hidden;
}
.ranking-progress-fill {
  height: 100%; background: var(--primary); border-radius: var(--r-pill);
}
.ranking-stat {
  text-align: center; white-space: nowrap;
}
.ranking-stat-num {
  font-family: var(--font-display);
  font-weight: 800; font-size: 24px; line-height: 1;
}
.ranking-stat-num.invited { color: var(--primary); }
.ranking-stat-num.verified { color: var(--mint); }
.ranking-stat-label {
  font-size: 11px; color: var(--muted); margin-top: 4px; font-weight: 600;
}

/* ─── Layer breakdown card ─── */
.layer-breakdown {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.layer-breakdown-list {
  flex: 1; min-width: 160px;
  display: flex; flex-direction: column; gap: 8px;
}
.layer-breakdown-row {
  display: flex; align-items: center; gap: 10px; font-size: 13px;
}
.layer-breakdown-dot {
  width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0;
}
.layer-breakdown-amount {
  font-family: var(--font-display); font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.layer-breakdown-pct {
  font-size: 11px; color: var(--muted); min-width: 36px; text-align: right;
}

/* ─── QR card (view-only) ─── */
.qr-card {
  position: relative; cursor: pointer;
  background: linear-gradient(150deg, var(--gold) 0%, var(--primary) 60%, var(--blush) 120%);
  border-radius: var(--r-xl); padding: 22px;
  color: #fff; overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition: transform .25s, box-shadow .25s;
  display: flex; align-items: center; gap: 18px;
}
.qr-card:hover { transform: translateY(-3px) scale(1.01); }
.qr-card-decor-1 {
  position: absolute; top: -18px; right: -18px;
  width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255,255,255,0.18); pointer-events: none;
}
.qr-card-decor-2 {
  position: absolute; bottom: -30px; left: -30px;
  width: 100px; height: 100px; border-radius: 50%;
  background: rgba(255,255,255,0.10); pointer-events: none;
}
.qr-card-tile {
  background: #fff; padding: 12px; border-radius: var(--r-md);
  width: 124px; height: 124px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; position: relative;
}
.qr-card-tile.pulse { animation: qr-pulse-ring 1.8s ease-out infinite; }
.qr-card-tile svg {
  width: 100%; height: 100%; display: block;
}
.qr-card-body { flex: 1; min-width: 0; position: relative; }
.qr-card-headline {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700;
  margin-top: 4px; line-height: 1.15;
}
.qr-card-earned {
  margin-top: 8px; font-size: 12px; opacity: 0.9;
  display: flex; align-items: center; gap: 8px;
}
.qr-card-earned b { font-family: var(--font-money); font-size: 16px; font-weight: 700; }
.qr-card-cta {
  margin-top: 14px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: rgba(255,255,255,0.22);
  border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600;
  white-space: nowrap;
}

@keyframes qr-pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(255,255,255,.45); }
  70%  { box-shadow: 0 0 0 22px rgba(255,255,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}

/* ─── QR share modal ─── */
.qr-share-modal {
  display: none;
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15,12,8,0.65);
  backdrop-filter: blur(8px);
  align-items: center; justify-content: center;
  padding: 24px;
}
.qr-share-modal.open {
  display: flex;
  animation: qrFadeUp .25s ease-out both;
}
.qr-share-modal-card {
  background: var(--surface); border-radius: var(--r-xl);
  max-width: 520px; width: 100%; position: relative; overflow: hidden;
  box-shadow: 0 40px 80px rgba(0,0,0,.4);
  animation: qrFadeUp .35s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes qrFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.qr-share-modal-header {
  background: linear-gradient(140deg, var(--gold) 0%, var(--primary) 60%, var(--blush) 130%);
  color: #fff; padding: 28px 28px 22px; position: relative;
}
.qr-share-modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: rgba(255,255,255,0.25); color: #fff;
  font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.qr-share-modal-title {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 700; margin: 4px 0 6px;
}
.qr-share-modal-sub {
  font-size: 13px; opacity: 0.9;
}
.qr-share-modal-body {
  padding: 24px 28px 28px;
  display: flex; flex-direction: column; gap: 16px; align-items: center;
}
.qr-share-modal-qr {
  background: #fff; padding: 18px; border-radius: 20px;
  border: 4px solid var(--primary);
  box-shadow: 0 12px 28px -8px rgba(255,107,53,.35);
}
.qr-share-modal-qr svg { display: block; width: 220px; height: 220px; }
.qr-share-modal-url {
  background: var(--surface-2); color: var(--ink);
  padding: 10px 14px; border-radius: 12px;
  font-family: var(--font-mono); font-size: 12px;
  word-break: break-all; text-align: center;
  border: 1px dashed var(--hairline-strong);
  width: 100%;
}
.qr-share-modal-actions {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  width: 100%;
}
.qr-share-modal-actions .btn { justify-content: center; }
.qr-share-modal-earned {
  font-size: 12px; color: var(--muted); text-align: center;
}
.qr-share-modal-earned b { color: var(--primary); font-weight: 700; }

/* ─── Buttons (sunset variants) ─── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px; font-size: 13px; font-weight: 600;
  border-radius: var(--r-pill); border: 1px solid transparent;
  white-space: nowrap; transition: transform .15s, box-shadow .15s, background .15s;
  cursor: pointer; font-family: inherit;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: 0 6px 14px -6px var(--primary);
}
.btn-primary:hover { background: var(--primary-deep); }
.btn-ghost {
  background: var(--surface); color: var(--ink);
  border-color: var(--hairline-strong);
}
.btn-soft {
  background: var(--primary-soft); color: var(--primary-deep);
}

/* ─── Confetti ─── */
@keyframes confetti-float-up {
  0%   { transform: translate(0,0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx), -120vh) rotate(var(--rot)); opacity: 0; }
}
.confetti-piece {
  position: fixed; top: 50%; left: 50%;
  width: 10px; height: 14px; border-radius: 2px;
  pointer-events: none;
  animation: confetti-float-up 2.4s cubic-bezier(.2,.8,.2,1) forwards;
}

/* ─── Page title block (sunset) ─── */
.sunset-page-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  flex-wrap: wrap; gap: 16px;
}
.sunset-page-title {
  font-family: var(--font-display);
  font-size: 30px; font-weight: 800;
  letter-spacing: -0.02em; margin: 4px 0 0;
  color: var(--ink);
}
@media (max-width: 720px) {
  .sunset-page-title { font-size: 24px; }
}
.sunset-page-sub {
  margin: 6px 0 0; color: var(--ink-2); font-size: 14px;
  word-break: keep-all;
}

/* ─── Section title (inside cards) ─── */
.section-title-row {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 12px; flex-wrap: wrap;
}
.section-title-display {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 700; margin-top: 4px;
}

/* ─── Grids (sunset) ─── */
.grid-2-1 {
  display: grid; grid-template-columns: 1fr; gap: 14px;
}
.grid-1-1 {
  display: grid; grid-template-columns: 1fr; gap: 14px;
}
.grid-3-cols { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (min-width: 720px) {
  .grid-2-1 { grid-template-columns: 2fr 1fr; gap: 18px; }
  .grid-1-1 { grid-template-columns: 1fr 1fr; gap: 18px; }
}

/* ─── Override base layouts for sunset light topbar ─── */
.topbar {
  background: color-mix(in oklab, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hairline);
}

/* ─── Subagent invite card (password admin) ─── */
.subagent-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.subagent-card-head {
  display: flex; align-items: center; gap: 12px;
}
.subagent-link-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0 0;
  border-top: 1px dashed var(--hairline);
}
.subagent-link-label {
  font-size: 11px; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.subagent-link-url {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
  background: var(--surface-2);
  padding: 6px 10px;
  border-radius: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.btn-tiny {
  padding: 5px 12px; font-size: 11px;
}
@media (max-width: 640px) {
  .subagent-link-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .subagent-link-row .btn-tiny { justify-self: flex-start; }
}

/* ─── Credential reveal banner (one-time, after agent create / password reset) ─── */
.cred-banner {
  position: relative;
  background: linear-gradient(140deg, var(--gold) 0%, var(--primary) 60%, var(--blush) 130%);
  border-radius: var(--r-xl);
  padding: 24px;
  color: #fff;
  box-shadow: 0 24px 60px -28px var(--primary);
  margin-bottom: 18px;
}
.cred-banner-head {
  display: flex; align-items: flex-start; gap: 16px; justify-content: space-between;
}
.cred-banner-title {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700; margin-top: 6px;
}
.cred-banner-sub {
  margin-top: 8px; font-size: 13px; opacity: 0.92;
  word-break: keep-all; line-height: 1.5;
}
.cred-banner-close {
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: rgba(255,255,255,0.25); color: #fff;
  font-size: 16px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.cred-banner-close:hover { background: rgba(255,255,255,0.35); }
.cred-banner-grid {
  margin-top: 18px;
  display: grid; gap: 10px;
}
.cred-row {
  display: grid; grid-template-columns: 80px 1fr; gap: 10px; align-items: center;
  background: rgba(255,255,255,0.18);
  padding: 10px 14px;
  border-radius: 10px;
}
.cred-row-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: rgba(255,255,255,0.85);
}
.cred-row-value {
  font-family: var(--font-mono);
  font-size: 14px; color: #fff; font-weight: 600;
  word-break: break-all; user-select: all;
}
.cred-banner-cta {
  margin-top: 16px;
  background: #fff; color: var(--primary-deep);
  border: none;
  padding: 12px 24px;
  border-radius: var(--r-pill);
  font-weight: 700; font-size: 14px; cursor: pointer;
  font-family: inherit;
  width: 100%;
}
.cred-banner-cta:hover { background: var(--primary-soft); }
@media (max-width: 640px) {
  .cred-row { grid-template-columns: 1fr; gap: 4px; padding: 10px 12px; }
}
