:root {
    --primary-color: #334fbb;
    --success-color: #168365;
    --danger-color: #c64754;
    --warning-color: #af7614;
    --dark-color: #202a43;
    --workspace-bg: #f4f6fa;
    --workspace-border: #e3e8f1;
    --workspace-muted: #748096;
    --workspace-sidebar: 208px;
    --workspace-topbar: 68px;
    --bs-primary-rgb: 51, 79, 187;
    --bs-success-rgb: 22, 131, 101;
    --bs-danger-rgb: 198, 71, 84;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--dark-color); background: var(--workspace-bg); font-size: 14px; line-height: 1.6; }
a { color: var(--primary-color); }
a:hover { color: #263b91; }
:focus-visible { outline: 3px solid #a4b6ff; outline-offset: 3px; }
.skip-link { position: fixed; top: -90px; left: 16px; padding: 10px 16px; background: #fff; border: 2px solid var(--primary-color); border-radius: 8px; z-index: 1100; }
.skip-link:focus { top: 10px; }
.workspace-topbar { position: sticky; top: 0; z-index: 1030; height: var(--workspace-topbar); display: flex; align-items: center; gap: 14px; padding: 0 28px; background: rgba(255,255,255,.97); border-bottom: 1px solid var(--workspace-border); }
.workspace-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 16px; font-weight: 700; color: #233454; white-space: nowrap; }
.workspace-brand small { display: block; color: var(--workspace-muted); font-size: 10px; font-weight: 400; letter-spacing: .08em; line-height: 1.3; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; color: white; background: var(--primary-color); border-radius: 10px; font-size: 15px; }
.chain-control { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.chain-control label { font-size: 12px; color: var(--workspace-muted); white-space: nowrap; }
.chain-control select { min-width: 134px; max-width: 190px; background-color: #f7f9fc; border-color: var(--workspace-border); }
.workspace-shell { min-height: calc(100vh - var(--workspace-topbar)); }
.sidebar { width: var(--workspace-sidebar); position: fixed; top: var(--workspace-topbar); bottom: 0; left: 0; z-index: 1020; overflow-y: auto; background: #fff; border-right: 1px solid var(--workspace-border); padding: 24px 12px 20px; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 14px 14px; color: #8b95a7; font-size: 11px; letter-spacing: .12em; }
.sidebar .nav { gap: 3px; }
.sidebar .nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 13px; margin: 0; color: #657187; font-weight: 500; border-radius: 7px; line-height: 1.5; transition: color .15s, background .15s; }
.sidebar .nav-link i { width: 18px; text-align: center; font-size: 14px; opacity: .85; }
.sidebar .nav-link:hover { color: var(--primary-color); background: #f5f7fd; }
.sidebar .nav-link.active { color: var(--primary-color); background: #edf1fc; font-weight: 650; }
.sidebar-footer { margin: 24px 13px 0; padding-top: 16px; border-top: 1px solid var(--workspace-border); font-size: 11px; color: #8b95a7; }
.workspace-main { margin-left: var(--workspace-sidebar); padding: 28px; min-width: 0; outline: none; }
.workspace-main > .container-fluid { padding: 0; }
.nav-toggle, .sidebar-heading .btn-close, .nav-backdrop { display: none; }
h2 { font-size: 24px; line-height: 1.35; font-weight: 680; letter-spacing: -.03em; margin-bottom: 0; }
h2 > i { color: #6d7dad; font-size: 19px; margin-right: 7px; }
h3 { font-weight: 650; }
h5, h6 { line-height: 1.5; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.page-heading h2 { margin-bottom: 5px !important; }
.page-subtitle { color: var(--workspace-muted); margin: 0; font-size: 12px; font-weight: 400; max-width: 64em; }
.page-actions, .workspace-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.card { border: 1px solid var(--workspace-border); border-radius: 12px; box-shadow: 0 2px 6px rgba(36, 50, 83, .025); overflow: visible; }
.card:hover { transform: none; }
.card-header { background: #fff; padding: 16px 20px; border-bottom: 1px solid #edf0f5; border-radius: 12px 12px 0 0 !important; }
.card-header h5 { font-size: 15px; font-weight: 650; }
.card-header > strong { font-size: 14px; }
.card-header i { color: #8090b0; margin-right: 4px; }
.card-body { padding: 20px; min-width: 0; }
.card-header.d-flex { flex-wrap: wrap; gap: 10px; }
.card-header .d-flex { flex-wrap: wrap; }
.stat-card, .metric-card { background: #fff; color: var(--dark-color); padding: 19px 20px; border: 1px solid var(--workspace-border); border-radius: 12px; min-height: 128px; height: 100%; box-shadow: 0 2px 6px rgba(36,50,83,.025); }
.stat-card.success, .stat-card.danger, .stat-card.warning, .stat-card.info { background: #fff; }
.stat-card h6 { color: #7b879b; font-size: 12px; font-weight: 500; margin-bottom: 13px; }
.stat-card h6 i { margin-right: 5px; opacity: .7; }
.stat-card h3 { font-size: clamp(23px, 2vw, 31px); margin-bottom: 7px; letter-spacing: -.035em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-card.success h3 { color: var(--success-color); }
.stat-card.danger h3 { color: var(--danger-color); }
.stat-card.warning h3 { color: var(--primary-color); }
.stat-card small, .stat-card .text-white-50 { color: var(--workspace-muted) !important; font-size: 11px; line-height: 1.7; }
#chainsOverviewCard { background: #edf1fc; border-color: #e0e7fa; min-height: 116px; }
#chainsOverviewRows { color: #53627f; font-size: 12px; }
#statsCards { margin-bottom: 8px !important; }
.wallet-card { border-left: 3px solid #98a9da; }
.text-muted { color: var(--workspace-muted) !important; }
.profit-positive { color: var(--success-color); font-weight: 650; }
.profit-negative { color: var(--danger-color); font-weight: 650; }
.text-success { color: var(--success-color) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.btn { border-radius: 7px; font-size: 13px; padding: 7px 12px; font-weight: 500; line-height: 1.5; white-space: nowrap; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-primary { background-color: var(--primary-color); border-color: var(--primary-color); }
.btn-primary:hover, .btn-primary:focus { background-color: #293f98; border-color: #293f98; }
.btn-outline-primary { color: var(--primary-color); border-color: #bfcbee; }
.btn-outline-primary:hover { background: var(--primary-color); border-color: var(--primary-color); }
.btn-outline-secondary { color: #68758b; border-color: #dbe1eb; }
.btn-outline-success { border-color: #b8ddcf; color: var(--success-color); }
.btn-outline-danger { border-color: #ebc9ce; color: var(--danger-color); }
.btn-link { text-decoration: none; }
.form-label { color: #626f85; font-size: 12px; font-weight: 500; margin-bottom: 6px; }
.form-control, .form-select { border-color: #dfe5ee; border-radius: 7px; font-size: 13px; min-height: 36px; color: #34445f; }
.form-control::placeholder { color: #a0a9b8; font-size: 12px; }
.form-control:focus, .form-select:focus { border-color: #9cafed; box-shadow: 0 0 0 3px rgba(51,79,187,.1); }
.form-control[readonly] { background: #f7f9fc; }
.form-text { font-size: 11px; color: var(--workspace-muted); }
.table { color: #46536b; font-size: 12px; margin-bottom: 0; vertical-align: middle; }
.table > :not(caption) > * > * { padding: 12px 13px; border-bottom-color: #edf0f5; }
.table-sm > :not(caption) > * > * { padding: 9px 11px; }
.table thead th { background: #f8faff; color: #7a8598; border-bottom-width: 1px; font-size: 11px; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.table-light { --bs-table-bg: #f8faff; --bs-table-color: #7a8598; }
.table tbody td { font-variant-numeric: tabular-nums; }
.table .text-end { white-space: nowrap; }
.table-hover tbody tr:hover { --bs-table-accent-bg: #f7f9fe; }
.table-responsive { max-width: 100%; overflow-x: auto; border-radius: 8px; -webkit-overflow-scrolling: touch; }
.table-responsive:focus-visible { outline-offset: -2px; }
.table-responsive .table { min-width: max-content; width: 100%; }
.table-responsive .table td:not(.text-end) { max-width: 340px; overflow-wrap: anywhere; }
.badge { border-radius: 5px; padding: 5px 7px; font-size: 10px; font-weight: 550; letter-spacing: .01em; }
.badge.bg-success { background: #e7f4ee !important; color: #168365; }
.badge.bg-danger { background: #fae9ec !important; color: #bf4051; }
.badge.bg-primary { background: #ebeffc !important; color: #405dba; }
.badge.bg-secondary { background: #edf0f5 !important; color: #6c7890; }
.badge.bg-warning { background: #fff3d7 !important; color: #9f711c !important; }
.badge.bg-info { background: #e8f2fc !important; color: #3f78a7 !important; }
.alert { border-radius: 9px; border-width: 1px; padding: 12px 15px; font-size: 12px; overflow-wrap: anywhere; }
.alert-info, .alert-primary { color: #4c6596; background: #eff4fd; border-color: #dfe8f9; }
.alert-warning { color: #987125; background: #fffbef; border-color: #f3e9c7; }
.alert-danger { color: #b14c59; background: #fff3f4; border-color: #f0d9dd; }
.alert-secondary, .alert-light { color: #6e7b91; background: #f8fafd; border-color: var(--workspace-border); }
.alert-success { color: #27856c; background: #f0faf6; border-color: #d6ece3; }
.loading, .empty-state { display: grid; justify-items: center; align-content: center; gap: 12px; color: #8792a5; padding: 42px 20px; text-align: center; min-height: 130px; }
.loading .spinner-border { width: 24px; height: 24px; border-width: 2px; }
.empty-state i { color: #a6b4d0; font-size: 22px; }
.nav-tabs { border-bottom-color: var(--workspace-border); flex-wrap: wrap; gap: 3px; }
.nav-tabs .nav-link { color: #7c889b; font-size: 12px; border-radius: 7px 7px 0 0; }
.nav-tabs .nav-link.active { color: var(--primary-color); font-weight: 600; border-color: var(--workspace-border) var(--workspace-border) #fff; }
.pagination { flex-wrap: wrap; gap: 3px; }
.page-link { border-radius: 5px !important; font-size: 12px; color: var(--primary-color); border-color: var(--workspace-border); }
.modal-content { border: 0; border-radius: 14px; box-shadow: 0 22px 70px rgba(23,39,75,.18); }
.modal-header, .modal-footer { border-color: #edf0f5; padding: 17px 20px; }
.modal-title { font-size: 16px; font-weight: 650; }
.modal-body { padding: 20px; }
.modal-footer { gap: 8px; }
code { color: #677c9e; font-size: 11px; overflow-wrap: anywhere; }
.details-note { color: var(--workspace-muted); font-size: 12px; margin: 12px 0; }
.details-note summary { cursor: pointer; padding: 5px 0; }
.details-note p { margin: 6px 0; max-width: 80em; }
.annual-stats-table .wallet-col { position: sticky; left: 0; z-index: 1; background: #fff; }
.annual-stats-table thead .wallet-col { z-index: 2; background: #f8faff; }
.annual-stats-table .month-col, .annual-stats-table .total-col { min-width: 135px !important; }
.login-body { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 10% 10%, #e9eefb, transparent 60%), #f4f6fa; }
.login-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--workspace-border); border-radius: 18px; padding: 36px; box-shadow: 0 16px 50px rgba(39,59,108,.07); }
.login-card .brand-mark { width: 40px; height: 40px; margin-bottom: 24px; }
.login-card h1 { font-size: 24px; font-weight: 650; margin-bottom: 8px; }
.login-card .sub { color: var(--workspace-muted); font-size: 12px; margin-bottom: 28px; }
.login-card .btn { min-height: 42px; }
@media (min-width: 992px) and (max-width: 1280px) { .workspace-main { padding: 22px; } #statsCards > .col-md-3 { width: 50%; } }
@media (max-width: 991px) {
    :root { --workspace-topbar: 62px; }
    .workspace-topbar { padding: 0 18px; gap: 12px; }
    .workspace-main { margin-left: 0; padding: 22px; }
    .nav-toggle { display: inline-flex; justify-content: center; align-items: center; width: 34px; height: 34px; padding: 0; flex-shrink: 0; }
    .sidebar { top: 0; width: 244px; z-index: 1050; transform: translateX(-100%); visibility: hidden; transition: transform .18s ease, visibility .18s; padding-top: 22px; }
    .sidebar-heading .btn-close { display: block; }
    .nav-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 1040; background: rgba(24,35,62,.35); border: none; }
    .nav-open .sidebar { transform: translateX(0); visibility: visible; }
    .nav-open { overflow: hidden; }
    .sidebar .nav-link { min-height: 42px; }
}
@media (max-width: 575px) {
    .workspace-topbar { gap: 9px; padding: 0 12px; }
    .workspace-brand { font-size: 13px; gap: 7px; }
    .workspace-brand small { font-size: 9px; letter-spacing: 0; }
    .brand-mark { width: 29px; height: 29px; border-radius: 8px; font-size: 13px; }
    .chain-control { gap: 0; min-width: 0; }
    .chain-control label { display: none; }
    .chain-control select { min-width: 0; width: 113px; font-size: 12px; padding-left: 8px; padding-right: 25px; min-height: 33px; }
    .workspace-main { padding: 20px 14px; overflow-wrap: anywhere; }
    h2 { font-size: 21px; }
    h2 > i { font-size: 16px; }
    .page-heading { margin-bottom: 20px; gap: 12px; }
    .page-heading > .page-actions { width: 100%; }
    .page-subtitle { font-size: 11px; }
    .card-header, .card-body { padding: 15px; }
    .card-header { gap: 10px; }
    .card-body > .row:not([class*="g-"]) { row-gap: 14px; }
    .stat-card { padding: 15px; min-height: 122px; }
    .stat-card h3 { font-size: 24px; }
    .stat-card h6 { margin-bottom: 9px; }
    #statsCards > .col-md-3 { width: 50%; }
    #statsCards { --bs-gutter-x: 10px; }
    .page-actions .btn { margin: 0 !important; }
    .workspace-main .d-flex.justify-content-between { flex-wrap: wrap; gap: 8px; }
    .card-header .d-flex, .page-actions > div { flex-wrap: wrap; gap: 6px; }
    .btn { min-height: 34px; }
    .btn-sm { min-height: 29px; }
    .input-group { min-width: 0; }
    .table > :not(caption) > * > * { padding: 10px; }
    .modal-dialog { margin: 12px; }
    .modal-body, .modal-header, .modal-footer { padding: 16px; }
    .login-card { padding: 28px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation-duration: .01ms !important; } }

/* Same-currency amounts remain visually separate; reference values stay secondary. */
.currency-cashflow {font-size:14px;line-height:1.45;font-variant-numeric:tabular-nums;color:var(--bs-body-color,#24314b)}
.currency-cashflow-row {white-space:nowrap;margin-bottom:3px}
.currency-cashflow-full {display:flex;flex-wrap:wrap;gap:10px 26px;align-items:flex-start}
.currency-cashflow-full .currency-reference {flex-basis:100%}
.currency-cashflow small {font-size:11px;font-weight:400}
.currency-cashflow-full strong {font-size:18px}
.stat-card h3 .currency-cashflow {font-size:18px}
.stat-card h3 .currency-cashflow strong {font-size:20px}
.amount-precision {cursor:help;font-variant-numeric:tabular-nums}
