:root {
    --premium-canvas: #f3f6fa;
    --premium-surface: #ffffff;
    --premium-surface-soft: #f8fafc;
    --premium-ink: #152033;
    --premium-text: #344054;
    --premium-muted: #708096;
    --premium-line: #dfe6ee;
    --premium-line-soft: #edf1f5;
    --premium-navy: #101a2e;
    --premium-blue: #2563eb;
    --premium-success: #078266;
    --premium-warning: #b76a00;
    --premium-danger: #c9364a;
    --premium-shadow: 0 1px 2px rgba(15,23,42,.025), 0 10px 26px rgba(15,23,42,.045);
    --pro-ink: var(--premium-ink);
    --pro-muted: var(--premium-muted);
    --pro-line: var(--premium-line);
    --pro-line-strong: #cfd8e5;
    --pro-canvas: var(--premium-canvas);
    --pro-panel: var(--premium-surface);
    --pro-sidebar: #0b1324;
    --pro-success: var(--premium-success);
    --pro-danger: var(--premium-danger);
    --pro-shadow: 0 1px 2px rgba(16,24,40,.035), 0 8px 24px rgba(16,24,40,.045);
}

body.app-shell {
    background: var(--premium-canvas) !important;
    color: var(--premium-text);
    font-family: "Segoe UI Variable", "Segoe UI", Inter, Arial, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    transition: grid-template-columns .2s ease;
}

.sidebar,
.client-app .sidebar {
    border-right: 1px solid rgba(255,255,255,.07) !important;
    background: var(--pro-sidebar) !important;
    box-shadow: 10px 0 30px rgba(8,15,30,.05) !important;
    transition: width .2s ease, padding .2s ease, transform .2s ease;
}

.sidebar .brand,
.client-app .sidebar .brand { margin-bottom: 4px; border-bottom-color: rgba(255,255,255,.08); }
.side-nav a,
.side-nav summary,
.client-app .side-nav a { position: relative; overflow: hidden; min-height: 40px; border-radius: 6px !important; color: #aebbd0 !important; }
.side-nav a:hover,
.side-nav summary:hover,
.client-app .side-nav a:hover { background: rgba(255,255,255,.05) !important; color: #fff !important; }
.side-nav a.active,
.side-nav summary.active,
.client-app .side-nav a.active { border-color: rgba(255,255,255,.06) !important; background: rgba(255,255,255,.075) !important; color: #fff !important; box-shadow: inset 2px 0 0 var(--brand) !important; }

.admin-topbar,
.client-topbar {
    min-height: 68px !important;
    border-bottom: 1px solid rgba(207,216,229,.8) !important;
    background: rgba(255,255,255,.9) !important;
    box-shadow: 0 1px 0 rgba(16,24,40,.025), 0 8px 30px rgba(16,24,40,.025) !important;
    backdrop-filter: blur(18px) saturate(1.2);
}

.experience-tools { display: flex; flex: 0 0 auto; align-items: center; gap: 7px; }
.experience-icon-button,
.experience-command-button { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; border: 1px solid var(--pro-line); border-radius: 6px; background: #fff; color: #475467; cursor: pointer; font: inherit; }
.experience-icon-button { width: 38px; padding: 0; font-size: 18px; }
.experience-command-button { min-width: 162px; gap: 9px; justify-content: flex-start; padding: 0 12px; border-color: #d8e0e9; background: #f8fafc; color: #536176; font-size: 11px; font-weight: 700; box-shadow: inset 0 1px 0 #fff; }
.experience-command-button span { margin-right: auto; }
.command-search-icon { position: relative; width: 14px; height: 14px; flex: 0 0 14px; border: 1.7px solid #7b8797; border-radius: 50%; }
.command-search-icon::after { content: ""; position: absolute; width: 5px; height: 1.7px; right: -4px; bottom: -2px; border-radius: 2px; background: #7b8797; transform: rotate(45deg); transform-origin: left center; }
.experience-command-button:hover,
.experience-icon-button:hover { border-color: #aebbc9; background: #f9fbfd; color: var(--pro-ink); }
.experience-command-button kbd,
.command-dialog kbd { padding: 2px 6px; border: 1px solid #d8e0ea; border-bottom-width: 2px; border-radius: 4px; background: #fff; color: #7a8798; font: 9px/1.5 inherit; }
.command-close-button { display: inline-grid; width: 34px; height: 34px; place-items: center; padding: 0; border: 1px solid #d8e0ea; border-radius: 5px; background: #fff; color: #667085; font-size: 21px; line-height: 1; cursor: pointer; }
.command-close-button:hover { border-color: #aebbc9; background: #f7f9fc; color: var(--pro-ink); }
.admin-global-search { margin-right: auto; }

.content,
.client-app .content { width: 100%; max-width: 1680px !important; margin-inline: auto; padding: 24px 26px 36px !important; }
.page-head { min-height: 64px; padding-bottom: 4px; }
.page-head h1 { color: var(--pro-ink); font-size: clamp(23px,2vw,29px); font-weight: 780; letter-spacing: 0; }
.page-head .muted,
.muted { color: var(--pro-muted); }

.panel,
.metric,
.summary-card,
.premium-metrics article,
.client-premium-hero,
.trade-watchlist,
.trade-chart-panel,
.trade-ticket,
.trade-desk-summary article { border: 1px solid var(--pro-line) !important; border-radius: 8px !important; box-shadow: var(--pro-shadow) !important; }
.panel { padding: 20px; }
.panel-head h2,
.panel h2 { color: var(--pro-ink); font-weight: 780; }
.metrics,
.premium-metrics,
.admin-dashboard-summary,
.finance-kpi-grid { gap: 12px; }
.metric,
.premium-metrics article,
.finance-kpi-grid article,
.summary-card { position: relative; overflow: hidden; }
.metric::after,
.premium-metrics article::after,
.finance-kpi-grid article::after,
.summary-card::after { content: ""; position: absolute; inset: auto 0 0; height: 2px; background: var(--brand); opacity: .55; }

.client-premium-hero { position: relative; overflow: hidden; border-color: #22304a !important; background: #101d33 !important; color: #fff; }
.client-premium-hero aside { position: relative; z-index: 1; border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.055); backdrop-filter: blur(10px); }

input,
select,
textarea { min-height: 42px; border-color: var(--pro-line-strong); border-radius: 6px; background: #fff; color: var(--pro-ink); }
input:focus,
select:focus,
textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb,var(--brand) 13%,transparent); }
textarea { min-height: 92px; }
.btn { border-radius: 6px; box-shadow: 0 1px 2px rgba(16,24,40,.08); }

.table-experience-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 0 8px; color: var(--pro-muted); font-size: 10px; font-weight: 700; }
.table-experience-tools button { min-height: 30px; padding: 5px 9px; border: 1px solid var(--pro-line-strong); border-radius: 5px; background: #fff; color: #475467; font: 700 10px/1 inherit; cursor: pointer; }
.table-experience-tools button:hover { border-color: #9eacbd; color: var(--pro-ink); }
.table-wrap { border-color: var(--pro-line); border-radius: 7px; background: #fff; box-shadow: 0 1px 2px rgba(16,24,40,.025); }
.table-wrap thead { position: sticky; top: 0; z-index: 2; }
th { height: 42px; background: #f7f9fc; color: #667085; }
td { height: 48px; font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: #f8fbff; }

.alert { position: relative; padding-right: 44px; border-width: 1px; border-radius: 7px; box-shadow: 0 8px 24px rgba(16,24,40,.05); }
.alert [data-alert-close] { position: absolute; top: 50%; right: 10px; width: 28px; height: 28px; padding: 0; border: 0; background: transparent; color: currentColor; font-size: 20px; transform: translateY(-50%); cursor: pointer; }

.command-palette[hidden] { display: none; }
.command-palette { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: start center; padding-top: min(16vh,140px); }
.command-palette-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(10,18,32,.58); backdrop-filter: blur(5px); }
.command-dialog { position: relative; width: min(620px,calc(100vw - 28px)); overflow: hidden; border: 1px solid rgba(255,255,255,.38); border-radius: 8px; background: #fff; box-shadow: 0 28px 80px rgba(8,15,30,.28); animation: command-in .16s ease-out; }
.command-search { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; min-height: 62px; padding: 10px 14px; border-bottom: 1px solid var(--pro-line); }
.command-search > span { color: #667085; font-size: 24px; }
.command-search input { min-height: 40px; padding: 0; border: 0; box-shadow: none !important; font-size: 15px; }
.command-results { max-height: min(54vh,470px); overflow-y: auto; padding: 8px; }
.command-results a { display: grid; grid-template-columns: 1fr auto; gap: 8px 18px; align-items: center; min-height: 52px; padding: 9px 12px; border-radius: 6px; color: var(--pro-ink); }
.command-results a strong { font-size: 13px; }
.command-results a small { color: #7b8797; font-size: 10px; }
.command-results a.active { background: color-mix(in srgb,var(--brand) 10%,#f7f9fc); color: color-mix(in srgb,var(--brand) 75%,#0f172a); }
.command-results > p { padding: 28px; color: var(--pro-muted); text-align: center; }
.command-dialog footer { display: flex; gap: 18px; padding: 9px 14px; border-top: 1px solid var(--pro-line); background: #f8fafc; color: #7b8797; font-size: 9px; }
@keyframes command-in { from { opacity: 0; transform: translateY(-10px) scale(.985); } }

.platform-toast-stack { position: fixed; z-index: 1200; right: 18px; bottom: 18px; display: grid; gap: 8px; width: min(360px,calc(100vw - 36px)); }
.platform-toast { padding: 13px 15px; border: 1px solid #b7dfd3; border-left: 3px solid var(--pro-success); border-radius: 6px; background: #fff; color: #24463c; box-shadow: 0 16px 40px rgba(16,24,40,.16); font-size: 12px; font-weight: 700; opacity: 0; transform: translateY(8px); transition: opacity .2s ease,transform .2s ease; }
.platform-toast.visible { opacity: 1; transform: translateY(0); }
.platform-toast.error { border-color: #f2c3ca; border-left-color: var(--pro-danger); color: #7e2532; }
.sidebar-overlay { display: none; }

body.sidebar-collapsed { grid-template-columns: 76px minmax(0,1fr) !important; }
body.sidebar-collapsed .sidebar { width: 76px !important; padding-inline: 10px !important; }
body.sidebar-collapsed .sidebar .brand { justify-content: center; padding-inline: 0; }
body.sidebar-collapsed .sidebar .brand img { max-width: 42px; object-fit: contain; object-position: left; }
body.sidebar-collapsed .admin-brand-copy,
body.sidebar-collapsed .client-brand-copy,
body.sidebar-collapsed .side-nav-label,
body.sidebar-collapsed .side-user span,
body.sidebar-collapsed .side-user small,
body.sidebar-collapsed .side-user > a:not(.user-badge),
body.sidebar-collapsed .side-nav a > span,
body.sidebar-collapsed .side-nav summary > span,
body.sidebar-collapsed .side-nav .nav-badge { display: none !important; }
body.sidebar-collapsed .side-nav { grid-template-columns: 1fr; padding-right: 0; }
body.sidebar-collapsed .side-nav a,
body.sidebar-collapsed .side-nav summary { display: flex; width: 54px; align-items: center; justify-content: center; padding: 8px 4px; color: transparent !important; font-size: 0; }
body.sidebar-collapsed .side-nav a::before,
body.sidebar-collapsed .side-nav summary::after { content: attr(data-nav-short); position: static; display: block !important; width: auto; height: auto; background: transparent; color: #aebbd0; font-size: 10px; font-weight: 850; }
body.sidebar-collapsed .side-nav a.active::before,
body.sidebar-collapsed .side-nav summary.active::after { color: #fff; }
body.sidebar-collapsed .side-subnav { margin-left: 0; padding-left: 0; border-left: 0; }
body.sidebar-collapsed .side-user { align-items: center; }
body.sidebar-collapsed .side-user .user-badge { justify-content: center; padding: 0; }

body.ui-compact .content,
body.ui-compact .client-app .content { padding-top: 16px !important; }
body.ui-compact .panel { margin-bottom: 11px; padding: 14px; }
body.ui-compact .metric,
body.ui-compact .premium-metrics article,
body.ui-compact .summary-card { min-height: 76px; padding: 12px 14px; }
body.ui-compact td { height: 40px; padding-block: 8px; }
body.ui-compact th { height: 36px; padding-block: 8px; }
body.ui-compact .page-head { min-height: 52px; margin-bottom: 12px; }

@media (max-width: 1180px) {
    .experience-command-button { min-width: 150px; padding-inline: 10px; }
}

@media (max-width: 900px) {
    body.app-shell { display: block !important; }
    body.app-shell .sidebar { position: fixed !important; z-index: 80; inset: 0 auto 0 0; width: min(290px,86vw) !important; height: 100dvh !important; padding: 14px !important; transform: translateX(-105%); }
    body.mobile-nav-open .sidebar { transform: translateX(0); }
    .sidebar-overlay { position: fixed; z-index: 70; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(8,15,30,.52); backdrop-filter: blur(2px); }
    body.mobile-nav-open .sidebar-overlay { display: block; }
    body.sidebar-collapsed .admin-brand-copy,
    body.sidebar-collapsed .client-brand-copy,
    body.sidebar-collapsed .side-nav-label,
    body.sidebar-collapsed .side-user span,
    body.sidebar-collapsed .side-user small,
    body.sidebar-collapsed .side-user > a:not(.user-badge),
    body.sidebar-collapsed .side-nav a > span,
    body.sidebar-collapsed .side-nav summary > span,
    body.sidebar-collapsed .side-nav .nav-badge { display: initial !important; }
    body.sidebar-collapsed .side-nav a,
    body.sidebar-collapsed .side-nav summary { width: auto; justify-content: initial; padding: 9px 11px; color: #aebbd0 !important; font-size: 12px; }
    body.sidebar-collapsed .side-nav a::before,
    body.sidebar-collapsed .side-nav summary::after { display: none !important; }
    .admin-topbar,
    .client-topbar { padding-inline: 12px !important; }
    .experience-command-button { display: none; }
    .content,
    .client-app .content { padding: 18px 14px 30px !important; }
}

@media (max-width: 640px) {
    .experience-tools { gap: 5px; }
    .experience-icon-button { width: 36px; min-height: 36px; }
    .admin-global-search { display: none !important; }
    .topbar-actions { gap: 5px; }
    .topbar-link { width: 36px; min-height: 36px; justify-content: center; padding: 0; }
    .page-head { margin-bottom: 14px; }
    .page-head h1 { font-size: 22px; }
    .panel { padding: 14px; }
    .command-palette { padding-top: 8vh; }
}

.auth-screen {
    min-height: 100vh;
    padding: 34px 18px;
    background: #eef2f7 !important;
    font-family: "Segoe UI Variable", "Segoe UI", Inter, Arial, sans-serif;
}

.auth-screen::before { display: none !important; }

.auth-card {
    position: relative;
    width: min(470px,100%);
    padding: 30px !important;
    border: 1px solid #dce4ed !important;
    border-radius: 8px !important;
    background: #fff !important;
    box-shadow: 0 24px 60px rgba(15,23,42,.12) !important;
}

.auth-card .brand {
    justify-content: flex-start;
    margin-bottom: 26px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--pro-line);
}

.auth-card h1 {
    margin-bottom: 22px;
    color: var(--pro-ink);
    font-size: 25px;
    font-weight: 720;
}

.auth-card .form-stack { gap: 15px; }
.auth-card .btn { width: 100%; margin-top: 4px; }
.auth-card .legal-disclosure { margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--pro-line); color: #7b8797; font-size: 10px; text-align: center; }

@media (max-width: 520px) {
    .auth-screen { align-items: flex-start; padding: 18px 12px; }
    .auth-card { padding: 22px 18px !important; }
}

/* Messaging workspace */
.support-stats {
    display: grid;
    grid-template-columns: repeat(6,minmax(0,1fr));
    gap: 9px;
    margin-bottom: 14px;
}

.support-stats > div {
    min-height: 68px;
    padding: 11px 13px;
    border: 1px solid var(--pro-line);
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(16,24,40,.025);
}

.support-stats small { display: block; color: var(--pro-muted); font-size: 10px; font-weight: 700; }
.support-stats strong { display: block; margin-top: 5px; color: var(--pro-ink); font-size: 20px; font-variant-numeric: tabular-nums; }

.chat-layout {
    display: grid !important;
    grid-template-columns: 310px minmax(0,1fr) !important;
    gap: 12px !important;
    align-items: stretch !important;
    min-height: 0;
}

.chat-layout.single-chat {
    width: min(1120px,100%);
    grid-template-columns: minmax(0,1fr) !important;
}

.conversations-panel,
.chat-panel {
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border-radius: 8px !important;
}

.conversations-panel {
    display: flex;
    max-height: 610px !important;
    flex-direction: column;
}

.conversation-panel-head {
    display: flex;
    min-height: 70px;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--pro-line);
}

.conversation-panel-head .eyebrow { margin: 0 0 2px; font-size: 8px; }
.conversation-panel-head h2 { margin: 0; font-size: 15px; }
.conversation-panel-head > span { display: grid; min-width: 27px; height: 27px; place-items: center; border-radius: 50%; background: #344054; color: #fff; font-size: 11px; font-weight: 800; }

.chat-search-form {
    display: block !important;
    padding: 11px 12px;
    border-bottom: 1px solid var(--pro-line);
    background: #fafbfd;
}

.chat-search-primary { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px; }
.chat-search-primary input { width: 100%; min-height: 38px; font-size: 11px; }
.chat-search-primary button,
.chat-filter-actions button { min-height: 38px; padding: 7px 10px; border: 1px solid var(--brand); border-radius: 5px; background: var(--brand); color: #fff; font-size: 10px; font-weight: 800; cursor: pointer; }

.chat-filter-disclosure { margin-top: 8px; }
.chat-filter-disclosure summary { color: #536176; font-size: 10px; font-weight: 800; cursor: pointer; }
.chat-filter-disclosure summary::marker { color: #8b98aa; }
.chat-filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding-top: 8px; }
.chat-filter-grid select { width: 100%; min-width: 0; min-height: 36px; padding-inline: 8px 24px; font-size: 10px; }
.chat-unread-filter { grid-column: 1/-1; display: flex; align-items: center; gap: 7px; min-height: 28px; color: #536176; font-size: 10px; }
.chat-unread-filter input { width: 15px; min-height: 15px; height: 15px; margin: 0; }
.chat-filter-actions { grid-column: 1/-1; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-filter-actions button { min-height: 32px; }
.chat-filter-actions a { color: #667085; font-size: 10px; font-weight: 700; }

.conversation-list {
    display: block !important;
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    padding: 6px !important;
}

.conversation-list a {
    display: grid !important;
    grid-template-columns: 36px minmax(0,1fr) auto !important;
    gap: 9px !important;
    align-items: center;
    min-height: 68px;
    margin: 0 0 3px;
    padding: 8px 9px !important;
    border: 1px solid transparent !important;
    border-radius: 6px !important;
    background: transparent !important;
    box-shadow: none !important;
}

.conversation-list a:hover { background: #f5f8fb !important; }
.conversation-list a.active { border-color: #bfe5dc !important; background: #effaf7 !important; box-shadow: inset 2px 0 0 var(--brand) !important; }
.conversation-list .avatar { width: 36px !important; height: 36px !important; }
.conversation-list strong { color: var(--pro-ink); font-size: 11px !important; }
.conversation-list small { margin-top: 1px; color: #7b8797; font-size: 9px !important; }
.conversation-list em { min-width: 20px !important; height: 20px !important; font-size: 9px !important; }
.conversation-tags { display: flex !important; gap: 4px; margin-top: 4px !important; }
.conversation-tags b { padding: 2px 5px; border-radius: 3px; background: #eef2f6; color: #566477; font-size: 8px; font-weight: 800; }
.conversation-wait { color: #996200 !important; font-weight: 700; }
.conversation-wait.breached { color: var(--pro-danger) !important; }

.chat-panel { display: flex; min-height: 0; flex-direction: column; background: #fff; }
.chat-head {
    display: flex !important;
    min-height: 76px !important;
    align-items: center !important;
    gap: 11px !important;
    padding: 13px 16px !important;
    border-bottom: 1px solid var(--pro-line) !important;
    background: #fff !important;
}

.chat-head .avatar { width: 40px; height: 40px; }
.chat-head > div:not(.chat-head-actions) { min-width: 0; }
.chat-head h2 { margin: 0; color: var(--pro-ink); font-size: 15px !important; }
.chat-head .muted { overflow: hidden; max-width: 360px; margin: 2px 0 0; color: #7a8798; font-size: 9px !important; text-overflow: ellipsis; white-space: nowrap; }
.chat-presence { display: block; margin-top: 3px; color: #8b98aa; font-size: 9px; font-weight: 700; }
.chat-presence.online { color: var(--pro-success); }
.chat-head-actions { display: flex; margin-left: auto; align-items: center; gap: 7px; }
.chat-head .btn,
.chat-head .chat-notification-toggle { margin-left: 0 !important; min-height: 34px; padding: 6px 10px; border-radius: 5px; font-size: 9px; box-shadow: none; }
.chat-notification-toggle { border: 1px solid #cdd8e4; background: #fff; color: #526176; font-weight: 800; cursor: pointer; }
.chat-notification-toggle.active { border-color: #9ddccb; background: #effbf7; color: #08775a; }
.chat-client-status { padding: 5px 8px; border-radius: 999px; background: #eef2f6; color: #536176; font-size: 9px; font-weight: 800; }

.chat-thread-controls {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px !important;
    align-items: end;
    padding: 9px 12px !important;
    border-bottom: 1px solid var(--pro-line) !important;
    background: #f8fafc !important;
}

.chat-thread-controls label { display: flex !important; min-width: 0 !important; align-items: center; gap: 6px !important; color: #667085; font-size: 9px !important; }
.chat-thread-controls select { width: auto !important; min-width: 112px !important; min-height: 34px !important; padding: 6px 28px 6px 9px !important; font-size: 10px !important; }
.chat-thread-controls .btn { min-height: 34px; }

.chat-secondary-toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--pro-line); background: #fff; }
.chat-message-search { width: min(420px,100%) !important; min-height: 34px !important; margin: 0 !important; padding: 6px 10px !important; border: 1px solid #d7e0ea !important; border-radius: 5px !important; background: #f8fafc !important; font-size: 10px !important; }
.chat-export-client { margin: 0 0 0 auto !important; }

.chat-thread {
    display: block !important;
    height: clamp(280px,42vh,440px) !important;
    min-height: 280px;
    flex: 0 0 auto;
    overflow-y: scroll !important;
    overscroll-behavior-y: auto;
    touch-action: auto;
    scrollbar-gutter: stable;
    padding: 22px 24px !important;
    background: #f3f6fa !important;
    scrollbar-color: #bdc8d6 transparent;
}

.chat-thread::before {
    display: none;
}

.chat-load-older {
    align-self: center;
    margin: 0 auto 18px;
}

.chat-message { margin-bottom: 12px !important; }
.chat-bubble {
    min-width: 210px;
    max-width: min(680px,72%) !important;
    padding: 11px 13px 9px !important;
    border: 1px solid #dce3ec !important;
    border-radius: 8px 8px 8px 2px !important;
    background: #fff !important;
    color: #273548 !important;
    box-shadow: 0 2px 8px rgba(16,24,40,.045) !important;
}

.chat-message.mine .chat-bubble {
    border-color: #9edecd !important;
    border-radius: 8px 8px 2px 8px !important;
    background: #e8f8f3 !important;
}

.chat-message.internal .chat-bubble { border-color: #e6cc78 !important; background: #fff9df !important; }
.chat-message.pinned .chat-bubble { box-shadow: inset 3px 0 0 #4f46e5,0 2px 8px rgba(16,24,40,.045) !important; }
.chat-bubble strong { display: inline-block !important; margin: 0 0 6px !important; color: #667085; font-size: 10px !important; font-weight: 850; text-transform: uppercase; }
.chat-bubble p { margin: 0 !important; color: inherit; font-size: 13px !important; line-height: 1.55 !important; white-space: pre-wrap; }
.chat-message-meta { display: flex !important; gap: 5px 8px; justify-content: flex-end; margin-top: 8px !important; color: #8a96a6 !important; font-size: 9px !important; }
.chat-read-receipt.read { color: #08775a; font-weight: 800; }
.chat-message-actions { gap: 2px; margin-top: 6px; }
.chat-message-actions button { min-height: 24px; padding: 2px 6px; font-size: 9px; }
.chat-reply-reference { margin: 2px 0 7px; padding: 5px 7px; border-left-width: 2px; font-size: 9px; }

.chat-form {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) auto auto auto !important;
    gap: 8px !important;
    align-items: center !important;
    padding: 11px 12px !important;
    border-top: 1px solid var(--pro-line) !important;
    background: #fff !important;
}

.client-app .chat-form { grid-template-columns: minmax(0,1fr) auto auto !important; }

.chat-form textarea { height: 46px; min-height: 46px !important; max-height: 120px; padding: 12px !important; overflow-y: auto; resize: none; border-radius: 6px !important; font-size: 11px; line-height: 20px; }
.chat-form .chat-attachment-picker {
    position: relative;
    width: auto;
    min-width: 76px;
    max-width: 118px;
    min-height: 38px;
    padding: 7px 10px;
    overflow: hidden;
    border-radius: 5px;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-form .chat-attachment-picker input[type="file"] {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none;
}
.chat-form .chat-attachment-picker [data-chat-file-label] {
    display: block;
    max-width: 96px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-form > .btn { min-height: 38px; padding-inline: 13px; }
.chat-form > .chat-attachment-picker,
.chat-form > .chat-internal-toggle,
.chat-form > .btn {
    height: 40px;
    min-height: 40px;
    align-self: center;
    margin: 0;
}
.chat-internal-toggle { display: inline-flex !important; align-items: center; justify-content: center; gap: 6px; padding: 0 10px; border: 1px solid #e3d18d; border-radius: 5px; background: #fff9df; font-size: 9px; line-height: 1; white-space: nowrap; }
.chat-internal-toggle input { width: 14px; min-height: 14px; height: 14px; }
.chat-reply-preview { grid-column: 1/-1; }
.chat-audit { margin: 0; padding: 10px 14px; border-top: 1px solid var(--pro-line); background: #fafbfd; }

.chat-attachments {
    display: grid;
    gap: 7px;
    margin-top: 9px;
}
.chat-attachment-wrap { display: grid; gap: 6px; margin: 0 !important; }
.chat-attachment-preview-link { margin: 0 !important; }
.chat-attachment-preview {
    width: min(300px,100%) !important;
    max-height: 190px !important;
    border-color: #d6dee9 !important;
    border-radius: 6px !important;
    object-fit: cover;
}
.chat-attachment {
    display: grid !important;
    grid-template-columns: 42px minmax(0,1fr) auto;
    gap: 9px;
    align-items: center;
    width: min(360px,100%);
    margin: 0 !important;
    padding: 8px !important;
    border: 1px solid #d8e1eb !important;
    border-radius: 6px !important;
    background: rgba(255,255,255,.84) !important;
    color: #263548 !important;
    text-decoration: none;
}
.chat-attachment > span {
    display: grid;
    width: 42px;
    height: 34px;
    place-items: center;
    border-radius: 4px;
    background: #e9f0f8;
    color: #36516f;
    font-size: 8px;
    font-weight: 900;
}
.chat-attachment strong { overflow: hidden; margin: 0 !important; color: #263548 !important; font-size: 10px !important; text-overflow: ellipsis; text-transform: none; white-space: nowrap; }
.chat-attachment small { color: #7a8798; font-size: 8px; white-space: nowrap; }
.chat-attachment:hover { border-color: #9fb1c6 !important; background: #fff !important; }

.chat-upload-preview,
.chat-upload-progress { grid-column: 1 / -1; }
.chat-upload-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 9px;
    border: 1px dashed #b8c7d8;
    border-radius: 6px;
    background: #f8fafc;
}
.chat-upload-preview[hidden], .chat-upload-progress[hidden] { display: none !important; }
.chat-upload-item {
    display: grid;
    grid-template-columns: 32px minmax(0,125px) 22px;
    gap: 7px;
    align-items: center;
    min-width: 205px;
    padding: 6px;
    border: 1px solid #dbe3ed;
    border-radius: 5px;
    background: #fff;
}
.chat-upload-item > img,
.chat-upload-item > b { width: 32px; height: 32px; border-radius: 4px; object-fit: cover; }
.chat-upload-item > b { display: grid; place-items: center; background: #eaf0f7; color: #3f536c; font-size: 7px; }
.chat-upload-item > span { display: grid; min-width: 0; }
.chat-upload-item strong { overflow: hidden; color: #273548; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.chat-upload-item small { color: #8390a1; font-size: 8px; }
.chat-upload-item button { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: #eef2f6; color: #566579; cursor: pointer; }
.chat-upload-item button:hover { background: #fee2e2; color: #b42318; }
.chat-upload-progress { position: relative; height: 20px; overflow: hidden; border-radius: 4px; background: #e9eef4; }
.chat-upload-progress > span { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--brand,#00a982); transition: width .16s ease; }
.chat-upload-progress > small { position: relative; z-index: 1; display: grid; height: 100%; place-items: center; color: #253449; font-size: 8px; font-weight: 900; }
.chat-form.is-dragging-files { outline: 2px dashed var(--brand,#00a982); outline-offset: -7px; background: #f1fbf8 !important; }
.chat-form.is-dragging-files::before { grid-column: 1/-1; content: "Déposez vos fichiers ici"; color: #08775a; font-size: 10px; font-weight: 850; text-align: center; }

/* Financial command center */
.finance-center { container-type: inline-size; }
.finance-center .finance-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 12px;
    margin-bottom: 14px;
}
.finance-center .finance-kpi-grid article {
    display: grid;
    min-height: 116px;
    align-content: center;
    padding: 18px;
    border: 1px solid var(--pro-line);
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 7px 20px rgba(16,24,40,.045);
}
.finance-center .finance-kpi-grid span { color: #697789; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.finance-center .finance-kpi-grid strong { margin: 7px 0 3px; color: #152337; font-size: 22px; line-height: 1.1; }
.finance-center .finance-kpi-grid small { color: #8a96a6; font-size: 9px; }
.finance-center .positive { color: #07835f !important; }
.finance-center .negative { color: #d92d20 !important; }
.finance-filter-panel { margin-bottom: 14px; padding: 12px !important; }
.finance-filters { display: grid; grid-template-columns: minmax(210px,1.5fr) minmax(170px,1fr) 145px 145px auto auto; gap: 9px; align-items: end; }
.finance-filters label { display: grid; gap: 5px; color: #59677a; font-size: 9px; font-weight: 800; }
.finance-filters input, .finance-filters select { min-height: 38px; }
.finance-ledger-panel { padding: 0 !important; overflow: hidden; }
.finance-ledger-panel .panel-head { padding: 15px 17px; border-bottom: 1px solid var(--pro-line); }
.ledger-page-indicator { color: #778497; font-size: 9px; font-weight: 800; }
.finance-ledger-table { min-width: 940px; }
.finance-ledger-table th { padding: 9px 12px !important; background: #f7f9fc !important; color: #68768a !important; font-size: 9px !important; text-transform: uppercase; }
.finance-ledger-table td { padding: 11px 12px !important; vertical-align: middle; }
.finance-ledger-table td > strong { display: block; color: #263548; font-size: 10px; }
.finance-ledger-table td > small, .finance-ledger-table td > time + small { display: block; margin-top: 2px; color: #8a96a6; font-size: 8px; }
.finance-type { display: inline-flex; padding: 4px 7px; border-radius: 4px; background: #eef2f6; color: #4c5d73; font-size: 8px; font-weight: 850; }
.finance-type.type-deposit, .finance-type.type-profit { background: #e9f8f2; color: #08775a; }
.finance-type.type-withdrawal { background: #fff0ee; color: #b42318; }
.finance-type.type-trade { background: #eaf2ff; color: #2459a6; }
.finance-type.type-bonus, .finance-type.type-referral_bonus { background: #fff7dc; color: #8a6100; }
.amount-cell { text-align: right; white-space: nowrap; font-weight: 850; }
.row-action { display: inline-flex; min-height: 28px; align-items: center; padding: 4px 8px; border: 1px solid #d6dfeb; border-radius: 4px; color: #36516f; font-size: 8px; font-weight: 850; text-decoration: none; }
.row-action:hover { border-color: #9eb0c6; background: #f4f7fa; }
.ledger-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--pro-line); }
.ledger-pagination span { color: #738095; font-size: 9px; }
.ledger-pagination .disabled { pointer-events: none; opacity: .45; }

/* Client CRM actions */
.crm-task-workspace { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--pro-line); }
.crm-task-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.crm-task-heading h3 { margin: 0 0 3px; font-size: 14px; }
.crm-task-heading p { margin: 0; }
.crm-task-heading > span { padding: 5px 8px; border-radius: 4px; background: #eef2f6; color: #526176; font-size: 8px; font-weight: 850; }
.crm-task-create { display: grid; grid-template-columns: minmax(190px,1.5fr) 180px 125px auto; gap: 9px; align-items: end; padding: 12px; border: 1px solid #dfe6ef; border-radius: 6px; background: #f8fafc; }
.crm-task-create label { display: grid; gap: 5px; color: #59677a; font-size: 9px; font-weight: 800; }
.crm-task-create input, .crm-task-create select { min-height: 37px; }
.crm-task-create .crm-task-description { grid-column: 1 / -2; }
.crm-task-create textarea { min-height: 58px; resize: vertical; }
.crm-task-create > .btn { grid-column: -2; }
.crm-task-list { display: grid; gap: 7px; margin-top: 11px; }
.crm-task-item { display: grid; grid-template-columns: 64px minmax(0,1fr) auto; gap: 11px; align-items: center; padding: 10px 11px; border: 1px solid #dfe6ef; border-radius: 6px; background: #fff; }
.crm-task-item.overdue { border-color: #f1b5ae; box-shadow: inset 3px 0 0 #d92d20; }
.crm-task-item.status-completed { opacity: .67; background: #f8fafc; }
.crm-task-item.status-completed .crm-task-copy > strong { text-decoration: line-through; }
.crm-priority { display: inline-grid; min-height: 26px; place-items: center; padding: 3px 6px; border-radius: 4px; background: #eef2f6; color: #526176; font-size: 8px; font-weight: 850; }
.crm-priority.priority-high { background: #fff4e8; color: #9a4b00; }
.crm-priority.priority-urgent { background: #feeceb; color: #b42318; }
.crm-priority.priority-low { background: #edf7ff; color: #27618e; }
.crm-task-copy { min-width: 0; }
.crm-task-copy > strong { display: block; color: #263548; font-size: 11px; }
.crm-task-copy p { margin: 4px 0; color: #5e6d80; font-size: 9px; line-height: 1.45; }
.crm-task-copy small { color: #8793a3; font-size: 8px; }
.crm-task-actions { display: flex; align-items: center; gap: 5px; }
.crm-task-actions form { margin: 0; }
.crm-task-delete { display: grid; width: 28px; height: 28px; place-items: center; padding: 0; border: 1px solid #e1e6ed; border-radius: 4px; background: #fff; color: #8490a0; cursor: pointer; }
.crm-task-delete:hover { border-color: #f0b4ae; background: #fff1ef; color: #b42318; }
.dashboard-crm-reminders { padding: 0 !important; overflow: hidden; }
.dashboard-crm-reminders .panel-head { padding: 14px 16px; border-bottom: 1px solid var(--pro-line); }
.crm-reminder-strip { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
.crm-reminder-strip > a { display: grid; grid-template-columns: 58px minmax(0,1fr); gap: 5px 9px; padding: 12px 14px; border-right: 1px solid var(--pro-line); border-bottom: 1px solid var(--pro-line); color: inherit; text-decoration: none; }
.crm-reminder-strip > a:hover { background: #f8fafc; }
.crm-reminder-strip strong { overflow: hidden; align-self: center; color: #263548; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.crm-reminder-strip small { grid-column: 2; color: #8490a0; font-size: 8px; }

/* Notification preferences and session security */
.notification-preferences { margin-bottom: 14px; padding: 0 !important; overflow: hidden; }
.notification-preferences > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; cursor: pointer; list-style: none; }
.notification-preferences > summary::-webkit-details-marker { display: none; }
.notification-preferences > summary span { display: grid; gap: 2px; }
.notification-preferences > summary strong { color: #263548; font-size: 12px; }
.notification-preferences > summary small { color: #8490a0; font-size: 9px; }
.notification-preferences > summary b { color: var(--brand,#00a982); font-size: 9px; }
.notification-preference-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; padding: 0 16px 16px; border-top: 1px solid var(--pro-line); }
.notification-preference-grid > label { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 11px; border: 1px solid #dfe6ef; border-radius: 6px; background: #f8fafc; }
.notification-preference-grid > label span { display: grid; gap: 2px; }
.notification-preference-grid > label strong { color: #263548; font-size: 10px; }
.notification-preference-grid > label small { color: #8490a0; font-size: 8px; }
.notification-preference-grid input[type="checkbox"] { width: 34px; height: 18px; min-height: 18px; accent-color: var(--brand,#00a982); }
.notification-preference-grid > .btn { justify-self: start; }
.active-sessions-panel { margin-bottom: 14px; }
.profile-sessions-panel .panel-head { margin-bottom: 10px; }
.profile-session-list { display: grid; gap: 7px; }
.profile-session-item { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 9px 10px; border: 1px solid #dfe6ef; border-radius: 6px; background: #f8fafc; }
.session-device-icon { position: relative; display: block; width: 30px; height: 22px; border: 2px solid #65758a; border-radius: 3px; }
.session-device-icon::after { position: absolute; right: 6px; bottom: -5px; left: 6px; height: 2px; border-radius: 2px; background: #65758a; content: ""; }
.profile-session-item > div { display: grid; gap: 3px; min-width: 0; }
.profile-session-item strong { color: #263548; font-size: 10px; }
.profile-session-item small { overflow: hidden; color: #8490a0; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.profile-session-item form { margin: 0; }

/* Client market favorites */
.trade-market-item { position: relative; display: grid; grid-template-columns: minmax(0,1fr) 28px; align-items: center; gap: 2px; margin-bottom: 2px; }
.trade-market-item[hidden] { display: none; }
.trade-market-item .trade-market-row { min-width: 0; }
.trade-favorite-form { margin: 0; }
.trade-favorite-button { display: grid; width: 27px; height: 27px; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #94a3b8; font-size: 17px; line-height: 1; cursor: pointer; }
.trade-favorite-button:hover { background: #f2f5f8; color: #526176; }
.trade-favorite-button.active { color: #d39200; }

/* Guided KYC workflow */
.kyc-workflow { display: grid; grid-template-columns: 238px minmax(0,1fr); padding: 0 !important; background: #fff; }
.kyc-verification-panel { width: min(100%,1180px); margin-inline: auto; overflow: hidden; scroll-margin-top: 86px; border: 1px solid #dce4ed; border-radius: 8px; background: #fff; box-shadow: 0 16px 42px rgba(21,37,54,.08); }
.kyc-verification-panel:focus { outline: none; }
.kyc-verification-panel .kyc-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 26px 30px 22px; background: #fff; }
.kyc-head-main { display: flex; min-width: 0; align-items: center; gap: 16px; }
.kyc-head-main .eyebrow { margin: 0 0 4px; color: #078266; font-size: 11px; font-weight: 800; letter-spacing: 0; text-transform: uppercase; }
.kyc-head-main h2 { margin: 0 0 5px; color: #17263a; font-size: 25px; line-height: 1.2; }
.kyc-head-main p.muted { margin: 0; color: #6b7789; font-size: 13px; line-height: 1.45; }
.kyc-identity-mark { position: relative; display: grid; width: 54px; height: 54px; flex: 0 0 54px; place-items: center; border: 1px solid #b9dfd5; border-radius: 8px; background: #eaf8f4; }
.kyc-identity-mark i { position: relative; width: 28px; height: 21px; border: 2px solid #078266; border-radius: 3px; }
.kyc-identity-mark i::before { position: absolute; top: 5px; left: 4px; width: 6px; height: 6px; border-radius: 50%; background: #078266; content: ""; }
.kyc-identity-mark i::after { position: absolute; top: 5px; right: 4px; width: 9px; height: 2px; background: #078266; box-shadow: 0 5px 0 #078266; content: ""; }
.kyc-head-status { display: grid; flex: 0 0 auto; justify-items: end; gap: 6px; }
.kyc-head-status small { color: #7d8998; font-size: 11px; font-weight: 700; }
.kyc-head-status .status { padding: 7px 11px; border-radius: 5px; font-size: 11px; }
.kyc-intro-facts { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); padding: 0 30px 24px; background: #fff; }
.kyc-intro-facts > span { display: flex; min-width: 0; align-items: center; gap: 11px; padding: 11px 14px; border: 1px solid #e2e8f0; border-right: 0; background: #f8fafc; }
.kyc-intro-facts > span:first-child { border-radius: 6px 0 0 6px; }
.kyc-intro-facts > span:last-child { border-right: 1px solid #e2e8f0; border-radius: 0 6px 6px 0; }
.kyc-intro-facts > span > i { display: grid; width: 28px; height: 28px; flex: 0 0 28px; place-items: center; border-radius: 50%; background: #e6f6f1; color: #078266; font-size: 9px; font-style: normal; font-weight: 900; }
.kyc-intro-facts > span > span { display: grid; min-width: 0; gap: 2px; }
.kyc-intro-facts b { color: #314157; font-size: 11px; }
.kyc-intro-facts small { overflow: hidden; color: #7a8798; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.kyc-workflow-progress { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 28px 18px; border-top: 1px solid #e3e9f0; border-right: 1px solid #e3e9f0; background: #f7f9fc; }
.kyc-workflow-progress::before { position: absolute; top: 56px; bottom: 56px; left: 37px; width: 1px; background: #d8e0e9; content: ""; }
.kyc-workflow-progress button { position: relative; z-index: 1; display: grid; grid-template-columns: 38px minmax(0,1fr); gap: 2px 11px; align-items: center; min-height: 66px; padding: 9px 10px; border: 0; border-radius: 6px; background: transparent; color: #78869a; text-align: left; cursor: pointer; }
.kyc-workflow-progress button:hover { background: #eef3f7; }
.kyc-workflow-progress button > span { grid-row: 1 / span 2; display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid #cbd5e1; border-radius: 50%; background: #fff; color: #66758a; font-size: 11px; font-weight: 900; box-shadow: 0 0 0 4px #f7f9fc; }
.kyc-workflow-progress button b { align-self: end; color: #394960; font-size: 12px; }
.kyc-workflow-progress button small { align-self: start; font-size: 10px; }
.kyc-workflow-progress button.active { background: #fff; box-shadow: 0 3px 12px rgba(29,48,69,.07); }
.kyc-workflow-progress button.active > span { border-color: #078266; background: #078266; color: #fff; box-shadow: 0 0 0 4px #dff4ed; }
.kyc-workflow-progress button.done > span { border-color: #99cdbf; background: #e3f5ef; color: #08775a; }
.kyc-workflow-body { min-width: 0; min-height: 430px; padding: 34px 38px 30px; border-top: 1px solid #e3e9f0; }
.kyc-workflow-pane { max-width: 760px; margin: 0 auto; }
.kyc-workflow-pane[hidden] { display: none; }
.kyc-workflow-pane > header { margin-bottom: 25px; }
.kyc-workflow-pane > header > span { display: inline-block; margin-bottom: 7px; color: #078266; font-size: 10px; font-weight: 900; text-transform: uppercase; }
.kyc-workflow-pane > header h3 { margin: 0 0 7px; color: #182638; font-size: 22px; line-height: 1.25; }
.kyc-workflow-pane > header p { max-width: 650px; margin: 0; color: #6d7a8c; font-size: 12px; line-height: 1.6; }
.kyc-form-grid { display: grid; grid-template-columns: minmax(220px,.85fr) minmax(320px,1.15fr); gap: 18px; align-items: start; }
.kyc-form-grid label, .kyc-workflow-pane > label { display: grid; gap: 8px; color: #3f4f64; font-size: 11px; font-weight: 800; }
.kyc-form-grid select, .kyc-form-grid textarea, .kyc-workflow-pane > label textarea { width: 100%; border-color: #cfd9e5; border-radius: 6px; background: #fff; font-size: 12px; }
.kyc-form-grid select { height: 48px; min-height: 48px; padding-block: 8px; }
.kyc-form-grid textarea { min-height: 112px; padding: 12px; line-height: 1.5; }
.kyc-address-field small { color: #8793a3; font-size: 9px; font-weight: 600; line-height: 1.5; }
.kyc-security-note { position: relative; display: grid; gap: 4px; margin-top: 20px; padding: 14px 16px 14px 45px; border: 1px solid #d9e6f2; border-radius: 6px; background: #f4f8fc; }
.kyc-security-note::before { position: absolute; top: 15px; left: 16px; display: grid; width: 20px; height: 20px; place-items: center; border: 1px solid #73a0c8; border-radius: 50%; color: #356d9e; content: "i"; font-size: 11px; font-weight: 900; }
.kyc-security-note strong { color: #284e72; font-size: 11px; }
.kyc-security-note span { color: #60768c; font-size: 10px; line-height: 1.55; }
.kyc-workflow-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 28px; padding-top: 20px; border-top: 1px solid #e5eaf1; }
.kyc-workflow-actions .btn { min-width: 118px; min-height: 42px; }
.kyc-workflow-error { grid-column: 1/-1; margin: 0 auto 18px; width: 100%; max-width: 760px; padding: 11px 13px; border: 1px solid #f0c6c0; border-radius: 5px; background: #fff2f0; color: #a52a20; font-size: 11px; font-weight: 800; }
.kyc-upload-grid.professional { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.kyc-upload-zone { position: relative; display: grid !important; min-height: 188px; place-items: center; align-content: center; gap: 9px; padding: 22px; border: 1px dashed #aebdcd; border-radius: 7px; background: #fbfcfe; color: #536176; text-align: center; cursor: pointer; transition: border-color .18s ease,background .18s ease,transform .18s ease; }
.kyc-upload-zone[hidden] { display: none !important; }
.kyc-upload-zone.passport { grid-column: 1/-1; }
.kyc-upload-zone:hover { border-color: #078266; background: #f2faf7; transform: translateY(-1px); }
.kyc-upload-zone.has-file, .kyc-upload-zone[data-existing="1"] { border-color: #69ad9a; background: #f0faf7; }
.kyc-upload-zone .kyc-upload-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 7px; background: #e8eef6; color: #3f5d7e; font-size: 12px; font-weight: 900; }
.kyc-upload-zone strong { color: #263548; font-size: 12px; }
.kyc-upload-zone small { max-width: 100%; overflow: hidden; color: #7d8999; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.kyc-upload-zone input[type="file"] { width: 100%; max-width: 290px; min-height: 36px; padding: 5px; border: 1px solid #d7e0ea; border-radius: 5px; background: #fff; color: #607086; font-size: 10px; }
.kyc-quality-checks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.kyc-quality-checks span { padding: 7px 10px; border: 1px solid #dce4ed; border-radius: 5px; background: #fff; color: #607086; font-size: 9px; font-weight: 750; }
.kyc-quality-checks span::before { margin-right: 6px; color: #08775a; content: "\2713"; }
.kyc-liveness-layout { display: grid; grid-template-columns: minmax(190px,.6fr) minmax(340px,1.4fr); gap: 24px; align-items: start; }
.kyc-camera-column { min-width: 0; }
.kyc-liveness-layout .kyc-liveness-steps { display: grid; grid-template-columns: 1fr; gap: 7px; margin: 0 0 14px; }
.kyc-liveness-layout .kyc-liveness-steps li { min-height: 42px; padding: 11px 12px; border: 1px solid #dfe6ef; border-radius: 5px; background: #fff; font-size: 11px; }
.kyc-liveness-layout .kyc-liveness-steps li.active { border-color: #4d8dcd; background: #eef6ff; color: #21558d; }
.kyc-liveness-layout .kyc-liveness-steps li.done { border-color: #b9dacc; background: #eff9f5; color: #08775a; }
.kyc-review-summary { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1px; margin-bottom: 20px; overflow: hidden; border: 1px solid #dfe6ef; border-radius: 6px; background: #dfe6ef; }
.kyc-review-summary > div { display: grid; gap: 5px; min-height: 88px; align-content: center; padding: 15px 17px; background: #fff; }
.kyc-review-summary span { color: #7a8798; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.kyc-review-summary strong { overflow-wrap: anywhere; color: #263548; font-size: 11px; }
.kyc-certification { display: flex !important; min-height: 68px; grid-template-columns: none !important; align-items: center; gap: 12px !important; margin-top: 18px; padding: 14px 16px; border: 1px solid #cfd9e5; border-radius: 6px; background: #f8fafc; }
.kyc-certification input { width: 19px; height: 19px; min-height: 19px; margin: 0; accent-color: var(--brand,#00a982); }
.kyc-certification span { display: grid; gap: 3px; }
.kyc-certification strong { color: #2c3b4f; font-size: 11px; }
.kyc-certification small { color: #7b8899; font-size: 9px; font-weight: 600; }
.kyc-review-readiness { display: grid; gap: 8px; padding: 12px 13px; border: 1px solid #ecd7ad; border-radius: 6px; background: #fffaf0; }
.kyc-review-readiness.complete { border-color: #b9dacc; background: #eff9f5; }
.kyc-review-readiness > div { display: flex; justify-content: space-between; gap: 10px; }
.kyc-review-readiness strong { color: #37465a; font-size: 10px; }
.kyc-review-readiness span { color: #748196; font-size: 9px; }
.kyc-review-readiness progress { width: 100%; height: 6px; accent-color: var(--brand,#00a982); }
.kyc-review-readiness ul { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; padding: 0; list-style: none; }
.kyc-review-readiness li { padding: 4px 6px; border-radius: 4px; background: #fff0ee; color: #a33b30; font-size: 8px; font-weight: 800; }
.kyc-review-readiness li.done { background: #e3f5ed; color: #08775a; }
.kyc-review-card button:disabled { cursor: not-allowed; filter: grayscale(.5); opacity: .45; }

/* Neutral client surfaces: remove colored reflections around dashboard panels. */
.client-app .panel {
    border-color: #dce3ec !important;
    background: #fff !important;
    box-shadow: 0 1px 2px rgba(15,23,42,.025), 0 10px 28px rgba(15,23,42,.055) !important;
}
.client-app .panel-head,
.client-app .settings-card-head,
.client-app .status-card-head {
    background: #fff !important;
}
.client-app .client-chart-card {
    overflow: hidden;
}
.client-app .client-chart-card .panel-head {
    margin: -18px -18px 14px;
    padding: 16px 18px 13px;
    border-bottom: 1px solid var(--premium-line-soft);
}
.client-app .client-financial-chart {
    background: #fff;
}

@media (max-width: 1100px) {
    .finance-center .finance-kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .finance-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .crm-task-create { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .crm-reminder-strip { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .crm-task-create .crm-task-description { grid-column: 1/-1; }
    .crm-task-create > .btn { grid-column: auto; }
    .notification-preference-grid { grid-template-columns: 1fr; }
    .kyc-workflow { grid-template-columns: 205px minmax(0,1fr); }
    .kyc-workflow-body { padding: 30px 26px 26px; }
    .kyc-workflow-progress { padding-inline: 12px; }
    .kyc-workflow-progress::before { left: 31px; }
    .kyc-workflow-progress button { grid-template-columns: 34px minmax(0,1fr); padding-inline: 7px; }
    .kyc-workflow-progress button > span { width: 30px; height: 30px; }
}
@media (max-width: 640px) {
    .finance-center .finance-kpi-grid { grid-template-columns: 1fr; }
    .finance-filters, .crm-task-create { grid-template-columns: 1fr; }
    .crm-task-create .crm-task-description, .crm-task-create > .btn { grid-column: 1; }
    .crm-task-item { grid-template-columns: 58px minmax(0,1fr); }
    .crm-reminder-strip { grid-template-columns: 1fr; }
    .crm-task-actions { grid-column: 1/-1; justify-content: flex-end; }
    .profile-session-item { grid-template-columns: 30px minmax(0,1fr); }
    .profile-session-item form { grid-column: 1/-1; justify-self: end; }
    .kyc-verification-panel { border-radius: 6px; }
    .kyc-workflow { grid-template-columns: 1fr; }
    .kyc-workflow-progress { display: grid; grid-template-columns: repeat(4,1fr); gap: 0; padding: 10px; border-right: 0; border-bottom: 1px solid #e3e9f0; }
    .kyc-workflow-progress::before { display: none; }
    .kyc-workflow-progress button { grid-template-columns: 1fr; justify-items: center; min-height: 62px; padding: 7px 3px; text-align: center; }
    .kyc-workflow-progress button > span { grid-row: auto; width: 28px; height: 28px; box-shadow: none; }
    .kyc-workflow-progress button small { display: none; }
    .kyc-workflow-body { min-height: 0; padding: 22px 16px; border-top: 0; }
    .kyc-verification-panel .kyc-panel-head { flex-direction: column; align-items: flex-start; padding: 20px 17px 16px; }
    .kyc-head-main { align-items: flex-start; }
    .kyc-head-main h2 { font-size: 21px; }
    .kyc-head-status { width: 100%; grid-auto-flow: column; align-items: center; justify-content: space-between; justify-items: start; }
    .kyc-intro-facts { grid-template-columns: 1fr; }
    .kyc-intro-facts { gap: 7px; padding: 0 17px 18px; }
    .kyc-intro-facts > span { padding: 10px 12px; border: 1px solid #e2e8f0; border-radius: 5px !important; }
    .kyc-intro-facts > span:last-child { border: 1px solid #e2e8f0; }
    .kyc-form-grid, .kyc-upload-grid.professional, .kyc-liveness-layout, .kyc-review-summary { grid-template-columns: 1fr; }
    .kyc-upload-zone.passport { grid-column: 1; }
    .kyc-workflow-actions { justify-content: stretch; }
    .kyc-workflow-actions .btn { flex: 1; }
}

@media (max-width: 1180px) {
    .support-stats { grid-template-columns: repeat(3,minmax(0,1fr)); }
    .chat-layout { grid-template-columns: 270px minmax(0,1fr) !important; }
    .chat-head-actions .chat-notification-toggle { display: none; }
}

@media (max-width: 900px) {
    .chat-layout,
    .chat-layout.single-chat { grid-template-columns: 1fr !important; min-height: 0; }
    .conversations-panel { max-height: 380px !important; }
    .conversation-list { max-height: 245px; }
    .chat-panel { min-height: 620px; }
    .chat-head-actions { flex-wrap: wrap; justify-content: flex-end; }
    .chat-panel { min-height: 0; }
    .chat-thread { min-height: 270px; height: 42vh !important; padding: 18px 14px !important; }
}

@media (max-width: 640px) {
    .support-stats { display: flex; overflow-x: auto; }
    .support-stats > div { min-width: 145px; }
    .chat-head { align-items: flex-start !important; padding: 11px 12px !important; }
    .chat-head .avatar { width: 34px; height: 34px; }
    .chat-head-actions { gap: 4px; }
    .chat-head-actions .btn.secondary { display: none; }
    .chat-thread-controls label { width: calc(50% - 4px); display: grid !important; }
    .chat-thread-controls select { width: 100% !important; }
    .chat-thread-controls .btn { width: 100%; }
    .chat-secondary-toolbar { padding: 7px 9px; }
    .chat-bubble { min-width: 140px; max-width: 88% !important; }
    .chat-form { grid-template-columns: 1fr auto !important; }
    .client-app .chat-form { grid-template-columns: 1fr auto !important; }
    .chat-form textarea,
    .chat-form .chat-reply-preview { grid-column: 1/-1; }
    .chat-form .chat-internal-toggle { grid-column: 1; }
    .chat-form .chat-attachment-picker { grid-column: 1; }
    .chat-form > .btn { grid-column: 2; grid-row: 2 / span 2; align-self: stretch; }
}

/* Premium interface system v2 */
body.app-shell::before { display: none !important; }

/* Account menu shared by administrators and account managers. */
.app-shell .admin-account-menu {
    position: relative;
    flex: 0 0 auto;
}

.app-shell .admin-account-menu > summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.app-shell .admin-account-menu > summary::-webkit-details-marker { display: none; }
.app-shell .admin-account-menu > summary::after {
    display: none;
}
.app-shell .admin-account-menu > summary:focus-visible { border-radius: 6px; outline: 3px solid color-mix(in srgb, var(--brand) 20%, transparent); outline-offset: 3px; }

.app-shell .admin-account-popover {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 110;
    width: 300px;
    overflow: hidden;
    border: 1px solid var(--premium-line, #dbe3ed);
    border-radius: 8px;
    background: var(--premium-surface, #fff);
    box-shadow: 0 18px 42px rgba(15,23,42,.18);
}

.app-shell .admin-account-popover header {
    display: grid;
    grid-template-columns: 42px minmax(0,1fr);
    align-items: center;
    gap: 11px;
    padding: 17px;
    border-bottom: 1px solid var(--premium-line-soft, #e9eef5);
}
.app-shell .admin-account-popover .avatar { width: 42px; height: 42px; }
.app-shell .admin-account-popover header > span { display: grid; min-width: 0; gap: 2px; }
.app-shell .admin-account-popover header strong,
.app-shell .admin-account-popover header small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-shell .admin-account-popover header strong { color: var(--premium-ink, #172235); font-size: 13px; }
.app-shell .admin-account-popover header small { color: var(--premium-muted, #66758b); font-size: 10px; }

.app-shell .admin-account-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding: 12px; }
.app-shell .admin-account-meta > span { display: grid; min-width: 0; gap: 4px; padding: 10px; border: 1px solid var(--premium-line-soft, #e9eef5); border-radius: 6px; background: var(--premium-surface-soft, #f7f9fc); }
.app-shell .admin-account-meta small { color: var(--premium-muted, #66758b); font-size: 8px; font-weight: 760; }
.app-shell .admin-account-meta strong { overflow: hidden; color: var(--premium-ink, #172235); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.app-shell .admin-account-popover nav { display: grid; gap: 3px; padding: 0 8px 8px; }
.app-shell .admin-account-popover nav a { min-height: 38px; padding: 10px 11px; border-radius: 6px; color: var(--premium-ink, #405169); font-size: 11px; font-weight: 760; }
.app-shell .admin-account-popover nav a:hover { background: var(--premium-surface-soft, #f7f9fc); }
.app-shell .admin-account-popover nav a.logout { color: #bd2636; }
.app-shell .admin-account-popover nav a.logout:hover { background: #fff1f2; color: #a31525; }

html[data-theme="dark"] .app-shell .admin-account-popover nav a.logout { color: #ff9ba7; }
html[data-theme="dark"] .app-shell .admin-account-popover nav a.logout:hover { background: #3d202b; color: #ffc4cb; }

.admin-own-profile-grid { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(300px,.75fr); gap: 16px; }
.admin-own-profile-identity { display: grid; grid-template-columns: 64px minmax(0,1fr); gap: 15px; align-items: center; padding-bottom: 18px; border-bottom: 1px solid var(--premium-line, #dbe3ed); }
.admin-own-profile-identity .avatar { width: 64px; height: 64px; }
.admin-own-profile-identity > div { display: grid; min-width: 0; gap: 3px; }
.admin-own-profile-identity h2 { margin: 0; }
.admin-own-profile-details { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 16px; }
.admin-own-profile-details > div { display: grid; gap: 4px; padding: 13px; border: 1px solid var(--premium-line-soft, #e9eef5); border-radius: 6px; background: var(--premium-surface-soft, #f7f9fc); }
.admin-own-profile-details span { color: var(--premium-muted, #66758b); font-size: 9px; font-weight: 780; text-transform: uppercase; }
.admin-own-profile-details strong { overflow-wrap: anywhere; color: var(--premium-ink, #172235); font-size: 12px; }
.admin-password-page { max-width: 1180px !important; }
.admin-password-panel { width: min(100%,720px); margin-inline: auto; }
.admin-password-panel .form-stack { gap: 14px; }
.admin-password-panel .inline-actions { margin-top: 4px; padding-top: 15px; border-top: 1px solid var(--premium-line, #dbe3ed); }
.business-health-metrics { grid-template-columns: repeat(4,minmax(0,1fr)); }
.compact-table table { font-size: 11px; }
.compact-table :is(th,td) { padding: 9px 10px; }
.scheduled-report-list { max-height: 360px; overflow-y: auto; scrollbar-color: #a9b5c5 transparent; }
.settings-switch { display: flex !important; min-height: 58px; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--premium-line, #dbe3ed); border-radius: 7px; background: var(--premium-surface-soft, #f7f9fc); }
.settings-switch > span { display: grid; gap: 3px; }
.settings-switch small { color: var(--premium-muted, #66758b); font-size: 9px; }
.settings-switch input { width: 18px !important; height: 18px !important; min-height: 18px !important; flex: 0 0 18px; }
.danger-zone { border-color: #efcbd0 !important; background: #fffafb !important; }
html[data-theme="dark"] .danger-zone { border-color: #5e3540 !important; background: #271b25 !important; }

/* Technical error supervision. */
.error-monitor-page { max-width: 1680px !important; }
.error-monitor-live-alert {
    width: 100%;
    min-height: 44px;
    margin: 0 0 16px;
    padding: 10px 14px;
    border: 1px solid #8ccdbb;
    border-radius: 7px;
    background: #ecf9f5;
    color: #08775a;
    font-size: 11px;
    font-weight: 820;
    cursor: pointer;
}
.error-monitor-live-alert:hover { border-color: #55ad95; background: #e2f5ef; }
.error-monitor-kpis strong { font-variant-numeric: tabular-nums; }
.error-filter-grid { display: grid; grid-template-columns: 160px 150px minmax(190px,1fr) minmax(220px,1.3fr) auto; gap: 10px; align-items: end; }
.error-filter-grid label { display: grid; min-width: 0; gap: 6px; }
.error-filter-grid :is(input,select) { width: 100%; min-width: 0; }
.error-filter-grid .btn { min-width: 92px; }
.error-event-list { display: grid; gap: 7px; }
.error-event {
    overflow: hidden;
    border: 1px solid var(--premium-line, #dbe3ed);
    border-left: 3px solid #df4053;
    border-radius: 7px;
    background: var(--premium-surface, #fff);
}
.error-event.warning { border-left-color: #d88a12; }
.error-event.fatal { border-left-color: #b91c2d; }
.error-event summary {
    display: grid;
    grid-template-columns: 92px minmax(220px,1fr) 190px 142px;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 10px 13px;
    cursor: pointer;
    list-style: none;
}
.error-event summary::-webkit-details-marker { display: none; }
.error-event summary:hover { background: var(--premium-surface-soft, #f7f9fc); }
.error-severity { justify-self: start; padding: 5px 8px; border-radius: 999px; background: #fff0f1; color: #b42333; font-size: 9px; font-weight: 850; }
.error-event.warning .error-severity { background: #fff6e7; color: #a86206; }
.error-event.fatal .error-severity { background: #feecee; color: #9d1828; }
.error-event-main { display: grid; min-width: 0; gap: 3px; }
.error-event-main strong { overflow: hidden; color: var(--premium-ink, #172235); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.error-event-main small { overflow: hidden; color: var(--premium-muted, #66758b); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.error-event summary code { overflow: hidden; color: #405169; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.error-event summary time { color: var(--premium-muted, #66758b); font-size: 9px; text-align: right; }
.error-event-details { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; padding: 13px; border-top: 1px solid var(--premium-line-soft, #e9eef5); background: var(--premium-surface-soft, #f7f9fc); }
.error-event-details > div { display: grid; min-width: 0; gap: 3px; }
.error-event-details span { color: var(--premium-muted, #66758b); font-size: 8px; font-weight: 780; text-transform: uppercase; }
.error-event-details strong { overflow-wrap: anywhere; color: var(--premium-ink, #172235); font-size: 10px; }
.error-event-details pre { grid-column: 1/-1; max-height: 240px; margin: 3px 0 0; padding: 11px; overflow: auto; border: 1px solid var(--premium-line, #dbe3ed); border-radius: 6px; background: #101b2e; color: #dbe6f2; font-size: 9px; line-height: 1.55; }
.error-log-maintenance { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.error-log-maintenance > div { min-width: 0; }
.error-log-maintenance form { display: grid; grid-template-columns: minmax(210px,280px) auto; align-items: end; gap: 9px; }
.error-log-maintenance label { display: grid; gap: 5px; }

html[data-theme="dark"] .error-monitor-live-alert { border-color: #2f7664; background: #17382f; color: #8addc5; }
html[data-theme="dark"] .error-event summary code { color: #b9c7d8; }
html[data-theme="dark"] .error-severity { background: #49222b; color: #ffabb5; }
html[data-theme="dark"] .error-event.warning .error-severity { background: #443019; color: #f4c477; }
html[data-theme="dark"] .error-event.fatal .error-severity { background: #4d2029; color: #ff9aa7; }

@media (max-width: 900px) {
    .admin-own-profile-grid { grid-template-columns: 1fr; }
    .business-health-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .error-filter-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .error-filter-grid .btn { width: 100%; }
    .error-event summary { grid-template-columns: 82px minmax(180px,1fr) 130px; }
    .error-event summary time { grid-column: 2/-1; text-align: left; }
    .error-log-maintenance { align-items: stretch; flex-direction: column; }
}

@media (max-width: 640px) {
    .app-shell .admin-account-menu > summary { grid-template-columns: 34px; padding-left: 0; }
    .app-shell .admin-account-menu > summary::after { display: none; }
    .app-shell .admin-account-popover { position: fixed; top: 66px; right: 9px; width: min(300px,calc(100vw - 18px)); }
    .admin-own-profile-details { grid-template-columns: 1fr; }
    .error-filter-grid { grid-template-columns: 1fr; }
    .error-event summary { grid-template-columns: 76px minmax(0,1fr); gap: 8px; }
    .error-event summary code,
    .error-event summary time { grid-column: 2; text-align: left; }
    .error-event-details { grid-template-columns: 1fr; }
    .error-log-maintenance form { grid-template-columns: 1fr; }
    .business-health-metrics { grid-template-columns: 1fr; }
}

.app-shell .content,
.client-app .content {
    width: min(100%,1680px);
    padding: 26px 28px 42px !important;
}

.app-shell .page-head {
    min-height: 70px;
    margin-bottom: 16px;
    padding: 3px 0 13px;
    border-bottom: 1px solid var(--premium-line);
}

.app-shell .page-head h1 {
    margin: 0;
    color: var(--premium-ink);
    font-size: 27px;
    font-weight: 720;
    line-height: 1.2;
}

.app-shell .page-head p,
.app-shell .page-head .muted {
    margin-top: 5px;
    color: var(--premium-muted);
    font-size: 12px;
}

.app-shell .eyebrow {
    margin-bottom: 5px;
    color: var(--premium-success);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.app-shell .panel,
.app-shell .metric,
.app-shell .summary-card,
.app-shell .settings-card,
.app-shell .status-card,
.app-shell .premium-metrics article,
.app-shell .finance-kpi-grid article,
.app-shell .admin-dashboard-summary article {
    border: 1px solid var(--premium-line) !important;
    border-radius: 7px !important;
    background: var(--premium-surface) !important;
    box-shadow: var(--premium-shadow) !important;
}

.app-shell .panel,
.app-shell .settings-card { padding: 20px; }

.app-shell .panel-head,
.app-shell .settings-card-head,
.app-shell .status-card-head,
.app-shell .notification-detail-head {
    background: var(--premium-surface) !important;
}

.app-shell .panel-head {
    min-height: 42px;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
    padding-bottom: 13px;
    border-bottom: 1px solid var(--premium-line-soft);
}

.app-shell .panel-head h2,
.app-shell .panel h2,
.app-shell .settings-card h2 {
    margin: 0;
    color: var(--premium-ink);
    font-size: 16px;
    font-weight: 720;
    line-height: 1.35;
}

.app-shell .panel-head p,
.app-shell .panel-head .muted {
    margin: 3px 0 0;
    color: var(--premium-muted);
    font-size: 11px;
}

.app-shell .metric::after,
.app-shell .premium-metrics article::after,
.app-shell .finance-kpi-grid article::after,
.app-shell .summary-card::after { display: none !important; }

.app-shell .metric,
.app-shell .premium-metrics article,
.app-shell .finance-kpi-grid article,
.app-shell .summary-card {
    min-height: 104px;
    padding: 17px 18px !important;
}

.app-shell .metric span,
.app-shell .premium-metrics span,
.app-shell .summary-card span {
    color: var(--premium-muted);
    font-size: 11px;
    font-weight: 700;
}

.app-shell .metric strong,
.app-shell .premium-metrics strong,
.app-shell .summary-card strong {
    color: var(--premium-ink);
    font-size: 22px;
    font-weight: 730;
    font-variant-numeric: tabular-nums;
}

.app-shell .metric em,
.app-shell .premium-metrics em,
.app-shell .summary-card em {
    color: #8793a4;
    font-size: 10px;
    font-style: normal;
}

.app-shell .btn,
.app-shell button.btn,
.app-shell .table-button,
.app-shell .mini.approve,
.app-shell .mini.primary-action {
    min-height: 40px;
    padding: 9px 14px;
    border: 1px solid var(--brand) !important;
    border-radius: 6px !important;
    background: var(--brand) !important;
    color: #fff !important;
    box-shadow: 0 1px 2px rgba(15,23,42,.08) !important;
    font-size: 11px;
    font-weight: 780;
    line-height: 1.2;
    transition: background .16s ease,border-color .16s ease,box-shadow .16s ease,transform .16s ease;
}

.app-shell .btn:hover,
.app-shell button.btn:hover,
.app-shell .table-button:hover,
.app-shell .mini.approve:hover,
.app-shell .mini.primary-action:hover {
    border-color: color-mix(in srgb,var(--brand) 82%,#000) !important;
    background: color-mix(in srgb,var(--brand) 82%,#000) !important;
    box-shadow: 0 4px 12px rgba(15,23,42,.10) !important;
    transform: translateY(-1px);
}

.app-shell .btn.secondary,
.app-shell button.btn.secondary,
.app-shell .mini.secondary {
    border-color: #cfd8e3 !important;
    background: #fff !important;
    color: #344054 !important;
    box-shadow: 0 1px 2px rgba(15,23,42,.04) !important;
}

.app-shell .btn.secondary:hover,
.app-shell button.btn.secondary:hover {
    border-color: #aebbc9 !important;
    background: #f8fafc !important;
}

.app-shell .btn.danger,
.app-shell button.btn.danger,
.app-shell .mini.reject {
    border-color: #e7b3bc !important;
    background: #fff5f6 !important;
    color: #b4233b !important;
    box-shadow: none !important;
}

.app-shell label {
    color: #46566c;
    font-size: 11px;
    font-weight: 750;
}

.app-shell input,
.app-shell select,
.app-shell textarea {
    min-height: 43px;
    border: 1px solid #cfd9e5;
    border-radius: 6px;
    background: #fff;
    color: var(--premium-ink);
    font: inherit;
    font-size: 12px;
    box-shadow: inset 0 1px 2px rgba(15,23,42,.025);
}

.app-shell textarea {
    min-height: 100px;
    line-height: 1.55;
    resize: vertical;
}

.app-shell input::placeholder,
.app-shell textarea::placeholder { color: #98a3b2; }

.app-shell input:hover,
.app-shell select:hover,
.app-shell textarea:hover { border-color: #aebcca; }

.app-shell input:focus,
.app-shell select:focus,
.app-shell textarea:focus {
    border-color: color-mix(in srgb,var(--brand) 72%,#8ea2bb);
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb,var(--brand) 12%,transparent);
}

.app-shell input[type="checkbox"],
.app-shell input[type="radio"] {
    min-height: auto;
    accent-color: var(--brand);
    box-shadow: none;
}

.app-shell .table-wrap {
    overflow: auto;
    border: 1px solid var(--premium-line);
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15,23,42,.025);
}

.app-shell table { border-collapse: separate; border-spacing: 0; }

.app-shell th {
    height: 44px;
    padding: 10px 13px;
    border-bottom: 1px solid var(--premium-line);
    background: #f7f9fc !important;
    color: #66758a;
    font-size: 9px;
    font-weight: 850;
    letter-spacing: 0;
    text-transform: uppercase;
    white-space: nowrap;
}

.app-shell td {
    height: 50px;
    padding: 11px 13px;
    border-bottom: 1px solid var(--premium-line-soft);
    color: #344054;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.app-shell tbody tr:last-child td { border-bottom: 0; }
.app-shell tbody tr:hover td { background: #f8fafc !important; }

.app-shell .status {
    min-height: 24px;
    padding: 4px 8px;
    border: 1px solid #d8e1eb;
    border-radius: 999px;
    background: #f7f9fc !important;
    color: #526176 !important;
    font-size: 9px;
    font-weight: 800;
    line-height: 1.2;
}

.app-shell .status.approved,
.app-shell .status.active,
.app-shell .status.executed,
.app-shell .status.closed {
    border-color: #b8ddcf !important;
    background: #edf9f5 !important;
    color: #06735a !important;
}

.app-shell .status.pending,
.app-shell .status.in_review {
    border-color: #ead5a9 !important;
    background: #fff8e9 !important;
    color: #976000 !important;
}

.app-shell .status.rejected,
.app-shell .status.failed,
.app-shell .status.inactive {
    border-color: #efc4cb !important;
    background: #fff2f4 !important;
    color: #b4233b !important;
}

.app-shell .alert {
    min-height: 48px;
    padding: 13px 44px 13px 15px;
    border: 1px solid #d7e2ec !important;
    border-left: 3px solid #4b78ae !important;
    border-radius: 6px;
    background: #f5f8fc !important;
    color: #38516e !important;
    box-shadow: none !important;
    font-size: 11px;
    line-height: 1.55;
}

.app-shell .alert.success {
    border-color: #c4e2d8 !important;
    border-left-color: var(--premium-success) !important;
    background: #f0faf7 !important;
    color: #17614f !important;
}

.app-shell .alert.error {
    border-color: #efcbd1 !important;
    border-left-color: var(--premium-danger) !important;
    background: #fff4f5 !important;
    color: #923044 !important;
}

.app-shell .tabs,
.app-shell .tab-switcher {
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--premium-line);
    border-radius: 7px;
    background: #f5f7fa;
}

.app-shell .tabs a,
.app-shell .tabs button,
.app-shell .tab-switcher label {
    min-height: 36px;
    border-radius: 5px;
    color: #66758a;
    font-size: 10px;
    font-weight: 750;
}

.app-shell .tabs a.active,
.app-shell .tabs button.active,
.app-shell .tab-switcher input:checked + label {
    background: #fff !important;
    color: var(--premium-ink) !important;
    box-shadow: 0 1px 3px rgba(15,23,42,.08);
}

.app-shell .admin-topbar,
.app-shell .client-topbar {
    min-height: 66px !important;
    border-bottom: 1px solid var(--premium-line) !important;
    background: rgba(255,255,255,.96) !important;
    box-shadow: 0 4px 18px rgba(15,23,42,.035) !important;
    backdrop-filter: blur(14px);
}

.app-shell .sidebar,
.client-app .sidebar {
    border-right: 1px solid rgba(255,255,255,.06) !important;
    background: var(--premium-navy) !important;
    box-shadow: 8px 0 24px rgba(15,23,42,.05) !important;
}

.app-shell .sidebar .brand {
    min-height: 64px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.app-shell .side-nav { gap: 3px; }

.app-shell .side-nav a,
.app-shell .side-nav summary {
    min-height: 42px;
    border: 1px solid transparent !important;
    border-radius: 6px !important;
    color: #aebbd0 !important;
    font-size: 11px;
    font-weight: 690;
}

.app-shell .side-nav a:hover,
.app-shell .side-nav summary:hover {
    background: rgba(255,255,255,.05) !important;
    color: #fff !important;
}

.app-shell .side-nav a.active,
.app-shell .side-nav summary.active,
.client-app .side-nav a.active {
    border-color: rgba(255,255,255,.07) !important;
    background: rgba(255,255,255,.075) !important;
    color: #fff !important;
    box-shadow: inset 3px 0 0 var(--brand) !important;
}

.app-shell .nav-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #d92d45;
    color: #fff;
    font-size: 9px;
    font-weight: 850;
}

.app-shell .chart-legend {
    color: #66758a;
    font-size: 10px;
    font-weight: 750;
}

.app-shell .premium-action-grid a,
.app-shell .next-premium-action,
.app-shell .compact-checklist a,
.app-shell .detail-grid > div,
.app-shell .settings-overview article {
    border: 1px solid var(--premium-line) !important;
    border-radius: 6px !important;
    background: #f8fafc !important;
    box-shadow: none !important;
}

.app-shell .premium-action-grid a:hover,
.app-shell .compact-checklist a:hover,
.app-shell .settings-overview article:hover {
    border-color: #b7c4d2 !important;
    background: #fff !important;
}

.app-shell .admin-tabs {
    top: 74px;
    gap: 3px;
    padding: 5px;
    border: 1px solid var(--premium-line);
    border-radius: 7px;
    background: rgba(255,255,255,.97);
    box-shadow: 0 5px 16px rgba(15,23,42,.045);
    backdrop-filter: blur(12px);
}

.app-shell .admin-tabs a {
    min-height: 36px;
    padding: 8px 12px;
    border-radius: 5px;
    color: #66758a;
    font-size: 10px;
    font-weight: 750;
}

.app-shell .admin-tabs a:hover,
.app-shell .admin-tabs a:focus {
    background: #f3f6f9;
    color: var(--premium-ink);
}

.client-app .market-tabs {
    gap: 8px;
    padding: 6px 10px 0;
    border-bottom: 1px solid var(--premium-line);
    background: #fff;
}

.client-app .market-tabs label {
    min-height: 48px;
    padding: 0 13px;
    border-bottom: 2px solid transparent;
    color: #66758a;
    font-size: 11px;
    font-weight: 750;
}

.client-app #tab-track:checked ~ .market-tabs label[for="tab-track"],
.client-app #tab-chart:checked ~ .market-tabs label[for="tab-chart"] {
    border-bottom-color: var(--brand);
    color: var(--premium-ink);
}

.app-shell .filters,
.app-shell .kyc-filter-bar,
.app-shell .finance-filters,
.app-shell .global-search-large {
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--premium-line);
    border-radius: 7px;
    background: #f8fafc;
}

.app-shell .notification-filter-bar {
    gap: 5px;
    padding: 5px;
    border: 1px solid var(--premium-line);
    border-radius: 7px;
    background: #f6f8fb;
}

.app-shell .notification-filter-bar a {
    min-height: 34px;
    padding: 8px 11px;
    border-radius: 5px;
    color: #66758a;
    font-size: 10px;
    font-weight: 750;
}

.app-shell .notification-filter-bar a.active {
    background: #fff;
    color: var(--premium-ink);
    box-shadow: 0 1px 3px rgba(15,23,42,.08);
}

@media (max-width: 1100px) {
    .app-shell .content,
    .client-app .content { padding: 22px 20px 34px !important; }
    .app-shell .page-head h1 { font-size: 24px; }
}

@media (max-width: 700px) {
    .app-shell .content,
    .client-app .content { padding: 16px 13px 28px !important; }
    .app-shell .page-head { min-height: 58px; margin-bottom: 12px; }
    .app-shell .page-head h1 { font-size: 21px; }
    .app-shell .panel,
    .app-shell .settings-card { padding: 15px; }
    .app-shell .panel-head { min-height: 38px; margin-bottom: 13px; padding-bottom: 11px; }
    .app-shell .metric,
    .app-shell .premium-metrics article,
    .app-shell .finance-kpi-grid article,
    .app-shell .summary-card { min-height: 92px; padding: 14px !important; }
    .app-shell .btn,
    .app-shell button.btn { min-height: 42px; }
    .client-app .client-chart-card .panel-head { margin: -15px -15px 12px; padding: 14px 15px 12px; }
}

/* System, light and dark appearance modes */
.theme-mode-icon {
    position: relative;
    display: block;
    width: 16px;
    height: 16px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
}

[data-theme-toggle][data-mode="system"] .theme-mode-icon {
    box-shadow: inset 7px 0 0 currentColor;
}

[data-theme-toggle][data-mode="light"] .theme-mode-icon {
    width: 12px;
    height: 12px;
    border: 0;
    background: currentColor;
    box-shadow: 0 -7px 0 -5px currentColor,0 7px 0 -5px currentColor,7px 0 0 -5px currentColor,-7px 0 0 -5px currentColor;
}

[data-theme-toggle][data-mode="dark"] .theme-mode-icon {
    border: 0;
    background: currentColor;
}

[data-theme-toggle][data-mode="dark"] .theme-mode-icon::after {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #fff;
    content: "";
}

html[data-theme="dark"] {
    --bg: #0d1422;
    --surface: #141e2f;
    --surface-2: #182437;
    --ink: #f1f5f9;
    --muted: #94a3b8;
    --line: #2a384b;
    --line-dark: #223044;
    --pro-ink: #f1f5f9;
    --pro-muted: #94a3b8;
    --pro-line: #2a384b;
    --pro-line-strong: #3a4a60;
    --pro-canvas: #0d1422;
    --pro-panel: #141e2f;
    --pro-shadow: 0 1px 2px rgba(0,0,0,.14),0 12px 28px rgba(0,0,0,.16);
    --ui-canvas: #0d1422;
    --ui-ink: #f1f5f9;
    --ui-muted: #94a3b8;
    --ui-line: #2a384b;
    --ui-line-soft: #223044;
    --ui-white: #141e2f;
    --ui-shadow: 0 1px 2px rgba(0,0,0,.14),0 12px 28px rgba(0,0,0,.16);
    --premium-canvas: #0d1422;
    --premium-surface: #141e2f;
    --premium-surface-soft: #182437;
    --premium-ink: #f1f5f9;
    --premium-text: #d4dce7;
    --premium-muted: #94a3b8;
    --premium-line: #2a384b;
    --premium-line-soft: #223044;
    --premium-navy: #090f1b;
    --premium-shadow: 0 1px 2px rgba(0,0,0,.14),0 12px 28px rgba(0,0,0,.16);
}

html[data-theme="dark"] body,
html[data-theme="dark"] body.app-shell,
html[data-theme="dark"] .app-shell {
    background: var(--premium-canvas) !important;
    color: var(--premium-text);
}

html[data-theme="dark"] .app-shell .admin-topbar,
html[data-theme="dark"] .app-shell .client-topbar {
    border-bottom-color: var(--premium-line) !important;
    background: rgba(20,30,47,.96) !important;
    box-shadow: 0 5px 20px rgba(0,0,0,.16) !important;
}

html[data-theme="dark"] .topbar-context span,
html[data-theme="dark"] .app-shell .muted,
html[data-theme="dark"] .app-shell .page-head p,
html[data-theme="dark"] .app-shell .page-head .muted { color: var(--premium-muted) !important; }

html[data-theme="dark"] .topbar-context strong,
html[data-theme="dark"] .app-shell .page-head h1,
html[data-theme="dark"] .app-shell .panel-head h2,
html[data-theme="dark"] .app-shell .panel h2,
html[data-theme="dark"] .app-shell .settings-card h2,
html[data-theme="dark"] .app-shell h1,
html[data-theme="dark"] .app-shell h2,
html[data-theme="dark"] .app-shell h3,
html[data-theme="dark"] .app-shell strong { color: var(--premium-ink); }

html[data-theme="dark"] .experience-icon-button,
html[data-theme="dark"] .experience-command-button,
html[data-theme="dark"] .command-close-button {
    border-color: var(--premium-line);
    background: #182437;
    color: #cbd5e1;
    box-shadow: none;
}

html[data-theme="dark"] [data-theme-toggle][data-mode="dark"] .theme-mode-icon::after { background: #182437; }

html[data-theme="dark"] .experience-icon-button:hover,
html[data-theme="dark"] .experience-command-button:hover,
html[data-theme="dark"] .command-close-button:hover {
    border-color: #45566d;
    background: #1d2a3e;
    color: #fff;
}

html[data-theme="dark"] .app-shell .panel,
html[data-theme="dark"] .app-shell .metric,
html[data-theme="dark"] .app-shell .summary-card,
html[data-theme="dark"] .app-shell .settings-card,
html[data-theme="dark"] .app-shell .status-card,
html[data-theme="dark"] .app-shell .premium-metrics article,
html[data-theme="dark"] .app-shell .finance-kpi-grid article,
html[data-theme="dark"] .app-shell .admin-dashboard-summary article,
html[data-theme="dark"] .client-app .panel {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface) !important;
    box-shadow: var(--premium-shadow) !important;
}

html[data-theme="dark"] .app-shell .panel-head,
html[data-theme="dark"] .app-shell .settings-card-head,
html[data-theme="dark"] .app-shell .status-card-head,
html[data-theme="dark"] .app-shell .notification-detail-head,
html[data-theme="dark"] .client-app .panel-head {
    border-color: var(--premium-line-soft) !important;
    background: var(--premium-surface) !important;
}

html[data-theme="dark"] .app-shell input,
html[data-theme="dark"] .app-shell select,
html[data-theme="dark"] .app-shell textarea {
    border-color: #35455a;
    background: #101a2a;
    color: #edf2f7;
    box-shadow: inset 0 1px 2px rgba(0,0,0,.16);
}

html[data-theme="dark"] .app-shell input:hover,
html[data-theme="dark"] .app-shell select:hover,
html[data-theme="dark"] .app-shell textarea:hover { border-color: #506078; }

html[data-theme="dark"] .app-shell input::placeholder,
html[data-theme="dark"] .app-shell textarea::placeholder { color: #718096; }

html[data-theme="dark"] .app-shell label { color: #b9c5d4; }

html[data-theme="dark"] .app-shell .btn.secondary,
html[data-theme="dark"] .app-shell button.btn.secondary,
html[data-theme="dark"] .app-shell .mini.secondary {
    border-color: #3a4a60 !important;
    background: #182437 !important;
    color: #dbe4ee !important;
}

html[data-theme="dark"] .app-shell .btn.secondary:hover,
html[data-theme="dark"] .app-shell button.btn.secondary:hover {
    border-color: #53647a !important;
    background: #1d2a3e !important;
}

html[data-theme="dark"] .app-shell .btn.danger,
html[data-theme="dark"] .app-shell button.btn.danger,
html[data-theme="dark"] .app-shell .mini.reject {
    border-color: #6b3440 !important;
    background: #351c26 !important;
    color: #f7a8b6 !important;
}

html[data-theme="dark"] .app-shell .table-wrap,
html[data-theme="dark"] .app-shell table { border-color: var(--premium-line); background: var(--premium-surface); }

html[data-theme="dark"] .app-shell th {
    border-color: var(--premium-line) !important;
    background: #182437 !important;
    color: #9fadc0;
}

html[data-theme="dark"] .app-shell td {
    border-color: var(--premium-line-soft);
    background: var(--premium-surface);
    color: #d4dce7;
}

html[data-theme="dark"] .app-shell tbody tr:hover td { background: #182437 !important; }

html[data-theme="dark"] .app-shell .premium-action-grid a,
html[data-theme="dark"] .app-shell .next-premium-action,
html[data-theme="dark"] .app-shell .compact-checklist a,
html[data-theme="dark"] .app-shell .detail-grid > div,
html[data-theme="dark"] .app-shell .settings-overview article,
html[data-theme="dark"] .app-shell .filters,
html[data-theme="dark"] .app-shell .kyc-filter-bar,
html[data-theme="dark"] .app-shell .finance-filters,
html[data-theme="dark"] .app-shell .global-search-large {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface-soft) !important;
    color: var(--premium-text);
}

html[data-theme="dark"] .app-shell .premium-action-grid a:hover,
html[data-theme="dark"] .app-shell .compact-checklist a:hover,
html[data-theme="dark"] .app-shell .settings-overview article:hover {
    border-color: #4a5b72 !important;
    background: #1b293d !important;
}

html[data-theme="dark"] .app-shell .admin-tabs,
html[data-theme="dark"] .app-shell .notification-filter-bar,
html[data-theme="dark"] .app-shell .tabs,
html[data-theme="dark"] .app-shell .tab-switcher {
    border-color: var(--premium-line);
    background: rgba(20,30,47,.97);
}

html[data-theme="dark"] .app-shell .admin-tabs a,
html[data-theme="dark"] .app-shell .notification-filter-bar a,
html[data-theme="dark"] .app-shell .tabs a,
html[data-theme="dark"] .app-shell .tabs button,
html[data-theme="dark"] .app-shell .tab-switcher label { color: #9eacbe; }

html[data-theme="dark"] .app-shell .notification-filter-bar a.active,
html[data-theme="dark"] .app-shell .tabs a.active,
html[data-theme="dark"] .app-shell .tabs button.active,
html[data-theme="dark"] .app-shell .tab-switcher input:checked + label {
    background: #223047 !important;
    color: #fff !important;
}

html[data-theme="dark"] .client-app .market-tabs {
    border-color: var(--premium-line);
    background: var(--premium-surface);
}

html[data-theme="dark"] .client-app .market-tabs label { color: #9eacbe; }
html[data-theme="dark"] .client-app #tab-track:checked ~ .market-tabs label[for="tab-track"],
html[data-theme="dark"] .client-app #tab-chart:checked ~ .market-tabs label[for="tab-chart"] { color: #fff; }

html[data-theme="dark"] .client-app .client-financial-chart,
html[data-theme="dark"] .client-app .tradingview-widget-container,
html[data-theme="dark"] .client-app .markets-terminal { background: var(--premium-surface) !important; }

html[data-theme="dark"] .kyc-verification-panel,
html[data-theme="dark"] .kyc-verification-panel .kyc-panel-head,
html[data-theme="dark"] .kyc-workflow,
html[data-theme="dark"] .kyc-workflow-body,
html[data-theme="dark"] .kyc-review-summary > div { background: var(--premium-surface) !important; }

html[data-theme="dark"] .kyc-intro-facts,
html[data-theme="dark"] .kyc-workflow-progress,
html[data-theme="dark"] .kyc-certification,
html[data-theme="dark"] .kyc-security-note,
html[data-theme="dark"] .kyc-upload-zone,
html[data-theme="dark"] .kyc-liveness-layout .kyc-liveness-steps li {
    border-color: var(--premium-line);
    background: var(--premium-surface-soft) !important;
}

html[data-theme="dark"] .kyc-workflow-progress button.active,
html[data-theme="dark"] .kyc-upload-zone input[type="file"] { background: #1b293d !important; }

html[data-theme="dark"] .kyc-workflow-pane > header h3,
html[data-theme="dark"] .kyc-head-main h2,
html[data-theme="dark"] .kyc-review-summary strong,
html[data-theme="dark"] .kyc-upload-zone strong { color: var(--premium-ink); }

html[data-theme="dark"] .chat-panel,
html[data-theme="dark"] .conversations-panel,
html[data-theme="dark"] .chat-head,
html[data-theme="dark"] .chat-form,
html[data-theme="dark"] .chat-secondary-toolbar,
html[data-theme="dark"] .chat-thread-controls {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface) !important;
}

html[data-theme="dark"] .chat-thread { background: #101a2a !important; }
html[data-theme="dark"] .conversation-list a { border-color: transparent !important; background: transparent !important; }
html[data-theme="dark"] .conversation-list a:hover { background: #1b293d !important; }
html[data-theme="dark"] .conversation-list a.active { border-color: #315f58 !important; background: #18342f !important; }
html[data-theme="dark"] .chat-bubble { border-color: #35455a; background: #1b293d; color: #e2e8f0; }
html[data-theme="dark"] .chat-message.mine .chat-bubble { border-color: #286c5c; background: #173a33; }

html[data-theme="dark"] .command-dialog {
    border-color: #45566d;
    background: var(--premium-surface);
    color: var(--premium-text);
}

html[data-theme="dark"] .command-search,
html[data-theme="dark"] .command-dialog footer { border-color: var(--premium-line); background: var(--premium-surface-soft); }
html[data-theme="dark"] .command-results a { color: var(--premium-text); }
html[data-theme="dark"] .command-results a.active { background: #223047; color: #fff; }

html[data-theme="dark"] .auth-screen { background: #0d1422 !important; }
html[data-theme="dark"] .auth-card {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface) !important;
    color: var(--premium-text);
    box-shadow: 0 26px 70px rgba(0,0,0,.36) !important;
}
html[data-theme="dark"] .auth-card h1 { color: var(--premium-ink); }

html[data-theme="dark"] .dashboard-layout-tools {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface) !important;
    box-shadow: var(--premium-shadow) !important;
}

html[data-theme="dark"] .dashboard-layout-tools.layout-edit-mode {
    border-color: color-mix(in srgb,var(--brand) 48%,var(--premium-line)) !important;
    background: color-mix(in srgb,var(--brand) 10%,var(--premium-surface)) !important;
}

html[data-theme="dark"] .dashboard-layout-tools strong { color: var(--premium-ink) !important; }
html[data-theme="dark"] .dashboard-layout-tools span,
html[data-theme="dark"] .layout-save-status { color: var(--premium-muted) !important; }

html[data-theme="dark"] .settings-hero {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface) !important;
    box-shadow: var(--premium-shadow) !important;
}

html[data-theme="dark"] .settings-hero h1 { color: var(--premium-ink) !important; }
html[data-theme="dark"] .settings-hero p:not(.eyebrow) { color: var(--premium-muted) !important; }

html[data-theme="dark"] .settings-health {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface-soft) !important;
}

html[data-theme="dark"] .settings-health span { color: var(--premium-muted) !important; }
html[data-theme="dark"] .settings-health strong { color: var(--premium-ink) !important; }
html[data-theme="dark"] .settings-overview span { color: var(--premium-muted) !important; }
html[data-theme="dark"] .settings-overview strong { color: var(--premium-ink) !important; }

html[data-theme="dark"] .settings-index {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface) !important;
    box-shadow: var(--premium-shadow) !important;
}

html[data-theme="dark"] .settings-index a { color: #aebbd0 !important; }
html[data-theme="dark"] .settings-index a:hover {
    background: #1b293d !important;
    color: #fff !important;
}

html[data-theme="dark"] .settings-index a.active {
    background: var(--brand) !important;
    color: #fff !important;
}

html[data-theme="dark"] .settings-card {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface) !important;
    box-shadow: var(--premium-shadow) !important;
}

html[data-theme="dark"] .settings-card-head {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface-soft) !important;
}

html[data-theme="dark"] .settings-card-head p { color: var(--premium-muted) !important; }
html[data-theme="dark"] .settings-card-head > span {
    background: #183a34 !important;
    color: #81d6bd !important;
}

html[data-theme="dark"] .settings-subsection { border-color: var(--premium-line-soft) !important; }

html[data-theme="dark"] .theme-card,
html[data-theme="dark"] .permission-editor .form-stack,
html[data-theme="dark"] .design-preview-main {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface-soft) !important;
}

html[data-theme="dark"] .theme-card strong,
html[data-theme="dark"] .design-preview-brand { color: var(--premium-ink) !important; }
html[data-theme="dark"] .theme-card span { color: var(--premium-muted) !important; }

html[data-theme="dark"] .design-preview {
    border-color: var(--premium-line) !important;
    background: #101a2a !important;
}

html[data-theme="dark"] .color-grid input[type="color"] {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface-soft) !important;
}

/* Complete dark-mode coverage for legacy admin and client components. */
html[data-theme="dark"] .users-list-panel,
html[data-theme="dark"] .users-accordion-list {
    border-color: var(--premium-line) !important;
    background: var(--premium-canvas) !important;
}

html[data-theme="dark"] .user-accordion-item,
html[data-theme="dark"] .user-accordion-item summary,
html[data-theme="dark"] .accordion-detail-card {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .user-accordion-item[open] {
    border-color: #3b5775 !important;
    box-shadow: 0 12px 28px rgba(0,0,0,.18) !important;
}

html[data-theme="dark"] .user-accordion-item summary:hover,
html[data-theme="dark"] .user-accordion-item[open] summary,
html[data-theme="dark"] .user-accordion-details,
html[data-theme="dark"] .modern-meta span {
    border-color: var(--premium-line-soft) !important;
    background: var(--premium-surface-soft) !important;
}

html[data-theme="dark"] .accordion-arrow {
    border-color: #40536b !important;
    background: #1b293d !important;
}

html[data-theme="dark"] .accordion-arrow::before { border-color: #8db7e5 !important; }
html[data-theme="dark"] .user-cell strong,
html[data-theme="dark"] .user-meta strong { color: var(--premium-ink) !important; }
html[data-theme="dark"] .user-cell small,
html[data-theme="dark"] .detail-label,
html[data-theme="dark"] .modern-meta em,
html[data-theme="dark"] .user-accordion-item .muted { color: var(--premium-muted) !important; }
html[data-theme="dark"] .user-balance { color: #56d7b4 !important; }

html[data-theme="dark"] .user-accordion-item .kyc-admin-links a {
    border: 1px solid var(--premium-line) !important;
    background: #1b293d !important;
    color: #b9c8da !important;
}

html[data-theme="dark"] .client-premium-hero > div,
html[data-theme="dark"] .client-premium-hero > aside {
    border-color: #2d3c52 !important;
    background: #141e2f !important;
    box-shadow: 0 12px 28px rgba(0,0,0,.16) !important;
}

html[data-theme="dark"] .client-premium-hero h1 { color: #f8fafc !important; }
html[data-theme="dark"] .client-premium-hero p,
html[data-theme="dark"] .client-premium-hero aside span,
html[data-theme="dark"] .client-premium-hero aside small { color: #aab8ca !important; }

html[data-theme="dark"] .portfolio-mini-list div,
html[data-theme="dark"] .premium-activity-list a {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface-soft) !important;
}

html[data-theme="dark"] .portfolio-mini-list div:hover,
html[data-theme="dark"] .premium-activity-list a:hover { background: #1b293d !important; }
html[data-theme="dark"] .portfolio-mini-list strong,
html[data-theme="dark"] .portfolio-mini-list b,
html[data-theme="dark"] .premium-activity-list strong { color: var(--premium-ink) !important; }
html[data-theme="dark"] .portfolio-mini-list em,
html[data-theme="dark"] .premium-activity-list em,
html[data-theme="dark"] .premium-activity-list span { color: var(--premium-muted) !important; }

html[data-theme="dark"] .app-shell .alert {
    border-color: #344860 !important;
    border-left-color: #5d8fc9 !important;
    background: #17273a !important;
    color: #b8cbe0 !important;
}

html[data-theme="dark"] .app-shell .alert.success {
    border-color: #285c50 !important;
    border-left-color: #20a881 !important;
    background: #142f2b !important;
    color: #9bd8c6 !important;
}

html[data-theme="dark"] .app-shell .alert.error {
    border-color: #673340 !important;
    border-left-color: #e05269 !important;
    background: #321c27 !important;
    color: #f2a7b4 !important;
}

html[data-theme="dark"] .app-shell :is(
    .layout-hidden-list,
    .layout-hidden-chip,
    .onboarding-list a,
    .onboarding-list span,
    .user-action-card,
    .manager-card,
    .admin-profile-card,
    .compact-list-item,
    .notification-info-card,
    .notification-field,
    .notification-item,
    .email-log-summary article,
    .status-metrics div,
    .status-list div,
    .status-timeline div,
    .payment-method-item,
    .method-card,
    .payment-help-list article,
    .selected-payment-panel,
    .payment-coordinate-grid div,
    .payment-summary-box,
    .payment-summary-grid div,
    .support-stats > div,
    .profile-session-item,
    .notification-preference-grid > label,
    .crm-task-create,
    .crm-task-item,
    .finance-kpi-grid article,
    .status-stat-card,
    .pending-part,
    .leaderboard a,
    .workbench-grid a,
    .workbench-list a,
    .action-list a,
    .search-result-card > a,
    .export-link-grid a,
    .empty-state
) {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface) !important;
    color: var(--premium-text) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .app-shell :is(
    .notification-item.unread,
    .notification-info-card.emphasis,
    .status-step-row span.todo,
    .search-result-card > a:hover,
    .export-link-grid a:hover,
    .leaderboard a:hover,
    .workbench-grid a:hover,
    .workbench-list a:hover,
    .action-list a:hover
) {
    border-color: #3b506a !important;
    background: var(--premium-surface-soft) !important;
}

html[data-theme="dark"] .app-shell :is(
    .kyc-panel-head,
    .kyc-step-card,
    .kyc-current-files,
    .kyc-selfie-review,
    .kyc-document-gallery figure,
    .kyc-liveness-admin,
    .kyc-rejection-note,
    .kyc-client-rejection,
    .period-switcher,
    .tab-switcher,
    .permission-editor form,
    .notification-message-preview,
    .payment-barcode,
    .chat-attachment,
    .chat-reply-reference,
    .chat-reply-preview,
    .chat-audit
) {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface-soft) !important;
    color: var(--premium-text) !important;
}

html[data-theme="dark"] .app-shell :is(
    .portfolio-spec-hero article,
    .spec-side-toggle label,
    .order-ticket-note,
    .spec-preview div,
    .spec-market-list a,
    .spec-trade-list div,
    .order-ticket-pro,
    .market-focus-panel,
    .market-focus-price div,
    .execution-metrics div,
    .position-metrics div,
    .trade-desk-balance,
    .trade-desk-summary article,
    .trade-ticket-preview span,
    .trade-position-row,
    .trade-risk-field
) {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface-soft) !important;
    color: var(--premium-text) !important;
}

html[data-theme="dark"] .app-shell :is(
    .market-tabs,
    .market-matrix th,
    .market-matrix td,
    .chart-watchlist,
    .personal-chart,
    .market-terminal-shell
) {
    border-color: var(--premium-line) !important;
    background-color: var(--premium-surface) !important;
    color: var(--premium-text) !important;
}

html[data-theme="dark"] .app-shell .market-matrix thead th,
html[data-theme="dark"] .app-shell .market-matrix tbody th { background: var(--premium-surface-soft) !important; }
html[data-theme="dark"] .app-shell .market-matrix .neutral-cell { background: #1b293d !important; }
html[data-theme="dark"] .app-shell .market-matrix .heat-down { background: #35212a !important; }

html[data-theme="dark"] .app-shell a { color: #5bb8a0; }
html[data-theme="dark"] .app-shell a:hover { color: #7bd4bd; }
html[data-theme="dark"] .app-shell .side-nav a,
html[data-theme="dark"] .app-shell .topbar-link { color: inherit; }

html[data-theme="dark"] .layout-icon-btn,
html[data-theme="dark"] .table-experience-tools button,
html[data-theme="dark"] .chat-attachment-picker,
html[data-theme="dark"] .chat-notification-toggle,
html[data-theme="dark"] .chat-load-older,
html[data-theme="dark"] .chat-message-actions,
html[data-theme="dark"] .spec-chart-toolbar button,
html[data-theme="dark"] .order-type-row button,
html[data-theme="dark"] .trade-range-buttons button {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface-soft) !important;
    color: #b9c7d8 !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .layout-icon-btn:hover,
html[data-theme="dark"] .table-experience-tools button:hover,
html[data-theme="dark"] .chat-attachment-picker:hover,
html[data-theme="dark"] .chat-load-older:hover,
html[data-theme="dark"] .spec-chart-toolbar button:hover,
html[data-theme="dark"] .trade-range-buttons button:hover {
    border-color: #4d6078 !important;
    background: #223047 !important;
    color: #fff !important;
}

html[data-theme="dark"] .compact-checklist i {
    border-color: var(--premium-line) !important;
    background: #1b293d !important;
    color: #b9c7d8 !important;
}

html[data-theme="dark"] .account-status-strip .ok {
    background: #14362f !important;
    color: #7fd8bd !important;
}

html[data-theme="dark"] .account-status-strip .warn {
    background: #392a17 !important;
    color: #efc377 !important;
}

html[data-theme="dark"] .impersonation-banner {
    border-color: #366b60 !important;
    background: #16342f !important;
    color: #a7dfcf !important;
}

html[data-theme="dark"] .impersonation-banner a {
    border-color: #4a7d71 !important;
    background: #1c453d !important;
    color: #d7f5ec !important;
}

html[data-theme="dark"] .side-user > a:not(.user-badge),
html[data-theme="dark"] .client-app .side-user > a:not(.user-badge) {
    border-color: rgba(255,255,255,.12) !important;
    background: transparent !important;
    color: #aebbd0 !important;
}

html[data-theme="dark"] .notification-type-badge.withdrawal,
html[data-theme="dark"] .notification-type-badge.kyc,
html[data-theme="dark"] .notification-type-badge.error {
    border-color: var(--premium-line) !important;
    background: #1b293d !important;
    color: #c4cfdd !important;
}

@media (prefers-color-scheme: dark) {
    html:not([data-theme]) { color-scheme: dark; }
    html:not([data-theme]) body { background: #0d1422; color: #d4dce7; }
}

/* Final dark-theme normalization for the complete client workspace. */
html[data-theme="dark"] .client-app .trade-desk-hero {
    border-color: var(--premium-line) !important;
    background: #141e2f !important;
    color: var(--premium-text) !important;
    box-shadow: var(--premium-shadow) !important;
}

html[data-theme="dark"] .client-app .trade-desk-hero h1,
html[data-theme="dark"] .client-app .trade-desk-hero p {
    color: var(--premium-ink) !important;
}

html[data-theme="dark"] .client-app .trade-desk-hero p,
html[data-theme="dark"] .client-app .trade-desk-balance span,
html[data-theme="dark"] .client-app .trade-desk-balance small {
    color: var(--premium-muted) !important;
}

html[data-theme="dark"] .client-app .trade-desk-balance {
    border-color: #35455a !important;
    background: #182437 !important;
}

html[data-theme="dark"] .client-app :is(
    .trade-watchlist,
    .trade-chart-panel,
    .trade-ticket,
    .trade-box-head,
    .trade-market-tools,
    .trade-chart-head,
    .trade-range-buttons,
    .trade-chart-footer,
    .trade-ticket form
) {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface) !important;
    color: var(--premium-text) !important;
}

html[data-theme="dark"] .client-app .trade-watch-scroll {
    background: var(--premium-surface) !important;
    scrollbar-color: #506078 transparent;
}

html[data-theme="dark"] .client-app .trade-box-head span,
html[data-theme="dark"] .client-app .trade-chart-head span,
html[data-theme="dark"] .client-app .trade-chart-head p,
html[data-theme="dark"] .client-app .trade-market-row small,
html[data-theme="dark"] .client-app .trade-ticket-preview small,
html[data-theme="dark"] .client-app .trade-risk-field small,
html[data-theme="dark"] .client-app .trade-chart-footer span {
    color: var(--premium-muted) !important;
}

html[data-theme="dark"] .client-app .trade-box-head strong,
html[data-theme="dark"] .client-app .trade-chart-head h2,
html[data-theme="dark"] .client-app .trade-price-box strong,
html[data-theme="dark"] .client-app .trade-market-row,
html[data-theme="dark"] .client-app .trade-market-row strong,
html[data-theme="dark"] .client-app .trade-market-row em,
html[data-theme="dark"] .client-app .trade-ticket-preview strong,
html[data-theme="dark"] .client-app .trade-chart-footer strong {
    color: var(--premium-ink) !important;
}

html[data-theme="dark"] .client-app .trade-market-row:hover,
html[data-theme="dark"] .client-app .trade-market-row.active {
    border-color: #3e5c7c !important;
    background: #1b2b40 !important;
}

html[data-theme="dark"] .client-app .trade-side-option,
html[data-theme="dark"] .client-app .trade-risk-field,
html[data-theme="dark"] .client-app .trade-ticket-preview span,
html[data-theme="dark"] .client-app .trade-duration-modes span,
html[data-theme="dark"] .client-app .trade-duration-input,
html[data-theme="dark"] .client-app .order-ticket-note {
    border-color: #35455a !important;
    background: #182437 !important;
    color: var(--premium-text) !important;
}

html[data-theme="dark"] .client-app .trade-side-option span,
html[data-theme="dark"] .client-app .trade-side-option b,
html[data-theme="dark"] .client-app .trade-duration-field > label {
    color: var(--premium-ink) !important;
}

html[data-theme="dark"] .client-app .trade-side-option small,
html[data-theme="dark"] .client-app .trade-duration-field > small {
    color: var(--premium-muted) !important;
}

html[data-theme="dark"] .client-app .trade-side-option.buy:has(input:checked) {
    border-color: #239b79 !important;
    background: #15362f !important;
    box-shadow: inset 0 0 0 1px #239b79 !important;
}

html[data-theme="dark"] .client-app .trade-side-option.sell:has(input:checked) {
    border-color: #b74b60 !important;
    background: #351f29 !important;
    box-shadow: inset 0 0 0 1px #b74b60 !important;
}

html[data-theme="dark"] .client-app .trade-side-option.buy:has(input:checked) b { color: #75d9bd !important; }
html[data-theme="dark"] .client-app .trade-side-option.sell:has(input:checked) b { color: #f1a0af !important; }

html[data-theme="dark"] .client-app .trade-main-chart {
    border-color: var(--premium-line) !important;
    background: #0b1220 !important;
}

html[data-theme="dark"] .client-app .trade-grid-lines {
    background-image:
        linear-gradient(rgba(82, 103, 130, .24) 1px, transparent 1px),
        linear-gradient(90deg, rgba(82, 103, 130, .18) 1px, transparent 1px) !important;
}

html[data-theme="dark"] .client-app .trade-chart-disclaimer {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface-soft) !important;
    color: var(--premium-muted) !important;
}

html[data-theme="dark"] .client-app .market-chip-row a {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface-soft) !important;
    color: var(--premium-text) !important;
}

html[data-theme="dark"] .client-app .market-chip-row a:hover {
    border-color: #465d77 !important;
    background: #1d2b40 !important;
}

html[data-theme="dark"] .client-app .market-chip-row span { color: var(--premium-muted) !important; }
html[data-theme="dark"] .client-app .market-chip-row strong { color: var(--premium-ink) !important; }

html[data-theme="dark"] .client-app .chat-layout.single-chat {
    width: 100% !important;
    max-width: none !important;
}

html[data-theme="dark"] .client-app :is(
    .chat-panel,
    .chat-head,
    .chat-secondary-toolbar,
    .chat-form
) {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface) !important;
    color: var(--premium-text) !important;
}

html[data-theme="dark"] .client-app .chat-thread {
    border-color: var(--premium-line) !important;
    background: #101a2a !important;
    scrollbar-color: #506078 transparent;
}

html[data-theme="dark"] .client-app .chat-message-search,
html[data-theme="dark"] .client-app .chat-form textarea {
    border-color: #35455a !important;
    background: #0f1928 !important;
    color: #edf2f7 !important;
    box-shadow: inset 0 1px 2px rgba(0,0,0,.18) !important;
}

html[data-theme="dark"] .client-app .chat-bubble {
    border-color: #35455a !important;
    background: #1b293d !important;
    color: #e2e8f0 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,.18) !important;
}

html[data-theme="dark"] .client-app .chat-message.mine .chat-bubble {
    border-color: #286c5c !important;
    background: #173a33 !important;
}

html[data-theme="dark"] .client-app .chat-bubble strong { color: #aebbd0 !important; }
html[data-theme="dark"] .client-app .chat-message-meta { color: #8594a8 !important; }
html[data-theme="dark"] .client-app .empty-chat { color: var(--premium-muted) !important; }

html[data-theme="dark"] .client-app .chat-client-status {
    background: #223047 !important;
    color: #c5d1df !important;
}

html[data-theme="dark"] .client-app .chat-notification-toggle.active {
    border-color: #367665 !important;
    background: #173a33 !important;
    color: #8ad9c2 !important;
}

html[data-theme="dark"] .client-app .chat-attachment-picker,
html[data-theme="dark"] .client-app .chat-export-client {
    border-color: #3a4a60 !important;
    background: #182437 !important;
    color: #dbe4ee !important;
}

/* The client conversation should use the available workspace in every theme. */
.client-app .chat-layout.single-chat {
    width: 100%;
    max-width: none;
}

/* Shared dark messaging workspace: admin, manager and client. */
html[data-theme="dark"] .app-shell :is(
    .conversations-panel,
    .chat-panel,
    .conversation-panel-head,
    .chat-search-form,
    .chat-head,
    .chat-thread-controls,
    .chat-secondary-toolbar,
    .chat-form,
    .chat-audit,
    .chat-retention-panel
) {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface) !important;
    color: var(--premium-text) !important;
}

html[data-theme="dark"] .app-shell .chat-search-form,
html[data-theme="dark"] .app-shell .chat-thread-controls,
html[data-theme="dark"] .app-shell .chat-secondary-toolbar,
html[data-theme="dark"] .app-shell .chat-audit {
    background: var(--premium-surface-soft) !important;
}

html[data-theme="dark"] .app-shell :is(
    .chat-search-primary input,
    .chat-filter-grid select,
    .chat-thread-controls select,
    .chat-message-search,
    .chat-form textarea,
    .chat-edit-input,
    .chat-retention-panel input
) {
    border-color: #35455a !important;
    background: #0f1928 !important;
    color: #edf2f7 !important;
    box-shadow: inset 0 1px 2px rgba(0,0,0,.18) !important;
}

html[data-theme="dark"] .app-shell :is(
    .chat-search-primary input,
    .chat-message-search,
    .chat-form textarea,
    .chat-edit-input
)::placeholder {
    color: #718096 !important;
}

html[data-theme="dark"] .app-shell .chat-filter-disclosure summary,
html[data-theme="dark"] .app-shell .chat-unread-filter,
html[data-theme="dark"] .app-shell .chat-thread-controls label,
html[data-theme="dark"] .app-shell .chat-filter-actions a {
    color: #aab8ca !important;
}

html[data-theme="dark"] .app-shell .conversation-list {
    background: var(--premium-surface) !important;
    scrollbar-color: #506078 transparent;
}

html[data-theme="dark"] .app-shell .conversation-list a {
    border-color: transparent !important;
    background: transparent !important;
}

html[data-theme="dark"] .app-shell .conversation-list a:hover {
    border-color: #344a64 !important;
    background: #1b293d !important;
}

html[data-theme="dark"] .app-shell .conversation-list a.active {
    border-color: #347a68 !important;
    background: #173a33 !important;
    box-shadow: inset 2px 0 0 var(--brand) !important;
}

html[data-theme="dark"] .app-shell .conversation-list strong { color: var(--premium-ink) !important; }
html[data-theme="dark"] .app-shell .conversation-list small { color: var(--premium-muted) !important; }
html[data-theme="dark"] .app-shell .conversation-tags b {
    background: #26364c !important;
    color: #c6d1df !important;
}

html[data-theme="dark"] .app-shell .chat-thread {
    border-color: var(--premium-line) !important;
    background: #101a2a !important;
    scrollbar-color: #506078 transparent;
}

html[data-theme="dark"] .app-shell .chat-bubble {
    border-color: #35455a !important;
    background: #1b293d !important;
    color: #e2e8f0 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,.2) !important;
}

html[data-theme="dark"] .app-shell .chat-message.mine .chat-bubble {
    border-color: #286c5c !important;
    background: #173a33 !important;
}

html[data-theme="dark"] .app-shell .chat-message.internal .chat-bubble {
    border-color: #806b31 !important;
    background: #332b18 !important;
    color: #f0ddb1 !important;
}

html[data-theme="dark"] .app-shell .chat-message.deleted .chat-bubble {
    border-color: #3a485c !important;
    background: #202c3e !important;
    color: #9eacbe !important;
    opacity: .78;
}

html[data-theme="dark"] .app-shell .chat-bubble strong { color: #aebbd0 !important; }
html[data-theme="dark"] .app-shell .chat-message-meta { color: #8594a8 !important; }
html[data-theme="dark"] .app-shell .chat-message.deleted [data-message-body] { color: #9eacbe !important; }

html[data-theme="dark"] .app-shell :is(
    .chat-message-actions,
    .chat-reply-reference,
    .chat-reply-preview,
    .chat-attachment,
    .chat-upload-preview,
    .chat-upload-item
) {
    border-color: #35455a !important;
    background: #182437 !important;
    color: #dbe4ee !important;
}

html[data-theme="dark"] .app-shell .chat-attachment:hover {
    border-color: #52657d !important;
    background: #223047 !important;
}

html[data-theme="dark"] .app-shell .chat-attachment > span,
html[data-theme="dark"] .app-shell .chat-upload-item > b {
    background: #26364c !important;
    color: #b9c9db !important;
}

html[data-theme="dark"] .app-shell .chat-attachment strong,
html[data-theme="dark"] .app-shell .chat-upload-item strong {
    color: var(--premium-ink) !important;
}

html[data-theme="dark"] .app-shell .chat-attachment small,
html[data-theme="dark"] .app-shell .chat-upload-item small { color: var(--premium-muted) !important; }

html[data-theme="dark"] .app-shell .chat-internal-toggle {
    border-color: #806b31 !important;
    background: #332b18 !important;
    color: #f0ddb1 !important;
}

html[data-theme="dark"] .app-shell .chat-attachment-picker,
html[data-theme="dark"] .app-shell .chat-notification-toggle,
html[data-theme="dark"] .app-shell .chat-message-actions button,
html[data-theme="dark"] .app-shell .chat-edit-controls button {
    border-color: #3a4a60 !important;
    background: #182437 !important;
    color: #dbe4ee !important;
}

html[data-theme="dark"] .app-shell .chat-notification-toggle.active {
    border-color: #367665 !important;
    background: #173a33 !important;
    color: #8ad9c2 !important;
}

html[data-theme="dark"] .app-shell .chat-client-status {
    background: #223047 !important;
    color: #c5d1df !important;
}

html[data-theme="dark"] .app-shell .chat-upload-progress {
    background: #26364c !important;
}

html[data-theme="dark"] .app-shell .chat-upload-progress > small {
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .app-shell .chat-form.is-dragging-files {
    background: #15362f !important;
}

/* Compatibility layer for legacy modules still using direct light colors. */
html[data-theme="dark"] .app-shell :is(
    .admin-global-search,
    .market-card,
    .client-message-item,
    .permission-matrix .check-row,
    .topbar-link,
    .period-switcher,
    .order-type-row button,
    .feature-band article
) {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface) !important;
    color: var(--premium-text) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .app-shell :is(
    .admin-global-search input,
    .global-search-large input
) {
    border-color: #35455a !important;
    background: #0f1928 !important;
    color: #edf2f7 !important;
}

html[data-theme="dark"] .app-shell :is(
    .market-card strong,
    .market-card span,
    .market-card em,
    .client-message-item strong,
    .permission-matrix .check-row strong,
    .topbar-link strong
) {
    color: inherit !important;
}

html[data-theme="dark"] .app-shell .notification-filter-bar a {
    border-color: transparent !important;
    background: transparent !important;
    color: var(--premium-muted) !important;
}

html[data-theme="dark"] .app-shell .notification-filter-bar a:hover,
html[data-theme="dark"] .app-shell .notification-filter-bar a.active {
    border-color: #40536b !important;
    background: #223047 !important;
    color: var(--premium-ink) !important;
}

html[data-theme="dark"] .app-shell .platform-toast {
    border-color: #37675b !important;
    border-left-color: #32b18d !important;
    background: #17342e !important;
    color: #b7e5d7 !important;
    box-shadow: 0 16px 40px rgba(0,0,0,.28) !important;
}

html[data-theme="dark"] .app-shell .platform-toast.error {
    border-color: #713746 !important;
    border-left-color: #e05269 !important;
    background: #351d27 !important;
    color: #f3b0bb !important;
}

html[data-theme="dark"] .app-shell .email-log-summary article {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface-soft) !important;
    color: var(--premium-text) !important;
}

html[data-theme="dark"] .app-shell :is(
    .chart-watchlist a,
    .chart-watchlist a:hover,
    .chart-watchlist a.active
) {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface-soft) !important;
    color: var(--premium-text) !important;
}

/* Dark states for account actions, trading footer and the complete KYC workflow. */
html[data-theme="dark"] .client-app .next-action-list a {
    border-color: #3b506a !important;
    background: #1b293d !important;
    color: #9dc5ef !important;
}

html[data-theme="dark"] .client-app .next-action-list a:hover {
    border-color: #526985 !important;
    background: #223247 !important;
}

html[data-theme="dark"] .client-app .next-action-list a.important {
    border-color: #347a68 !important;
    background: #173a33 !important;
    color: #82d8bf !important;
}

html[data-theme="dark"] .client-app .trade-chart-disclaimer a {
    color: #67b7a2 !important;
}

html[data-theme="dark"] .client-app .kyc-intro-facts {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface) !important;
}

html[data-theme="dark"] .client-app .kyc-intro-facts > span {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface-soft) !important;
}

html[data-theme="dark"] .client-app .kyc-intro-facts > span:last-child {
    border-color: var(--premium-line) !important;
}

html[data-theme="dark"] .client-app .kyc-intro-facts > span > i {
    background: #173a33 !important;
    color: #75d9bd !important;
}

html[data-theme="dark"] .client-app .kyc-intro-facts b { color: var(--premium-ink) !important; }
html[data-theme="dark"] .client-app .kyc-intro-facts small { color: var(--premium-muted) !important; }

html[data-theme="dark"] .client-app .kyc-workflow-progress {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface-soft) !important;
}

html[data-theme="dark"] .client-app .kyc-workflow-progress::before {
    background: #405067 !important;
}

html[data-theme="dark"] .client-app .kyc-workflow-progress button {
    background: transparent !important;
    color: var(--premium-muted) !important;
}

html[data-theme="dark"] .client-app .kyc-workflow-progress button:hover {
    background: #1d2b40 !important;
}

html[data-theme="dark"] .client-app .kyc-workflow-progress button b { color: #c8d3e0 !important; }
html[data-theme="dark"] .client-app .kyc-workflow-progress button small { color: var(--premium-muted) !important; }

html[data-theme="dark"] .client-app .kyc-workflow-progress button > span {
    border-color: #52627a !important;
    background: #1b293d !important;
    color: #b9c6d5 !important;
    box-shadow: 0 0 0 4px var(--premium-surface-soft) !important;
}

html[data-theme="dark"] .client-app .kyc-workflow-progress button.active {
    background: #1b293d !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .client-app .kyc-workflow-progress button.active > span {
    border-color: #19a47e !important;
    background: #168468 !important;
    color: #fff !important;
    box-shadow: 0 0 0 4px #193e37 !important;
}

html[data-theme="dark"] .client-app .kyc-workflow-progress button.done > span {
    border-color: #347a68 !important;
    background: #173a33 !important;
    color: #82d8bf !important;
}

html[data-theme="dark"] .client-app .kyc-workflow-body,
html[data-theme="dark"] .client-app .kyc-workflow-actions {
    border-color: var(--premium-line) !important;
}

html[data-theme="dark"] .client-app .kyc-workflow-pane > header h3,
html[data-theme="dark"] .client-app .kyc-form-grid label,
html[data-theme="dark"] .client-app .kyc-workflow-pane > label,
html[data-theme="dark"] .client-app .kyc-security-note strong,
html[data-theme="dark"] .client-app .kyc-certification strong,
html[data-theme="dark"] .client-app .kyc-review-readiness strong {
    color: var(--premium-ink) !important;
}

html[data-theme="dark"] .client-app .kyc-workflow-pane > header p,
html[data-theme="dark"] .client-app .kyc-address-field small,
html[data-theme="dark"] .client-app .kyc-security-note span,
html[data-theme="dark"] .client-app .kyc-certification small,
html[data-theme="dark"] .client-app .kyc-review-readiness span,
html[data-theme="dark"] .client-app .kyc-head-status small {
    color: var(--premium-muted) !important;
}

html[data-theme="dark"] .client-app :is(
    .kyc-security-note,
    .kyc-certification,
    .kyc-review-readiness,
    .kyc-quality-checks span,
    .kyc-liveness-layout .kyc-liveness-steps li,
    .kyc-review-summary > div
) {
    border-color: var(--premium-line) !important;
    background: var(--premium-surface-soft) !important;
    color: var(--premium-text) !important;
}

html[data-theme="dark"] .client-app .kyc-upload-zone {
    border-color: #45566d !important;
    background: #172234 !important;
    color: var(--premium-text) !important;
}

html[data-theme="dark"] .client-app .kyc-upload-zone:hover,
html[data-theme="dark"] .client-app .kyc-upload-zone.has-file,
html[data-theme="dark"] .client-app .kyc-upload-zone[data-existing="1"] {
    border-color: #347a68 !important;
    background: #173a33 !important;
}

html[data-theme="dark"] .client-app .kyc-upload-zone .kyc-upload-icon {
    background: #26364c !important;
    color: #b9c9db !important;
}

html[data-theme="dark"] .client-app .kyc-upload-zone small { color: var(--premium-muted) !important; }

html[data-theme="dark"] .client-app .kyc-liveness-layout .kyc-liveness-steps li.active {
    border-color: #3c6f9e !important;
    background: #192f47 !important;
    color: #9dc5ef !important;
}

html[data-theme="dark"] .client-app .kyc-liveness-layout .kyc-liveness-steps li.done,
html[data-theme="dark"] .client-app .kyc-review-readiness.complete {
    border-color: #347a68 !important;
    background: #173a33 !important;
    color: #82d8bf !important;
}

html[data-theme="dark"] .app-shell .status,
html[data-theme="dark"] .app-shell .status.none {
    border-color: #40536b !important;
    background: #223047 !important;
    color: #c5d1df !important;
}

html[data-theme="dark"] .app-shell :is(
    .status.approved,
    .status.active,
    .status.executed,
    .status.closed,
    .status.sent,
    .status.client
) {
    border-color: #347a68 !important;
    background: #173a33 !important;
    color: #82d8bf !important;
}

html[data-theme="dark"] .app-shell :is(
    .status.pending,
    .status.in_review
) {
    border-color: #806b31 !important;
    background: #332b18 !important;
    color: #f0d58f !important;
}

html[data-theme="dark"] .app-shell :is(
    .status.rejected,
    .status.failed,
    .status.inactive
) {
    border-color: #713746 !important;
    background: #351d27 !important;
    color: #f3b0bb !important;
}

html[data-theme="dark"] .app-shell :is(
    .status.info,
    .status.admin
) {
    border-color: #465985 !important;
    background: #202b49 !important;
    color: #b7c8f5 !important;
}
/* Professional actions and printable client record */
.trade-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

@media print {
    body.app-shell {
        background: #fff !important;
        color: #111827 !important;
    }

    .sidebar,
    .admin-topbar,
    .experience-tools,
    .admin-tabs,
    .page-head .inline-actions,
    .dashboard-layout-tools,
    .quick-actions,
    form,
    button {
        display: none !important;
    }

    body.app-shell .content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: none !important;
    }

    .panel,
    .summary-card,
    .admin-profile-card,
    .compact-list-item {
        background: #fff !important;
        color: #111827 !important;
        box-shadow: none !important;
        break-inside: avoid;
    }

    .panel *,
    .summary-card *,
    .admin-profile-card * {
        color: #111827 !important;
    }
}

/* Language selector shared by client and administration */
.language-switcher {
    display: inline-grid;
    grid-template-columns: repeat(2, 34px);
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--border, #d7e0ea);
    border-radius: 7px;
    background: var(--soft, #f5f8fb);
    flex: 0 0 auto;
}

.language-switcher button {
    width: 34px;
    min-width: 34px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--muted, #637083);
    font: inherit;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.language-switcher button:hover { color: var(--text, #122033); }

.language-switcher button.active {
    background: var(--brand, #00a982);
    color: #fff;
    box-shadow: 0 2px 7px rgba(0, 169, 130, .2);
}

html[data-theme="dark"] .language-switcher {
    border-color: #314159;
    background: #111d2e;
}

html[data-theme="dark"] .language-switcher button { color: #9fb0c5; }
html[data-theme="dark"] .language-switcher button:hover { color: #f6f8fb; }
html[data-theme="dark"] .language-switcher button.active { color: #fff; }

@media (max-width: 720px) {
    .language-switcher { grid-template-columns: repeat(2, 30px); }
    .language-switcher button { width: 30px; min-width: 30px; height: 28px; }
}

/* Consistent bilingual file selector */
.platform-file-picker {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 9px;
    align-items: center;
    width: 100%;
    min-width: 0;
}

.platform-file-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
}

.platform-file-button {
    min-height: 36px;
    padding: 8px 12px;
    border: 1px solid var(--border, #d4deea);
    border-radius: 6px;
    background: var(--soft, #f5f8fb);
    color: var(--text, #152238);
    font: inherit;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
}

.platform-file-button:hover { border-color: var(--brand, #00a982); }
.platform-file-name { min-width: 0; overflow: hidden; color: var(--muted, #68778c); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

html[data-theme="dark"] .platform-file-button {
    border-color: #34445b;
    background: #162338;
    color: #eff4fa;
}

html[data-theme="dark"] .platform-file-name { color: #9fb0c5; }

/* Production polish: shared contrast, responsive controls and operational tools. */
.notification-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.notification-actions form { margin: 0; }
.notification-actions .mini { white-space: nowrap; }
.notification-client-toolbar,
.notification-search-bar { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.notification-client-toolbar .notification-filter-bar { flex: 1 1 auto; margin: 0; }
.notification-search,
.notification-search-bar label { display: flex; align-items: end; gap: 8px; flex: 0 1 430px; }
.notification-search > span,
.notification-search-bar label > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.notification-search input,
.notification-search-bar input { min-width: 220px; }
.security-control-card { margin-bottom: 18px; border-left: 3px solid var(--brand); }
.security-control-form { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(220px, 340px) auto; align-items: end; gap: 14px; }
.security-control-form .check-row { align-self: center; }
.updater-preview-panel { border-color: color-mix(in srgb, var(--brand) 45%, #d7e0ea); }
.updater-last-result { border-left: 3px solid var(--brand); }
.updater-last-result.is-error { border-left-color: var(--danger, #c9364a); }
.updater-workflow {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin: 0 0 18px;
    overflow: hidden;
    border: 1px solid #d9e3ed;
    border-radius: 7px;
    background: #d9e3ed;
}
.updater-workflow > div {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
    padding: 13px 14px;
    background: #fff;
}
.updater-workflow b {
    display: inline-grid;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    place-items: center;
    border-radius: 50%;
    background: #e8f7f3;
    color: #087d66;
    font-size: 12px;
}
.updater-workflow span { display: grid; min-width: 0; gap: 2px; }
.updater-workflow strong { color: #152238; font-size: 12px; }
.updater-workflow small { color: #68778c; font-size: 10px; }
.updater-step-notice {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    border-left: 3px solid var(--brand);
    background: #f1faf7;
    color: #526174;
    font-size: 12px;
}
.updater-step-notice strong { color: #087d66; white-space: nowrap; }
.updater-install-callout { margin-bottom: 16px; }
.updater-install-button { min-height: 44px; font-weight: 800; }
.updater-cancel-form {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e1e8f0;
}
.updater-preview-panel:focus { outline: 3px solid color-mix(in srgb, var(--brand) 28%, transparent); outline-offset: 4px; }
.updater-manifest { margin: 16px 0; border: 1px solid #d9e3ed; border-radius: 6px; overflow: hidden; }
.updater-manifest summary { cursor: pointer; padding: 12px 14px; font-weight: 750; background: #f7fafc; }
.updater-manifest pre { max-height: 280px; overflow: auto; margin: 0; padding: 14px; background: #0f172a; color: #d9e6f2; font-size: 12px; line-height: 1.65; }
.client-dashboard-preferences { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 18px 0 10px; }
.client-dashboard-preferences > span { color: #64748b; font-size: 13px; font-weight: 700; }
.client-dashboard-preferences nav { display: inline-flex; padding: 3px; border: 1px solid #d8e2ec; border-radius: 7px; background: #fff; }
.client-dashboard-preferences a { min-width: 72px; padding: 7px 10px; border-radius: 5px; color: #526174; text-align: center; font-size: 12px; font-weight: 750; }
.client-dashboard-preferences a.active { background: #122033; color: #fff; }

html[data-theme="dark"] .app-shell {
    --premium-bg: #0b1320;
    --premium-surface: #142033;
    --premium-surface-soft: #19283c;
    --premium-border: #31445b;
    --premium-ink: #f2f6fb;
    --premium-muted: #a8b7c9;
}
html[data-theme="dark"] .app-shell :is(.panel, .metric, .finance-kpi-grid > article, .premium-metrics > article, .auth-card, .settings-grid > article) {
    background: var(--premium-surface) !important;
    border-color: var(--premium-border) !important;
    color: var(--premium-ink) !important;
}
html[data-theme="dark"] .app-shell :is(h1, h2, h3, h4, strong, label, th, td, .page-head, .panel-head) { color: var(--premium-ink); }
html[data-theme="dark"] .app-shell :is(.muted, small, em, .form-note, .panel-head span, .page-head p) { color: var(--premium-muted) !important; }
html[data-theme="dark"] .app-shell small.conversation-wait {
    color: #ff8795 !important;
    font-weight: 800;
}
html[data-theme="dark"] .app-shell small.conversation-wait.breached { color: #ff5f73 !important; }
html[data-theme="dark"] .app-shell :is(input, select, textarea) {
    background: #0f1a2a !important;
    border-color: #3a5069 !important;
    color: #f7f9fc !important;
    caret-color: #52d6b4;
}
html[data-theme="dark"] .app-shell :is(input, textarea)::placeholder { color: #8495aa !important; opacity: 1; }
html[data-theme="dark"] .app-shell :is(table tbody tr, .notification-item, .premium-activity-list a, .market-chip-row a) { border-color: #304258 !important; }
html[data-theme="dark"] .app-shell :is(table tbody tr:hover, .notification-item:hover, .premium-activity-list a:hover) { background: #1a2b40 !important; }
html[data-theme="dark"] .notification-client-toolbar,
html[data-theme="dark"] .notification-search-bar,
html[data-theme="dark"] .client-dashboard-preferences nav,
html[data-theme="dark"] .updater-manifest { background: #142033; border-color: #31445b; }
html[data-theme="dark"] .updater-workflow { border-color: #31445b; background: #31445b; }
html[data-theme="dark"] .updater-workflow > div { background: #142033; }
html[data-theme="dark"] .updater-workflow b { background: #173a33; color: #6ee7c5; }
html[data-theme="dark"] .updater-workflow strong { color: #f2f6fb; }
html[data-theme="dark"] .updater-workflow small { color: #a8b7c9 !important; }
html[data-theme="dark"] .updater-step-notice { border-left-color: #35c6a3; background: #142f2c; color: #b9c8d8; }
html[data-theme="dark"] .updater-step-notice strong { color: #6ee7c5 !important; }
html[data-theme="dark"] .updater-cancel-form { border-top-color: #31445b; }
html[data-theme="dark"] .client-dashboard-preferences a { color: #b3c0d0; }
html[data-theme="dark"] .client-dashboard-preferences a.active { background: #16a085; color: #fff; }
html[data-theme="dark"] .updater-manifest summary { background: #19283c; color: #f2f6fb; }

@media (max-width: 1100px) {
    .security-control-form { grid-template-columns: 1fr 1fr; }
    .security-control-form .btn { grid-column: 1 / -1; justify-self: start; }
    .notification-client-toolbar, .notification-search-bar { align-items: stretch; flex-direction: column; }
    .notification-search, .notification-search-bar label { flex: 1 1 auto; width: 100%; }
}
@media (max-width: 760px) {
    .content { padding-left: 14px; padding-right: 14px; }
    .page-head { align-items: flex-start; }
    .page-head, .panel-head, .client-dashboard-preferences { flex-direction: column; }
    .inline-actions, .page-head > form, .page-head > .btn { width: 100%; }
    .inline-actions .btn, .page-head > form .btn, .page-head > .btn { width: 100%; justify-content: center; }
    .security-control-form { grid-template-columns: 1fr; }
    .security-control-form .btn { grid-column: auto; width: 100%; }
    .notification-filter-bar { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
    .notification-filter-bar a { flex: 0 0 auto; }
    .notification-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
    .notification-actions { justify-content: flex-start; }
    .notification-item { align-items: flex-start; flex-direction: column; }
    .client-dashboard-preferences { align-items: stretch; }
    .client-dashboard-preferences nav { display: grid; grid-template-columns: repeat(3, 1fr); }
    .client-dashboard-preferences a { min-width: 0; }
    .table-wrap { overscroll-behavior-inline: contain; }
    .updater-workflow { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 540px) {
    .platform-file-picker { grid-template-columns: 1fr; }
    .updater-workflow { grid-template-columns: 1fr; }
    .updater-step-notice { align-items: flex-start; flex-direction: column; }
    .updater-cancel-form .btn { width: 100%; justify-content: center; }
}
