/* =============================================================
   theme-aurora.css — Neobucks Aurora Theme
   Design tokens + Bootstrap overrides
   ============================================================= */

/* -------------------------------------------------------------
   1. Design Tokens
   ------------------------------------------------------------- */
:root {
    /* Brand */
    --color-primary:        #0CBF7A;
    --color-primary-dark:   #0A2540;
    --color-primary-hover:  #0aab6c;
    --color-primary-light:  #d4f5e9;

    /* Text */
    --color-text-heading:   #1A2B3C;
    --color-text-body:      #4A5568;
    --color-text-muted:     #718096;
    --color-text-inverse:   #FFFFFF;

    /* Surfaces */
    --color-bg:             #F0F4F8;
    --color-surface:        #FFFFFF;
    --color-surface-alt:    #F7FAFC;
    --color-border:         #E2E8F0;

    /* Plans */
    --color-plan-starter:   #0CBF7A;
    --color-plan-growth:    #27AE60;
    --color-plan-boost:     #F26419;
    --color-plan-surge:     #8B44AC;
    --color-plan-apex:      #E6A817;
    --color-plan-infinity:  #1E74B8;

    /* Feedback */
    --color-success:        #0CBF7A;
    --color-warning:        #E6A817;
    --color-danger:         #E53E3E;
    --color-info:           #1E74B8;

    /* Typography */
    --font-base:            'Plus Jakarta Sans', 'Manrope', sans-serif;
    --font-size-base:       15px;
    --font-size-sm:         13px;
    --font-size-xs:         11px;
    --line-height-base:     1.6;

    /* Spacing */
    --space-xs:             4px;
    --space-sm:             8px;
    --space-md:             16px;
    --space-lg:             24px;
    --space-xl:             40px;

    /* Shape */
    --radius-sm:            6px;
    --radius-md:            12px;
    --radius-lg:            20px;
    --radius-pill:          999px;

    /* Shadows */
    --shadow-sm:            0 1px 4px rgba(0, 0, 0, .08);
    --shadow-md:            0 4px 16px rgba(0, 0, 0, .10);
    --shadow-lg:            0 8px 32px rgba(0, 0, 0, .12);

    /* Transitions */
    --transition-fast:      150ms ease;
    --transition-base:      250ms ease;
}

/* -------------------------------------------------------------
   1b. Dark mode tokens  (auto — follows OS preference)
   ------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
    :root {
        /* Brand — primary stays, light tint darkened */
        --color-primary-hover:  #0ed485;
        --color-primary-light:  #0a3d28;

        /* Text */
        --color-text-heading:   #E8EDF2;
        --color-text-body:      #A0AEC0;
        --color-text-muted:     #8D9AB0;   /* boosted for WCAG AA on dark surfaces */
        --color-text-secondary: #8899AA;
        --color-text-inverse:   #0D1117;

        /* Surfaces */
        --color-bg:             #0D1117;
        --color-surface:        #161B27;
        --color-surface-alt:    #1E2433;
        --color-border:         #2A3040;

        /* Shadows — more opaque on dark */
        --shadow-sm:            0 1px 4px  rgba(0, 0, 0, .30);
        --shadow-md:            0 4px 16px rgba(0, 0, 0, .40);
        --shadow-lg:            0 8px 32px rgba(0, 0, 0, .50);
    }

    /* Bootstrap root variables — prevent Bootstrap's hardcoded light defaults
       from winning over our dark tokens (Bootstrap uses these in .text-muted,
       .text-secondary, list-groups, breadcrumbs, etc.) */
    :root {
        --bs-body-color:        var(--color-text-body);
        --bs-body-bg:           var(--color-bg);
        --bs-secondary-color:   var(--color-text-muted);
        --bs-tertiary-color:    var(--color-text-muted);
        --bs-emphasis-color:    var(--color-text-heading);
        --bs-border-color:      var(--color-border);
        --bs-card-bg:           var(--color-surface);
        --bs-card-border-color: var(--color-border);
        --bs-tooltip-color:     var(--color-text-heading);
        --bs-tooltip-bg:        var(--color-surface-alt);
    }

    /* Bootstrap form controls — hardcoded light colors need override */
    .form-control,
    .form-select {
        background-color: var(--color-surface-alt);
        border-color:     rgba(255, 255, 255, .12);   /* more visible on dark */
        color:            var(--color-text-body);
    }
    .form-control:focus,
    .form-select:focus {
        background-color: var(--color-surface-alt);
        color:            var(--color-text-heading);
        border-color:     var(--color-primary);
        box-shadow:       0 0 0 3px rgba(12, 191, 122, .18);
    }
    .form-control::placeholder { color: var(--color-text-muted); }
    .form-control[readonly]    { background-color: var(--color-surface); }

    .input-group-text {
        background-color: var(--color-surface-alt);
        border-color:     var(--color-border);
        color:            var(--color-text-muted);
    }

    /* Form checkbox/switch */
    .form-check-input {
        background-color: var(--color-surface-alt);
        border-color:     var(--color-border);
    }
    .form-check-input:checked {
        background-color: var(--color-primary);
        border-color:     var(--color-primary);
    }
    .form-switch .form-check-input:not(:checked) {
        background-color: rgba(160, 174, 192, .18);
        border-color:     rgba(160, 174, 192, .32);
    }

    /* Bootstrap modals */
    .modal-content {
        background-color: var(--color-surface);
        border-color:     var(--color-border);
    }
    .modal-header {
        border-bottom-color: var(--color-border);
    }
    /* Chat date separator — dark mode */
    .chat-date-sep span {
        background:   var(--color-surface-alt, #1E2433);
        border-color: var(--color-border, #2A3040);
        color:        var(--color-text-muted, #8D9AB0);
    }

    /* Bootstrap alerts — lighten tinted backgrounds */
    .alert-warning {
        background-color: rgba(230, 168, 23, .12);
        border-color:     rgba(230, 168, 23, .25);
        color:            #f0c050;
    }
    .alert-primary {
        background-color: rgba(12, 191, 122, .10);
        border-color:     rgba(12, 191, 122, .22);
        color:            #0ed485;
    }
    .alert-danger {
        background-color: rgba(229, 62, 62, .12);
        border-color:     rgba(229, 62, 62, .25);
        color:            #fc7272;
    }

    /* Bootstrap badges */
    .badge.bg-warning { background-color: rgba(230,168,23,.20) !important; color: #f0c050 !important; }

    /* btn-close needs to be white */
    .btn-close { filter: invert(1) grayscale(1); }

    /* Sandbox banner */
    .sandbox-banner {
        background-color: rgba(230, 168, 23, .12);
        border-bottom-color: rgba(230, 168, 23, .25);
        color: #f0c050;
    }
}

/* -------------------------------------------------------------
   2. Base
   ------------------------------------------------------------- */
body {
    font-family:       var(--font-base);
    font-size:         var(--font-size-base);
    line-height:       var(--line-height-base);
    color:             var(--color-text-body);
    background-color:  var(--color-bg);
    /* Prevent rubber-band scroll in PWA / standalone mode */
    overscroll-behavior: none;
}

h1, h2, h3, h4, h5, h6 {
    color:       var(--color-text-heading);
    font-weight: 700;
}

a {
    color:      var(--color-primary);
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-hover);
}

/* -------------------------------------------------------------
   3. Bootstrap overrides — colors
   ------------------------------------------------------------- */
/* Always use our token so Bootstrap's rgba(33,37,41) never wins on dark bg */
.text-muted     { color: var(--color-text-muted) !important; }
.text-secondary { color: var(--color-text-muted) !important; }

.text-primary   { color: var(--color-primary)      !important; }
.bg-primary     { background-color: var(--color-primary) !important; }
.border-primary { border-color: var(--color-primary) !important; }

.btn-primary {
    background-color: var(--color-primary);
    border-color:     var(--color-primary);
    color:            var(--color-text-inverse);
    font-weight:      600;
    border-radius:    var(--radius-sm);
    transition:       background-color var(--transition-fast), border-color var(--transition-fast);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--color-primary-hover);
    border-color:     var(--color-primary-hover);
    color:            var(--color-text-inverse);
}

.btn-outline-primary {
    border-color: var(--color-primary);
    color:        var(--color-primary);
    font-weight:  600;
    border-radius: var(--radius-sm);
    transition:   background-color var(--transition-fast), color var(--transition-fast);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: var(--color-primary);
    border-color:     var(--color-primary);
    color:            var(--color-text-inverse);
}

/* -------------------------------------------------------------
   4. Bootstrap overrides — components
   ------------------------------------------------------------- */
.card {
    border:        1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow:    var(--shadow-sm);
    background:    var(--color-surface);
}

.card-header {
    background:    var(--color-surface-alt);
    border-bottom: 1px solid var(--color-border);
    font-weight:   600;
    color:         var(--color-text-heading);
}

.form-control,
.form-select {
    border:        1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size:     max(16px, var(--font-size-base)); /* 16px min — prevents iOS Safari zoom on focus */
    color:         var(--color-text-body);
    background:    var(--color-surface);
    transition:    border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--color-primary);
    box-shadow:   0 0 0 3px rgba(12, 191, 122, .15);
    outline:      none;
}

/* iOS Safari zoom-on-focus: Bootstrap overrides .form-control with .875rem
   via the more-specific .form-control-sm selector — match that specificity. */
.input-group-sm > .form-control,
.input-group-sm > .form-select,
.input-group-sm > .input-group-text,
.form-control-sm,
.form-select-sm {
    font-size: max(16px, var(--font-size-base));
}

.badge.bg-primary {
    background-color: var(--color-primary) !important;
}

/* -------------------------------------------------------------
   5. Plan accent utilities
   ------------------------------------------------------------- */
.plan-starter  { --plan-color: var(--color-plan-starter);  }
.plan-growth   { --plan-color: var(--color-plan-growth);   }
.plan-boost    { --plan-color: var(--color-plan-boost);    }
.plan-surge    { --plan-color: var(--color-plan-surge);    }
.plan-apex     { --plan-color: var(--color-plan-apex);     }
.plan-infinity { --plan-color: var(--color-plan-infinity); }

.plan-accent-border { border-left: 4px solid var(--plan-color); }
.plan-accent-text   { color: var(--plan-color); }
.plan-accent-bg     { background-color: var(--plan-color); }

/* -------------------------------------------------------------
   6. Layout shell
   ------------------------------------------------------------- */
:root {
    --header-height:     56px;
    --bottom-nav-height: 60px;
    --safe-bottom:       env(safe-area-inset-bottom, 0px);
}

.app-body {
    display:          flex;
    flex-direction:   column;
    min-height:       100vh;
    min-height:       100dvh;
    background-color: var(--color-bg);
    overflow-x:       hidden;
}

.app-shell {
    display:        flex;
    flex-direction: column;
    flex:           1 1 auto;
    min-height:     0;
}

/* On mobile, pad main content so it isn't hidden under the bottom nav */
.is-logged .app-main {
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 16px);
}

/* On desktop, no bottom nav — remove the extra padding */
@media (min-width: 992px) {
    .is-logged .app-main {
        padding-bottom: var(--space-xl);
    }
}

/* -------------------------------------------------------------
   7. App header
   ------------------------------------------------------------- */
.app-header {
    position:         sticky;
    top:              0;
    z-index:          100;
    background-color: var(--color-primary-dark);
    /* Height grows to include iOS status bar safe area */
    height:           calc(var(--header-height) + env(safe-area-inset-top, 0px));
    box-shadow:       0 1px 0 rgba(255,255,255,.06);
    padding-top:      env(safe-area-inset-top, 0px);
}

.app-header__inner {
    display:         flex;
    align-items:     center;
    gap:             var(--space-md);
    height:          var(--header-height);
    padding:         0 var(--space-md);
    max-width:       1280px;
    margin:          0 auto;
    width:           100%;
}

/* Brand */
.app-header__brand {
    display:         flex;
    align-items:     center;
    gap:             var(--space-sm);
    text-decoration: none;
    flex-shrink:     0;
}

.app-header__brand-mark {
    display:          flex;
    align-items:      center;
    justify-content:  center;
    width:            32px;
    height:           32px;
    border-radius:    var(--radius-sm);
    background-color: var(--color-primary);
    color:            #fff;
    font-size:        15px;
}

.app-header__logo {
    height:      32px;
    width:       auto;
    object-fit:  contain;
    filter:      brightness(0) invert(1);
}

.app-header__brand-name {
    display:        flex;
    flex-direction: column;
    line-height:    1.2;
}

.app-header__brand-name strong {
    color:       #fff;
    font-size:   15px;
    font-weight: 700;
    letter-spacing: -.2px;
}

.app-header__brand-name small {
    color:     rgba(255,255,255,.55);
    font-size: var(--font-size-xs);
}

/* Desktop nav */
.app-header__nav {
    display:     flex;
    align-items: center;
    gap:         var(--space-xs);
    flex:        1 1 auto;
    justify-content: center;
}

.app-header__nav-link {
    display:         flex;
    align-items:     center;
    gap:             6px;
    padding:         6px 14px;
    border-radius:   var(--radius-pill);
    color:           rgba(255,255,255,.65);
    font-size:       var(--font-size-sm);
    font-weight:     500;
    text-decoration: none;
    transition:      background-color var(--transition-fast), color var(--transition-fast);
    white-space:     nowrap;
}

.app-header__nav-link:hover,
.app-header__nav-link.is-active {
    background-color: rgba(255,255,255,.12);
    color:            #fff;
}

.app-header__nav-link.is-active {
    font-weight: 600;
}

/* Header actions */
.app-header__actions {
    display:     flex;
    align-items: center;
    gap:         var(--space-sm);
    margin-left: auto;
    flex-shrink: 0;
}

/* Equalize header action buttons — keeps Bootstrap btn styles intact */
.app-header__actions .btn-sm {
    min-width:       32px;
    height:          32px;
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
    padding-left:    8px;
    padding-right:   8px;
    font-size:       14px;
    flex-shrink:     0;
}
@media (min-width: 992px) {
    .app-header__actions .btn-sm {
        height:    auto;
        min-width: auto;
        padding:   5px 12px;
        font-size: .875rem;
    }
}

.app-header__user-chip {
    display:      flex;
    align-items:  center;
    gap:          6px;
    color:        rgba(255,255,255,.75);
    font-size:    var(--font-size-sm);
    padding:      4px 10px;
    border-radius: var(--radius-pill);
    background:   rgba(255,255,255,.08);
}

/* -------------------------------------------------------------
   8. Bottom tab navigation (mobile primary nav)
   ------------------------------------------------------------- */
.app-bottom-nav {
    position:         fixed;
    bottom:           0;
    left:             0;
    right:            0;
    z-index:          100;
    display:          flex;
    align-items:      stretch;
    background-color: var(--color-surface);
    border-top:       1px solid var(--color-border);
    height:           calc(var(--bottom-nav-height) + var(--safe-bottom));
    padding-bottom:   var(--safe-bottom);
    box-shadow:       0 -2px 12px rgba(0,0,0,.08);
}

.app-bottom-nav__item {
    flex:            1;
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    justify-content: center;
    gap:             3px;
    color:           var(--color-text-muted);
    font-size:       var(--font-size-xs);
    font-weight:     500;
    text-decoration: none;
    padding:         8px 4px;
    transition:      color var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    min-width:       0;
}

.app-bottom-nav__item i {
    font-size:   18px;
    line-height: 1;
    flex-shrink: 0;
}

.app-bottom-nav__item span {
    white-space:   nowrap;
    overflow:      hidden;
    text-overflow: ellipsis;
    max-width:     100%;
    font-size:     10px; /* tighter on 5 tabs */
}

.app-bottom-nav__item.is-active {
    color: var(--color-primary);
}

.app-bottom-nav__item:active {
    opacity: .7;
}

/* Swap Mercado ↔ Mi Red on mobile bottom nav
   Array order: 1-Inicio 2-Mercado 3-MiRed 4-Historial 5-Perfil
   Desired mobile order: Inicio · Mi Red · Mercado · Historial · Perfil */
.app-bottom-nav__item:nth-child(1) { order: 1; }
.app-bottom-nav__item:nth-child(2) { order: 3; }
.app-bottom-nav__item:nth-child(3) { order: 2; }
.app-bottom-nav__item:nth-child(4) { order: 4; }
.app-bottom-nav__item:nth-child(5) { order: 5; }

/* Hide bottom nav on desktop */
@media (min-width: 992px) {
    .app-bottom-nav { display: none; }
}

/* -------------------------------------------------------------
   9. Site footer (desktop only)
   ------------------------------------------------------------- */
.app-footer {
    background-color: var(--color-primary-dark);
    color:            rgba(255,255,255,.8);
    padding:          var(--space-xl) 0;
    margin-top:       auto;
}

.app-footer__eyebrow {
    font-size:      var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 1px;
    color:          var(--color-primary);
    font-weight:    600;
    margin-bottom:  var(--space-sm);
}

.app-footer__title {
    color:         #fff;
    font-size:     1.5rem;
    margin-bottom: var(--space-sm);
}

.app-footer__copy {
    color:     rgba(255,255,255,.6);
    font-size: var(--font-size-sm);
}

.app-footer__section-label {
    font-size:      var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 1px;
    color:          rgba(255,255,255,.45);
    font-weight:    600;
    margin-bottom:  var(--space-sm);
}

.app-footer a {
    color: rgba(255,255,255,.7);
}

.app-footer a:hover {
    color: var(--color-text-inverse);
}

/* -------------------------------------------------------------
   10. Auth layout
   ------------------------------------------------------------- */
.is-auth .app-main {
    display:         flex;
    align-items:     center;
    justify-content: center;
    padding:         var(--space-lg) var(--space-md);
    min-height:      calc(100dvh - var(--header-height));
    padding-bottom:  calc(var(--space-lg) + env(safe-area-inset-bottom, 0px));
}

.auth-shell {
    width:     100%;
    max-width: 420px;
}

.auth-card {
    border-radius: var(--radius-lg) !important;
    box-shadow:    var(--shadow-lg) !important;
}

.auth-card__brand {
    text-align: center;
}

.auth-card__brand h1 {
    font-size: 1.25rem;
}

.auth-country-select {
    max-width: 105px;
    flex-shrink: 0;
}

.auth-card__links a {
    color: var(--color-primary);
    font-weight: 500;
}

/* -------------------------------------------------------------
   11. Sandbox banner
   ------------------------------------------------------------- */
.sandbox-banner {
    background-color: #FFF3CD;
    color:            #7D4E05;
    font-size:        var(--font-size-sm);
    font-weight:      500;
    text-align:       center;
    padding:          8px var(--space-md);
    border-bottom:    1px solid #FFDCA0;
}

/* -------------------------------------------------------------
   12. Dashboard — wallet cards
   ------------------------------------------------------------- */
.wallet-card {
    border-radius: var(--radius-md) !important;
    border:        1px solid var(--color-border) !important;
    box-shadow:    var(--shadow-sm) !important;
}

.wallet-card__label {
    font-size:    var(--font-size-sm);
    color:        var(--color-text-muted);
    font-weight:  500;
    margin-bottom: var(--space-xs);
}

.wallet-card__amount {
    font-size:     clamp(1rem, 4.5vw, 1.75rem);
    font-weight:   700;
    color:         var(--color-text-heading);
    margin:        0;
    line-height:   1.2;
    white-space:   nowrap;
    overflow:      hidden;
    text-overflow: ellipsis;
}

.wallet-card--buying  { border-left: 3px solid var(--color-primary) !important; }
.wallet-card--withdraw { border-left: 3px solid var(--color-info) !important; }

/* Dashboard action buttons row */
.dashboard-actions {
    display:               grid;
    grid-template-columns: repeat(3, 1fr);
    gap:                   var(--space-sm);
}

.dashboard-action-btn {
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    justify-content: center;
    gap:             6px;
    padding:         12px 8px;
    background:      var(--color-surface);
    border:          1px solid var(--color-border);
    border-radius:   var(--radius-lg);
    color:           var(--color-text-secondary);
    font-size:       12px;
    font-weight:     600;
    cursor:          pointer;
    transition:      all var(--transition-fast);
    width:           100%;
    text-align:      center;
}
.dashboard-action-btn:hover {
    border-color: var(--color-primary);
    color:        var(--color-primary);
    background:   color-mix(in srgb, var(--color-primary) 5%, var(--color-surface));
}
.dashboard-action-btn:active {
    transform: scale(.97);
}

.dashboard-action-btn__icon {
    width:            42px;
    height:           42px;
    border-radius:    50%;
    background:       color-mix(in srgb, var(--color-primary) 10%, transparent);
    color:            var(--color-primary);
    display:          flex;
    align-items:      center;
    justify-content:  center;
    font-size:        16px;
    flex-shrink:      0;
    transition:       background var(--transition-fast);
}
.dashboard-action-btn:hover .dashboard-action-btn__icon {
    background: color-mix(in srgb, var(--color-primary) 18%, transparent);
}

.dashboard-action-btn__label {
    white-space: nowrap;
    line-height: 1;
}

/* -------------------------------------------------------------
   13. Dashboard — asset cards
   ------------------------------------------------------------- */
.asset-card {
    border-radius: var(--radius-md) !important;
    transition:    box-shadow var(--transition-fast);
}

.asset-card:hover {
    box-shadow: var(--shadow-md) !important;
}

.asset-card__name {
    font-size:   var(--font-size-base);
    font-weight: 600;
    color:       var(--color-text-heading);
}

.asset-card__type {
    font-size: var(--font-size-xs);
}

.asset-card__days-badge {
    font-size:    var(--font-size-xs);
    padding:      4px 8px;
    border-radius: var(--radius-pill);
    flex-shrink:  0;
}

.asset-card__stat-label {
    font-size:     var(--font-size-xs);
    color:         var(--color-text-muted);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight:   500;
}

.asset-card__stat-value {
    font-size:   1rem;
    font-weight: 700;
    color:       var(--color-text-heading);
    margin:      0;
}

.asset-card__timer {
    padding-top:  var(--space-sm);
    border-top:   1px solid var(--color-border);
    margin-top:   var(--space-sm);
}

/* -------------------------------------------------------------
   14. Modals — bottom sheet on mobile, centered on desktop
   ------------------------------------------------------------- */

/* Respect iOS safe area — push all modals below the status bar */
.modal {
    padding-top: env(safe-area-inset-top, 0px);
}

.app-modal .modal-content {
    border:        none;
    border-radius: var(--radius-lg);
    box-shadow:    var(--shadow-lg);
}

.app-modal .modal-header {
    border-bottom:  1px solid var(--color-border);
    padding:        var(--space-md) var(--space-lg);
}

.app-modal .modal-body {
    padding: var(--space-lg);
}

/* Bottom sheet on mobile */
@media (max-width: 575px) {
    .app-modal .modal-dialog {
        margin:     0;
        max-width:  100%;
        align-items: flex-end;
        min-height: 100%;
        display:    flex;
    }

    .app-modal .modal-content {
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        width: 100%;
        /* Respect home indicator on iOS */
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    /* Animate from bottom */
    .app-modal.fade .modal-dialog {
        transform:  translateY(100%);
        transition: transform var(--transition-base);
    }

    .app-modal.show .modal-dialog {
        transform: translateY(0);
    }
}

/* Modal balance display */
.app-modal__balance-display {
    background:    var(--color-surface-alt);
    border:        1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding:       var(--space-md);
}

.app-modal__balance-label {
    font-size:     var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: .5px;
    color:         var(--color-text-muted);
    font-weight:   600;
    margin-bottom: var(--space-xs);
}

.app-modal__balance-amount {
    font-size:     clamp(1.1rem, 5vw, 1.5rem);
    font-weight:   700;
    color:         var(--color-text-heading);
    margin:        0;
    line-height:   1;
    white-space:   nowrap;
    overflow:      hidden;
    text-overflow: ellipsis;
}

/* Internal transfer flow */
.app-modal__transfer-flow {
    display:        flex;
    align-items:    center;
    gap:            var(--space-sm);
    background:     var(--color-surface-alt);
    border:         1px solid var(--color-border);
    border-radius:  var(--radius-md);
    padding:        var(--space-md);
}

.app-modal__transfer-node {
    flex: 1;
    min-width: 0;
}

.app-modal__transfer-arrow {
    flex-shrink: 0;
    font-size:   18px;
}

/* Bank card in deposit modal */
.app-modal__bank-card {
    background:    var(--color-surface-alt);
    border:        1px solid var(--color-border);
    border-left:   3px solid var(--color-primary);
    border-radius: var(--radius-md);
    padding:       var(--space-md);
}

/* =============================================================
   15. Transactions page
   ============================================================= */

/* Filter chips strip */
.tx-filter-strip {
    display:    flex;
    gap:        var(--space-xs);
    flex-wrap:  wrap;
}
.tx-filter-chip {
    display:       inline-flex;
    align-items:   center;
    padding:       5px 14px;
    font-size:     13px;
    font-weight:   500;
    border-radius: var(--radius-full);
    border:        1px solid var(--color-border);
    color:         var(--color-text-secondary);
    text-decoration: none;
    transition:    var(--transition-fast);
    white-space:   nowrap;
}
.tx-filter-chip:hover {
    border-color: var(--color-primary);
    color:        var(--color-primary);
}
.tx-filter-chip.active {
    background:   var(--color-primary);
    border-color: var(--color-primary);
    color:        #fff;
}

/* Transaction list */
.tx-list {
    display:       flex;
    flex-direction: column;
    gap:           0;
    border:        1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow:      hidden;
}
.tx-row {
    display:         flex;
    align-items:     center;
    gap:             var(--space-md);
    padding:         var(--space-md);
    background:      var(--color-surface);
    border-bottom:   1px solid var(--color-border);
    transition:      background var(--transition-fast);
}
.tx-row:last-child {
    border-bottom: none;
}
.tx-row:hover {
    background: var(--color-surface-alt);
}

/* Icon bubble */
.tx-icon {
    width:            40px;
    height:           40px;
    border-radius:    var(--radius-md);
    display:          flex;
    align-items:      center;
    justify-content:  center;
    font-size:        16px;
    flex-shrink:      0;
}
.tx-icon--success  { background: rgba(var(--color-success-rgb, 25,135,84), .12); color: var(--color-success); }
.tx-icon--primary  { background: rgba(var(--color-primary-rgb, 26,115,232), .12); color: var(--color-primary); }
.tx-icon--warning  { background: rgba(var(--color-warning-rgb, 255,193,7), .15);  color: #c87f00; }
.tx-icon--danger   { background: rgba(var(--color-danger-rgb,  220,53,69), .12);  color: var(--color-danger); }
.tx-icon--info     { background: rgba(var(--color-info-rgb,    13,202,240), .12); color: #0987a0; }
.tx-icon--secondary{ background: var(--color-surface-alt);                        color: var(--color-text-muted); }

.tx-body     { flex: 1; min-width: 0; }
.tx-label    { font-size: 14px; font-weight: 600; color: var(--color-text-primary); }
.tx-desc     { font-size: 12px; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-date     { font-size: 11px; color: var(--color-text-muted); margin-top: 1px; }
.tx-amount   { font-size: 15px; font-weight: 700; flex-shrink: 0; white-space: nowrap; }

/* =============================================================
   16. Network page
   ============================================================= */

.network-levels {
    display:               grid;
    grid-template-columns: 1fr;
    gap:                   var(--space-sm);
}
@media (min-width: 576px) {
    .network-levels { grid-template-columns: repeat(2, 1fr); }
}

.network-level-card {
    border:        1px solid var(--color-border);
    border-left:   4px solid var(--level-color, var(--color-primary));
    border-radius: var(--radius-md);
    padding:       var(--space-md);
    background:    var(--color-surface);
    display:       flex;
    align-items:   flex-start;
    gap:           var(--space-md);
}
.network-level-number {
    width:          38px;
    height:         38px;
    border-radius:  var(--radius-md);
    background:     color-mix(in srgb, var(--level-color, var(--color-primary)) 15%, transparent);
    color:          var(--level-color, var(--color-primary));
    display:        flex;
    align-items:    center;
    justify-content: center;
    font-weight:    800;
    font-size:      13px;
    flex-shrink:    0;
}
.network-level-body { flex: 1; min-width: 0; }

/* =============================================================
   17. Network page — additions
   ============================================================= */

/* Stats row cards */
.network-stat-card {
    padding: var(--space-md);
}
.network-stat-label {
    font-size:     12px;
    color:         var(--color-text-muted);
    margin-bottom: 4px;
}
.network-stat-value {
    font-size:   24px;
    font-weight: 800;
    margin:      0;
    line-height: 1.1;
}

/* Next goal card */
.network-goal-card {
    border-left: 4px solid var(--color-warning);
}
.network-goal-progress {
    height:        8px;
    border-radius: var(--radius-full);
    background:    var(--color-surface-alt);
}
.network-goal-progress .progress-bar {
    border-radius: var(--radius-full);
    transition:    width 0.6s ease;
}

/* =============================================================
   18. Profile page
   ============================================================= */

.profile-info-row {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    gap:             var(--space-md);
    padding:         10px 0;
    border-bottom:   1px solid var(--color-border);
}
.profile-info-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.profile-info-label {
    font-size:   13px;
    color:       var(--color-text-muted);
    flex-shrink: 0;
}
.profile-info-value {
    font-size:    14px;
    font-weight:  500;
    color:        var(--color-text-primary);
    text-align:   right;
}

/* =============================================================
   18. Payment (deposit) page
   ============================================================= */

.payment-bank-card {
    background:    var(--color-surface-alt);
    border:        1px solid var(--color-border);
    border-left:   3px solid var(--color-primary);
    border-radius: var(--radius-md);
    padding:       var(--space-md);
}

/* =============================================================
   19. Invest page
   ============================================================= */

/* Grid: single column mobile → 2-col lg */
.invest-grid {
    display:               grid;
    grid-template-columns: 1fr;
    gap:                   var(--space-lg);
}
@media (min-width: 992px) {
    .invest-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Asset card */
.invest-asset-card {
    border-left: 4px solid var(--plan-color, var(--color-primary));
    overflow:    hidden;
}
.invest-asset-card .card-header {
    background: var(--color-surface-alt);
}

/* Logo */
.invest-asset-logo {
    width:         48px;
    height:        48px;
    border-radius: var(--radius-md);
    object-fit:    contain;
    background:    var(--color-surface);
    border:        1px solid var(--color-border);
    flex-shrink:   0;
}
.invest-asset-logo-placeholder {
    width:            48px;
    height:           48px;
    border-radius:    var(--radius-md);
    background:       color-mix(in srgb, var(--plan-color, var(--color-primary)) 15%, white);
    border:           1px solid color-mix(in srgb, var(--plan-color, var(--color-primary)) 30%, transparent);
    display:          flex;
    align-items:      center;
    justify-content:  center;
    flex-shrink:      0;
    font-weight:      700;
    font-size:        14px;
    color:            var(--plan-color, var(--color-primary));
}

.invest-asset-name {
    font-size:   15px;
    font-weight: 700;
    color:       var(--color-text-primary);
    white-space: nowrap;
    overflow:    hidden;
    text-overflow: ellipsis;
}
.invest-asset-symbol {
    font-size:   11px;
    font-weight: 600;
    color:       var(--color-text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Plan row */
.invest-plan-row {
    padding: var(--space-md);
}
.invest-plan-row.border-top {
    border-top-color: var(--color-border) !important;
}

/* Plan header: badge + ROI */
.invest-plan-header {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    gap:             var(--space-sm);
    margin-bottom:   var(--space-xs);
}
.invest-plan-badge {
    display:       inline-flex;
    align-items:   center;
    font-size:     12px;
    font-weight:   600;
    padding:       3px 10px;
    border-radius: var(--radius-full);
    background:    color-mix(in srgb, var(--plan-color, var(--color-primary)) 12%, transparent);
    color:         var(--plan-color, var(--color-primary));
    border:        1px solid color-mix(in srgb, var(--plan-color, var(--color-primary)) 25%, transparent);
}
.invest-plan-roi {
    font-size:   14px;
    font-weight: 700;
}

/* Range label */
.invest-plan-range {
    font-size:     12px;
    margin-bottom: var(--space-sm);
}

/* Tier table */
.invest-tier-table-wrap {
    margin-bottom: var(--space-sm);
    border:        1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow:      hidden;
}
.invest-tier-table {
    width:         100%;
    font-size:     12px;
    border-collapse: collapse;
}
.invest-tier-table th {
    background:  var(--color-surface-alt);
    padding:     4px 10px;
    text-align:  left;
    font-weight: 600;
    color:       var(--color-text-muted);
}
.invest-tier-table td {
    padding:     4px 10px;
    border-top:  1px solid var(--color-border);
}

/* Form row: input + button side by side */
.invest-form-row {
    display: flex;
    gap:     8px;
}
.invest-form-row .input-group {
    flex: 1;
}
.invest-submit-btn {
    flex-shrink:   0;
    white-space:   nowrap;
    padding-left:  20px;
    padding-right: 20px;
}
/* Qty selector (precio fijo) */
.invest-qty-selector {
    display:       flex;
    align-items:   stretch;
    flex:          1;
    border:        1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow:      hidden;
}
.invest-qty-btn {
    display:         flex;
    align-items:     center;
    justify-content: center;
    width:           44px;
    flex-shrink:     0;
    background:      var(--color-surface-2, var(--color-surface));
    border:          none;
    color:           var(--color-text-primary);
    cursor:          pointer;
    font-size:       13px;
    transition:      background 0.15s;
}
.invest-qty-btn:hover:not(:disabled) {
    background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
    color:      var(--color-primary);
}
.invest-qty-btn:disabled {
    opacity: 0.35;
    cursor:  not-allowed;
}
.invest-qty-input {
    flex:          1;
    border:        none;
    border-left:   1px solid var(--color-border);
    border-right:  1px solid var(--color-border);
    text-align:    center;
    font-size:     max(16px, 15px); /* ≥16px prevents iOS Safari zoom on focus */
    font-weight:   600;
    background:    var(--color-surface);
    color:         var(--color-text-primary);
    padding:       0;
    min-width:     0;
}

/* Locked plan banner */
.invest-locked-banner {
    display:       flex;
    align-items:   center;
    gap:           var(--space-xs, 6px);
    padding:       10px 14px;
    border-radius: var(--radius-md);
    background:    color-mix(in srgb, var(--color-warning, #f59e0b) 12%, var(--color-surface));
    color:         var(--color-warning, #92400e);
    font-size:     13px;
    margin-bottom: var(--space-sm, 8px);
}
.invest-locked-banner i {
    font-size: 14px;
    flex-shrink: 0;
}

/* Fallback notice — shown in the card header when the asset replaces a locked one */
.invest-fallback-notice {
    display:       flex;
    align-items:   center;
    gap:           var(--space-xs, 6px);
    padding:       6px 12px;
    margin-bottom: 10px;
    border-radius: var(--radius-sm, 6px);
    background:    color-mix(in srgb, var(--color-primary, #6366f1) 10%, var(--color-surface));
    color:         var(--color-primary, #6366f1);
    font-size:     12px;
    line-height:   1.4;
}
.invest-fallback-notice i {
    font-size:  13px;
    flex-shrink: 0;
}
.invest-fallback-timer {
    font-size:   11px;
    font-weight: 600;
    opacity:     0.85;
    white-space: nowrap;
    flex-shrink: 0;
}
.invest-asset-fallback {
    border-color: color-mix(in srgb, var(--color-primary, #6366f1) 30%, transparent);
}

/* Promotions strip */
.invest-promo-strip {
    display:    flex;
    flex-wrap:  wrap;
    gap:        var(--space-sm);
}
.invest-promo-chip {
    display:       inline-flex;
    align-items:   center;
    font-size:     12px;
    padding:       4px 12px;
    background:    color-mix(in srgb, var(--color-warning) 12%, transparent);
    border:        1px solid color-mix(in srgb, var(--color-warning) 30%, transparent);
    border-radius: var(--radius-full);
    color:         var(--color-text-primary);
}

/* ── "¿Cómo funciona?" button ──────────────────────────────────────── */
.invest-how-btn {
    display:         inline-flex;
    align-items:     center;
    background:      var(--color-surface);
    border:          1px solid var(--color-border);
    border-radius:   var(--radius-full);
    padding:         4px 10px;
    font-size:       12px;
    font-weight:     600;
    color:           var(--color-text-muted);
    cursor:          pointer;
    letter-spacing:  0.2px;
    transition:      color var(--transition-fast, 0.15s), border-color var(--transition-fast, 0.15s);
    text-decoration: none;
    white-space:     nowrap;
    min-height:      28px;
}
.invest-how-btn:hover,
.invest-how-btn:focus-visible {
    color:        var(--color-primary);
    border-color: var(--color-primary);
    outline:      none;
}

/* ── How It Works modal content ────────────────────────────────────── */
.invest-hiw-section {
    display:     flex;
    align-items: flex-start;
    gap:         var(--space-md);
    padding:     var(--space-xs) 0;
}
.invest-hiw-icon {
    width:           34px;
    height:          34px;
    border-radius:   var(--radius-md);
    background:      color-mix(in srgb, var(--plan-color, var(--color-primary)) 12%, transparent);
    color:           var(--plan-color, var(--color-primary));
    display:         flex;
    align-items:     center;
    justify-content: center;
    flex-shrink:     0;
    font-size:       13px;
}
.invest-hiw-divider {
    border:        none;
    border-top:    1px solid var(--color-border);
    margin:        var(--space-sm) 0;
}

/* Tier table inside modal */
.invest-hiw-tier-table {
    border:        1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow:      hidden;
}
.invest-hiw-tier-table table {
    width:           100%;
    border-collapse: collapse;
    font-size:       var(--font-size-sm);
}
.invest-hiw-tier-table th {
    padding:        6px var(--space-sm);
    background:     var(--color-surface-alt);
    font-size:      10px;
    font-weight:    700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color:          var(--color-text-muted);
    text-align:     left;
}
.invest-hiw-tier-table td {
    padding:     8px var(--space-sm);
    border-top:  1px solid var(--color-border);
    vertical-align: middle;
}
.invest-hiw-tier-highlight td {
    background: color-mix(in srgb, var(--plan-color, var(--color-primary)) 7%, transparent);
    font-weight: 600;
}
.invest-hiw-tier-badge {
    display:       inline-block;
    font-size:     9px;
    font-weight:   700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding:       1px 5px;
    border-radius: var(--radius-full);
    background:    color-mix(in srgb, var(--plan-color, var(--color-primary)) 18%, transparent);
    color:         var(--plan-color, var(--color-primary));
    vertical-align: middle;
    margin-left:   4px;
}

/* Example box */
.invest-hiw-example {
    background:    var(--color-surface-alt);
    border:        1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding:       var(--space-md);
    margin-top:    var(--space-md);
}
.invest-hiw-example-title {
    font-size:      11px;
    font-weight:    700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color:          var(--color-text-muted);
    margin-bottom:  var(--space-xs);
}
.invest-hiw-example-row {
    display:         flex;
    justify-content: space-between;
    align-items:     baseline;
    gap:             var(--space-sm);
    padding:         4px 0;
    font-size:       var(--font-size-sm);
    border-top:      1px solid var(--color-border);
}
.invest-hiw-example-row:first-of-type {
    border-top: none;
}

/* ── Global Chat ─────────────────────────────────────────────── */
.chat-fab {
    position:        fixed;
    bottom:          calc(var(--bottom-nav-height, 60px) + var(--safe-bottom, 0px) + 16px);
    left:            16px;
    z-index:         1040;
    width:           52px;
    height:          52px;
    border-radius:   50%;
    background:      var(--color-primary);
    color:           #fff;
    border:          none;
    font-size:       20px;
    display:         flex;
    align-items:     center;
    justify-content: center;
    box-shadow:      0 4px 16px rgba(0,0,0,.25);
    transition:      transform .2s, box-shadow .2s;
}
.chat-fab:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(0,0,0,.3); }
@media (min-width: 992px) { .chat-fab { bottom: 24px; left: auto; right: 16px; } }
.chat-fab__badge {
    position:        absolute;
    min-width:       18px;
    height:          18px;
    border-radius:   9px;
    background:      #e74c3c;
    color:           #fff;
    font-size:       10px;
    font-weight:     700;
    line-height:     18px;
    text-align:      center;
    padding:         0 4px;
    pointer-events:  none;
    top:             4px;
    right:           4px;
}
.chat-fab__badge--dm     { top: 4px; right: 4px; left: auto; background: #e74c3c; }
.chat-fab__badge--global { top: 4px; left: 4px; right: auto; background: #27ae60; }

.chat-modal__dialog  { max-width: 420px; height: 560px; }
.chat-modal__content { display: flex; flex-direction: column; height: 100%; }
.chat-modal__header  {
    background:    var(--color-surface-alt);
    border-bottom: 1px solid var(--color-border);
    padding:       12px 16px;
    display:       flex;
    align-items:   center;
    justify-content: space-between;
    gap:           8px;
}
.chat-modal__avatar-sm {
    width:           34px;
    height:          34px;
    border-radius:   50%;
    background:      var(--color-primary-light);
    color:           var(--color-primary);
    display:         flex;
    align-items:     center;
    justify-content: center;
    font-size:       14px;
    flex-shrink:     0;
}
.chat-modal__status {
    font-size:   11px;
    color:       var(--color-text-muted);
    display:     block;
    line-height: 1.2;
}
.chat-modal__body {
    flex:       1;
    overflow-y: auto;
    padding:    12px 16px;
    display:    flex;
    flex-direction: column;
    gap:        8px;
    background: var(--color-surface);
}
.chat-modal__footer { border-top: 1px solid var(--color-border); background: var(--color-surface-alt); }

/* Fila input + botón enviar como UN SOLO control (pill unificado) */
.chat-modal__footer .input-group.align-items-end {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 4px 4px 4px 16px;
    transition: border-color .15s, box-shadow .15s;
}
.chat-modal__footer .input-group.align-items-end:focus-within {
    border-color: var(--color-primary);
}

.chat-input-ta {
    flex: 1;
    min-width: 0;
    resize: none;
    overflow-y: hidden;
    min-height: 32px;
    max-height: 120px;
    line-height: 1.4;
    transition: height .1s ease;
    padding: 6px 2px;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}
.chat-input-ta:focus {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

#btnSendChat {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
}
#btnSendChat:hover:not(:disabled) { background: var(--color-primary-hover); }

.chat-modal__loading { width: 100%; }

/* Messages */
.chat-msg         { display: flex; }
.chat-msg--own    { justify-content: flex-end; }
.chat-msg__bubble {
    max-width:     75%;
    padding:       8px 12px;
    border-radius: 16px 16px 16px 4px;
    background:    var(--color-surface-alt);
    border:        1px solid var(--color-border);
    word-break:    break-word;
}
.chat-msg--own .chat-msg__bubble {
    border-radius: 16px 16px 4px 16px;
    background:    var(--color-primary);
    border-color:  var(--color-primary);
    color:         #fff;
}
.chat-msg__name {
    display:     block;
    font-size:   10px;
    font-weight: 700;
    color:       var(--color-primary);
    margin-bottom: 2px;
    text-transform: capitalize;
}
.chat-msg__text  { margin: 0; font-size: 13px; line-height: 1.45; }
.chat-msg__time  {
    display:    block;
    font-size:  10px;
    opacity:    .65;
    text-align: right;
    margin-top: 3px;
}

/* ── Chat: tabs, DM panels ───────────────────────────────── */
.chat-modal__tabs {
    display:        flex;
    border-bottom:  1px solid var(--color-border);
    background:     var(--color-surface-alt);
    flex-shrink:    0;
}
.chat-modal__tab {
    flex:            1;
    padding:         10px 8px;
    font-size:       13px;
    font-weight:     600;
    border:          none;
    background:      transparent;
    color:           var(--color-text-muted);
    border-bottom:   2px solid transparent;
    cursor:          pointer;
    position:        relative;
    transition:      color .15s, border-color .15s;
}
.chat-modal__tab.is-active {
    color:         var(--color-primary);
    border-bottom-color: var(--color-primary);
}
.chat-tab__badge {
    position:   absolute;
    top:        6px;
    right:      14px;
    min-width:  16px;
    height:     16px;
    border-radius: 8px;
    background: #e74c3c;
    color:      #fff;
    font-size:  10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    padding:    0 3px;
}
.chat-panel         { display: none; flex-direction: column; height: 100%; overflow: hidden; }
.chat-panel.is-active { display: flex; }
.chat-feed          { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }

/* Date separator (WhatsApp-style pill between groups of messages) */
.chat-date-sep {
    display:         flex;
    align-items:     center;
    justify-content: center;
    text-align:      center; /* fallback para navegadores sin flex */
    width:           100%;
    padding:         4px 0;
    pointer-events:  none;
    flex-shrink:     0;
}
.chat-date-sep span {
    display:        inline-block; /* garantiza border-radius en todos los motores */
    background:     rgba(0, 0, 0, .10);
    color:          var(--color-text-muted, #6c757d);
    font-size:      .68rem;
    font-weight:    600;
    padding:        3px 12px;
    border-radius:  20px;
    border:         1px solid rgba(0, 0, 0, .12);
    white-space:    nowrap;
    letter-spacing: .02em;
}

/* DM toolbar */
.chat-dm-toolbar {
    display:     flex;
    align-items: center;
    justify-content: space-between;
    padding:     8px 12px;
    border-bottom: 1px solid var(--color-border);
    background:  var(--color-surface-alt);
    flex-shrink: 0;
    gap:         8px;
    min-height:  44px;
}

/* Conversation list */
.chat-conv-list { flex: 1; overflow-y: auto; }
.chat-conv-item {
    display:     flex;
    align-items: center;
    gap:         12px;
    padding:     12px 16px;
    cursor:      pointer;
    border-bottom: 1px solid var(--color-border);
    transition:  background .15s;
}
.chat-conv-item:hover { background: var(--color-surface-alt); }
.chat-conv-item__avatar {
    width:           38px;
    height:          38px;
    border-radius:   50%;
    background:      var(--color-primary-light);
    color:           var(--color-primary);
    font-size:       15px;
    font-weight:     700;
    display:         flex;
    align-items:     center;
    justify-content: center;
    flex-shrink:     0;
}
.chat-conv-item__body  { flex: 1; min-width: 0; }
.chat-conv-item__name  { font-size: 13px; font-weight: 600; display: block; }
.chat-conv-item__preview { font-size: 12px; color: var(--color-text-muted); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-conv-item__time  { font-size: 11px; color: var(--color-text-muted); flex-shrink: 0; }
.chat-conv-item__unread {
    min-width:  20px;
    height:     20px;
    border-radius: 10px;
    background: var(--color-primary);
    color:      #fff;
    font-size:  11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    padding:    0 4px;
    flex-shrink: 0;
}

/* ── Chat DM notice ─────────────────────────────────────── */
.chat-dm-notice {
    padding:     8px 14px;
    font-size:   11px;
    color:       var(--color-text-muted);
    background:  color-mix(in srgb, var(--color-primary) 6%, transparent);
    border-bottom: 1px solid var(--color-border);
    display:     flex;
    align-items: center;
    gap:         6px;
    flex-shrink: 0;
}

/* --- Utilidades compartidas (reemplazan estilos inline) --- */
html {
    color-scheme: light dark;
    overscroll-behavior: none;
}
.chat-modal__char-count { font-size: .7rem; }

/* ── FAQ FAB ──────────────────────────────────────────────── */
.faq-fab {
    position:        fixed;
    bottom:          calc(var(--bottom-nav-height, 60px) + var(--safe-bottom, 0px) + 80px);
    left:            16px;
    z-index:         1039;
    width:           52px;
    height:          52px;
    border-radius:   50%;
    border:          none;
    font-size:       20px;
    display:         flex;
    align-items:     center;
    justify-content: center;
    box-shadow:      0 4px 16px rgba(0,0,0,.25);
    transition:      transform .2s, box-shadow .2s;
    cursor:          pointer;
}
.faq-fab--primary { background: var(--color-primary); color: #fff; }
.faq-fab--light   { background: var(--color-surface-alt); color: var(--color-text); border: 1px solid var(--color-border) !important; }
.faq-fab--outline { background: transparent; color: var(--color-primary); border: 2px solid var(--color-primary) !important; }
.faq-fab:hover    { transform: scale(1.08); box-shadow: 0 6px 20px rgba(0,0,0,.3); }
@media (min-width: 992px) { .faq-fab { bottom: 88px; left: auto; right: 16px; } }

/* ── FAQ Modal ────────────────────────────────────────────── */
.faq-modal__dialog    { max-width: 520px; }
.faq-modal__icon-wrap {
    width:           30px;
    height:          30px;
    border-radius:   50%;
    background:      rgba(var(--bs-primary-rgb), .12);
    color:           var(--color-primary);
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
    font-size:       14px;
    flex-shrink:     0;
}
.faq-modal__intro {
    padding:   12px 20px 0;
    margin:    0;
    color:     var(--color-text-muted, #6c757d);
    font-size: .875rem;
}
.faq-modal__category-label {
    padding:        10px 20px 4px;
    font-size:      .68rem;
    font-weight:    700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color:          var(--color-text-muted, #6c757d);
    background:     var(--color-surface-alt, #f8f9fa);
    border-bottom:  1px solid var(--color-border, #dee2e6);
}
.faq-modal__item     { border: none; border-bottom: 1px solid var(--color-border, #dee2e6); background: transparent; }
.faq-modal__question {
    font-size:   .875rem;
    font-weight: 500;
    padding:     14px 20px;
    color:       var(--color-text);
    background:  transparent !important;
    box-shadow:  none !important;
}
.faq-modal__question:not(.collapsed) { color: var(--color-primary); }
.faq-modal__answer {
    font-size:   .875rem;
    line-height: 1.65;
    color:       var(--color-text-muted, #6c757d);
    padding:     2px 20px 16px;
}
.faq-modal__answer p:last-child,
.faq-modal__answer li:last-child { margin-bottom: 0; }
.faq-modal__answer ul,
.faq-modal__answer ol { padding-left: 1.2rem; }
.chat-msg__name-link { color: inherit; text-decoration: none; }
.chat-msg__name-link:hover { text-decoration: underline; }

/* ── DM contact search ─────────────────────────────────── */
.chat-dm-search {
    position:   relative;
    padding:    8px 12px;
    border-bottom: 1px solid var(--color-border);
}
.chat-dm-search__icon {
    position:  absolute;
    left:      22px;
    top:       50%;
    transform: translateY(-50%);
    color:     var(--color-text-muted, #6c757d);
    font-size: .8rem;
    pointer-events: none;
}
.chat-dm-search__input {
    width:            100%;
    padding:          6px 10px 6px 28px;
    font-size:        max(16px, .8rem); /* ≥16px prevents iOS Safari zoom */
    border:           1px solid var(--color-border);
    border-radius:    var(--radius-md, 8px);
    background:       var(--color-surface-alt);
    color:            var(--color-text);
    outline:          none;
    transition:       border-color .15s;
}
.chat-dm-search__input:focus { border-color: var(--color-primary); }
.chat-dm-search__input::placeholder { color: var(--color-text-muted, #6c757d); }

/* ── Admin contact highlight ────────────────────────────── */
.chat-conv-item--admin { background: rgba(var(--bs-primary-rgb), .04); }
.chat-conv-item__avatar--admin {
    background: var(--color-primary);
    color:      #fff;
}
.chat-conv-item__name--admin { color: var(--color-primary); font-weight: 700; }
.chat-contact__admin-badge {
    display:          inline-block;
    margin-left:      6px;
    padding:          1px 6px;
    font-size:        9px;
    font-weight:      700;
    text-transform:   uppercase;
    letter-spacing:   .04em;
    border-radius:    4px;
    background:       var(--color-primary);
    color:            #fff;
    vertical-align:   middle;
    line-height:      1.6;
}

/* ── Admin global chat bubble ───────────────────────────── */
.chat-msg__bubble--admin {
    background:   rgba(var(--bs-primary-rgb), .08);
    border-color: rgba(var(--bs-primary-rgb), .25);
}
.chat-msg__name--admin { color: var(--color-primary); }
.chat-msg__admin-badge {
    display:        inline-block;
    margin-left:    5px;
    padding:        1px 5px;
    font-size:      9px;
    font-weight:    700;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-radius:  4px;
    background:     var(--color-primary);
    color:          #fff;
    vertical-align: middle;
    line-height:    1.6;
}
.chat-msg__ai-badge {
    display:        inline-block;
    margin-left:    5px;
    padding:        1px 5px;
    font-size:      9px;
    font-weight:    700;
    border-radius:  4px;
    background:     rgba(120,80,200,.13);
    color:          #7850c8;
    vertical-align: middle;
    line-height:    1.6;
}
@media (prefers-color-scheme: dark) {
    .chat-msg__ai-badge { background: rgba(160,120,255,.2); color: #c4a8ff; }
}

/* ── Dark mode: correcciones de utilidades Bootstrap que no adaptan solos ── */
@media (prefers-color-scheme: dark) {
    /* bg-light y bg-white quedan en blanco en dark mode — mapear a superficies oscuras */
    .bg-light  { background-color: var(--color-surface-alt, #1E2433) !important; }
    .bg-white  { background-color: var(--color-surface,     #161B27) !important; }

    /* Texto sobre esos fondos */
    .bg-light .text-muted,
    .bg-white .text-muted { color: var(--color-text-muted, #8D9AB0) !important; }

    /* Tablas */
    .table          { --bs-table-bg: var(--color-surface); color: var(--bs-body-color); }
    .table-striped  { --bs-table-striped-bg: var(--color-surface-alt); }
    .table-hover    { --bs-table-hover-bg:   rgba(255,255,255,.04); }
    .table thead th { border-bottom-color: rgba(255,255,255,.12); }

    /* Badges de estado que usan bg-light internamente */
    .badge.bg-light { background-color: rgba(255,255,255,.1) !important; color: #e2e8f0 !important; }
}
