/*
 * Hollis & Co app — customer panel, admin console, onboarding and auth.
 * Same class vocabulary as the original Natural Payments panel (so every view
 * and behaviour is unchanged); the visual language is Hollis & Co's: Cormorant
 * Garamond display type, Inter UI type, navy / ivory / steel / gold palette.
 */

:root {
    --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

    --navy: #1A2A3E;
    --navy-dark: #111E2D;
    --navy-mid: #243650;
    --steel: #6A8CA5;
    --ivory: #F5F1EC;
    --ivory-dark: #EDE9E3;
    --gray: #D0D0D2;
    --gold: #C5A86A;
    --gold-dim: rgba(197, 168, 106, .18);

    --color-backdrop: var(--ivory);
    --color-surface: #ffffff;
    --color-surface-hover: #faf8f5;
    --color-surface-secondary: #f5f1ec;
    --color-surface-sunken: #ede9e3;
    --color-tag: #ebe6df;
    --color-border: rgba(26, 42, 62, .1);
    --color-border-strong: rgba(26, 42, 62, .22);
    --color-text: #1A2A3E;
    --color-text-secondary: #5f6f80;
    --color-text-tertiary: #93a0ae;
    --color-button: #1A2A3E;
    --color-button-hover: #243650;
    --color-focus: #C5A86A;

    --color-success: #15803d;
    --color-success-bg: #ecfdf5;
    --color-success-border: #a7f3d0;
    --color-warning: #b45309;
    --color-warning-bg: #fffbeb;
    --color-warning-border: #fde68a;
    --color-error: #b42318;
    --color-error-bg: #fef2f2;
    --color-error-border: #fecaca;
    --color-info: #2f5f8a;
    --color-info-bg: #eef4fa;
    --color-info-border: rgba(106, 140, 165, .4);

    --color-chart: #6A8CA5;
    --color-deposit: #15803d;
    --color-withdrawal: #b42318;

    --radius-sm: 4px;
    --radius: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-xl: 14px;

    --shadow-soft: 0 2px 12px rgba(26, 42, 62, .05);
    --shadow-strong: 0 12px 40px rgba(26, 42, 62, .14);
    --shadow-raised: 0 1px 2px rgba(26, 42, 62, .06), 0 0 0 1px rgba(26, 42, 62, .05);

    --ease: cubic-bezier(.24, .8, .24, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-sans); font-size: 14px; line-height: 1.5; color: var(--color-text); background: var(--color-surface); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-weight: 400; }
[hidden] { display: none !important; }
.mono { font-family: var(--font-mono); font-size: .9em; letter-spacing: -.01em; }
.muted { color: var(--color-text-secondary); }
.faint { color: var(--color-text-tertiary); }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.credit { color: var(--color-success); }
.debit { color: var(--color-text); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

/* Utilities used by the shared <x-logo> component. */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.gap-3 { gap: 12px; }
.w-px { width: 1px; }
.h-6 { height: 24px; }
.font-display { font-family: var(--font-display); }
.font-sans { font-family: var(--font-sans); }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.text-xl { font-size: 20px; line-height: 28px; }
.text-\[8px\] { font-size: 8px; }
.leading-none { line-height: 1; }
.uppercase { text-transform: uppercase; }
.tracking-\[0\.01em\] { letter-spacing: .01em; }
.tracking-\[0\.18em\] { letter-spacing: .18em; }
.text-foreground { color: var(--color-text); }
.text-muted-foreground { color: var(--color-text-secondary); }
.text-\[\#F5F1EC\] { color: #F5F1EC; }
.text-\[\#F5F1EC\]\/60 { color: rgba(245, 241, 236, .6); }
.bg-border\/60 { background: rgba(208, 208, 210, .6); }
.bg-\[\#F5F1EC\]\/40 { background: rgba(245, 241, 236, .4); }

/* ---------- Shell ---------- */

body.app { background: var(--color-backdrop); min-height: 100vh; }

.app-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.app-sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 24px 14px 16px; background: var(--navy); color: var(--ivory); }
body.app--admin .app-sidebar { background: var(--navy-dark); }
.app-brand { display: flex; align-items: center; gap: 10px; padding: 6px 12px 34px; }
.app-brand > * { flex-shrink: 0; }
.app-brand .leading-none { white-space: nowrap; }
.app-brand-tag { padding: 2px 8px; border-radius: 999px; background: var(--gold); color: var(--navy); font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.app-nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; margin: 0 -4px; padding: 0 4px; }
.app-nav-label { padding: 22px 12px 8px; color: rgba(245, 241, 236, .45); font-size: 10px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; }
.app-nav-item { display: flex; align-items: center; gap: 12px; min-height: 38px; padding: 8px 12px; border-radius: var(--radius); color: rgba(245, 241, 236, .72); font-size: 13px; font-weight: 500; transition: background-color .15s var(--ease), color .15s var(--ease); }
.app-nav-item svg { width: 17px; height: 17px; flex-shrink: 0; color: rgba(245, 241, 236, .5); transition: color .15s var(--ease); }
.app-nav-item:hover { background: rgba(255, 255, 255, .06); color: var(--ivory); }
.app-nav-item:hover svg { color: rgba(245, 241, 236, .85); }
.app-nav-item.is-active { background: rgba(255, 255, 255, .1); color: var(--ivory); box-shadow: inset 2px 0 0 var(--gold); }
.app-nav-item.is-active svg { color: var(--gold); }
.app-nav-item.is-disabled { color: rgba(245, 241, 236, .4); cursor: default; }
.app-nav-item.is-disabled:hover { background: transparent; }
.app-nav-count { margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--gold); color: var(--navy); font-size: 11px; font-weight: 600; text-align: center; }
.app-nav-soon { margin-left: auto; padding: 1px 8px; border-radius: 999px; background: rgba(255, 255, 255, .1); color: rgba(245, 241, 236, .6); font-size: 11px; }

.app-account { position: relative; margin-top: 12px; }
.app-account > summary { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-md); cursor: pointer; list-style: none; }
.app-account > summary::-webkit-details-marker { display: none; }
.app-account > summary:hover { background: rgba(255, 255, 255, .06); }
.app-account > summary > svg { color: rgba(245, 241, 236, .5); flex-shrink: 0; }
.app-account-avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--gold); flex-shrink: 0; }
.app-account-avatar span { width: 12px; height: 12px; border-radius: 2px; background: var(--navy); }
.app-account-avatar--admin { background: var(--ivory); }
.app-account-name { display: block; color: var(--ivory); font-size: 13px; font-weight: 500; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-account-sub { display: block; color: rgba(245, 241, 236, .55); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-account-text { min-width: 0; flex: 1; }
.app-account .dropdown-menu { bottom: calc(100% + 6px); top: auto; left: 0; right: 0; }

.app-main { min-width: 0; margin: 10px 10px 10px 0; border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-soft); }
.app-content { max-width: 1240px; margin: 0 auto; padding: 52px 72px 88px; }
.app-mobilebar { display: none; }

/* ---------- Page header ---------- */

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 40px; }
.page-title { font-family: var(--font-display); font-size: 34px; font-weight: 600; line-height: 1.1; letter-spacing: -.01em; }
.page-subtitle { max-width: 640px; margin-top: 8px; color: var(--color-text-secondary); font-size: 14px; text-wrap: pretty; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.breadcrumb { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; color: var(--color-text-secondary); font-size: 13px; }
.breadcrumb a:hover { color: var(--color-text); }
.breadcrumb svg { width: 12px; height: 12px; }

.section { margin-top: 56px; }
.section:first-child { margin-top: 0; }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-title { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -.01em; }
.section-title svg { width: 14px; height: 14px; color: var(--color-text-secondary); transition: transform .15s var(--ease); }
a.section-title:hover svg { transform: translateX(2px); }

/* ---------- Buttons ---------- */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 8px 16px; border: 1px solid transparent; border-radius: var(--radius); background: var(--ivory-dark); color: var(--navy); font-size: 13px; font-weight: 500; line-height: 1.2; white-space: nowrap; cursor: pointer; transition: background-color .15s var(--ease), border-color .15s var(--ease), opacity .15s var(--ease); }
.btn:hover { background: #e4ded5; }
.btn svg { width: 14px; height: 14px; }
.btn-primary { background: var(--color-button); border-color: var(--color-button); color: var(--ivory); }
.btn-primary:hover { background: var(--color-button-hover); border-color: var(--color-button-hover); }
.btn-danger { background: var(--color-error-bg); border-color: var(--color-error-border); color: var(--color-error); }
.btn-danger:hover { background: #fee2e2; }
.btn-success { background: var(--color-success); border-color: var(--color-success); color: #fff; }
.btn-success:hover { background: #166534; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--ivory-dark); }
.btn-sm { min-height: 30px; padding: 5px 11px; font-size: 12px; }
.btn-lg { min-height: 44px; padding: 11px 22px; font-size: 14px; }
.btn-block { width: 100%; }
.btn:disabled, .btn.is-disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn-link { padding: 0; border: 0; background: none; color: var(--color-text); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(26, 42, 62, .35); cursor: pointer; }
.btn-link:hover { color: var(--steel); text-decoration-color: currentColor; }

/* ---------- Dropdowns ---------- */

.dropdown { position: relative; }
.dropdown > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; min-width: 240px; padding: 6px; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-strong); }
.dropdown-item { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 9px 11px; border: 0; border-radius: var(--radius); background: none; text-align: left; font-size: 13px; font-weight: 500; cursor: pointer; }
.dropdown-item:hover { background: var(--color-surface-secondary); }
.dropdown-item svg { width: 16px; height: 16px; margin-top: 1px; color: var(--steel); flex-shrink: 0; }
.dropdown-item small { display: block; color: var(--color-text-secondary); font-size: 12px; font-weight: 400; }
.dropdown-divider { height: 1px; margin: 6px 4px; background: var(--color-border); }

/* ---------- Cards, stats, lists ---------- */

.card { border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); }
.card-body { padding: 22px 24px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--color-border); }
.card-title { font-size: 14px; font-weight: 600; }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .split > .card + .card { margin-top: 0; }
.card--sunken { border-color: transparent; background: var(--color-surface-secondary); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; align-items: start; }

.stat { padding: 20px 22px; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); transition: border-color .15s var(--ease); }
a.stat:hover { border-color: var(--color-border-strong); }
.stat-label { color: var(--color-text-secondary); font-size: 10px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; }
.stat-value { margin-top: 10px; font-family: var(--font-display); font-size: 32px; font-weight: 600; line-height: 1.1; letter-spacing: -.01em; }
.stat-meta { margin-top: 6px; color: var(--color-text-secondary); font-size: 12px; }

.balance { display: flex; align-items: baseline; gap: 6px; font-family: var(--font-display); font-size: 48px; font-weight: 600; line-height: 1.05; letter-spacing: -.015em; }
.balance-currency { color: var(--steel); font-size: .6em; }
.balance-label { margin-bottom: 8px; color: var(--color-text-secondary); font-size: 10px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; }

.details { display: grid; grid-template-columns: 180px minmax(0, 1fr); margin: 0; }
.details dt, .details dd { margin: 0; padding: 12px 0; border-bottom: 1px solid var(--color-border); font-size: 14px; }
.details dt { color: var(--color-text-secondary); }
.details dd { min-width: 0; overflow-wrap: anywhere; }
.details > :nth-last-child(-n + 2) { border-bottom: 0; }
.details--compact dt, .details--compact dd { padding: 8px 0; font-size: 13px; }

.kv { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--color-border); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv-label { color: var(--color-text-secondary); }
a.kv:hover { color: var(--steel); }

.copy { display: inline-flex; align-items: center; gap: 8px; }
.copy-button { display: inline-grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--color-text-secondary); cursor: pointer; }
.copy-button:hover { background: var(--color-surface-secondary); color: var(--color-text); }
.copy-button svg { width: 14px; height: 14px; }
.copy-button.is-copied { color: var(--color-success); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { padding: 8px 12px 12px; color: var(--color-text-secondary); font-size: 10px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; text-align: left; white-space: nowrap; }
.table td { padding: 13px 12px; border-top: 1px solid var(--color-border); vertical-align: middle; }
.table th.text-right, .table td.text-right { text-align: right; }
.table th:first-child, .table td:first-child { padding-left: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table tbody tr[data-href] { cursor: pointer; }
.table tbody tr[data-href]:hover td { background: var(--color-surface-hover); }
.table .table-group td { padding-top: 24px; padding-bottom: 8px; border-top: 0; color: var(--color-text-secondary); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.table--dense td { padding-top: 9px; padding-bottom: 9px; font-size: 13px; }
.table-primary { display: block; }
.table-secondary { display: block; margin-top: 2px; color: var(--color-text-secondary); font-size: 12px; }

.amount { white-space: nowrap; font-variant-numeric: tabular-nums; }
.credit-dot { display: inline-block; width: 6px; height: 6px; margin: 0 6px 0 -12px; border-radius: 50%; background: var(--color-deposit); vertical-align: middle; transform: translateY(-1px); }
.amount-currency { color: var(--color-text-secondary); margin-right: 1px; }
.amount--credit { color: var(--color-success); }
.amount--muted { color: var(--color-text-tertiary); text-decoration: line-through; }

/* ---------- Badges, chips, avatars ---------- */

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface-secondary); color: var(--color-text-secondary); font-size: 10px; font-weight: 500; letter-spacing: .08em; line-height: 1.6; text-transform: uppercase; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge--plain::before { display: none; }
.badge--plain { text-transform: none; letter-spacing: 0; font-size: 12px; }
.badge--success { background: var(--color-success-bg); border-color: var(--color-success-border); color: var(--color-success); }
.badge--warning { background: var(--color-warning-bg); border-color: var(--color-warning-border); color: var(--color-warning); }
.badge--error { background: var(--color-error-bg); border-color: var(--color-error-border); color: var(--color-error); }
.badge--info { background: var(--color-info-bg); border-color: var(--color-info-border); color: var(--color-info); }

.chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 4px 10px; border-radius: var(--radius-sm); background: var(--color-surface-secondary); font-size: 13px; white-space: nowrap; }
.chip-swatch { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.chip--bare { padding: 0; background: none; }

.person { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.person-avatar { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--color-tag); color: var(--color-text-secondary); font-size: 11px; flex-shrink: 0; }
.person-avatar svg { width: 12px; height: 12px; }

.agent-art { border-radius: var(--radius-sm); background: var(--agent-gradient); box-shadow: inset 0 0 0 1px rgba(26, 42, 62, .06); flex-shrink: 0; }
.agent-art--sky { --agent-gradient: radial-gradient(120% 90% at 30% 20%, #dde8f0 0%, #9db7cb 45%, #6A8CA5 100%); }
.agent-art--sand { --agent-gradient: radial-gradient(120% 90% at 65% 35%, #f5ecd8 0%, #ddc694 50%, #C5A86A 100%); }
.agent-art--clay { --agent-gradient: radial-gradient(120% 90% at 40% 65%, #efcfbf 0%, #cf8f72 50%, #a2634b 100%); }
.agent-art--moss { --agent-gradient: radial-gradient(120% 90% at 50% 25%, #e9f1e6 0%, #b1cfa9 50%, #729f72 100%); }
.agent-art--dusk { --agent-gradient: radial-gradient(120% 90% at 40% 30%, #e5def3 0%, #ab9fd4 50%, #76659f 100%); }
.agent-art--stone { --agent-gradient: radial-gradient(120% 90% at 40% 30%, #f1efea 0%, #cdc9c1 50%, #9a958c 100%); }

.agent-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.agent-tile { display: flex; align-items: center; gap: 18px; min-width: 0; padding: 4px; margin: -4px; border-radius: var(--radius-md); }
.agent-tile:hover { background: var(--color-surface-hover); }
.agent-tile .agent-art { width: 72px; height: 72px; }
.agent-tile-name { display: block; font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-tile-meta { display: block; color: var(--color-text-secondary); font-size: 13px; }

/* ---------- Chart ---------- */

.chart { position: relative; margin: 32px -72px 0; background-image: radial-gradient(circle, #e6e1d9 1px, transparent 1.4px); background-size: 28px 28px; background-position: center; }
.chart svg { width: 100%; height: 240px; overflow: visible; }
.chart-line { fill: none; stroke: var(--color-chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart-guide { stroke: var(--color-text); stroke-width: 1; stroke-dasharray: 2 3; opacity: 0; vector-effect: non-scaling-stroke; }
.chart-dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border: 2px solid #fff; border-radius: 50%; background: var(--navy); box-shadow: 0 1px 4px rgba(0, 0, 0, .2); opacity: 0; pointer-events: none; }
.chart-tooltip { position: absolute; top: 0; padding: 8px 12px; border-radius: var(--radius); background: var(--navy); color: var(--ivory); font-size: 13px; line-height: 1.35; white-space: nowrap; transform: translateX(-50%); opacity: 0; pointer-events: none; }
.chart-tooltip span { display: block; color: rgba(245, 241, 236, .65); font-size: 12px; }
.chart.is-hovering .chart-dot, .chart.is-hovering .chart-tooltip { opacity: 1; }
.chart-empty { display: grid; place-items: center; height: 240px; color: var(--color-text-secondary); font-size: 13px; }
.chart-ranges { display: flex; justify-content: center; gap: 4px; margin-top: 18px; }

.segmented { display: inline-flex; gap: 4px; }
.segmented a, .segmented button { padding: 6px 12px; border: 1px solid transparent; border-radius: var(--radius); background: none; color: var(--color-text-secondary); font-size: 13px; font-weight: 500; cursor: pointer; transition: color .15s var(--ease), background-color .15s var(--ease); }
.segmented a:hover, .segmented button:hover { color: var(--color-text); }
.segmented .is-active { background: var(--navy); border-color: var(--navy); color: var(--ivory); }

.tabs { display: flex; gap: 24px; margin-bottom: 28px; border-bottom: 1px solid var(--color-border); }
.tabs a { position: relative; padding: 0 0 12px; color: var(--color-text-secondary); font-size: 13px; font-weight: 500; }
.tabs a:hover { color: var(--color-text); }
.tabs a.is-active { color: var(--color-text); }
.tabs a.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1.5px; background: var(--gold); }
.tabs .count { margin-left: 6px; color: var(--color-text-tertiary); }

/* ---------- Filters ---------- */

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 20px; }
.filters .input, .filters .select { height: 36px; min-height: 36px; padding: 0 12px; font-size: 13px; }
.filters .select { padding-right: 34px; background-position: right 11px center; }
.filters .btn { min-height: 36px; height: 36px; }
.filters .input[type="date"], .filters .input[type="month"] { height: 36px; }
.filters .field { gap: 6px; }
.filters .field-label { font-size: 12px; color: var(--color-text-secondary); }
.search { position: relative; flex: 1 1 180px; min-width: 180px; max-width: 380px; }
.search svg { position: absolute; left: 12px; top: 50%; width: 15px; height: 15px; color: var(--color-text-secondary); transform: translateY(-50%); pointer-events: none; }
.search .input { width: 100%; padding-left: 36px; }

/* ---------- Forms ---------- */

.form { display: flex; flex-direction: column; gap: 20px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-row--3 { grid-template-columns: 2fr 1fr 1fr; }
.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.form-actions--end { justify-content: flex-end; }
.form-section { padding-top: 28px; margin-top: 8px; border-top: 1px solid var(--color-border); }
.form-section-title { margin-bottom: 4px; font-size: 15px; font-weight: 600; }
.form-section-hint { margin-bottom: 18px; color: var(--color-text-secondary); font-size: 13px; }

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 500; color: var(--color-text); }
.field-optional { color: var(--color-text-tertiary); font-size: 11px; font-weight: 400; }
.field-hint { color: var(--color-text-secondary); font-size: 12px; }
.field-error { color: var(--color-error); font-size: 12px; }
.input, .select, .textarea { width: 100%; min-height: 40px; padding: 9px 12px; border: 1px solid var(--gray); border-radius: var(--radius); background: var(--color-surface); font-size: 14px; line-height: 20px; outline: none; transition: border-color .12s var(--ease), box-shadow .12s var(--ease); }
.input::placeholder, .textarea::placeholder { color: var(--color-text-tertiary); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--navy); box-shadow: 0 0 0 3px var(--gold-dim); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--color-surface-secondary); color: var(--color-text-secondary); cursor: not-allowed; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--color-error); }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%236A8CA5' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; cursor: pointer; }
.textarea { min-height: 96px; resize: vertical; }
.input[type="date"], .input[type="month"], .input[type="datetime-local"], .input[type="time"] { height: 40px; padding-top: 0; padding-bottom: 0; }
.input::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
.input::-webkit-calendar-picker-indicator:hover { opacity: 1; }
.input-money { position: relative; }
.input-money::before { content: "$"; position: absolute; left: 12px; top: 50%; color: var(--color-text-secondary); transform: translateY(-50%); pointer-events: none; }
.input-money .input { padding-left: 26px; }
.input-money:has(.input-lg)::before { left: 14px; font-size: 22px; }
.input-money .input-lg { padding-left: 34px; }
.input-lg { min-height: 54px; font-size: 22px; }

.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--navy); flex-shrink: 0; }
.check small { display: block; color: var(--color-text-secondary); font-size: 12px; }

.choices { display: grid; gap: 10px; }
.choices--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice { position: relative; display: flex; align-items: center; gap: 14px; padding: 15px 16px; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); cursor: pointer; transition: border-color .12s var(--ease), background-color .12s var(--ease); }
.choice:hover { border-color: var(--color-border-strong); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius); background: var(--color-surface-secondary); color: var(--steel); flex-shrink: 0; }
.choice-icon svg { width: 18px; height: 18px; }
.choice-title { display: block; font-size: 14px; font-weight: 500; }
.choice-text { display: block; margin-top: 2px; color: var(--color-text-secondary); font-size: 12px; }
.choice-mark { width: 18px; height: 18px; margin-left: auto; border: 1.5px solid var(--color-border-strong); border-radius: 50%; flex-shrink: 0; }
.choice--check .choice-mark { border-radius: 5px; }
.choice:has(input:checked) { border-color: var(--navy); background: var(--color-surface-hover); }
.choice:has(input:checked) .choice-mark { border: 5px solid var(--navy); }
.choice--check:has(input:checked) .choice-mark { border: 0; background: var(--navy) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 6.2L5 8.5L9.5 3.5' stroke='%23F5F1EC' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center no-repeat; }
.choice:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--gold-dim); }
.choice.is-disabled { opacity: .55; cursor: default; }

.upload { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px dashed var(--color-border-strong); border-radius: var(--radius-md); }
.upload-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius); background: var(--color-surface-secondary); color: var(--steel); flex-shrink: 0; }
.upload-icon svg { width: 16px; height: 16px; }
.upload-text { flex: 1; min-width: 0; }
.upload-title { font-size: 14px; font-weight: 500; }
.upload-meta { color: var(--color-text-secondary); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload.is-done { border-style: solid; border-color: var(--navy); }

/* ---------- Feedback ---------- */

.alert { display: flex; gap: 12px; padding: 13px 16px; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface-secondary); font-size: 13px; line-height: 1.5; }
.alert svg { width: 16px; height: 16px; margin-top: 2px; flex-shrink: 0; }
.alert-title { font-size: 13px; font-weight: 600; }
.alert--success { background: var(--color-success-bg); border-color: var(--color-success-border); color: #0f5a2a; }
.alert--warning { background: var(--color-warning-bg); border-color: var(--color-warning-border); color: #78350f; }
.alert--error { background: var(--color-error-bg); border-color: var(--color-error-border); color: #7a1911; }
.alert--info { background: var(--color-info-bg); border-color: var(--color-info-border); color: var(--navy); }
.alert + .alert, .alert + .card, .alert + form { margin-top: 16px; }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; max-width: 420px; padding: 12px 16px; border-radius: var(--radius-md); background: var(--navy); color: var(--ivory); font-size: 13px; box-shadow: var(--shadow-strong); animation: toast-in .32s var(--ease); }
.toast svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--gold); }
.toast--error { background: var(--color-error); }
.toast--error svg { color: #fff; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: all .2s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 56px 24px; border: 1px dashed var(--color-border-strong); border-radius: var(--radius-md); text-align: center; }
.empty-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 8px; border-radius: 50%; background: var(--color-surface-secondary); }
.empty-icon svg { width: 18px; height: 18px; color: var(--steel); }
.empty-title { font-family: var(--font-display); font-size: 22px; font-weight: 600; }
.empty-text { max-width: 400px; color: var(--color-text-secondary); font-size: 13px; }
.empty .btn { margin-top: 14px; }

.timeline { position: relative; display: flex; flex-direction: column; gap: 22px; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 1px; background: var(--color-border-strong); }
.timeline-item { position: relative; font-size: 13px; }
.timeline-item::before { content: ""; position: absolute; left: -26px; top: 4px; width: 13px; height: 13px; border: 2px solid var(--color-surface); border-radius: 50%; background: var(--color-border-strong); box-shadow: 0 0 0 1px var(--color-border-strong); }
.timeline-item.is-done::before { background: var(--navy); box-shadow: 0 0 0 1px var(--navy); }
.timeline-item.is-current::before { background: var(--color-surface); box-shadow: 0 0 0 1px var(--gold), inset 0 0 0 3px var(--gold); }
.timeline-time { color: var(--color-text-secondary); font-size: 12px; }

.inbox-item { display: flex; gap: 16px; padding: 18px 0; border-top: 1px solid var(--color-border); }
.inbox-item:first-child { border-top: 0; }
.inbox-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--color-surface-secondary); color: var(--steel); flex-shrink: 0; }
.inbox-icon svg { width: 16px; height: 16px; }
.inbox-body { flex: 1; min-width: 0; }
.inbox-title { font-size: 14px; font-weight: 500; }
.inbox-text { margin-top: 2px; color: var(--color-text-secondary); font-size: 13px; }
.inbox-time { color: var(--color-text-secondary); font-size: 12px; white-space: nowrap; }
.inbox-item.is-unread .inbox-title::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 8px; border-radius: 50%; background: var(--gold); vertical-align: middle; }

.key-reveal { padding: 18px; border-radius: var(--radius-md); background: var(--navy); color: var(--ivory); }
.key-reveal code { display: block; margin-top: 10px; font-family: var(--font-mono); font-size: 13px; word-break: break-all; }
.key-reveal .copy-button { color: rgba(245, 241, 236, .7); }
.key-reveal .copy-button:hover { background: rgba(255, 255, 255, .1); color: #fff; }

.code { padding: 16px 18px; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface-secondary); font-family: var(--font-mono); font-size: 12px; line-height: 1.6; overflow-x: auto; white-space: pre; }

.meter { height: 6px; border-radius: 999px; background: var(--color-tag); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: inherit; background: var(--gold); }

/* ---------- Dialog ---------- */

.dialog { width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-strong); }
.dialog::backdrop { background: rgba(17, 30, 45, .45); backdrop-filter: blur(2px); }
.dialog[open] { animation: dialog-in .28s var(--ease); }
.dialog-body { padding: 28px; }
.dialog-title { font-family: var(--font-display); font-size: 28px; font-weight: 600; line-height: 1.1; }
.dialog-text { margin-top: 6px; color: var(--color-text-secondary); font-size: 13px; }
.dialog .form { margin-top: 22px; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- Pagination ---------- */

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 20px; color: var(--color-text-secondary); font-size: 13px; }
.pagination-links { display: flex; gap: 6px; }

/* ---------- Onboarding & auth ---------- */

body.onb-page { background: var(--color-surface); }
.onb { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.onb-main { display: flex; flex-direction: column; min-height: 100vh; padding: 28px 56px 40px; }
.onb-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.onb-top-actions { display: flex; align-items: center; gap: 8px; color: var(--color-text-secondary); font-size: 13px; }
.onb-progress { display: flex; gap: 6px; margin-top: 56px; max-width: 520px; }
.onb-progress span { flex: 1; height: 3px; border-radius: 3px; background: var(--ivory-dark); }
.onb-progress span.is-done { background: var(--navy); }
.onb-progress span.is-current { background: linear-gradient(90deg, var(--navy) 50%, var(--ivory-dark) 50%); }
.onb-step { margin-top: 14px; color: var(--color-text-secondary); font-size: 11px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; }
.onb-body { width: 100%; max-width: 520px; margin: 28px 0 auto; }
.onb-title { font-family: var(--font-display); font-size: 40px; font-weight: 600; line-height: 1.08; letter-spacing: -.015em; }
.onb-lede { margin-top: 10px; color: var(--color-text-secondary); font-size: 15px; }
.onb-body .form { margin-top: 32px; }
.onb-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 12px; padding-top: 24px; }
.onb-legal { max-width: 520px; margin-top: 40px; color: var(--color-text-tertiary); font-size: 11px; line-height: 1.55; }
.onb-legal a { text-decoration: underline; text-underline-offset: 2px; }
.onb-art { position: sticky; top: 0; height: 100vh; padding: 10px 10px 10px 0; }
.onb-art-image { position: relative; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; padding: 40px; border-radius: var(--radius-lg); background: var(--navy) center / cover no-repeat; overflow: hidden; }
.onb-art-image::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(17, 30, 45, .05) 30%, rgba(17, 30, 45, .78) 100%); }
.onb-art-card { position: relative; z-index: 1; max-width: 420px; padding: 24px 26px; border: 1px solid rgba(245, 241, 236, .16); border-radius: var(--radius-md); background: rgba(26, 42, 62, .66); color: var(--ivory); backdrop-filter: blur(14px); }
.onb-art-kicker { color: var(--gold); font-size: 10px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; }
.onb-art-title { margin-top: 8px; font-family: var(--font-display); font-size: 28px; font-weight: 600; line-height: 1.15; }
.onb-art-text { margin-top: 8px; color: rgba(245, 241, 236, .74); font-size: 13px; line-height: 1.55; }

.auth-body { margin-top: 72px; }
.auth-body .form { margin-top: 28px; }
.auth-alert { margin-top: 24px; }
.auth-alert + .form { margin-top: 20px; }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; }
.auth-row .check { font-size: 13px; }
.auth-alt { margin-top: 28px; color: var(--color-text-secondary); font-size: 13px; }

.review-block { padding: 20px 0; border-top: 1px solid var(--color-border); }
.review-block:first-child { border-top: 0; padding-top: 0; }
.review-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.review-title { font-size: 15px; font-weight: 600; }
.review-edit { color: var(--color-text-secondary); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.review-edit:hover { color: var(--color-text); }

.owner-row { position: relative; padding: 16px; border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.owner-row + .owner-row { margin-top: 10px; }
.owner-remove { position: absolute; top: 10px; right: 10px; }

.status-hero { display: flex; flex-direction: column; gap: 10px; }
.status-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--color-surface-secondary); color: var(--steel); }
.status-icon svg { width: 22px; height: 22px; }

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
    .app-content { padding: 44px 40px 72px; }
    .chart { margin-left: -40px; margin-right: -40px; }
    .split { grid-template-columns: minmax(0, 1fr); }
    .agent-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .app-shell { display: block; }
    .app-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 60; width: 280px; box-shadow: var(--shadow-strong); transform: translateX(-100%); transition: transform .25s var(--ease); }
    body.nav-open .app-sidebar { transform: none; }
    body.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 50; background: rgba(17, 30, 45, .35); }
    .app-mobilebar { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; }
    .app-mobilebar button { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); color: var(--navy); cursor: pointer; }
    .app-mobilebar button svg { width: 18px; height: 18px; }
    .app-main { margin: 0 8px 8px; }
    .app-content { padding: 28px 20px 56px; }
    .chart { margin-left: -20px; margin-right: -20px; }
    .page-header { flex-direction: column; }
    .page-title { font-size: 30px; }
    .grid-2, .grid-3, .form-row, .form-row--3, .choices--2 { grid-template-columns: minmax(0, 1fr); }
    .details { grid-template-columns: minmax(0, 1fr); }
    .details dt { padding-bottom: 0; border-bottom: 0; font-size: 12px; }
    .onb { grid-template-columns: minmax(0, 1fr); }
    .onb-art { display: none; }
    .onb-main { padding: 20px 20px 32px; }
    .onb-progress { margin-top: 32px; }
    .onb-title { font-size: 32px; }
    .auth-body { margin-top: 40px; }
    .hide-mobile { display: none; }
    .table { font-size: 13px; }
    .table th, .table td { padding-left: 8px; padding-right: 8px; }
    .table .hide-mobile:first-child + * { padding-left: 0; }
    .table .table-secondary > .mono { display: none; }
    .table--dense td, .table--dense th { padding-left: 6px; padding-right: 6px; font-size: 12px; }
    .page-actions { flex-wrap: wrap; }
    .filters .search { flex-basis: 100%; max-width: none; }
    .filters > .select, .filters > .input { flex: 1 1 140px; }
    .filters > .btn { flex: 1 1 auto; }
}

@media (max-width: 560px) {
    .agent-tiles, .grid-4 { grid-template-columns: minmax(0, 1fr); }
    .balance { font-size: 38px; }
}
