/* ==========================================================================
   Optimal Markets — Design System
   Spec: "design guide/DESIGN-GUIDE.md"
   Loaded by company/templates/base2.html and Users/templates/dashboard-base.html
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */

:root {
    /* Brand */
    --brand-50: #EFF6FF;
    --brand-100: #DBEAFE;
    --brand-600: #2563EB;
    --brand-700: #1D4ED8;
    --brand-800: #1E40AF;

    /* Dark navy surfaces */
    --navy-900: #0B1120;
    --navy-800: #111827;
    --navy-700: #1F2937;
    --navy-fg: #E5E7EB;
    --navy-fg-muted: #94A3B8;

    /* Neutrals */
    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --surface-2: #F1F5F9;
    --border: #E2E8F0;
    --border-strong: #CBD5E1;
    --text: #0F172A;
    --text-2: #475569;
    --text-3: #64748B;
    --text-4: #94A3B8;

    /* Semantic */
    --gain: #16A34A;
    --gain-bg: #DCFCE7;
    --gain-fill: rgba(22, 163, 74, .12);
    --loss: #DC2626;
    --loss-bg: #FEE2E2;
    --loss-fill: rgba(220, 38, 38, .12);
    --warn: #D97706;
    --warn-bg: #FEF3C7;
    --info-bg: #EFF6FF;

    /* Asset-class chart palette */
    --asset-stocks: #2563EB;
    --asset-crypto: #F59E0B;
    --asset-etfs: #10B981;
    --asset-forex: #8B5CF6;
    --asset-commodities: #EAB308;
    --asset-cash: #94A3B8;

    /* Shape */
    --r-sm: 6px;
    --r-md: 8px;
    --r-lg: 12px;
    --r-xl: 16px;
    --r-full: 999px;

    /* Elevation */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, .08);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, .12);

    /* Layout */
    --sidebar-w: 240px;
    --topbar-h: 64px;
    --content-max: 1440px;

    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --focus-ring: 0 0 0 3px rgba(37, 99, 235, .25);
}

[data-theme="dark"] {
    --bg: #0B1120;
    --surface: #111827;
    --surface-2: #1F2937;
    --border: #1F2937;
    --border-strong: #334155;
    --text: #F1F5F9;
    --text-2: #CBD5E1;
    --text-3: #94A3B8;
    --text-4: #64748B;

    --gain-bg: rgba(22, 163, 74, .15);
    --loss-bg: rgba(220, 38, 38, .15);
    --warn-bg: rgba(217, 119, 6, .15);
    --info-bg: rgba(37, 99, 235, .12);
    --brand-50: rgba(37, 99, 235, .12);
    --brand-100: rgba(37, 99, 235, .2);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, .45);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */

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

html {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-2);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    max-width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Bybit-style preloader — alternating letter opacity */
.om-preloader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0B1120;
    transition: opacity .4s ease, visibility .4s ease;
}

.om-preloader.is-done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.om-preloader__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 0 24px;
}

.om-preloader__brand {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 0;
    font-size: clamp(22px, 4vw, 32px);
    font-weight: 700;
    letter-spacing: .04em;
    line-height: 1.2;
    color: #F8FAFC;
    user-select: none;
}

.om-preloader__letter {
    display: inline-block;
    opacity: .22;
    animation: omLetterPulse 1.35s ease-in-out infinite;
}

.om-preloader__letter.is-space {
    width: .28em;
    animation: none;
    opacity: 0;
}

@keyframes omLetterPulse {
    0%, 100% { opacity: .18; }
    40%, 55% { opacity: 1; }
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text);
    font-weight: 600;
    letter-spacing: -.01em;
    margin: 0 0 .5rem;
}

a {
    color: var(--brand-600);
    text-decoration: none;
}

a:hover {
    color: var(--brand-700);
}

:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: var(--r-sm);
}

.num {
    font-variant-numeric: tabular-nums;
}

.gain {
    color: var(--gain);
}

.loss {
    color: var(--loss);
}

.warn {
    color: var(--warn);
}

.muted {
    color: var(--text-3);
}

.muted-2 {
    color: var(--text-4);
}

/* --------------------------------------------------------------------------
   3. Application shell
   -------------------------------------------------------------------------- */

.ds-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--navy-900);
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
    overflow-y: auto;
    z-index: 1040;
}

.ds-sidebar__brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    height: auto;
    margin: 4px 8px 20px;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -.02em;
    text-decoration: none;
}

.ds-sidebar__brand-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ds-sidebar__tagline {
    margin: 0 0 0 28px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .02em;
    color: var(--navy-fg-muted);
    opacity: .85;
}

.ds-sidebar__brand:hover {
    color: #fff;
}

.ds-sidebar__section {
    margin: 18px 8px 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--navy-fg-muted);
    opacity: .7;
}

.ds-sidebar__section:first-of-type {
    margin-top: 4px;
}

.ds-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--r-md);
    color: var(--navy-fg-muted);
    font-size: 13.5px;
    font-weight: 500;
    transition: background .15s, color .15s;
    position: relative;
}

.ds-nav-item i,
.ds-nav-item svg {
    width: 18px;
    font-size: 16px;
    text-align: center;
    flex: 0 0 18px;
}

.ds-nav-item:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
}

.ds-nav-item.active,
.ds-nav-item.is-active {
    background: var(--brand-600);
    color: #fff !important;
}

.ds-nav-item.active::before,
.ds-nav-item.is-active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 2px 2px 0;
    background: #fff;
    opacity: .9;
}

.ds-nav-item.active i,
.ds-nav-item.is-active i {
    color: #fff;
}

.ds-nav-item__check {
    margin-left: auto;
    color: #22c55e;
    font-size: 12px;
}

.ds-sidebar__nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ds-sidebar__footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.ds-nav-item.active i,
.ds-nav-item.is-active i {
    color: #fff;
}

.ds-nav-item__badge {
    margin-left: auto;
    background: var(--loss);
    color: #fff;
    border-radius: var(--r-full);
    font-size: 10.5px;
    font-weight: 600;
    padding: 1px 6px;
}

.ds-sidebar__promo {
    margin: auto 0 8px;
    padding: 16px;
    background: var(--navy-800);
    border-radius: var(--r-lg);
    color: var(--navy-fg);
}

.ds-sidebar__promo h6 {
    color: #fff;
    font-size: 13.5px;
    margin-bottom: 4px;
}

.ds-sidebar__promo p {
    font-size: 12px;
    color: var(--navy-fg-muted);
    margin-bottom: 12px;
}

.ds-topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 1030;
}

.ds-topbar__nav {
    display: flex;
    align-items: center;
    gap: 24px;
    margin: 0;
    padding: 0;
    list-style: none;
    height: 100%;
}

.ds-topbar__link {
    display: flex;
    align-items: center;
    height: 100%;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-2);
    border-bottom: 2px solid transparent;
}

.ds-topbar__link:hover {
    color: var(--text);
}

.ds-topbar__link.active {
    color: var(--brand-600);
    border-bottom-color: var(--brand-600);
}

.ds-topbar__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.ds-topbar__title {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
}

.ds-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: var(--r-md);
    background: transparent;
    color: var(--text-3);
    position: relative;
    cursor: pointer;
}

.ds-icon-btn:hover {
    background: var(--surface-2);
    color: var(--text);
}

.ds-icon-btn__dot {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: var(--r-full);
    background: var(--loss);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    line-height: 16px;
    text-align: center;
}

.ds-notify {
    position: relative;
}

.notifications-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(360px, 86vw);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1060;
    overflow: hidden;
}

.notifications-dropdown.show {
    display: block;
}

.notifications-dropdown-header,
.notifications-dropdown-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}

.notifications-dropdown-footer {
    border-bottom: 0;
    border-top: 1px solid var(--border);
}

.notifications-dropdown-header h4 {
    margin: 0;
    font-size: 14px;
}

.mark-all-read-btn {
    border: 0;
    background: transparent;
    color: var(--brand-600);
    cursor: pointer;
}

.notifications-dropdown-list {
    max-height: 320px;
    overflow-y: auto;
}

.notification-item-dropdown {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.notification-item-dropdown:hover {
    background: var(--surface-2);
}

.notification-item-dropdown.unread {
    background: var(--brand-50);
}

.notification-icon-dropdown {
    width: 32px;
    height: 32px;
    border-radius: var(--r-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    color: var(--brand-600);
    flex: 0 0 32px;
}

.notification-title-dropdown {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.notification-message-dropdown {
    font-size: 12.5px;
    color: var(--text-3);
    margin-top: 2px;
}

.notification-time-dropdown {
    font-size: 11.5px;
    color: var(--text-4);
    margin-top: 4px;
}

.notifications-loading,
.notifications-empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--text-3);
    font-size: 13px;
}

.mobile-bottom-nav {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1035;
    height: 64px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 0 8px;
}

.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 10.5px;
    font-weight: 500;
    color: var(--text-3);
    text-decoration: none;
}

.mobile-nav-item i {
    font-size: 16px;
}

.mobile-nav-item.active,
.mobile-nav-item:hover {
    color: var(--brand-600);
}

@media (max-width: 991.98px) {
    .mobile-bottom-nav {
        display: flex;
    }
}

.ds-main {
    margin-left: var(--sidebar-w);
    width: calc(100% - var(--sidebar-w));
    min-height: 100vh;
    background: var(--bg);
    max-width: 100%;
    overflow-x: clip;
}

.ds-content {
    max-width: min(var(--content-max), 100%);
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    overflow-x: hidden;
    min-width: 0;
}

.ds-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
    max-width: 100%;
}

.ds-toolbar .ds-search {
    flex: 1 1 220px;
    min-width: 0;
}

.ds-page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
}

.ds-page-head h1 {
    font-size: 26px;
    font-weight: 700;
    margin: 0;
}

.ds-page-head p {
    margin: 2px 0 0;
    font-size: 14px;
    color: var(--text-3);
}

.ds-page-head__actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.ds-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 24px;
    padding-top: 16px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-4);
}

@media (max-width: 991.98px) {
    .ds-sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
    }

    .ds-sidebar.is-open {
        transform: none;
        box-shadow: var(--shadow-lg);
    }

    .ds-main {
        margin-left: 0;
        width: 100%;
        max-width: 100vw;
    }

    .ds-topbar__nav {
        display: none;
    }

    .ds-topbar {
        padding: 0 12px;
        gap: 8px;
    }

    #toast-container {
        top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)) !important;
        left: 0;
        right: 0 !important;
        padding: 8px 12px !important;
    }

    #toast-container .custom-toast {
        min-width: 0 !important;
        max-width: none !important;
        width: 100%;
        margin-right: 0 !important;
    }

    .ds-content {
        padding: 12px 14px;
        padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
        min-height: calc(100vh - 56px);
        background: var(--bg);
    }

    .ds-card__head {
        padding: 12px 14px;
        gap: 8px;
    }

    .ds-card__head .ds-chips {
        width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px;
        scrollbar-width: none;
    }

    .ds-card__head .ds-chips::-webkit-scrollbar {
        display: none;
    }

    .ds-card__body {
        padding: 14px;
    }

    .ds-page-head {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 16px;
    }

    .ds-page-head__actions {
        margin-left: 0;
        width: 100%;
    }

    .ds-page-head h1 {
        font-size: 22px;
    }

    .ds-grid,
    .ds-grid--2,
    .ds-grid--main-rail,
    .ds-grid--kpi {
        grid-template-columns: 1fr;
    }

    .ds-table {
        min-width: 560px;
    }
}

/* --------------------------------------------------------------------------
   4. Cards
   -------------------------------------------------------------------------- */

.ds-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    min-width: 0;
    max-width: 100%;
}

.ds-card__head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.ds-card__head .ds-card__title {
    flex: 1 1 auto;
    min-width: 0;
}

.ds-card__head .ds-chips,
.ds-card__head .db-view-all,
.ds-card__head .ds-btn {
    flex-shrink: 0;
}

.ds-card__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.ds-card__body {
    padding: 20px;
}

.ds-card__foot {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.ds-grid {
    display: grid;
    gap: 16px;
}

.ds-grid--kpi {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.ds-grid--2 {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.ds-grid--main-rail {
    grid-template-columns: minmax(0, 1fr) 320px;
}

@media (max-width: 1199.98px) {
    .ds-grid--main-rail {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* --------------------------------------------------------------------------
   5. KPI card
   -------------------------------------------------------------------------- */

.ds-kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    padding: 16px 18px;
}

.ds-kpi__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--r-md);
    background: var(--brand-50);
    color: var(--brand-600);
    font-size: 15px;
    margin-bottom: 12px;
}

.ds-kpi__label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-3);
    margin: 0 0 4px;
}

.ds-kpi__value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.ds-kpi__delta {
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    margin-top: 4px;
}

/* --------------------------------------------------------------------------
   6. Buttons
   -------------------------------------------------------------------------- */

.ds-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: var(--r-md);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s;
}

.ds-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.ds-btn--primary {
    background: var(--brand-600);
    color: #fff;
}

.ds-btn--primary:hover:not(:disabled) {
    background: var(--brand-700);
    color: #fff;
}

.ds-btn--secondary {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text);
}

.ds-btn--secondary:hover:not(:disabled) {
    background: var(--surface-2);
    color: var(--text);
}

.ds-btn--ghost {
    background: transparent;
    color: var(--text-2);
}

.ds-btn--ghost:hover:not(:disabled) {
    background: var(--surface-2);
    color: var(--text);
}

.ds-btn--buy {
    background: var(--gain);
    color: #fff;
}

.ds-btn--buy:hover:not(:disabled) {
    background: #15803D;
    color: #fff;
}

.ds-btn--sell {
    background: var(--loss);
    color: #fff;
}

.ds-btn--sell:hover:not(:disabled) {
    background: #B91C1C;
    color: #fff;
}

.ds-btn--sm {
    height: 32px;
    padding: 0 12px;
    font-size: 12.5px;
}

.ds-btn--lg {
    height: 48px;
    padding: 0 24px;
    font-size: 15px;
}

.ds-btn--block {
    width: 100%;
}

/* --------------------------------------------------------------------------
   7. Pills / badges
   -------------------------------------------------------------------------- */

.ds-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--r-full);
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.ds-pill--gain,
.ds-pill--completed,
.ds-pill--executed,
.ds-pill--approved,
.ds-pill--active,
.ds-pill--low {
    background: var(--gain-bg);
    color: var(--gain);
}

.ds-pill--warn,
.ds-pill--pending,
.ds-pill--medium {
    background: var(--warn-bg);
    color: var(--warn);
}

.ds-pill--loss,
.ds-pill--failed,
.ds-pill--declined,
.ds-pill--high {
    background: var(--loss-bg);
    color: var(--loss);
}

.ds-pill--neutral {
    background: var(--surface-2);
    color: var(--text-3);
}

.ds-pill--brand {
    background: var(--brand-50);
    color: var(--brand-700);
}

.ds-verified {
    color: var(--brand-600);
    font-size: 13px;
}

/* --------------------------------------------------------------------------
   8. Tabs
   -------------------------------------------------------------------------- */

.ds-tabs {
    display: flex;
    gap: 24px;
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}

.ds-tabs::-webkit-scrollbar {
    display: none;
}

.ds-tab {
    padding: 0 0 12px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-3);
    border-bottom: 2px solid transparent;
    background: none;
    border-top: 0;
    border-left: 0;
    border-right: 0;
    cursor: pointer;
    white-space: nowrap;
}

.ds-tab:hover {
    color: var(--text);
}

.ds-tab.active {
    color: var(--brand-600);
    border-bottom-color: var(--brand-600);
}

.ds-segment {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    background: var(--surface-2);
    border-radius: var(--r-md);
}

.ds-segment__item {
    padding: 4px 10px;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-3);
    cursor: pointer;
}

.ds-segment__item.active {
    background: var(--surface);
    border-color: var(--border);
    color: var(--brand-600);
}

/* --------------------------------------------------------------------------
   9. Tables
   -------------------------------------------------------------------------- */

.ds-table-wrap {
    overflow-x: auto;
    max-width: 100%;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.ds-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    font-size: 13.5px;
}

.ds-table thead th {
    position: sticky;
    top: 0;
    padding: 10px 16px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .02em;
    color: var(--text-3);
    text-align: left;
    white-space: nowrap;
}

.ds-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-2);
    vertical-align: middle;
}

.ds-table tbody tr:last-child td {
    border-bottom: 0;
}

.ds-table tbody tr:hover {
    background: var(--surface-2);
}

.ds-table .num,
.ds-table .ta-r {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.ds-table__asset {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ds-table__asset img,
.ds-table__asset .ds-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--r-full);
    object-fit: cover;
    flex: 0 0 28px;
}

.ds-table__name {
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

.ds-table__sub {
    font-size: 12px;
    color: var(--text-4);
    line-height: 1.3;
}

.ds-table-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    font-size: 12.5px;
    color: var(--text-3);
}

.ds-table-foot nav {
    margin-left: auto;
}

/* --------------------------------------------------------------------------
   10. Forms
   -------------------------------------------------------------------------- */

.ds-field {
    margin-bottom: 16px;
}

.ds-label {
    display: block;
    margin-bottom: 6px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-3);
}

.ds-input,
.ds-select,
.ds-textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
}

.ds-select,
select.form-select {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%2394A3B8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px 12px;
    text-overflow: ellipsis;
    cursor: pointer;
}

.ds-select[multiple],
.ds-select[size]:not([size="1"]),
select.form-select[multiple],
select.form-select[size]:not([size="1"]) {
    padding-right: 12px;
    background-image: none;
}

.ds-input::placeholder,
.ds-textarea::placeholder {
    color: var(--text-4);
}

.ds-input:focus,
.ds-select:focus,
.ds-textarea:focus {
    outline: none;
    border-color: var(--brand-600);
    box-shadow: var(--focus-ring);
}

.ds-input--amount {
    height: 52px;
    font-size: 18px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.ds-help {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-4);
}

.ds-error {
    margin-top: 6px;
    font-size: 12px;
    color: var(--loss);
}

.ds-search {
    position: relative;
}

.ds-search i {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    color: var(--text-4);
    font-size: 13px;
    pointer-events: none;
}

.ds-search .ds-input {
    padding-left: 34px;
}

.ds-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ds-chip {
    padding: 6px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-2);
    cursor: pointer;
}

.ds-chip:hover {
    border-color: var(--border-strong);
}

.ds-chip.active {
    background: var(--brand-50);
    border-color: var(--brand-600);
    color: var(--brand-700);
}

.ds-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex: 0 0 40px;
}

.ds-switch input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.ds-switch__track {
    position: absolute;
    inset: 0;
    background: var(--border-strong);
    border-radius: var(--r-full);
    transition: background .2s;
    pointer-events: none;
}

.ds-switch__track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: var(--r-full);
    transition: transform .2s;
}

.ds-switch input:checked + .ds-switch__track {
    background: var(--brand-600);
}

.ds-switch input:checked + .ds-switch__track::after {
    transform: translateX(18px);
}

/* --------------------------------------------------------------------------
   11. Method-selection card
   -------------------------------------------------------------------------- */

.ds-method {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    text-align: left;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.ds-method:hover {
    border-color: var(--border-strong);
}

.ds-method.active {
    border-color: var(--brand-600);
    background: var(--brand-50);
}

.ds-method__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--r-md);
    background: var(--brand-100);
    color: var(--brand-700);
    font-size: 17px;
    flex: 0 0 40px;
}

.ds-method__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.ds-method__sub {
    font-size: 12px;
    color: var(--text-3);
}

.ds-method__meta {
    margin-left: auto;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-2);
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   12. Stepper
   -------------------------------------------------------------------------- */

.ds-stepper {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 0;
    list-style: none;
    overflow-x: auto;
    scrollbar-width: none;
}

.ds-stepper::-webkit-scrollbar {
    display: none;
}

.ds-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-4);
    white-space: nowrap;
}

.ds-step__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--r-full);
    background: var(--surface-2);
    color: var(--text-4);
    font-size: 12px;
    font-weight: 600;
    flex: 0 0 24px;
}

.ds-step.active {
    color: var(--text);
}

.ds-step.active .ds-step__num,
.ds-step.done .ds-step__num {
    background: var(--brand-600);
    color: #fff;
}

.ds-step.done {
    color: var(--text-2);
}

.ds-step__rule {
    flex: 1 1 24px;
    min-width: 24px;
    height: 1px;
    background: var(--border);
}

/* --------------------------------------------------------------------------
   13. Callouts
   -------------------------------------------------------------------------- */

.ds-callout {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--r-md);
    font-size: 13px;
    line-height: 1.55;
}

.ds-callout i {
    margin-top: 2px;
    flex: 0 0 auto;
}

.ds-callout strong {
    display: block;
    margin-bottom: 2px;
    font-weight: 600;
}

.ds-callout--info {
    background: var(--info-bg);
    color: var(--brand-800);
}

.ds-callout--caution {
    background: var(--warn-bg);
    color: #92400E;
}

.ds-callout--secure {
    background: var(--brand-50);
    color: var(--brand-800);
}

.ds-callout--danger {
    background: var(--loss-bg);
    color: #991B1B;
}

/* --------------------------------------------------------------------------
   14. Charts
   -------------------------------------------------------------------------- */

.ds-chart {
    position: relative;
    height: 280px;
}

.ds-chart--sm {
    height: 200px;
}

.ds-chart--donut {
    height: 220px;
}

.ds-sparkline {
    width: 72px;
    height: 28px;
    display: block;
}

.ds-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 12.5px;
}

.ds-legend li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

.ds-legend__dot {
    width: 8px;
    height: 8px;
    border-radius: var(--r-full);
    flex: 0 0 8px;
}

.ds-legend__label {
    color: var(--text-2);
}

.ds-legend__value {
    margin-left: auto;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.ds-legend__pct {
    width: 52px;
    text-align: right;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   15. Trader / strategy
   -------------------------------------------------------------------------- */

.ds-trader {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ds-trader__avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--r-full);
    object-fit: cover;
    flex: 0 0 40px;
}

.ds-trader__name {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.ds-trader__strategy {
    font-size: 12px;
    color: var(--text-3);
}

.ds-metric-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.ds-metric {
    padding: 14px 16px;
    border-right: 1px solid var(--border);
}

.ds-metric:last-child {
    border-right: 0;
}

.ds-metric__label {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-3);
    margin-bottom: 4px;
}

.ds-metric__value {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   16. Empty state
   -------------------------------------------------------------------------- */

.ds-empty {
    padding: 48px 24px;
    text-align: center;
}

.ds-empty__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 16px;
    border-radius: var(--r-full);
    background: var(--surface-2);
    color: var(--text-4);
    font-size: 22px;
}

.ds-empty h4 {
    font-size: 16px;
    margin-bottom: 6px;
}

.ds-empty p {
    max-width: 420px;
    margin: 0 auto 20px;
    font-size: 13.5px;
    color: var(--text-3);
}

/* --------------------------------------------------------------------------
   17. Marketing sections
   -------------------------------------------------------------------------- */

.mk-section {
    padding: 80px 0;
}

.mk-section--tight {
    padding: 56px 0;
}

.mk-section--dark {
    background: var(--navy-900);
    color: var(--navy-fg);
}

.mk-section--dark h1,
.mk-section--dark h2,
.mk-section--dark h3,
.mk-section--dark h4 {
    color: #fff;
}

.mk-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.mk-eyebrow {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--brand-600);
    margin-bottom: 12px;
}

.mk-h1 {
    font-size: clamp(36px, 5vw, 56px);
    line-height: 1.08;
    font-weight: 700;
    letter-spacing: -.02em;
}

.mk-h1 .accent {
    color: var(--brand-600);
}

.mk-h2 {
    font-size: clamp(28px, 3.4vw, 38px);
    line-height: 1.18;
    font-weight: 700;
    letter-spacing: -.02em;
}

.mk-lead {
    font-size: 17px;
    line-height: 1.65;
    color: var(--text-2);
}

.mk-section--dark .mk-lead {
    color: var(--navy-fg-muted);
}

.mk-trust {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 24px;
    margin-top: 40px;
}

.mk-trust__item i {
    display: block;
    margin-bottom: 8px;
    font-size: 18px;
    color: var(--brand-600);
}

.mk-trust__title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.mk-trust__text {
    font-size: 12.5px;
    color: var(--text-3);
    line-height: 1.5;
}

.mk-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
}

.mk-stat {
    padding: 24px;
    border-right: 1px solid var(--border);
    text-align: center;
}

.mk-stat:last-child {
    border-right: 0;
}

.mk-stat__value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.mk-stat__label {
    font-size: 12.5px;
    color: var(--text-3);
}

.mk-logos {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 40px;
    padding: 32px 0;
}

.mk-logos img {
    height: 26px;
    filter: grayscale(1);
    opacity: .6;
}

.mk-ways {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.mk-way {
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
}

.mk-way__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-bottom: 16px;
    border-radius: var(--r-md);
    font-size: 18px;
}

.mk-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.mk-step {
    display: flex;
    gap: 14px;
    padding: 24px;
    background: var(--navy-800);
    border-radius: var(--r-lg);
}

.mk-step__num {
    font-size: 26px;
    font-weight: 700;
    color: var(--brand-600);
    line-height: 1;
}

.mk-footer {
    background: var(--navy-900);
    color: var(--navy-fg-muted);
    padding: 64px 0 32px;
    font-size: 13.5px;
}

.mk-footer h6 {
    color: #fff;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.mk-footer a {
    display: block;
    padding: 5px 0;
    color: var(--navy-fg-muted);
}

.mk-footer a:hover {
    color: #fff;
}

.mk-footer__legal {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--navy-700);
    font-size: 12px;
    line-height: 1.6;
    color: #6B7280;
}

/* Landing hero + phone mockup */
.mk-hero-split {
    position: relative;
    overflow: hidden;
    padding: 72px 0 64px;
    background:
        radial-gradient(ellipse 70% 50% at 85% 20%, rgba(37, 99, 235, .10), transparent 55%),
        radial-gradient(ellipse 50% 40% at 10% 80%, rgba(15, 23, 42, .04), transparent 50%),
        var(--bg);
}

.mk-hero-split__grid {
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    gap: 48px;
    align-items: center;
}

.mk-hero-split__brand {
    font-size: clamp(22px, 2.6vw, 28px);
    font-weight: 800;
    letter-spacing: -.03em;
    color: var(--text);
    margin: 0 0 18px;
    line-height: 1.15;
}

.mk-hero-split__copy h1 {
    font-size: clamp(34px, 4.6vw, 52px);
    line-height: 1.08;
    font-weight: 700;
    letter-spacing: -.03em;
    color: var(--text);
    margin: 0 0 16px;
}

.mk-hero-split__copy h1 .accent {
    color: var(--brand-600);
}

.mk-hero-split__sub {
    font-size: 17px;
    line-height: 1.6;
    color: var(--text-2);
    max-width: 460px;
    margin: 0 0 28px;
}

.mk-hero-split__cta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 28px;
}

.mk-hero-split__trust {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 20px;
    max-width: 480px;
}

.mk-hero-split__trust-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.mk-hero-split__trust-item i {
    margin-top: 2px;
    color: var(--brand-600);
    font-size: 14px;
}

.mk-hero-split__trust-item strong {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

.mk-hero-split__trust-item span {
    display: block;
    font-size: 11.5px;
    color: var(--text-3);
    line-height: 1.4;
}

.mk-hero-split__visual {
    position: relative;
    display: flex;
    justify-content: center;
    animation: mkPhoneIn .9s ease .2s both;
}

.mk-hero-split__glow {
    position: absolute;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, .22), transparent 68%);
    top: 18%;
    filter: blur(8px);
    pointer-events: none;
}

/* Phone device */
.mk-phone {
    position: relative;
    z-index: 1;
    width: min(280px, 78vw);
    border-radius: 36px;
    padding: 10px;
    background: linear-gradient(160deg, #1f2937, #0B1120 55%, #111827);
    box-shadow:
        0 30px 60px rgba(11, 17, 32, .28),
        0 8px 20px rgba(11, 17, 32, .18),
        inset 0 0 0 1px rgba(255, 255, 255, .08);
    transform: rotate(2deg);
}

.mk-phone__bezel {
    position: relative;
    border-radius: 28px;
    overflow: hidden;
    background: #0B1120;
    aspect-ratio: 9 / 19.2;
}

.mk-phone__notch {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 88px;
    height: 22px;
    border-radius: 999px;
    background: #000;
    z-index: 3;
}

.mk-phone__screen {
    height: 100%;
    padding: 42px 14px 16px;
    display: flex;
    flex-direction: column;
    color: #E5E7EB;
    background:
        radial-gradient(ellipse 80% 40% at 50% 0%, rgba(37, 99, 235, .18), transparent 60%),
        #0B1120;
}

.mk-phone__status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    color: #9CA3AF;
    margin-bottom: 14px;
}

.mk-phone__label {
    font-size: 11px;
    color: #9CA3AF;
    margin-bottom: 4px;
}

.mk-phone__balance {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -.03em;
    color: #fff;
    line-height: 1.1;
}

.mk-phone__delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    margin-bottom: 14px;
    font-size: 11px;
    font-weight: 600;
    color: #4ADE80;
}

.mk-phone__chart {
    width: 100%;
    height: 64px;
    margin-bottom: 16px;
}

.mk-phone__chart svg {
    width: 100%;
    height: 100%;
    display: block;
}

.mk-phone__section-title {
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
}

.mk-phone__movers {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.mk-phone__mover {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .05);
}

.mk-phone__mover-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
}

.mk-phone__mover-name {
    font-size: 11px;
    font-weight: 600;
    color: #F3F4F6;
}

.mk-phone__mover-meta {
    font-size: 9.5px;
    color: #9CA3AF;
}

.mk-phone__mover-chg {
    font-size: 10.5px;
    font-weight: 600;
    text-align: right;
}

.mk-phone__mover-chg.is-up { color: #4ADE80; }
.mk-phone__mover-chg.is-down { color: #F87171; }

.mk-phone__nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, .06);
}

.mk-phone__nav span {
    text-align: center;
    font-size: 8.5px;
    color: #6B7280;
}

.mk-phone__nav span i {
    display: block;
    margin-bottom: 3px;
    font-size: 12px;
}

.mk-phone__nav span.is-active {
    color: #93C5FD;
}

/* Dark stats band */
.mk-stats-band {
    background: var(--navy-900);
    color: #fff;
    padding: 36px 0;
}

.mk-stats-band__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    text-align: center;
}

.mk-stats-band__value {
    font-size: clamp(22px, 2.4vw, 28px);
    font-weight: 700;
    letter-spacing: -.02em;
    margin-bottom: 4px;
}

.mk-stats-band__label {
    font-size: 12.5px;
    color: var(--navy-fg-muted);
}

@keyframes mkPhoneIn {
    from { opacity: 0; transform: translateY(24px) rotate(4deg); }
    to { opacity: 1; transform: none; }
}

@media (max-width: 960px) {
    .mk-hero-split__grid {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }
    .mk-hero-split__sub,
    .mk-hero-split__trust {
        margin-left: auto;
        margin-right: auto;
    }
    .mk-hero-split__cta {
        justify-content: center;
    }
    .mk-hero-split__trust {
        text-align: left;
    }
    .mk-phone {
        transform: none;
    }
    .mk-stats-band__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px 12px;
    }
}

@media (max-width: 520px) {
    .mk-hero-split {
        padding: 48px 0 40px;
    }
    .mk-hero-split__trust {
        grid-template-columns: 1fr;
    }
}

/* --------------------------------------------------------------------------
   18. Utilities
   -------------------------------------------------------------------------- */

.ds-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ds-row--wrap {
    flex-wrap: wrap;
}

.ds-spacer {
    margin-left: auto;
}

.ds-stack > * + * {
    margin-top: 16px;
}

.ds-divider {
    height: 1px;
    background: var(--border);
    border: 0;
    margin: 20px 0;
}

.ds-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-full);
    background: var(--brand-600);
    color: #fff;
    font-weight: 600;
    text-transform: uppercase;
}

.ds-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.ds-toolbar .ds-search {
    flex: 1 1 220px;
    max-width: 320px;
}

/* Settings hub (app-09) */
.ds-settings-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

@media (max-width: 900px) {
    .ds-settings-layout {
        grid-template-columns: 1fr;
    }
}

.ds-settings-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: sticky;
    top: calc(var(--topbar-h) + 16px);
}

.ds-settings-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--r-md);
    color: var(--text-2);
    font-size: 14px;
    font-weight: 500;
}

.ds-settings-nav a:hover {
    background: var(--surface-2);
    color: var(--text);
}

.ds-settings-nav a.active {
    background: var(--brand-50);
    color: var(--brand-700);
    font-weight: 600;
}

.ds-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.ds-toggle-row:last-child {
    border-bottom: 0;
}

.ds-toggle-row__text strong {
    display: block;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
}

.ds-toggle-row__text span {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    color: var(--text-3);
}

/* OTP inputs (withdrawal flow) */
.otp-section {
    margin: 20px 0;
}

.otp-field {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.otp-field input.otp-input {
    width: 44px;
    height: 52px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--text);
}

.otp-field input.otp-input:focus {
    border-color: var(--brand-600);
    box-shadow: var(--focus-ring);
    outline: none;
}

.otp-field input.otp-input.disabled {
    opacity: .6;
}

@media print {
    .ds-sidebar,
    .ds-topbar,
    .ds-page-head__actions {
        display: none !important;
    }

    .ds-main {
        margin-left: 0;
    }
}

/* --------------------------------------------------------------------------
   19. Bridge to legacy dashboard markup
   These rules re-anchor components that still use the old class names
   (notifications dropdown, mobile drawer, bottom nav) to the new shell.
   -------------------------------------------------------------------------- */

.ds-topbar__nav > li {
    height: 100%;
    display: flex;
    align-items: center;
}

/* The old drawer class is still toggled by some pages. */
.ds-sidebar.mobile-active {
    transform: none;
    box-shadow: var(--shadow-lg);
}

/* Anchor the notifications panel to the bell instead of fixed offsets. */
.ds-notify {
    position: relative;
}

.ds-notify .notifications-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    left: auto;
    width: min(380px, calc(100vw - 32px));
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1050;
}

/* Bootstrap dropdowns inherit the token palette. */
.dropdown-menu {
    --bs-dropdown-bg: var(--surface);
    --bs-dropdown-border-color: var(--border);
    --bs-dropdown-border-radius: var(--r-lg);
    --bs-dropdown-link-color: var(--text-2);
    --bs-dropdown-link-hover-bg: var(--surface-2);
    --bs-dropdown-link-hover-color: var(--text);
    --bs-dropdown-link-active-bg: var(--brand-50);
    --bs-dropdown-link-active-color: var(--brand-700);
    --bs-dropdown-divider-bg: var(--border);
    --bs-dropdown-font-size: 13.5px;
    box-shadow: var(--shadow-md);
    padding: 6px;
}

.dropdown-item {
    border-radius: var(--r-sm);
    padding: 8px 10px;
}

/* Bootstrap modals + spinners on the token palette. */
.modal-content {
    background: var(--surface);
    color: var(--text-2);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
}

.spinner-border.text-primary {
    color: var(--brand-600) !important;
}

/* Mobile bottom nav (legacy markup, new palette). */
.mobile-bottom-nav {
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.mobile-bottom-nav .mobile-nav-item {
    color: var(--text-3);
}

.mobile-bottom-nav .mobile-nav-item.active {
    color: var(--brand-600);
}

@media (max-width: 991.98px) {
    .mobile-bottom-nav {
        padding-bottom: env(safe-area-inset-bottom, 0px);
        height: calc(64px + env(safe-area-inset-bottom, 0px));
        z-index: 1040;
    }

    /* Hide minimized Tawk bubble only — open chat panel stays usable via Support. */
    #tawk-bubble-container,
    .tawk-min-container,
    .tawk-button {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
        opacity: 0 !important;
        bottom: -9999px !important;
        z-index: 0 !important;
    }
}

/* --------------------------------------------------------------------------
   Mobile dashboard layout — prevent horizontal drift / overflow
   -------------------------------------------------------------------------- */

.db-home,
.db-mid,
.db-dual,
.db-bottom,
.db-kpi-row,
.db-qa,
.db-alerts,
.ds-stack {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.db-mid > *,
.db-dual > *,
.db-bottom > * {
    min-width: 0;
    max-width: 100%;
}

@media (max-width: 767.98px) {
    .db-kpi-row {
        grid-template-columns: 1fr;
    }

    .db-qa {
        grid-template-columns: 1fr;
    }

    .db-alert {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .db-alert .ds-btn {
        width: 100%;
        justify-content: center;
    }

    .db-perf__side {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .db-perf__stat {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
    }

    .db-watch__head,
    .db-watch__row {
        grid-template-columns: minmax(0, 1fr) minmax(70px, 0.85fr) minmax(74px, 0.8fr);
        gap: 6px;
        padding: 10px 4px;
    }

    .db-table {
        min-width: 480px;
    }

    .db-qa__item {
        width: 100%;
    }
}

@media (max-width: 420px) {
    .ds-content {
        padding-left: 12px;
        padding-right: 12px;
    }

    .db-kpi__value {
        font-size: 16px;
    }

    .db-perf__stat {
        flex: 1 1 100%;
    }
}

/* --------------------------------------------------------------------------
   Touch screens
   iOS Safari zooms the page when a focused field is under 16px.
   Finger-sized targets: icon buttons 44px, small buttons 40px.
   -------------------------------------------------------------------------- */

@media (max-width: 991.98px), (pointer: coarse) {
    .ds-input:not(.ds-input--amount),
    .ds-select,
    .ds-textarea,
    input.form-control,
    select.form-control,
    select.form-select,
    textarea.form-control {
        font-size: 16px;
    }

    .ds-icon-btn {
        width: 44px;
        height: 44px;
        flex-shrink: 0;
    }

    .ds-btn--sm {
        height: 40px;
    }

    .ds-topbar .dropdown > [data-bs-toggle="dropdown"] {
        min-height: 44px;
    }

    .dropdown-item {
        padding: 11px 12px;
    }
}

/* --------------------------------------------------------------------------
   Phones: stat cards two-up, tables as labelled cards
   Prefixed with .ds-content so it outranks per-page <style> blocks that load later.
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
    .ds-content .db-kpi-row,
    .ds-content .ds-grid--kpi,
    .ds-content .mi-kpis,
    .ds-content .mt-kpis,
    .ds-content .wd-kpi,
    .ds-content .pf-pnl-grid,
    .ds-content .db-qa {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .ds-content .wd-kpi__card {
        flex-direction: column;
        gap: 8px;
        padding: 12px;
    }

    .ds-content .wd-kpi__icon {
        width: 32px;
        height: 32px;
        flex-basis: 32px;
    }

    .ds-content .wd-kpi__value {
        font-size: 17px;
        overflow-wrap: anywhere;
    }

    .ds-content .ds-settings-nav {
        position: static;
        flex-direction: row;
        overflow-x: auto;
        gap: 6px;
        margin: 0 -12px;
        padding: 0 12px 4px;
        scrollbar-width: none;
    }

    .ds-content .ds-settings-nav::-webkit-scrollbar {
        display: none;
    }

    .ds-content .ds-settings-nav a {
        flex: 0 0 auto;
        white-space: nowrap;
        min-height: 40px;
        border: 1px solid var(--border);
        border-radius: var(--r-full);
        background: var(--surface);
    }

    .ds-content .ds-tab {
        white-space: nowrap;
        min-height: 40px;
    }

    .ds-content .ds-grid--kpi > :last-child:nth-child(odd),
    .ds-content .mi-kpis > :last-child:nth-child(odd),
    .ds-content .mt-kpis > :last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }

    .ds-content .db-kpi,
    .ds-content .ds-kpi,
    .ds-content .mt-kpi {
        padding: 12px;
    }

    .ds-content .db-kpi__icon {
        width: 30px;
        height: 30px;
        margin-bottom: 8px;
        font-size: 13px;
    }

    .ds-content .db-kpi__value,
    .ds-content .ds-kpi__value,
    .ds-content .mt-kpi__val,
    .ds-content .mi-kpi__value {
        font-size: 17px;
        overflow-wrap: anywhere;
    }

    .ds-content .mi-kpi {
        flex-direction: column;
        gap: 8px;
        padding: 12px;
    }

    .ds-content .mi-kpi__icon {
        width: 32px;
        height: 32px;
        flex-basis: 32px;
        font-size: 13px;
    }

    .ds-content .db-qa__item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px;
    }

    .ds-content .db-qa__icon {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
    }

    .ds-content .mk-snapshot-row {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        gap: 10px;
        margin-left: -12px;
        margin-right: -12px;
        padding: 0 12px 4px;
        scrollbar-width: none;
    }

    .ds-content .mk-snapshot-row::-webkit-scrollbar {
        display: none;
    }

    .ds-content .mk-snapshot-row .mk-snap {
        flex: 0 0 min(168px, 46vw);
        scroll-snap-align: start;
        text-align: left;
    }

    .ds-content .mk-toolbar .ds-search {
        flex: 1 1 100% !important;
        max-width: none !important;
    }

    .ds-content .mk-sort-group {
        flex: 1 1 100%;
    }

    .ds-content .mk-sort-group a {
        flex: 1 1 0;
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .ds-content .db-perf__side {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .ds-content .db-perf__stat {
        min-width: 0;
        padding: 10px;
        overflow-wrap: anywhere;
    }

    /* Rows become cards; JS copies each column heading to td[data-label]. */
    .ds-table--stack {
        min-width: 0 !important;
        display: block;
        width: 100%;
    }

    .ds-table--stack thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .ds-table--stack tbody,
    .ds-table--stack tfoot {
        display: block;
    }

    .ds-table--stack tbody tr,
    .ds-table--stack tfoot tr {
        display: block;
        padding: 10px 14px;
        border-bottom: 1px solid var(--border);
    }

    .ds-table--stack tbody tr:last-child {
        border-bottom: 0;
    }

    .ds-table--stack tbody td,
    .ds-table--stack tfoot td {
        display: grid;
        grid-template-columns: minmax(84px, 38%) minmax(0, 1fr);
        column-gap: 12px;
        align-items: center;
        padding: 5px 0 !important;
        border: 0 !important;
        background: none !important;
        text-align: right !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
        min-width: 0;
        max-width: none !important;
        overflow: visible !important;
    }

    .ds-table--stack td.num,
    .ds-table--stack td.ta-r {
        overflow-wrap: normal;
    }

    .ds-table--stack tbody td > *,
    .ds-table--stack tfoot td > * {
        grid-column: 2;
        justify-self: end;
        max-width: 100%;
    }

    .ds-table--stack tbody td::before,
    .ds-table--stack tfoot td::before {
        content: attr(data-label);
        grid-column: 1;
        grid-row: 1 / span 4;
        align-self: start;
        padding-top: 2px;
        text-align: left;
        font-size: 12px;
        font-weight: 500;
        color: var(--text-3);
        overflow-wrap: normal;
    }

    .ds-table--stack td[data-label=""],
    .ds-table--stack td[colspan] {
        grid-template-columns: minmax(0, 1fr);
        text-align: left !important;
    }

    .ds-table--stack td[data-label=""] > *,
    .ds-table--stack td[colspan] > * {
        grid-column: 1;
        justify-self: stretch;
    }

    .ds-table--stack td[data-label=""]::before,
    .ds-table--stack td[colspan]::before {
        display: none;
    }

    .ds-table--stack td[colspan] {
        display: block;
        text-align: center !important;
    }

    /* First cell reads as the card title. */
    .ds-table--stack tbody td:first-child:not([colspan]) {
        font-weight: 600;
        color: var(--text);
    }
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

a, button, [role="button"], label, summary {
    -webkit-tap-highlight-color: transparent;
}

button, a, [role="button"], input, select, textarea, label {
    touch-action: manipulation;
}
