/* DTDesk Trade Pro — Clean Modern UI */
:root {
    --sidebar-w: 240px;
    --topbar-h: 70px;
    --footer-h: 48px;
    --sidebar-bg: #131722;
    --sidebar-hover: rgba(255,255,255,.06);
    --sidebar-text: #9ca3af;
    --sidebar-active: #6366f1;
    --content-bg: #f1f5f9;
    --card-bg: #ffffff;
    --text-dark: #1e293b;
    --text-body: #334155;
    --text-muted: #64748b;
    --primary: #6366f1;
    --primary-light: #eef2ff;
    --success: #10b981;
    --success-bg: #ecfdf5;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --warning: #f59e0b;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
    --shadow: 0 4px 20px rgba(15,23,42,.06);
    --shadow-lg: 0 12px 40px rgba(15,23,42,.1);
    --font: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono: 'SF Mono', Consolas, monospace;
    --transition: .2s ease;
}

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

body.dt-app {
    margin: 0;
    font-family: var(--font);
    background: var(--content-bg);
    color: var(--text-body);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    height: 100vh;
}

.mono { font-family: var(--mono); letter-spacing: -.02em; }

/* ─── Layout: fixed topbar + footer, scrollable content ─── */
.dt-wrapper { display: flex; height: 100vh; overflow: hidden; }

.dt-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    transition: margin-left var(--transition);
}

body.dt-sidebar-collapsed .dt-main { margin-left: 0; }

.dt-scroll-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    margin-top: var(--topbar-h);
    margin-bottom: var(--footer-h);
    -webkit-overflow-scrolling: touch;
}

.dt-content {
    padding: 24px 28px 32px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* ─── Sidebar ─── */
.dt-sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1100;
    border-right: 1px solid rgba(255,255,255,.04);
    transition: transform var(--transition), width var(--transition);
}

body.dt-sidebar-collapsed .dt-sidebar {
    transform: translateX(-100%);
}

.dt-brand-text { min-width: 0; }

.dt-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.dt-logo {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: .9rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(37,99,235,.35);
}

.dt-logo.sm { width: 36px; height: 36px; font-size: .8rem; border-radius: 10px; }

.dt-brand-title { font-weight: 700; color: #fff; font-size: 1.05rem; line-height: 1.2; }
.dt-brand-sub { font-size: .72rem; color: #6b7280; margin-top: 1px; }

.dt-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }

.dt-nav-label {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .1em;
    color: #4b5563;
    padding: 18px 14px 8px;
    text-transform: uppercase;
}

.dt-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    margin-bottom: 3px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 500;
    font-size: .88rem;
    transition: var(--transition);
}

.dt-nav-link i { font-size: 1.15rem; width: 22px; text-align: center; opacity: .9; }
.dt-nav-link:hover { background: var(--sidebar-hover); color: #f9fafb; }
.dt-nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
    box-shadow: 0 4px 14px rgba(37,99,235,.35);
}

.dt-nav-link.disabled {
    opacity: .45;
    pointer-events: none;
}

.dt-sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 16px;
    margin: 8px 12px 16px;
    background: rgba(255,255,255,.04);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,.06);
}

.dt-sidebar-user-info strong { display: block; color: #f3f4f6; font-size: .85rem; font-weight: 600; }
.dt-sidebar-user-info small { color: #6b7280; font-size: .72rem; display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }

.dt-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: .95rem;
    flex-shrink: 0;
}

.dt-avatar.sm, .dt-avatar.dt-avatar-sm { width: 36px; height: 36px; font-size: .82rem; }

/* ─── Topbar (fixed) ─── */
.dt-topbar {
    height: var(--topbar-h);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: fixed;
    top: 0;
    left: var(--sidebar-w);
    right: 0;
    z-index: 1050;
    box-shadow: var(--shadow-sm);
    transition: left var(--transition);
}

body.dt-sidebar-collapsed .dt-topbar { left: 0; }

.dt-sidebar-toggle {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    padding: 0;
    flex-shrink: 0;
}

.dt-sidebar-toggle:hover { background: var(--primary-light); color: var(--primary); border-color: #c7d2fe; }

.dt-topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }

.dt-page-title {
    font-size: .95rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dt-page-sub {
    font-size: .78rem;
    color: var(--text-muted);
    margin: 2px 0 0;
    font-weight: 400;
}

.dt-topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.dt-ticker {
    display: flex;
    gap: 24px;
    padding: 8px 20px;
    background: var(--border-light);
    border-radius: 30px;
    border: 1px solid var(--border);
}

.dt-ticker-item { display: flex; align-items: center; gap: 8px; }
.dt-ticker-item .lbl { font-size: .68rem; color: var(--text-muted); font-weight: 600; letter-spacing: .03em; }
.dt-ticker-item .val { font-weight: 700; font-size: .92rem; color: var(--text-dark); }

.dt-clock {
    font-size: .75rem;
    color: var(--text-muted);
    background: var(--border-light);
    padding: 7px 14px;
    border-radius: 30px;
    border: 1px solid var(--border);
    white-space: nowrap;
}

.dt-badge-market {
    font-size: .7rem;
    font-weight: 700;
    padding: 7px 14px;
    border-radius: 30px;
    letter-spacing: .02em;
    white-space: nowrap;
}

.dt-badge-market.open { background: var(--success-bg); color: var(--success); border: 1px solid #a7f3d0; }
.dt-badge-market.closed { background: #f3f4f6; color: var(--text-muted); border: 1px solid var(--border); }

.dt-broker-btn {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid #bfdbfe;
    font-weight: 600;
    font-size: .78rem;
    border-radius: 30px;
    padding: 6px 14px;
}

.dt-user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--border-light);
    border: 1px solid var(--border);
    font-weight: 600;
    font-size: .84rem;
    padding: 5px 14px 5px 5px;
    border-radius: 30px;
    color: var(--text-dark);
}

.dt-mobile-toggle {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 10px;
}

/* ─── Cards ─── */
.dt-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 24px;
    overflow: hidden;
}

.dt-card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    background: #fafbfc;
}

.dt-card-header h2 {
    margin: 0;
    font-size: .95rem;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
}

.dt-card-body { padding: 24px; }
.dt-card-body.p-0 { padding: 0; }

/* ─── Stat cards ─── */
.dt-stat-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

@media (max-width: 1200px) { .dt-stat-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 576px) { .dt-stat-row { grid-template-columns: 1fr; } }

.dt-stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.dt-stat-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }

.dt-stat-inner { display: flex; align-items: center; gap: 18px; }

.dt-stat-card .icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.dt-stat-card .icon.blue { background: #eff6ff; color: var(--primary); }
.dt-stat-card .icon.green { background: var(--success-bg); color: var(--success); }
.dt-stat-card .icon.purple { background: #f5f3ff; color: #7c3aed; }
.dt-stat-card .icon.orange { background: #fff7ed; color: #ea580c; }

.dt-stat-meta .num { font-size: 1.85rem; font-weight: 700; line-height: 1.1; color: var(--text-dark); }
.dt-stat-meta .lbl { font-size: .8rem; color: var(--text-muted); margin-top: 4px; font-weight: 500; }

/* Legacy stat layout fallback */
.dt-stat-card > .num { font-size: 1.85rem; font-weight: 700; line-height: 1.1; color: var(--text-dark); }
.dt-stat-card > .lbl { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.dt-stat-card > .icon { margin-bottom: 14px; width: 48px; height: 48px; border-radius: 12px; }

/* ─── Quote cards ─── */
.dt-quote-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

@media (max-width: 768px) { .dt-quote-row { grid-template-columns: 1fr; } }

.dt-quote-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px 28px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.dt-quote-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #7c3aed);
}

.dt-quote-card .sym { font-size: .78rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.dt-quote-card .price { font-size: 2rem; font-weight: 700; margin: 8px 0 4px; color: var(--text-dark); }
.dt-quote-card .chg { font-weight: 600; font-size: .88rem; display: flex; align-items: center; gap: 4px; }
.dt-quote-card .chg.up, .dt-quote-card .chg.text-success { color: var(--success); }
.dt-quote-card .chg.down, .dt-quote-card .chg.text-danger { color: var(--danger); }

/* ─── Tables ─── */
.dt-table-wrap { overflow-x: auto; border-radius: 0 0 var(--radius) var(--radius); }

.dt-table { width: 100%; border-collapse: collapse; }
.dt-table th {
    text-align: left;
    padding: 14px 20px;
    font-size: .7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    background: #f9fafb;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.dt-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    color: var(--text-body);
    font-size: .875rem;
}

.dt-table tbody tr { transition: var(--transition); }
.dt-table tbody tr:hover { background: #f9fafb; }
.dt-table tbody tr:last-child td { border-bottom: none; }

.dt-user-cell { display: flex; align-items: center; gap: 14px; }
.dt-user-cell .name { font-weight: 600; color: var(--text-dark); }
.dt-user-cell .email-sm { font-size: .78rem; color: var(--text-muted); margin-top: 1px; }

.dt-actions { display: flex; gap: 6px; align-items: center; }

/* ─── Badges ─── */
.badge-active, .badge-inactive, .badge-role-admin, .badge-role-viewer,
.badge-tip-active, .badge-tip-done, .badge-tip-sl {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .02em;
}

.badge-active { background: var(--success-bg); color: var(--success); }
.badge-inactive { background: #f3f4f6; color: var(--text-muted); }
.badge-role-admin { background: #fef3c7; color: #b45309; }
.badge-role-viewer { background: #eff6ff; color: #1d4ed8; }
.badge-tip-active { background: var(--success-bg); color: var(--success); }
.badge-tip-done { background: #eff6ff; color: #1d4ed8; }
.badge-tip-sl { background: var(--danger-bg); color: var(--danger); }

/* ─── Buttons ─── */
.btn-dt-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: .875rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    line-height: 1.4;
}

.btn-dt-primary:hover { background: #1d4ed8; color: #fff; box-shadow: 0 4px 14px rgba(37,99,235,.3); }

.btn-dt-outline {
    background: #fff;
    color: var(--primary);
    border: 1px solid #bfdbfe;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: .85rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.btn-dt-outline:hover { background: var(--primary-light); color: var(--primary); }

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
}

.btn-icon:hover { background: var(--primary-light); color: var(--primary); border-color: #bfdbfe; }
.btn-icon.danger:hover { background: var(--danger-bg); color: var(--danger); border-color: #fecaca; }

/* ─── Filters & chips ─── */
.dt-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.dt-filter-bar .form-control,
.dt-filter-bar .form-select {
    min-width: 160px;
    max-width: 220px;
    font-size: .875rem;
    border-radius: var(--radius-sm);
    border-color: var(--border);
    padding: 9px 14px;
    box-shadow: var(--shadow-sm);
}

.dt-filter-bar .form-control:focus,
.dt-filter-bar .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.dt-chip-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }

.dt-chip {
    padding: 8px 18px;
    border-radius: 30px;
    font-size: .82rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-muted);
    background: #f3f4f6;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.dt-chip:hover { color: var(--primary); background: var(--primary-light); border-color: #bfdbfe; }
.dt-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 4px 12px rgba(37,99,235,.25); }

/* ─── Forms ─── */
.dt-form .form-label { font-weight: 600; font-size: .84rem; color: var(--text-dark); margin-bottom: 6px; }

.dt-form .form-control,
.dt-form .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border);
    padding: 10px 14px;
    font-size: .875rem;
}

.dt-form .form-control:focus,
.dt-form .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

/* ─── Thin fixed footer ─── */
.dt-footer-bar {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-w);
    right: 0;
    height: var(--footer-h);
    background: var(--sidebar-bg);
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
    z-index: 1050;
    border-top: 1px solid rgba(255,255,255,.06);
    transition: left var(--transition);
}

body.dt-sidebar-collapsed .dt-footer-bar { left: 0; }

/* Legacy footer hidden */
.dt-footer { display: none; }

.dt-live-price { font-size: 1.5rem; font-weight: 700; color: var(--text-dark); }

.badge-buy { background: var(--success-bg); color: var(--success); padding: 5px 12px; border-radius: 20px; font-size: .72rem; font-weight: 700; }
.badge-outline-success { border: 1px solid #6ee7b7; color: var(--success); background: #fff; padding: 4px 12px; border-radius: 20px; font-size: .72rem; font-weight: 600; }
.badge-outline-danger { border: 1px solid #fca5a5; color: var(--danger); background: #fff; padding: 4px 12px; border-radius: 20px; font-size: .72rem; font-weight: 600; }

/* ─── User drawer ─── */
.dt-user-drawer { width: 440px !important; }
.dt-user-drawer .offcanvas-header { padding: 20px 24px; background: #fafbfc; }
.dt-user-drawer .offcanvas-title { font-weight: 700; font-size: 1rem; }
.dt-user-drawer .offcanvas-body { padding: 24px; }

.dt-drawer-profile { text-align: center; padding: 24px 0; border-bottom: 1px solid var(--border-light); }
.dt-drawer-profile .dt-avatar { width: 80px; height: 80px; font-size: 1.75rem; margin: 0 auto 14px; }

.dt-drawer-tabs { display: flex; gap: 6px; padding: 16px 0; border-bottom: 1px solid var(--border-light); }
.dt-drawer-tabs button {
    flex: 1;
    border: none;
    background: none;
    padding: 10px;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.dt-drawer-tabs button.active { background: var(--primary-light); color: var(--primary); }

.dt-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: .875rem;
    gap: 16px;
}

.dt-info-row span:first-child { color: var(--text-muted); font-weight: 500; flex-shrink: 0; }
.dt-info-row span:last-child { color: var(--text-dark); font-weight: 500; text-align: right; word-break: break-word; }

/* ─── Modals ─── */
.modal-content { border: none; border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-header { padding: 20px 24px; background: #fafbfc; border-bottom: 1px solid var(--border-light); }
.modal-header .modal-title { font-weight: 700; font-size: 1rem; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; background: #fafbfc; border-top: 1px solid var(--border-light); }

/* ─── Alerts ─── */
.dt-alert {
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    font-size: .875rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dt-alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }

/* ─── Option chain ─── */
.dt-chain-table th, .dt-chain-table td { font-size: .8rem; padding: 11px 10px; }
.dt-atm-row { background: #fffbeb !important; }

/* ─── Login pages ─── */
.dt-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #0f1419 0%, #1e293b 45%, #312e81 100%);
    padding: 32px 20px;
}

.dt-login-card {
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: 20px;
    padding: 44px 40px;
    box-shadow: var(--shadow-lg);
}

.dt-login-card .dt-logo { margin: 0 auto 22px; width: 60px; height: 60px; font-size: 1.1rem; }

.dt-login-card .form-control {
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    border-color: var(--border);
}

.dt-login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.dt-login-card .input-group-text {
    background: #f9fafb;
    border-color: var(--border);
    color: var(--text-muted);
}

.dt-login-card .btn-primary {
    background: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px;
    font-weight: 600;
}

.dt-login-card .btn-primary:hover { background: #1d4ed8; }

/* ─── Empty state ─── */
.dt-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.dt-empty i { font-size: 2.5rem; opacity: .35; margin-bottom: 12px; display: block; }

/* ─── Misc ─── */
.pulse-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 1.5s infinite;
    margin-right: 5px;
    vertical-align: middle;
}

@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .5; transform: scale(.85); } }

.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }

/* ─── Responsive ─── */
@media (max-width: 991px) {
    .dt-sidebar { transform: translateX(-100%); }
    .dt-main, .dt-topbar, .dt-footer-bar { margin-left: 0; left: 0; }
    body.dt-sidebar-open .dt-sidebar { transform: translateX(0); }
    .dt-content { padding: 20px 16px; }
    .dt-topbar { padding: 0 8px; --topbar-h: 56px; min-height: 56px; }
    .dt-topbar-center { display: flex !important; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .dt-topbar-center::-webkit-scrollbar { display: none; }
    .dt-topbar-ticker { flex-wrap: nowrap; gap: 6px; min-width: min-content; width: max-content; }
    .dt-topbar-tick { flex: 0 0 auto; min-width: 70px; max-width: 100px; padding: 3px 6px; }
    .dt-topbar-tick .lbl { font-size: 0.5rem; }
    .dt-topbar-tick .val { font-size: 0.65rem; }
    .dt-topbar-tick .chg { font-size: 0.52rem; }
    .dt-topbar-tick.dt-topbar-pcr { min-width: 64px; }
    .dt-sidebar-mobile { background: var(--sidebar-bg); color: #fff; width: 280px !important; }
    .dt-user-drawer { width: 100% !important; max-width: 100vw; }
}

@media (max-width: 768px) {
    .dt-clock { display: none; }
    .dt-page-sub { display: none; }
}

/* ─── Dark topbar (Trade Pro) ─── */
.dt-topbar-dark {
    background: #0b0e14;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    color: #fff;
}

.dt-topbar-dark .dt-sidebar-toggle,
.dt-topbar-dark .dt-topbar-icon-btn {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: #cbd5e1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.dt-topbar-dark .dt-sidebar-toggle:hover,
.dt-topbar-dark .dt-topbar-icon-btn:hover {
    background: rgba(37, 99, 235, 0.2);
    border-color: rgba(59, 130, 246, 0.4);
    color: #fff;
}

.dt-topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
}

.dt-topbar-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
}

.dt-topbar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.dt-topbar-brand-text strong {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.dt-topbar-brand-text small {
    font-size: 0.68rem;
    color: #94a3b8;
    font-weight: 500;
}

.dt-topbar-center {
    flex: 1;
    justify-content: flex-start;
    display: flex;
    padding: 0 8px;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.dt-topbar-center::-webkit-scrollbar { display: none; }

.dt-topbar-ticker {
    display: flex;
    gap: 8px 12px;
    align-items: stretch;
    justify-content: flex-start;
    flex-wrap: nowrap;
    width: max-content;
    min-width: 100%;
    padding: 2px 4px;
}

.dt-topbar-tick {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    flex: 0 0 auto;
    min-width: 78px;
    max-width: 120px;
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.dt-topbar-tick .lbl {
    font-size: 0.52rem;
    letter-spacing: 0.04em;
    color: #8a8d91;
    font-weight: 700;
    text-transform: uppercase;
    flex-shrink: 0;
    line-height: 1.1;
}

.dt-topbar-tick .val {
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    white-space: nowrap;
    line-height: 1.15;
}

.dt-topbar-tick .chg {
    font-size: 0.58rem;
    font-weight: 600;
    flex-shrink: 0;
    white-space: nowrap;
    line-height: 1.1;
}

.dt-topbar-tick .chg.up { color: #22c55e; }
.dt-topbar-tick .chg.down { color: #ef4444; }

.dt-topbar-dark .dt-badge-market {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
}

.dt-topbar-dark .dt-badge-market.open {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.35);
    color: #4ade80;
}

.dt-topbar-clock {
    font-size: 0.62rem;
    color: #422006;
    padding: 5px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.dt-topbar-clock.dt-clock-highlight {
    background: linear-gradient(180deg, #fde047 0%, #facc15 100%);
    border: 1px solid #eab308;
    color: #422006;
    font-weight: 700;
    box-shadow: 0 0 12px rgba(250, 204, 21, 0.35);
    letter-spacing: -0.01em;
}

.dt-topbar-user {
    border: none;
    background: transparent;
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 4px;
    border-radius: 30px;
}

.dt-topbar-user:hover,
.dt-topbar-user:focus {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.dt-topbar-dark .dropdown-menu {
    border: 1px solid var(--border);
}

/* ─── Dashboard home (mockup) ─── */
.dt-dash-head .dt-dash-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-dark);
}

.dt-dash-sub {
    color: var(--text-muted);
    margin: 4px 0 0;
    font-size: 0.9rem;
}

.dt-dash-summary {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 16px;
}

.dt-dash-sum-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
}

.dt-dash-sum-card .lbl {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.dt-dash-sum-card .price {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-dark);
}

.dt-dash-sum-card .chg {
    font-size: 0.82rem;
    font-weight: 600;
    margin-top: 4px;
}

.dt-dash-sum-card .chg.up { color: var(--success); }
.dt-dash-sum-card .chg.down { color: var(--danger); }

.dt-dash-sum-card .sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.dt-dash-sum-card.highlight-green {
    border-color: rgba(34, 197, 94, 0.25);
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.08), var(--card-bg));
}

.dt-dash-sum-card.highlight-blue {
    border-color: rgba(37, 99, 235, 0.25);
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.08), var(--card-bg));
}

.dt-breadth-bar {
    display: flex;
    height: 42px;
    border-radius: 10px;
    overflow: hidden;
    font-size: 0.78rem;
    font-weight: 600;
    color: #fff;
}

.dt-breadth-bar span {
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 8px;
}

.dt-breadth-bar .adv { background: #22c55e; }
.dt-breadth-bar .dec { background: #ef4444; }
.dt-breadth-bar .unc { background: #94a3b8; color: #1e293b; }

@media (max-width: 1400px) {
    .dt-dash-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .dt-dash-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dt-dash-sum-card .price { font-size: 1.1rem; }
}

/* ─── Pagination ─── */
.dt-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.dt-page-info {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.dt-page-btn {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-dark);
    font-weight: 600;
    min-width: 88px;
}

.dt-page-btn:hover:not(.disabled) {
    background: var(--primary-light);
    border-color: #c7d2fe;
    color: var(--primary);
}

.dt-page-btn.disabled,
.dt-page-btn:disabled {
    opacity: 0.45;
    pointer-events: none;
}

.dt-audit-details {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    font-size: 0.75rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.dt-topbar-dark .dt-topbar-left {
    min-width: auto;
    flex: 0 0 auto;
}

.dt-topbar-dark .dt-topbar-center {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    justify-content: flex-start;
    padding: 0 6px;
}

.dt-topbar-dark .dt-topbar-clock {
    font-size: 0.58rem;
    max-width: none;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    flex-shrink: 1;
    min-width: 0;
}

.dt-topbar-right {
    gap: 6px;
    flex-shrink: 0;
}

@media (max-width: 1400px) {
    .dt-topbar-tick .val { font-size: 0.72rem; }
    .dt-topbar-tick .chg { font-size: 0.58rem; }
    .dt-topbar-dark .dt-topbar-clock { font-size: 0.54rem; padding: 4px 8px; }
}

@media (max-width: 1200px) {
    .dt-topbar-ticker { gap: 4px 8px; }
}

/* ─── Sidebar theme switch (single toggle) ─── */
.dt-sidebar-brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 18px 14px;
}

.dt-sidebar-brand-row .dt-brand-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.dt-theme-inline {
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0;
    flex-shrink: 0;
}

.dt-theme-inline .dt-theme-switch-label {
    font-size: 0.65rem;
}

.dt-theme-switch-mobile {
    flex-direction: row;
    justify-content: center;
    gap: 12px;
}

.dt-theme-switch {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.dt-theme-switch-track {
    display: block;
    width: 52px;
    height: 28px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    position: relative;
    transition: var(--transition);
}

.dt-theme-switch.is-light .dt-theme-switch-track {
    background: linear-gradient(135deg, #2563eb, #6366f1);
    border-color: transparent;
}

.dt-theme-switch-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.22s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.dt-theme-switch.is-light .dt-theme-switch-knob {
    transform: translateX(24px);
}

.dt-theme-switch-knob i {
    font-size: 0.72rem;
    line-height: 1;
}

.dt-icon-dark { color: #6366f1; display: inline; }
.dt-icon-light { color: #f59e0b; display: none; }
.dt-theme-switch.is-light .dt-icon-dark { display: none; }
.dt-theme-switch.is-light .dt-icon-light { display: inline; }

.dt-theme-switch-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #9ca3af;
}

body.dt-theme-light .dt-theme-switch-track {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

body.dt-theme-light .dt-theme-switch.is-light .dt-theme-switch-track {
    background: linear-gradient(135deg, #2563eb, #6366f1);
}

body.dt-theme-light .dt-theme-switch-label { color: #64748b; }

.dt-dash-chart {
    height: 280px;
    width: 100%;
}

/* ─── Light theme ─── */
body.dt-theme-light {
    --content-bg: #eef2f7;
    --card-bg: #ffffff;
    --text-dark: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;
    --border: #dbe3ee;
    --border-light: #f1f5f9;
    --sidebar-bg: #ffffff;
    --sidebar-hover: rgba(15, 23, 42, 0.06);
    --sidebar-text: #475569;
    --sidebar-active: #6366f1;
}

body.dt-theme-light .dt-sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
}

body.dt-theme-light .dt-brand-title { color: #0f172a; }
body.dt-theme-light .dt-brand-sub { color: #64748b; }
body.dt-theme-light .dt-nav-label { color: #94a3b8; }
body.dt-theme-light .dt-nav-link { color: var(--sidebar-text); }
body.dt-theme-light .dt-nav-link:hover { color: #0f172a; background: var(--sidebar-hover); }
body.dt-theme-light .dt-theme-switch-label { color: #64748b; }

body.dt-theme-light .dt-sidebar-mobile { background: #fff; color: #0f172a; }

body.dt-theme-light .dt-topbar-dark {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    color: #0f172a;
}

body.dt-theme-light .dt-topbar-dark .dt-topbar-tick .val { color: #0f172a; }
body.dt-theme-light .dt-topbar-dark .dt-sidebar-toggle,
body.dt-theme-light .dt-topbar-dark .dt-topbar-icon-btn {
    background: #f8fafc;
    border-color: var(--border);
    color: #475569;
}
body.dt-theme-light .dt-topbar-dark .dt-topbar-user { color: #0f172a; }
body.dt-theme-light .dt-topbar-dark .dt-badge-market {
    background: #f1f5f9;
    border-color: var(--border);
    color: #475569;
}

/* ─── App-wide fullscreen (topbar button) ─── */
.dt-wrapper:fullscreen,
.dt-wrapper:-webkit-full-screen {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--body-bg, #0f1419);
}

body.dt-app-fullscreen .dt-wrapper {
    height: 100vh;
}

.dt-wrapper:fullscreen .dt-sidebar,
.dt-wrapper:-webkit-full-screen .dt-sidebar {
    height: 100%;
}

.dt-wrapper:fullscreen .dt-main,
.dt-wrapper:-webkit-full-screen .dt-main {
    height: 100%;
    flex: 1;
    min-height: 0;
}

.dt-wrapper:fullscreen .dt-scroll-area,
.dt-wrapper:-webkit-full-screen .dt-scroll-area {
    flex: 1;
    min-height: 0;
}

.dt-wrapper:fullscreen .dt-pro-chart,
.dt-wrapper:-webkit-full-screen .dt-pro-chart {
    min-height: 50vh;
}

body.dt-app-fullscreen .dt-dash-chart {
    min-height: 42vh;
}

/* ─── Mobile: dashboard charts, modals, user popup ─── */
@media (max-width: 768px) {
    .dt-dash-chart { height: min(240px, 38vh); min-height: 200px; }
    .dt-dash-head .dt-dash-title { font-size: 1.35rem; }
    .dt-dash-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    #viewUserModal .modal-dialog,
    #editUserModal .modal-dialog,
    #profileModal .modal-dialog {
        margin: 0;
        max-width: 100%;
        min-height: 100%;
    }
    #viewUserModal .modal-content,
    #editUserModal .modal-content {
        min-height: 100vh;
        border-radius: 0;
    }
    #viewUserModal .modal-body,
    #editUserModal .modal-body { padding: 1rem; overflow-x: hidden; }
    #viewUserModal .dt-table { font-size: 0.78rem; }
    #viewUserModal .nav-tabs { flex-wrap: nowrap; overflow-x: auto; }
    #viewUserModal .nav-tabs .nav-link { font-size: 0.82rem; padding: 0.4rem 0.65rem; white-space: nowrap; }
    .dt-topbar-user .dt-avatar.sm { width: 28px; height: 28px; font-size: 0.72rem; }
    .dt-topbar-right { gap: 4px; flex-shrink: 0; }
    .dt-topbar-left { flex-shrink: 0; }
    .dt-topbar-center { flex: 1; min-width: 0; }
    .dt-user-drawer .offcanvas-body { padding: 16px; }
    .dt-user-drawer .dt-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 576px) {
    .dt-topbar-tick { min-width: 62px; max-width: 88px; }
    .dt-dash-summary { grid-template-columns: 1fr 1fr; }
    .dt-chain-table { font-size: 0.72rem; }
    .dt-filter-bar .form-select,
    .dt-filter-bar .form-control { font-size: 0.85rem; }
}
