/* ==========================================================================
   Components
   ========================================================================== */

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-border: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 42px; padding: 0 var(--space-5);
  font: inherit; font-size: var(--text-base); font-weight: 600; line-height: 1;
  color: var(--btn-fg); background: var(--btn-bg);
  border: 1px solid var(--btn-border); border-radius: var(--radius-md);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"], .btn.htmx-request { opacity: 0.55; pointer-events: none; }
.btn svg { width: 18px; height: 18px; }

.btn-primary { --btn-bg: var(--primary); --btn-fg: var(--primary-contrast); --btn-border: var(--primary); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-accent { --btn-bg: var(--accent); --btn-fg: var(--accent-contrast); --btn-border: var(--accent); }
.btn-accent:hover { filter: brightness(1.06); }
/* Amber status dot after the label, e.g. on the main call to action. */
.btn-primary.btn-dot::after { background: var(--dot-on-primary); }
.btn-dot::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: 2px; }
.btn-ghost { --btn-bg: transparent; --btn-border: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-border: var(--danger); }
.btn-danger:hover { background: var(--danger); filter: brightness(0.93); }
.btn-sm { min-height: 34px; padding: 0 var(--space-3); font-size: var(--text-sm); border-radius: var(--radius-sm); }
.btn-lg { min-height: 50px; padding: 0 var(--space-6); font-size: var(--text-md); }
.btn-block { width: 100%; }
.btn-icon { width: 40px; min-height: 40px; padding: 0; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.card-body { padding: var(--space-5); }
@media (min-width: 768px) { .card-body { padding: var(--space-6); } }
.card-header {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border);
}
.card-header h2, .card-header h3 { font-size: var(--text-md); }
.card-footer { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border); }
.card-interactive { transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); }
.card-interactive:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* ---------- Stat tile ---------- */
.stat-tile { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); }
.stat-tile-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.stat-tile-label { font-size: var(--text-sm); color: var(--text-muted); font-weight: 500; }
.stat-tile-icon {
  display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: var(--radius-md); background: var(--accent-soft); color: var(--accent-strong);
}
.stat-tile-icon svg { width: 18px; height: 18px; }
.stat-tile-value { font-size: var(--text-xl); font-weight: 680; letter-spacing: var(--tracking-tight); font-variant-numeric: tabular-nums; }
.stat-tile-hint { font-size: var(--text-xs); color: var(--text-subtle); }

/* ---------- Badges ---------- */
.badge {
  --badge-fg: var(--neutral); --badge-bg: var(--neutral-soft);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 600; line-height: 1.5; white-space: nowrap;
  color: var(--badge-fg); background: var(--badge-bg);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-plain::before { display: none; }
.badge-success { --badge-fg: var(--success); --badge-bg: var(--success-soft); }
.badge-warning { --badge-fg: var(--warning); --badge-bg: var(--warning-soft); }
.badge-danger { --badge-fg: var(--danger); --badge-bg: var(--danger-soft); }
.badge-info { --badge-fg: var(--info); --badge-bg: var(--info-soft); }
.badge-neutral { --badge-fg: var(--neutral); --badge-bg: var(--neutral-soft); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: var(--space-4); }
.field-label { font-size: var(--text-sm); font-weight: 600; color: var(--text); }
.field-help { font-size: var(--text-xs); color: var(--text-subtle); }
.field-help ul { margin: 2px 0 0; padding-left: 1.1em; }
.field-error { font-size: var(--text-xs); color: var(--danger); font-weight: 500; }
.input, .field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 10px 14px;
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.field textarea { min-height: 110px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--focus); box-shadow: var(--ring);
}
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input-prefix {
  position: absolute; left: 14px; color: var(--text-subtle); font-weight: 600; pointer-events: none;
}
.input-group input { padding-left: 34px !important; }
.check { display: flex; gap: var(--space-2); align-items: flex-start; font-size: var(--text-sm); }
.check input { margin-top: 3px; accent-color: var(--accent); }
.check-list { display: flex; flex-direction: column; }
.check-list .check { padding: var(--space-3) 0; }
.check-list .check + .check { border-top: 1px solid var(--border); }
.check-hint { display: block; margin-top: 2px; font-size: var(--text-xs); color: var(--text-muted); }
.form-grid .field:has(.check-list) { grid-column: 1 / -1; }

/* ---------- Alerts ---------- */
.alert {
  --alert-fg: var(--info); --alert-bg: var(--info-soft);
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  background: var(--alert-bg); color: var(--text); font-size: var(--text-sm);
  border: 1px solid color-mix(in srgb, var(--alert-fg) 25%, transparent);
}
.alert svg { width: 18px; height: 18px; color: var(--alert-fg); margin-top: 1px; }
.alert-success { --alert-fg: var(--success); --alert-bg: var(--success-soft); }
.alert-warning { --alert-fg: var(--warning); --alert-bg: var(--warning-soft); }
.alert-danger { --alert-fg: var(--danger); --alert-bg: var(--danger-soft); }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th {
  text-align: left; font-size: var(--text-xs); font-weight: 600; text-transform: uppercase;
  letter-spacing: var(--tracking-wide); color: var(--text-subtle);
  padding: var(--space-3) var(--space-5); background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--dur-fast) var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }
.table .num, .table .text-right { text-align: right; }

/* ---------- Progress ---------- */
.progress { display: flex; flex-direction: column; gap: 6px; }
.progress-meta { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--text-muted); }
.progress-track { height: 8px; border-radius: var(--radius-full); background: var(--surface-3); overflow: hidden; }
.progress-bar {
  height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transition: width 600ms var(--ease);
}

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: var(--space-12) var(--space-6); color: var(--text-muted); }
.empty-state-icon {
  width: 52px; height: 52px; margin: 0 auto var(--space-4); display: grid; place-items: center;
  border-radius: var(--radius-lg); background: var(--surface-2); color: var(--text-subtle);
}
.empty-state h3 { color: var(--text); font-size: var(--text-md); margin-bottom: var(--space-2); }

/* ---------- Simulation bar & disclosure ---------- */
.sim-bar {
  background: var(--sim-bar-bg); color: var(--sim-bar-text);
  font-size: var(--text-xs); text-align: center; padding: 7px var(--gutter); line-height: 1.4;
}
.sim-bar strong { color: #fff; font-weight: 600; }
.sim-bar svg { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }
.disclosure { font-size: var(--text-xs); color: var(--text-subtle); line-height: 1.5; }
.virtual-tag {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: var(--tracking-wide);
  text-transform: uppercase; color: var(--text-subtle); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 1px 5px; vertical-align: middle;
}

/* ---------- Plan card ---------- */
.plan-card { position: relative; display: flex; flex-direction: column; gap: var(--space-5); padding: var(--space-6); }
.plan-card.is-featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-md); }
.plan-card-flag {
  position: absolute; top: -11px; left: var(--space-6);
  background: var(--accent); color: var(--accent-contrast); font-size: 11px; font-weight: 700;
  letter-spacing: var(--tracking-wide); text-transform: uppercase;
  padding: 3px 10px; border-radius: var(--radius-full);
}
.plan-rate { font-size: var(--text-2xl); font-weight: 700; letter-spacing: var(--tracking-tight); }
.plan-terms { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); margin: 0; }
.plan-terms dt { font-size: var(--text-xs); color: var(--text-subtle); }
.plan-terms dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Definition list (detail pages) ---------- */
.dl { display: grid; grid-template-columns: minmax(0, 1fr); margin: 0; }
.dl > div { display: flex; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.dl > div:last-child { border-bottom: 0; }
.dl dt { color: var(--text-muted); font-size: var(--text-sm); }
.dl dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Toasts ---------- */
.toast-region {
  position: fixed; z-index: 60; right: var(--space-4); bottom: var(--space-4);
  left: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); pointer-events: none;
}
@media (min-width: 640px) { .toast-region { left: auto; width: 380px; } }
.toast {
  pointer-events: auto; display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  font-size: var(--text-sm); animation: toast-in var(--dur) var(--ease);
}
.toast > svg { width: 18px; height: 18px; margin-top: 1px; }
.toast-success > svg { color: var(--success); }
.toast-error > svg { color: var(--danger); }
.toast-warning > svg { color: var(--warning); }
.toast-info > svg { color: var(--info); }
.toast-body { flex: 1; }
.toast-close { background: none; border: 0; color: var(--text-subtle); cursor: pointer; padding: 0; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: all var(--dur) var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Modal (native <dialog>) ---------- */
.modal {
  width: min(560px, calc(100vw - 2 * var(--gutter))); max-height: calc(100vh - 48px);
  padding: 0; border: 1px solid var(--border); border-radius: var(--radius-xl);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.modal::backdrop { background: rgb(5 10 20 / 0.55); backdrop-filter: blur(3px); }
.modal[open] { animation: modal-in var(--dur) var(--ease); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-5) var(--space-6) 0; }
.modal-body { padding: var(--space-5) var(--space-6); }
.modal-footer { display: flex; justify-content: flex-end; gap: var(--space-2); padding: 0 var(--space-6) var(--space-6); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---------- HTMX indicators ---------- */
.htmx-indicator { opacity: 0; transition: opacity var(--dur) var(--ease); }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 700ms linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.is-swapping { opacity: 0.5; transition: opacity var(--dur) var(--ease); }

/* ---------- Session list ---------- */
.session-list { list-style: none; margin: 0; padding: var(--space-2) var(--space-5); }
.session-list li { display: flex; gap: var(--space-3); align-items: center; padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.session-list li:last-child { border-bottom: 0; }

/* ---------- Dropdown & notifications ---------- */
.dropdown { position: relative; }
.dropdown-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50;
  width: min(380px, calc(100vw - 2 * var(--gutter)));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
@media (max-width: 480px) { .dropdown-panel { position: fixed; left: var(--gutter); right: var(--gutter); top: 72px; width: auto; } }
.dropdown-head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); font-size: var(--text-sm); }
.dropdown-foot { display: block; text-align: center; padding: var(--space-3); font-size: var(--text-sm); font-weight: 600; border-top: 1px solid var(--border); }
.notif-button { position: relative; }
.notif-badge {
  position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: var(--radius-full); background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 17px; text-align: center;
}
.notif-badge[hidden] { display: none; }
.notif-loading { display: grid; place-items: center; padding: var(--space-8); color: var(--text-subtle); }
.notif-scroll { max-height: 380px; overflow-y: auto; }
.notif-empty { padding: var(--space-8) var(--space-4); text-align: center; color: var(--text-muted); font-size: var(--text-sm); }
.notif-item + .notif-item { border-top: 1px solid var(--border); }
.notif-item button {
  display: flex; gap: var(--space-3); align-items: flex-start; width: 100%; text-align: left;
  padding: var(--space-3) var(--space-4); background: none; border: 0; font: inherit; color: inherit; cursor: pointer;
}
.notif-item button:hover { background: var(--surface-2); }
.notif-item.is-unread { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.notif-icon { width: 32px; height: 32px; border-radius: var(--radius-md); display: grid; place-items: center; flex-shrink: 0; }
.notif-icon svg { width: 16px; height: 16px; }
.tone-success { background: var(--success-soft); color: var(--success); }
.tone-warning { background: var(--warning-soft); color: var(--warning); }
.tone-danger { background: var(--danger-soft); color: var(--danger); }
.tone-info { background: var(--info-soft); color: var(--info); }
.tone-neutral { background: var(--neutral-soft); color: var(--neutral); }
.notif-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.notif-title { font-size: var(--text-sm); font-weight: 600; }
.notif-body { font-size: var(--text-xs); color: var(--text-muted); }
.notif-time { font-size: 11px; color: var(--text-subtle); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex-shrink: 0; }
.notif-card { overflow: hidden; }

/* ---------- Tabs & pager ---------- */
.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: var(--radius-md); }
.tab { padding: 6px 14px; border-radius: 8px; font-size: var(--text-sm); font-weight: 600; color: var(--text-muted); }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
.pager { display: flex; align-items: center; justify-content: center; gap: var(--space-3); margin-top: var(--space-5); }

/* ---------- Wallet & ledger ---------- */
.balance-hero { display: grid; gap: var(--space-6); padding: var(--space-6); align-items: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--surface) 60%); }
@media (min-width: 900px) { .balance-hero { grid-template-columns: 1fr 1.2fr; } }
.balance-hero-label { font-size: var(--text-sm); color: var(--text-muted); font-weight: 500; }
.balance-hero-value { font-size: clamp(1.9rem, 1.4rem + 1.8vw, 2.6rem); font-weight: 700; letter-spacing: -0.03em; margin: 4px 0; }
.balance-split { display: grid; gap: var(--space-3); }
.balance-split > div { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--surface-2); }
.balance-split strong { margin-left: auto; font-weight: 650; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot-available { background: var(--accent); }
.dot-invested { background: var(--info); }
.dot-reserved { background: var(--warning); }
.tx-cell { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.tx-main { min-width: 0; }
.tx-icon { width: 34px; height: 34px; border-radius: var(--radius-md); display: grid; place-items: center; flex-shrink: 0; }
.tx-icon svg { width: 16px; height: 16px; }
.tx-icon-credit { background: var(--success-soft); color: var(--success); }
.tx-icon-debit { background: var(--danger-soft); color: var(--danger); }
.tx-icon-internal { background: var(--neutral-soft); color: var(--neutral); }
.tx-amount { font-weight: 650; white-space: nowrap; }
.tx-credit { color: var(--success); }
.tx-debit { color: var(--text); }
.tx-internal { color: var(--text-muted); }
.tx-hero { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-4) 0; text-align: center; }
.tx-hero-amount { font-size: var(--text-2xl); }
.filter-bar { display: grid; gap: var(--space-3); grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
.filter-bar .field + .field { margin-top: 0; }
.filter-bar > .field:nth-child(5) { grid-column: 1 / -1; }
.filter-bar input, .filter-bar select { height: 44px; }
.filter-actions { display: flex; gap: var(--space-2); justify-content: flex-end; grid-column: 1 / -1; }
@media (min-width: 1024px) {
  .filter-bar { grid-template-columns: repeat(4, minmax(0, 1fr)) 1.6fr auto; }
  .filter-bar > .field:nth-child(5) { grid-column: auto; }
  .filter-actions { grid-column: auto; }
}
.table-compact td { padding: var(--space-3) var(--space-5); }
.tx-link { color: inherit; }
.tx-link:hover { color: var(--accent-strong); }

/* ---------- Withdrawal addresses ---------- */
.network-chip { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--surface-2); font-size: var(--text-sm); }
.network-code { display: grid; place-items: center; min-width: 44px; height: 30px; padding: 0 8px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent-strong); font-size: 11px; font-weight: 750; letter-spacing: 0.04em; text-transform: uppercase; }
.address-placeholder { padding: var(--space-4); border: 1px dashed var(--border-strong); border-radius: var(--radius-md); text-align: center; }
.address-list { list-style: none; margin: 0; padding: 0; }
.address-item { display: grid; gap: var(--space-2); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border); }
.address-item:last-child { border-bottom: 0; }
.address-head { display: flex; align-items: center; gap: var(--space-3); }
.address-value { font-size: var(--text-xs); padding: var(--space-2) var(--space-3); background: var(--surface-2); border-radius: var(--radius-sm); overflow-wrap: anywhere; }
.address-actions { --cluster-gap: var(--space-1); }
.inline-confirm summary { list-style: none; }
.inline-confirm summary::-webkit-details-marker { display: none; }
.inline-confirm[open] summary { background: var(--surface-2); }
.inline-confirm-body { display: grid; gap: var(--space-2); margin-top: var(--space-2); padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md); }
.inline-confirm-body .input { flex: 1; min-width: 160px; min-height: 36px; padding: 6px 10px; }
.field-group + .field, .field-group + noscript + .field { margin-top: var(--space-4); }

/* ---------- Verification ---------- */
.tier-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: var(--radius-full); background: var(--accent-soft); color: var(--accent-strong); font-weight: 650; font-size: var(--text-sm); }
.stepper { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); }
.step { display: flex; gap: var(--space-4); padding: var(--space-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.step.is-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.step-marker { width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--surface-2); color: var(--text-muted); }
.step.is-done .step-marker { background: var(--accent); color: var(--accent-contrast); }
.step.is-current .step-marker { background: var(--primary); color: var(--primary-contrast); }
.step-marker svg { width: 16px; height: 16px; }
.step-body { flex: 1; min-width: 0; }
.step-body h3 { font-size: var(--text-md); }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); font-size: var(--text-sm); }
.checklist li { display: flex; align-items: center; gap: var(--space-2); color: var(--text-muted); flex-wrap: wrap; }
.checklist li svg { width: 16px; height: 16px; color: var(--warning); }
.checklist li.is-ok { color: var(--text); }
.checklist li.is-ok svg { color: var(--success); }
.is-current-col { color: var(--accent-strong) !important; }
.doc-slot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); border: 1px dashed var(--border-strong); border-radius: var(--radius-md); flex-wrap: wrap; }
.doc-slot.has-doc { border-style: solid; background: var(--surface-2); }
.doc-slot-info { display: flex; gap: var(--space-3); align-items: flex-start; min-width: 0; }
.doc-slot-icon { color: var(--text-subtle); margin-top: 2px; }
.doc-slot.has-doc .doc-slot-icon { color: var(--success); }
.doc-slot-form label { cursor: pointer; }
.doc-slot-form .htmx-indicator { display: none; }
.doc-slot-form.htmx-request .htmx-indicator { display: inline-block; }
.tier-pill svg { width: 15px; height: 15px; }
a.tier-pill:hover { text-decoration: none; filter: brightness(0.97); }

/* ---------- Products ---------- */
.card-interactive { position: relative; }
.stretched { color: inherit; }
.stretched::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.stretched:hover { text-decoration: none; }
.plan-terms-3 { grid-template-columns: repeat(3, 1fr); }
.signal-card { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-6); }
.signal-card.is-featured { border-color: var(--accent); }
.signal-head { display: flex; align-items: center; gap: var(--space-2); }
.signal-status { margin-left: auto; }
.symbol-chip { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: var(--radius-sm); background: var(--primary); color: var(--primary-contrast); font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.02em; }
.symbol-chip-lg { font-size: var(--text-sm); padding: 6px 12px; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-6); align-items: start; }
.detail-layout > * { min-width: 0; }
@media (min-width: 1024px) {
  .detail-layout { grid-template-columns: minmax(0, 1fr) 360px; }
  .detail-aside { position: sticky; top: calc(var(--topbar-height) + var(--space-4)); }
}
.estimate-result { min-height: 40px; }
.risk-note { display: flex; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-radius: var(--radius-lg); background: var(--surface-2); color: var(--text-muted); font-size: var(--text-xs); line-height: 1.6; }
.risk-note svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-subtle); }
.risk-note strong { color: var(--text); }
.price-levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.price-levels > div { display: flex; flex-direction: column; gap: 4px; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--surface-2); }
.prose p + p { margin-top: var(--space-3); }
.prose { color: var(--text-muted); }

/* ---------- Investments ---------- */
.inv-card { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-5) var(--space-6); position: relative; }
.inv-card-head { display: flex; justify-content: space-between; gap: var(--space-3); align-items: flex-start; }
.inv-hero { padding: var(--space-6); }
.inv-hero-value { font-size: var(--text-xl); font-weight: 700; letter-spacing: var(--tracking-tight); margin-top: 4px; }
.claim-card { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: center; justify-content: space-between; border-color: var(--warning); background: color-mix(in srgb, var(--warning-soft) 60%, var(--surface)); }
.confirm-card { max-width: 640px; }
.confirm-hero { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: var(--space-8) var(--space-6) var(--space-4); text-align: center; border-bottom: 1px solid var(--border); }
.confirm-amount { font-size: clamp(2rem, 1.6rem + 1.5vw, 2.6rem); font-weight: 750; letter-spacing: -0.03em; }
.timeline { list-style: none; margin: 0; display: grid; gap: var(--space-4); }
.timeline li { position: relative; display: flex; justify-content: space-between; gap: var(--space-4); padding-left: var(--space-6); font-size: var(--text-sm); color: var(--text-muted); }
.timeline li::before { content: ""; position: absolute; left: 0; top: 5px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); }
.timeline li.is-done::before { background: var(--accent); border-color: var(--accent); }
.timeline li.is-danger::before { background: var(--danger); border-color: var(--danger); }
.timeline li strong { color: var(--text); font-weight: 600; }

/* ---------- Deposits & withdrawals ---------- */
.method-list { border: 0; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.method-list legend { margin-bottom: var(--space-2); }
.method-option { display: flex; gap: var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); border: 1px solid var(--border-strong); border-radius: var(--radius-md); cursor: pointer; }
.method-option:has(input:checked) { border-color: var(--accent); box-shadow: var(--ring); }
.method-option input { accent-color: var(--accent); }
.method-body { display: flex; flex-direction: column; }
.how-steps { margin: 0; padding-left: 1.2em; display: grid; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-muted); }
.wallet-address { display: flex; gap: var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); border: 1px dashed var(--danger); border-radius: var(--radius-md); background: var(--surface-2); }
.wallet-address code { flex: 1; overflow-wrap: anywhere; font-size: var(--text-sm); }
.wallet-qr { width: 184px; margin: 0 auto; padding: 8px; border-radius: 6px; background: #fff; }
.wallet-qr svg { display: block; width: 100%; height: auto; }
p.field-help + .field { margin-top: var(--space-4); }
.pin-input { letter-spacing: 0.6em; font-size: var(--text-lg) !important; text-align: center; max-width: 160px; }

/* ---------- Charts (see tokens.css for validated viz colours) ---------- */
.viz { margin: 0; }
.viz-plot { position: relative; }
.viz-plot svg { width: 100%; height: 180px; display: block; overflow: visible; outline: none; }
.viz-plot svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.viz-grid { stroke: var(--viz-grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.viz-area { fill: var(--viz-trend-fill); }
.viz-line { fill: none; stroke: var(--viz-trend); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.viz-crosshair { stroke: var(--viz-axis); stroke-width: 1; vector-effect: non-scaling-stroke; }
.viz-dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--viz-trend); box-shadow: 0 0 0 2px var(--surface); pointer-events: none; }
.viz-hit { fill: transparent; cursor: crosshair; }
.viz-y-labels { position: absolute; inset: 0; pointer-events: none; }
.viz-y-labels span { position: absolute; right: 0; transform: translateY(-100%); font-size: 10px; color: var(--viz-muted); font-variant-numeric: tabular-nums; padding-bottom: 2px; }
.viz-x-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--viz-muted); margin-top: 6px; }
.viz-tooltip { position: absolute; top: -6px; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center;
  padding: 6px 10px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md); pointer-events: none; white-space: nowrap; }
.viz-tooltip.is-right { transform: translate(-90%, -100%); }
.viz-tooltip strong { font-size: var(--text-sm); color: var(--text); font-variant-numeric: tabular-nums; }
.viz-tooltip span { font-size: 11px; color: var(--text-muted); }
.viz-tooltip[hidden], .viz-crosshair[hidden], .viz-dot[hidden] { display: none; }
.viz-table { margin-top: var(--space-3); font-size: var(--text-xs); }
.viz-table summary { cursor: pointer; color: var(--text-muted); }
.viz-table .table-wrap { max-height: 220px; overflow: auto; margin-top: var(--space-2); }
.viz-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.viz-hero { font-size: clamp(1.8rem, 1.4rem + 1.4vw, 2.4rem); font-weight: 720; letter-spacing: -0.03em; }
.delta { font-size: var(--text-sm); font-weight: 600; }
.delta-up { color: var(--success); }
.delta-down { color: var(--danger); }
.delta-flat { color: var(--text-muted); }

.alloc-bar { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; background: var(--surface-3); }
.alloc-seg { height: 100%; min-width: 4px; outline-offset: 2px; }
.alloc-seg:first-child { border-radius: 4px 0 0 4px; }
.alloc-seg:last-child { border-radius: 0 4px 4px 0; }
.alloc-seg:hover, .alloc-seg:focus-visible { filter: brightness(1.12); }
.alloc-1 { background: var(--viz-1); }
.alloc-2 { background: var(--viz-2); }
.alloc-3 { background: var(--viz-3); }
.alloc-empty { flex: 1; }
.alloc-legend { list-style: none; margin: var(--space-4) 0 0; padding: 0; display: grid; gap: var(--space-2); }
.alloc-legend li { display: grid; grid-template-columns: 12px 1fr auto 52px; gap: var(--space-2); align-items: center; font-size: var(--text-sm); }
.alloc-key { width: 12px; height: 12px; border-radius: 3px; }
.alloc-label { color: var(--text-muted); }
.alloc-value { font-weight: 600; color: var(--text); }
.alloc-pct { text-align: right; color: var(--text-muted); font-size: var(--text-xs); }
.tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tab { white-space: nowrap; flex-shrink: 0; }

/* Column chart: 4px rounded data-ends on the baseline, 2px surface gap between bars. */
.cols-plot { position: relative; height: 180px; outline: none; }
.cols-plot:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.cols-grid { position: absolute; left: 0; right: 0; border-top: 1px solid var(--viz-grid); }
.cols-grid span { position: absolute; right: 0; bottom: 2px; font-size: 10px; color: var(--viz-muted); font-variant-numeric: tabular-nums; }
.cols-bars { position: absolute; inset: 0 34px 0 0; display: flex; align-items: stretch; gap: 2px; }
.cols-hit { flex: 1; display: flex; align-items: flex-end; min-width: 0; cursor: default; }
.cols-bar { width: 100%; background: var(--viz-trend); border-radius: 4px 4px 0 0; min-height: 0; }
.cols-bar.is-zero { background: transparent; }
.cols-hit.is-active .cols-bar { filter: brightness(1.15); box-shadow: 0 0 0 2px var(--surface); }
.cols-hit.is-active { background: color-mix(in srgb, var(--viz-grid) 60%, transparent); }

/* ---------- Password show/hide ---------- */
.password-wrap { position: relative; display: flex; align-items: center; }
.password-wrap input { padding-right: 48px !important; }
.password-wrap .pin-input { padding-right: 40px !important; }
.password-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px;
  display: grid; place-items: center; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-subtle); cursor: pointer; }
.password-toggle:hover { color: var(--text); background: var(--surface-2); }
.password-toggle svg { width: 18px; height: 18px; }
.password-toggle .icon-hide, .password-toggle[aria-pressed="true"] .icon-show { display: none; }
.password-toggle[aria-pressed="true"] .icon-hide { display: inline; }
.password-toggle[hidden] { display: none; }
.pin-form .password-wrap, .field .password-wrap:has(.pin-input) { max-width: 160px; }
.match-hint { min-height: 1em; font-weight: 600; }

/* ---------- dd/mm/yyyy date field with calendar button ---------- */
.date-wrap { position: relative; display: flex; align-items: center; }
.date-wrap input[data-dmy-date] { padding-right: 48px !important; }
.date-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px;
  display: grid; place-items: center; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-subtle); cursor: pointer; }
.date-toggle:hover { color: var(--text); background: var(--surface-2); }
.date-toggle svg { width: 18px; height: 18px; }
.date-toggle[hidden] { display: none; }
/* The native input only anchors the browser's picker under the button. */
.field .date-wrap .date-native { position: absolute; right: 4px; bottom: 0; width: 38px; min-height: 0; height: 1px;
  padding: 0; border: 0; opacity: 0; pointer-events: none; }
.match-hint.is-match { color: var(--success); }
.match-hint.is-mismatch { color: var(--warning); }

/* ---------- Referrals ---------- */
.referral-link-row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; margin-top: var(--space-2); }
.referral-url {
  flex: 1 1 260px; min-width: 0; padding: 11px 14px; overflow-wrap: anywhere;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-md);
  background: var(--surface-2); font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text);
}
.referral-steps { list-style: none; margin: var(--space-4) 0 0; padding: 0; display: grid; gap: var(--space-4); }
@media (min-width: 900px) { .referral-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.referral-steps li { display: flex; gap: var(--space-3); align-items: flex-start; font-size: var(--text-sm); }
.referral-steps .step-num { display: inline-flex; align-items: center; justify-content: center; }

/* ---------- WhatsApp button (public pages) ---------- */
.whatsapp-fab {
  position: fixed; z-index: 55; left: max(20px, env(safe-area-inset-left)); bottom: max(20px, env(safe-area-inset-bottom));
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%;
  background: #25d366; color: #fff; box-shadow: 0 10px 24px -8px rgb(0 0 0 / 0.55), 0 0 0 4px rgb(37 211 102 / 0.18);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.whatsapp-fab:hover { transform: translateY(-2px) scale(1.04); text-decoration: none; box-shadow: 0 14px 28px -8px rgb(0 0 0 / 0.6), 0 0 0 6px rgb(37 211 102 / 0.22); }
.whatsapp-fab:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
@media (max-width: 479px) { .whatsapp-fab { width: 52px; height: 52px; left: 16px; bottom: 16px; } }
.field textarea[name="live_chat_script"] { min-height: 220px; font-family: var(--font-mono); font-size: var(--text-sm); line-height: 1.55; }
