@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
    /* Palette */
    --fm-bg:               #f7f8fc;
    --fm-surface:          #ffffff;

    --fm-ink:              #0a0f1e;
    --fm-ink-soft:         #3d4663;
    --fm-ink-muted:        #8892aa;

    --fm-primary:          #1847f5;
    --fm-primary-hover:    #3b63f7;
    --fm-primary-light:    #e8edff;
    --fm-primary-glow:     rgba(24, 71, 245, 0.18);
    --fm-primary-glow-sm:  rgba(24, 71, 245, 0.12);

    --fm-success:          #00c896;
    --fm-success-light:    rgba(0, 200, 150, 0.1);

    --fm-danger:           #ef4444;
    --fm-danger-light:     #fef2f2;
    --fm-warning:          #f59e0b;
    --fm-warning-light:    #fffbeb;

    /* Sidebar (dark section) */
    --fm-sidebar-bg:       #0a0f1e;
    --fm-sidebar-border:   rgba(255, 255, 255, 0.08);
    --fm-sidebar-hover:    rgba(255, 255, 255, 0.06);
    --fm-sidebar-active:   rgba(0, 200, 150, 0.12);
    --fm-sidebar-active-text: #00c896;
    --fm-sidebar-text:     rgba(255, 255, 255, 0.5);
    --fm-sidebar-text-hover: #ffffff;
    --fm-sidebar-label:    rgba(255, 255, 255, 0.25);

    /* Borders */
    --fm-border:           rgba(24, 71, 245, 0.12);
    --fm-border-hover:     rgba(24, 71, 245, 0.22);

    /* Shadows */
    --fm-shadow-sm:        0 1px 2px rgba(0, 0, 0, 0.04),
                           0 0 0 1px var(--fm-border);
    --fm-shadow:           0 4px 16px rgba(24, 71, 245, 0.08);
    --fm-shadow-md:        0 8px 32px rgba(24, 71, 245, 0.12);
    --fm-shadow-hover:     0 12px 40px rgba(24, 71, 245, 0.18);

    /* Border radius */
    --fm-radius-sm:        6px;
    --fm-radius:           10px;
    --fm-radius-lg:        16px;
    --fm-radius-xl:        20px;
    --fm-radius-pill:      100px;
    --fm-radius-full:      9999px;

    /* Typography */
    --fm-font-heading:     'Syne', sans-serif;
    --fm-font-body:        'DM Sans', sans-serif;

    /* Transitions */
    --fm-transition:       0.2s ease;
}

/* ============================================================
   BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    font-family: var(--fm-font-body);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.65;
    background-color: var(--fm-bg);
    color: var(--fm-ink-soft);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--fm-font-heading);
    font-weight: 800;
    letter-spacing: -1.5px;
    line-height: 1.05;
    color: var(--fm-ink);
    margin-top: 0;
}

p { margin-top: 0; }
h1:focus { outline: none; }

a {
    color: var(--fm-primary);
    text-decoration: none;
    transition: color var(--fm-transition);
}
a:hover { color: var(--fm-primary-hover); }

/* ============================================================
   SECTION LABELS
   ============================================================ */
.section-label {
    display: block;
    font-family: var(--fm-font-body);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--fm-primary);
    margin-bottom: 0.5rem;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    font-family: var(--fm-font-body);
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: var(--fm-radius-pill);
    transition: all var(--fm-transition);
    padding: 0.625rem 1.375rem;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.btn-sm {
    font-size: 0.8125rem;
    padding: 0.4375rem 1rem;
}

.btn-primary {
    color: #fff;
    background-color: var(--fm-primary);
    border: none;
    box-shadow: none;
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--fm-primary-hover);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 8px 24px var(--fm-primary-glow);
    border-color: transparent;
}
.btn-primary:active {
    transform: translateY(0);
    box-shadow: none;
    background-color: var(--fm-primary);
}
.btn-primary:disabled, .btn-primary.disabled {
    background: var(--fm-ink-muted);
    border-color: transparent;
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-outline-primary {
    color: var(--fm-primary);
    background: transparent;
    border: 1.5px solid var(--fm-primary);
}
.btn-outline-primary:hover {
    background: var(--fm-primary);
    color: #fff;
    border-color: var(--fm-primary);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--fm-primary-glow);
}

.btn-outline-secondary {
    color: var(--fm-ink-muted);
    background: var(--fm-surface);
    border: 1.5px solid var(--fm-border);
}
.btn-outline-secondary:hover {
    color: var(--fm-ink);
    border-color: var(--fm-border-hover);
    background: var(--fm-primary-light);
}

.btn-ghost {
    color: var(--fm-ink-muted);
    background: transparent;
    border: 1.5px solid var(--fm-border);
}
.btn-ghost:hover {
    color: var(--fm-ink);
    background: var(--fm-surface);
    border-color: var(--fm-border-hover);
}
.btn-ghost:disabled, .btn-ghost.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn:focus, .btn:active:focus,
.form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(24, 71, 245, 0.2);
    outline: none;
}

/* ============================================================
   FORM CONTROLS
   ============================================================ */
.form-control {
    font-family: var(--fm-font-body);
    border: 1.5px solid var(--fm-border);
    border-radius: var(--fm-radius-pill);
    font-size: 0.875rem;
    color: var(--fm-ink);
    background: var(--fm-surface);
    padding: 0.625rem 1rem;
    transition: border-color var(--fm-transition), box-shadow var(--fm-transition);
    line-height: 1.4;
}
.form-control:focus {
    border-color: var(--fm-primary);
    box-shadow: 0 0 0 3px rgba(24, 71, 245, 0.15);
}
.form-control::placeholder { color: var(--fm-ink-muted); }
.form-control:disabled {
    background: var(--fm-bg);
    border-color: var(--fm-border);
    color: var(--fm-ink-muted);
    cursor: not-allowed;
}

/* ============================================================
   CARDS (global base)
   ============================================================ */
.fm-card {
    background: var(--fm-surface);
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-lg);
    padding: 1.75rem;
    transition: transform var(--fm-transition), box-shadow var(--fm-transition);
}
.fm-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--fm-shadow-hover);
}

/* ============================================================
   TAGS / BADGES
   ============================================================ */
.badge-pill {
    display: inline-flex;
    align-items: center;
    font-family: var(--fm-font-body);
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 0.2rem 0.625rem;
    border-radius: 6px;
}
.badge-soon {
    background: var(--fm-primary-light);
    color: var(--fm-primary);
}
.badge-new {
    background: var(--fm-success-light);
    color: var(--fm-success);
}

/* ============================================================
   PAGE LAYOUT UTILITIES
   ============================================================ */
.page-container {
    padding: 2.5rem;
    max-width: 1080px;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 2.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-title {
    font-family: var(--fm-font-heading);
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -1.5px;
    line-height: 1.05;
    color: var(--fm-ink);
    margin: 0 0 0.375rem;
}

.page-subtitle {
    font-size: 0.9375rem;
    color: var(--fm-ink-muted);
    margin: 0;
    font-weight: 300;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--fm-surface);
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-xl);
}

.empty-state__icon {
    width: 4rem;
    height: 4rem;
    border-radius: var(--fm-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    font-size: 1.375rem;
}
.empty-state__icon svg {
    width: 1.625rem;
    height: 1.625rem;
}

.empty-state__title {
    font-family: var(--fm-font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--fm-ink);
    margin: 0 0 0.625rem;
}

.empty-state__desc {
    font-size: 0.9375rem;
    color: var(--fm-ink-muted);
    max-width: 420px;
    margin: 0 auto 1.75rem;
    line-height: 1.65;
    font-weight: 300;
}

/* ============================================================
   REVEAL ANIMATIONS
   ============================================================ */
@keyframes revealUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulseDot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%       { transform: scale(1.5); opacity: 0.5; }
}

/* Elements start hidden; JS adds .is-visible to trigger animation */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delays for children inside a reveal-grid */
.reveal-grid > .reveal:nth-child(1) { transition-delay: 0ms; }
.reveal-grid > .reveal:nth-child(2) { transition-delay: 60ms; }
.reveal-grid > .reveal:nth-child(3) { transition-delay: 120ms; }
.reveal-grid > .reveal:nth-child(4) { transition-delay: 180ms; }
.reveal-grid > .reveal:nth-child(5) { transition-delay: 240ms; }
.reveal-grid > .reveal:nth-child(6) { transition-delay: 300ms; }

/* Live / active pulsing dot */
.live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--fm-success);
    animation: pulseDot 1.8s ease-in-out infinite;
}

/* ============================================================
   VALIDATION
   ============================================================ */
.valid.modified:not([type=checkbox]) {
    outline: 2px solid var(--fm-success);
    outline-offset: 1px;
}
.invalid {
    outline: 2px solid var(--fm-danger);
    outline-offset: 1px;
}
.validation-message {
    color: var(--fm-danger);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* ============================================================
   BLAZOR SYSTEM UI
   ============================================================ */
#blazor-error-ui {
    background: var(--fm-warning-light);
    border-top: 2px solid var(--fm-warning);
    bottom: 0; display: none; left: 0;
    padding: 0.75rem 1.25rem;
    position: fixed; width: 100%; z-index: 1000;
    color: var(--fm-ink);
    font-size: 0.875rem;
    font-family: var(--fm-font-body);
}
#blazor-error-ui .dismiss {
    cursor: pointer; position: absolute; right: 0.75rem; top: 0.625rem;
}

.blazor-error-boundary {
    background: var(--fm-danger-light);
    border: 1px solid var(--fm-danger);
    border-radius: var(--fm-radius);
    padding: 1rem 1.25rem;
    color: var(--fm-danger);
    font-size: 0.875rem;
}
.blazor-error-boundary::after { content: "An error has occurred."; }

/* ============================================================
   LOADING SCREEN
   ============================================================ */
.loading-progress {
    position: relative; display: block;
    width: 5rem; height: 5rem;
    margin: 25vh auto 1rem auto;
}
.loading-progress circle {
    fill: none;
    stroke: var(--fm-primary-light);
    stroke-width: 0.5rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}
.loading-progress circle:last-child {
    stroke: var(--fm-primary);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}
.loading-progress-text {
    position: absolute; text-align: center;
    font-family: var(--fm-font-body);
    font-weight: 400;
    color: var(--fm-ink-muted);
    font-size: 0.8125rem;
    inset: calc(25vh + 2.75rem) 0 auto 0;
}
.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

/* ============================================================
   MISC
   ============================================================ */
.content { padding-top: 0; }

/* ============================================================
   TRANSACTION TABLE
   ============================================================ */
.tx-table-wrap {
    overflow-x: auto;
    border-radius: var(--fm-radius-lg);
    border: 1px solid var(--fm-border);
    background: var(--fm-surface);
}

.tx-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .84rem;
}

.tx-table th {
    padding: .6rem .85rem;
    text-align: left;
    font-weight: 600;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--fm-ink-muted);
    background: var(--fm-bg);
    border-bottom: 1px solid var(--fm-border);
}

.tx-table td {
    padding: .6rem .85rem;
    border-bottom: 1px solid var(--fm-border);
    vertical-align: middle;
    color: var(--fm-ink);
}

.tx-row:last-child td { border-bottom: none; }
.tx-row:hover td { background: rgba(24,71,245,.025); }

.tx-date { color: var(--fm-ink-muted); font-size: .8rem; white-space: nowrap; }
.tx-num  { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx-fee  { color: var(--fm-danger); }

.tx-type {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: var(--fm-radius-pill);
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.tx-type--buy  { background: var(--fm-success-light); color: #00a97c; }
.tx-type--sell { background: var(--fm-danger-light); color: var(--fm-danger); }

.tx-manual-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--fm-warning-light);
    color: var(--fm-warning);
    font-size: .6rem;
    font-weight: 800;
    margin-right: .3rem;
    vertical-align: middle;
}

.tx-actions { width: 36px; }
.tx-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--fm-ink-muted);
    padding: .25rem;
    border-radius: 4px;
    opacity: 0;
    transition: opacity .15s, color .15s;
}
.tx-row:hover .tx-action-btn { opacity: 1; }
.tx-action-btn:hover { color: var(--fm-danger); }

.text-end { text-align: right !important; }

/* ============================================================
   PORTFOLIO GRID
   ============================================================ */
.portfolio-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.portfolio-card {
    background: var(--fm-surface);
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-lg);
    padding: 1.25rem;
    transition: box-shadow .2s, border-color .2s;
}
.portfolio-card:hover { box-shadow: var(--fm-shadow-hover); border-color: var(--fm-border-hover); }

.portfolio-card__header {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.portfolio-card__icon {
    width: 40px;
    height: 40px;
    background: var(--fm-primary-light);
    color: var(--fm-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.portfolio-card__icon svg { width: 18px; height: 18px; }

.portfolio-card__meta { flex: 1; min-width: 0; }
.portfolio-card__name { font-size: .95rem; font-weight: 700; margin: 0 0 .15rem; color: var(--fm-ink); }
.portfolio-card__desc { font-size: .8rem; color: var(--fm-ink-muted); margin: 0; }

.portfolio-card__delete {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--fm-ink-muted);
    padding: .2rem;
    border-radius: 4px;
    opacity: 0;
    transition: opacity .15s, color .15s;
}
.portfolio-card:hover .portfolio-card__delete { opacity: 1; }
.portfolio-card__delete:hover { color: var(--fm-danger); }

.portfolio-card__stats {
    display: flex;
    gap: 1.5rem;
}
.portfolio-card__stat { display: flex; flex-direction: column; }
.portfolio-card__stat-val { font-size: .9rem; font-weight: 600; color: var(--fm-ink); }
.portfolio-card__stat-label { font-size: .7rem; color: var(--fm-ink-muted); }

/* ============================================================
   PORTFOLIO TABS
   ============================================================ */
.portfolio-tabs {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.portfolio-tab {
    background: none;
    border: 1.5px solid var(--fm-border);
    border-radius: var(--fm-radius-pill);
    padding: .35rem .85rem;
    font-size: .82rem;
    font-weight: 500;
    color: var(--fm-ink-muted);
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}
.portfolio-tab:hover { border-color: var(--fm-primary); color: var(--fm-primary); }
.portfolio-tab.active {
    background: var(--fm-primary);
    border-color: var(--fm-primary);
    color: #fff;
}

/* ============================================================
   BROKER CARD — connection state additions
   ============================================================ */
.broker-card__connection {
    margin-top: .85rem;
    padding-top: .75rem;
    border-top: 1px solid var(--fm-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: .78rem;
    gap: .5rem;
}

.broker-card__conn-info {
    display: flex;
    align-items: center;
    gap: .4rem;
    color: var(--fm-ink-muted);
    flex-wrap: wrap;
}

.broker-card__conn-method {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.broker-card__sync {
    color: var(--fm-ink-muted);
    font-size: .73rem;
}

.broker-card__import-hint {
    margin-top: .75rem;
    font-size: .78rem;
    color: var(--fm-ink-muted);
    display: flex;
    align-items: center;
    gap: .35rem;
}

.broker-tag--muted {
    background: var(--fm-bg);
    color: var(--fm-ink-muted);
    border: 1px solid var(--fm-border);
}

.badge-connected {
    background: var(--fm-success-light);
    color: #00a97c;
    border: none;
    font-size: .7rem;
    font-weight: 700;
    padding: .25rem .6rem;
    border-radius: var(--fm-radius-pill);
}

/* ============================================================
   GLOBAL MODAL BACKDROP
   Overrides Bootstrap's .modal-backdrop (z-index 1040, fully opaque black).
   app.css loads after bootstrap.min.css so this takes precedence.
   ============================================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 20, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1050;
    animation: fadeIn 0.15s ease;
    opacity: 1 !important; /* prevent Bootstrap's .fade / .show from interfering */
}

/* ============================================================
   SHARED MODAL SHELL (used by Portfolios page create modal)
   ============================================================ */
.create-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(480px, 94vw);
    background: var(--fm-surface);
    border-radius: var(--fm-radius-lg);
    box-shadow: 0 24px 64px rgba(0,0,0,.18);
    z-index: 1051;
    animation: slideUp .2s ease;
}
.create-modal .wizard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.5rem 1.75rem 1.25rem;
    border-bottom: 1px solid var(--fm-border);
    margin-bottom: .25rem;
}
.create-modal .wizard-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    color: var(--fm-ink);
}
.create-modal .wizard-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--fm-ink-muted);
    padding: .25rem;
    border-radius: 6px;
    line-height: 1;
    transition: background .15s, color .15s;
}
.create-modal .wizard-close:hover { background: var(--fm-primary-light); color: var(--fm-primary); }
.create-modal .wizard-body  { padding: 1.25rem 1.75rem 2rem; }
.create-modal .form-group   { margin-bottom: 1.25rem; }
.create-modal .form-label   { display: block; margin-bottom: .4rem; font-size: .82rem; font-weight: 600; color: var(--fm-ink-soft); }
.create-modal .wizard-footer {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--fm-border);
}

/* ============================================================
   SHARED HELPERS
   ============================================================ */
.btn-link {
    background: none;
    border: none;
    cursor: pointer;
    font-size: .78rem;
    font-weight: 500;
    padding: 0;
    text-decoration: underline;
}
.btn-link--danger { color: var(--fm-danger); }

.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem;
}

/* fm-input — standardise form inputs across wizard and modals */
.fm-input {
    width: 100%;
    padding: .55rem .85rem;
    border: 1.5px solid var(--fm-border);
    border-radius: var(--fm-radius);
    background: var(--fm-surface);
    font-size: .88rem;
    color: var(--fm-ink);
    font-family: var(--fm-font-body);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
    -webkit-appearance: none;
}
.fm-input:focus {
    border-color: var(--fm-primary);
    box-shadow: 0 0 0 3px var(--fm-primary-glow-sm);
}
.fm-input::placeholder { color: var(--fm-ink-muted); }

/* ── Dashboard section link ──────────────────────────────────────────── */
.dashboard__section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .75rem;
    margin-top: 2rem;
}
.dashboard__section-link {
    font-size: .8rem;
    color: var(--fm-primary);
    text-decoration: none;
    font-weight: 500;
}
.dashboard__section-link:hover { text-decoration: underline; }

/* ── Checklist done state ────────────────────────────────────────────── */
.checklist__item--done .checklist__step {
    background: var(--fm-success);
    color: #fff;
}
.checklist__item--done .checklist__name {
    text-decoration: line-through;
    color: var(--fm-ink-muted);
}
.btn-outline-muted {
    border: 1.5px solid var(--fm-border);
    background: transparent;
    color: var(--fm-ink-muted);
    font-size: .8rem;
    padding: .3rem .85rem;
    border-radius: var(--fm-radius);
    cursor: default;
    white-space: nowrap;
}

/* ── Stat card loading state ─────────────────────────────────────────── */
.stat-card__value--loading {
    color: var(--fm-ink-muted);
    animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .35; }
}

/* ── Holdings ticker chip (used inline on Dashboard) ─────────────────── */
.holdings-ticker {
    display: inline-block;
    font-size: .7rem;
    font-weight: 600;
    color: #1847f5;
    background: rgba(24, 71, 245, 0.08);
    padding: .1rem .35rem;
    border-radius: 4px;
    letter-spacing: .02em;
    vertical-align: middle;
}

/* ── Holdings type chip (used on Dashboard inline) ───────────────────── */
.holdings-type {
    display: inline-block;
    font-size: .72rem;
    font-weight: 500;
    padding: .15rem .55rem;
    border-radius: 20px;
    text-transform: capitalize;
    background: #f5f5f5;
    color: #6b7280;
}
.holdings-type--etf   { background: rgba(0,200,150,.1);  color: #007a5a; }
.holdings-type--stock { background: rgba(24,71,245,.08); color: #1847f5; }
.holdings-type--crypto{ background: rgba(245,158,11,.1); color: #b45309; }

/* ============================================================
   HOLDINGS — filter pills
   ============================================================ */
.holdings-filter {
    display: flex;
    gap: .45rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.holdings-filter__pill {
    background: none;
    border: 1.5px solid var(--fm-border);
    border-radius: var(--fm-radius-pill);
    padding: .3rem .85rem;
    font-size: .78rem;
    font-weight: 500;
    color: var(--fm-ink-muted);
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}
.holdings-filter__pill:hover { border-color: var(--fm-primary); color: var(--fm-primary); }
.holdings-filter__pill.active {
    background: var(--fm-primary);
    border-color: var(--fm-primary);
    color: #fff;
}

/* ============================================================
   HOLDINGS — sortable column headers
   ============================================================ */
.tx-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color .15s;
}
.tx-table th.sortable:hover { color: var(--fm-primary); }
.tx-table th.sortable.sort-active { color: var(--fm-primary); }

/* ============================================================
   HOLDINGS — unverified asset badge
   ============================================================ */
.holdings-unverified {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--fm-warning);
    color: #fff;
    font-size: .6rem;
    font-weight: 800;
    margin-right: .3rem;
    vertical-align: middle;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .page-container { padding: 1.25rem; }
    .page-title { font-size: 1.5rem; }
}

/* ============================================================
   AUTH LAYOUT  — two-column split (dark panel + light form)
   ============================================================ */

/* Entry animation for the card and panel content */
@keyframes authIn {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Outer grid ────────────────────────────────────────────── */
.auth-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

/* ── Left decorative panel ─────────────────────────────────── */
.auth-panel {
    background: #0a0f1e;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Radial glow — top-left blue */
.auth-panel::before {
    content: '';
    position: absolute;
    top: -100px;
    left: -80px;
    width: 480px;
    height: 480px;
    background: radial-gradient(circle, rgba(24, 71, 245, 0.20) 0%, transparent 60%);
    pointer-events: none;
}

/* Radial glow — bottom-right green */
.auth-panel::after {
    content: '';
    position: absolute;
    bottom: -80px;
    right: -60px;
    width: 360px;
    height: 360px;
    background: radial-gradient(circle, rgba(0, 200, 150, 0.12) 0%, transparent 60%);
    pointer-events: none;
}

.auth-panel__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 2.75rem 2.75rem 2.25rem;
    animation: authIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Brand row */
.auth-panel__brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.auth-panel__logomark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(24, 71, 245, 0.14);
    border: 1px solid rgba(24, 71, 245, 0.32);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.auth-panel__brand-name {
    font-family: 'Syne', sans-serif;
    font-size: 1.0625rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #ffffff;
}

/* Main headline */
.auth-panel__headline {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2.5rem 0 2rem;
}

.auth-panel__title {
    font-family: 'Syne', sans-serif;
    font-size: clamp(2rem, 2.8vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -2.5px;
    line-height: 1.0;
    color: #ffffff;
    margin: 0 0 1.25rem;
}

.auth-panel__sub {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9375rem;
    font-weight: 300;
    line-height: 1.72;
    color: rgba(255, 255, 255, 0.42);
    max-width: 340px;
    margin: 0;
}

/* Feature list */
.auth-panel__features {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.auth-panel__feature {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.5);
}

.auth-panel__feature-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #00c896;
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(0, 200, 150, 0.5);
}

/* Decorative chart */
.auth-panel__chart {
    margin-top: auto;
    padding-top: 1.5rem;
    opacity: 0.55;
    flex-shrink: 0;
}

/* ── Right form side ────────────────────────────────────────── */
.auth-form-side {
    /* Dot-grid texture + two soft corner glows */
    background-color: var(--fm-bg);
    background-image:
        radial-gradient(circle at 88% 12%, rgba(24, 71, 245, 0.065) 0%, transparent 42%),
        radial-gradient(circle at 12% 88%, rgba(0, 200, 150, 0.05) 0%, transparent 38%),
        radial-gradient(rgba(0, 0, 0, 0.055) 1px, transparent 1px);
    background-size: auto, auto, 22px 22px;
    /* Ensure the column fills the viewport so flex-centering works */
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    overflow-y: auto;
}

/* ── Auth card ──────────────────────────────────────────────── */
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--fm-surface);
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-xl);
    padding: 2.5rem 2.25rem 2rem;
    box-shadow: var(--fm-shadow-md);
    animation: authIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── Brand mark inside the card (hidden on desktop where panel shows it) */
.auth-card__brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 2rem;
}

.auth-card__brand-name {
    font-family: 'Syne', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--fm-ink);
}

/* On wide screens the left panel already shows the brand */
@media (min-width: 901px) {
    .auth-card__brand { display: none; }
}

/* ── Card headings ──────────────────────────────────────────── */
.auth-card__title {
    font-family: 'Syne', sans-serif;
    font-size: 1.625rem;
    font-weight: 800;
    letter-spacing: -1.5px;
    line-height: 1.1;
    color: var(--fm-ink);
    margin: 0 0 0.375rem;
}

.auth-card__subtitle {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9375rem;
    font-weight: 300;
    line-height: 1.6;
    color: var(--fm-ink-muted);
    margin: 0 0 1.75rem;
}

/* ── Form overrides inside auth card ────────────────────────── */
.auth-card .form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--fm-ink-soft);
    margin-bottom: 0.375rem;
    display: block;
}

/* Slightly less round than the global pill — forms feel more formal */
.auth-card .form-control {
    border-radius: var(--fm-radius);
}

/* Center text/icon inside full-width buttons */
.auth-card .btn {
    justify-content: center;
}

/* ── Alerts inside auth card ────────────────────────────────── */
.auth-card .alert {
    border-radius: var(--fm-radius);
    font-size: 0.875rem;
    line-height: 1.55;
    padding: 0.8125rem 1rem;
    margin-bottom: 1.25rem;
    border: none;
}

.auth-card .alert-danger {
    background: var(--fm-danger-light);
    color: var(--fm-danger);
}

.auth-card .alert-success {
    background: rgba(0, 200, 150, 0.08);
    color: #007a5a;
}

/* ── Footer + link ──────────────────────────────────────────── */
.auth-card__footer {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--fm-border);
    text-align: center;
    font-size: 0.875rem;
    color: var(--fm-ink-muted);
    font-weight: 400;
}

.auth-card__link {
    color: var(--fm-primary);
    font-weight: 500;
    text-decoration: none;
    transition: color var(--fm-transition);
}
.auth-card__link:hover {
    color: var(--fm-primary-hover);
    text-decoration: underline;
}

/* Forgot password link (right-aligned below the password field) */
.auth-card .text-end a,
.auth-card .text-end .auth-card__link {
    font-size: 0.8125rem;
}

/* ── Form text hint ─────────────────────────────────────────── */
.auth-card .form-text {
    font-size: 0.75rem;
    color: var(--fm-ink-muted);
    margin-top: 0.3rem;
}

/* ── Validation messages ────────────────────────────────────── */
.auth-card .text-danger.small,
.auth-card .validation-message {
    font-size: 0.75rem;
    color: var(--fm-danger);
    margin-top: 0.3rem;
    display: block;
}

/* ============================================================
   AUTH RESPONSIVE
   ============================================================ */

/* Tablet (≤ 900px) — hide left panel, single column */
@media (max-width: 900px) {
    .auth-layout {
        grid-template-columns: 1fr;
    }

    .auth-panel {
        display: none;
    }

    .auth-form-side {
        min-height: 100vh;
        padding: 3rem 1.5rem 2rem;
        /* Keep the texture but boost the top-left glow since there's no panel */
        background-color: var(--fm-bg);
        background-image:
            radial-gradient(circle at 50% 0%, rgba(24, 71, 245, 0.07) 0%, transparent 55%),
            radial-gradient(rgba(0, 0, 0, 0.055) 1px, transparent 1px);
        background-size: auto, 22px 22px;
    }
}

/* Compact mobile (≤ 540px) — card goes edge-to-edge, no border/shadow */
@media (max-width: 540px) {
    .auth-form-side {
        padding: 0;
        align-items: center;
        background-color: var(--fm-bg);
        background-image:
            radial-gradient(ellipse at 50% -5%, rgba(24, 71, 245, 0.13) 0%, transparent 58%),
            radial-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px);
        background-size: auto, 20px 20px;
    }

    .auth-card {
        max-width: 100%;
        border-radius: 0;
        border: none;
        box-shadow: none;
        padding: 2.5rem 1.375rem 2rem;
        /* Subtle top accent stripe */
        border-top: 3px solid var(--fm-primary);
    }

    .auth-card__brand {
        display: flex; /* always show on small mobile */
    }
}
