/*
|--------------------------------------------------------------------------
| KIKOBAR Light/Dark Theme Foundation
|--------------------------------------------------------------------------
| One explicit preference is shared by the portal, authentication pages and
| generated public website. Theme presentation never mutates business data.
*/

html[data-kb-theme="light"] {
    color-scheme: light;
}

html[data-kb-theme="dark"] {
    color-scheme: dark;
    --kb-dark-surface: #10233a;
    --kb-dark-surface-raised: #142d49;
    --kb-dark-border: #36506f;
    --kb-dark-text: #f2f7ff;
    --kb-dark-muted: #b8c7da;
    --kb-dark-accent: #78afff;
    --kb-card: #10233a;
    --kb-muted: #b8c7da;
    --kb-ink: #e6eef9;
    --kb-ink-soft: #a9bad0;
    --kb-primary: #54c7b7;
    --kb-primary-dark: #8be0d4;
    --kb-primary-soft: #123b40;
    --kb-navy: #d8e9ff;
    --kb-navy-deep: #071426;
    --kb-line: #29415f;
    --kb-bg: #071426;
    --kb-white: #10233a;
    --kb-success: #72d4a4;
    --kb-success-bg: #10362d;
    --kb-warning: #f7cb72;
    --kb-warning-bg: #3a2e13;
    --kb-danger: #ff9b9b;
    --kb-danger-bg: #3d1d25;
    --kb-shadow: 0 18px 48px rgba(0, 0, 0, .28);
    --kb-shadow-soft: 0 7px 24px rgba(0, 0, 0, .22);

    --kds-primary-900: #cfe2ff;
    --kds-primary-800: #a8cbff;
    --kds-primary-700: #7db2ff;
    --kds-primary-600: #5d9cff;
    --kds-primary-100: #16365f;
    --kds-primary-50: #102a49;
    --kds-teal-900: #bdeee7;
    --kds-teal-800: #91ddd2;
    --kds-teal-700: #60cbbb;
    --kds-teal-100: #123b40;
    --kds-green-700: #6dd5a3;
    --kds-green-100: #10362d;
    --kds-orange-700: #ffbe6c;
    --kds-orange-100: #3c2b15;
    --kds-red-700: #ff929e;
    --kds-red-100: #3c1c25;
    --kds-purple-700: #c2a1ff;
    --kds-purple-100: #2c2443;
    --kds-ink-900: #edf5ff;
    --kds-ink-700: #c3d2e4;
    --kds-ink-500: #9db0c6;
    --kds-ink-300: #72869d;
    --kds-surface: #10233a;
    --kds-background: #071426;
    --kds-border: #29415f;
    --kds-border-soft: #203852;
    --kds-shadow-sm: 0 8px 20px rgba(0, 0, 0, .20);
    --kds-shadow-md: 0 14px 34px rgba(0, 0, 0, .25);
    --kds-shadow-lg: 0 22px 50px rgba(0, 0, 0, .30);
}

.kb-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 13px;
    border: 1px solid rgba(255, 255, 255, .36);
    border-radius: 13px;
    color: #ffffff;
    background: rgba(255, 255, 255, .12);
    font: inherit;
    font-size: 12px;
    font-weight: 850;
    line-height: 1;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .09);
    transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.kb-theme-toggle:hover {
    background: rgba(255, 255, 255, .20);
    transform: translateY(-1px);
}

.kb-theme-toggle:focus-visible {
    outline: 3px solid #ffcf5a;
    outline-offset: 3px;
}

.kb-theme-toggle-icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

html[data-kb-theme="light"] [data-kb-theme-icon-light],
html[data-kb-theme="dark"] [data-kb-theme-icon-dark] {
    display: none;
}

/* Authentication shell */
.kb-auth-theme-control {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 20;
}

.kb-auth-theme-control .kb-theme-toggle {
    color: #0b3b83;
    background: rgba(255, 255, 255, .93);
    border-color: #c9d9ee;
    box-shadow: 0 8px 24px rgba(7, 38, 84, .13);
}

html[data-kb-theme="dark"] body,
html[data-kb-theme="dark"] .kb-main,
html[data-kb-theme="dark"] .kb-content {
    color: #e6eef9;
    background: #071426;
}

html[data-kb-theme="dark"] .kb-sidebar {
    color: #dceaff;
    background: #091a2d;
    border-color: #243d5a;
}

html[data-kb-theme="dark"] .kb-nav-link {
    color: #b7c7db;
}

html[data-kb-theme="dark"] .kb-nav-link:hover,
html[data-kb-theme="dark"] .kb-nav-link.is-active {
    color: #ffffff;
    background: #15375d;
}

html[data-kb-theme="dark"] .kb-sidebar-title,
html[data-kb-theme="dark"] .kb-user-mini-role,
html[data-kb-theme="dark"] .kb-card-subtitle,
html[data-kb-theme="dark"] .kb-content small {
    color: #9fb1c8;
}

html[data-kb-theme="dark"] .kb-user-mini,
html[data-kb-theme="dark"] .kb-sidebar-footer {
    border-color: #29415f;
}

html[data-kb-theme="dark"] .kb-card,
html[data-kb-theme="dark"] .kds-card,
html[data-kb-theme="dark"] .kb-record-row,
html[data-kb-theme="dark"] .kb-notification-inbox,
html[data-kb-theme="dark"] .kb-finance-table-wrap,
html[data-kb-theme="dark"] .table-wrap,
html[data-kb-theme="dark"] .kb-content table,
html[data-kb-theme="dark"] .kb-content fieldset,
html[data-kb-theme="dark"] .kb-content details {
    color: #e6eef9;
    background: #10233a !important;
    border-color: #29415f !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .18);
}

html[data-kb-theme="dark"] .kb-content h1,
html[data-kb-theme="dark"] .kb-content h2,
html[data-kb-theme="dark"] .kb-content h3,
html[data-kb-theme="dark"] .kb-content h4,
html[data-kb-theme="dark"] .kb-content strong,
html[data-kb-theme="dark"] .kb-card-title,
html[data-kb-theme="dark"] .kb-content label {
    color: #f2f7ff;
}

html[data-kb-theme="dark"] .kb-content p,
html[data-kb-theme="dark"] .kb-content li,
html[data-kb-theme="dark"] .kb-content td {
    color: #c1cee0;
}

html[data-kb-theme="dark"] .kb-content th {
    color: #dce9fa;
    background: #132c49;
    border-color: #29415f;
}

html[data-kb-theme="dark"] .kb-content td,
html[data-kb-theme="dark"] .kb-content tr,
html[data-kb-theme="dark"] .kb-content hr {
    border-color: #29415f;
}

html[data-kb-theme="dark"] .kb-content tr:hover td {
    background: #142d49;
}

html[data-kb-theme="dark"] .kb-content input:not([type="checkbox"]):not([type="radio"]),
html[data-kb-theme="dark"] .kb-content select,
html[data-kb-theme="dark"] .kb-content textarea,
html[data-kb-theme="dark"] .kb-input {
    color: #edf5ff;
    background: #0b1c30 !important;
    border-color: #36506f !important;
}

html[data-kb-theme="dark"] .kb-content input::placeholder,
html[data-kb-theme="dark"] .kb-content textarea::placeholder,
html[data-kb-theme="dark"] .kb-input::placeholder {
    color: #8296ae;
}

html[data-kb-theme="dark"] .kb-content input:focus,
html[data-kb-theme="dark"] .kb-content select:focus,
html[data-kb-theme="dark"] .kb-content textarea:focus,
html[data-kb-theme="dark"] .kb-input:focus {
    background: #0d2239 !important;
    border-color: #6aa7ff !important;
    box-shadow: 0 0 0 4px rgba(77, 151, 255, .18);
}

html[data-kb-theme="dark"] .kb-notification-inbox .is-unread {
    background: #102d50 !important;
    border-left-color: #66a5ff !important;
}

html[data-kb-theme="dark"] .kb-bottom-nav {
    background: rgba(9, 26, 45, .97);
    border-color: #29415f;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, .28);
}

html[data-kb-theme="dark"] .kb-bottom-link {
    color: #a7b8ce;
}

html[data-kb-theme="dark"] .kb-bottom-link.is-active {
    color: #ffffff;
    background: #173b65;
}

html[data-kb-theme="dark"] .kb-login-main,
html[data-kb-theme="dark"] .kb-login-page {
    background: #071426;
}

html[data-kb-theme="dark"] .kb-login-box {
    color: #e6eef9;
    background: rgba(16, 35, 58, .97);
    border-color: #29415f;
    box-shadow: 0 26px 70px rgba(0, 0, 0, .34);
}

html[data-kb-theme="dark"] .kb-login-main h2,
html[data-kb-theme="dark"] .kb-label {
    color: #edf5ff;
}

html[data-kb-theme="dark"] .kb-login-intro,
html[data-kb-theme="dark"] .kb-check,
html[data-kb-theme="dark"] .kb-login-activation,
html[data-kb-theme="dark"] .kb-auth-footer,
html[data-kb-theme="dark"] .kb-login-trust {
    color: #a9bad0;
}

html[data-kb-theme="dark"] .kb-auth-theme-control .kb-theme-toggle {
    color: #eaf3ff;
    background: rgba(16, 35, 58, .95);
    border-color: #36506f;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
}

/* Dashboard contrast repair.
   Dashboard-specific styles are rendered inside the page body, so these
   deliberately specific rules keep every dark surface and its copy paired. */
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 {
    --kb-ink: var(--kb-dark-text);
    --kb-ink-soft: var(--kb-dark-muted);
    --kb-line: var(--kb-dark-border);
    color: var(--kb-dark-text);
}

html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-page-header,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-fund-primary,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-hero-meta-item,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-dividend-progress,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-action,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-next-due,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-empty {
    color: var(--kb-dark-text) !important;
    background: var(--kb-dark-surface) !important;
    border-color: var(--kb-dark-border) !important;
}

html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-page-header h1,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-card-title,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-action-copy strong,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-next-due-amount,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-dividend-copy strong {
    color: var(--kb-dark-text) !important;
}

html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-page-subtitle,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-card-subtitle,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-hero-label,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-hero-meta-item span,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-stat-label,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-stat-note,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-action-copy span,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-next-due-label,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-next-due-date,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-dividend-copy span,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-dividend-meter-head span {
    color: var(--kb-dark-muted) !important;
}

html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-hero-value,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-hero-meta-item strong,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-stat-value,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-dividend-meter-head strong {
    color: var(--kb-dark-accent) !important;
}

html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-fund-primary .kb-hero-value {
    color: #72d4a4 !important;
}

html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-date-pill,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-action-count {
    color: #dbe9ff !important;
    background: #173b65 !important;
    border-color: var(--kb-dark-border) !important;
}

html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-action:hover,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-action:focus-visible {
    background: var(--kb-dark-surface-raised) !important;
    border-color: #6b91be !important;
}

html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-quick-link {
    color: var(--kb-dark-text) !important;
    border-color: var(--kb-dark-border);
}

html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-quick-arrow,
html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-dividend-open {
    color: #8bd9cc !important;
}

html[data-kb-theme="dark"] .kb-content .kb-dashboard-v1 .kb-dividend-track {
    background: #243955;
}

/* Authentication secondary actions need a light accent on a dark card. */
html[data-kb-theme="dark"] .kb-login-box .kb-link,
html[data-kb-theme="dark"] .kb-login-box .kb-password-toggle,
html[data-kb-theme="dark"] .kb-login-box .kb-login-activation a,
html[data-kb-theme="dark"] .kb-login-box .kb-resend-button {
    color: var(--kb-dark-accent) !important;
}

html[data-kb-theme="dark"] .kb-login-box .kb-private-access,
html[data-kb-theme="dark"] .kb-login-box .kb-input-icon {
    color: #9fb3cc !important;
}

html[data-kb-theme="dark"] .kb-login-box .kb-login-activation {
    border-color: var(--kb-dark-border);
}

html[data-kb-theme="dark"] .kb-login-box .kb-auth-note {
    color: var(--kb-dark-muted);
    background: #132c49;
    border-color: var(--kb-dark-border);
}

/* Portal component contrast repair.
   Several feature views define light cards in page-local style blocks rendered
   after the shared stylesheet. These scoped, important overrides keep each
   affected surface and its copy on the same dark palette. */
html[data-kb-theme="dark"] .kb-content .kb-empty,
html[data-kb-theme="dark"] .kb-content .kb-finance-note,
html[data-kb-theme="dark"] .kb-content .kb-repayment-summary > div,
html[data-kb-theme="dark"] .kb-content .kb-history-summary > div,
html[data-kb-theme="dark"] .kb-content .kb-history-note,
html[data-kb-theme="dark"] .kb-content .kb-guarantee-stat,
html[data-kb-theme="dark"] .kb-content .kb-guarantee-card,
html[data-kb-theme="dark"] .kb-content .kb-guarantee-grid > div,
html[data-kb-theme="dark"] .kb-content .kb-guarantee-terms,
html[data-kb-theme="dark"] .kb-content .kb-member-dividend-context,
html[data-kb-theme="dark"] .kb-content .kb-member-dividend-status,
html[data-kb-theme="dark"] .kb-content #kb-member-dividend-ui > section,
html[data-kb-theme="dark"] .kb-content .kb-report-view-context,
html[data-kb-theme="dark"] .kb-content .kb-report-filter-chip,
html[data-kb-theme="dark"] .kb-content #kb-dividend-report-ui > section,
html[data-kb-theme="dark"] .kb-content .kb-action-state,
html[data-kb-theme="dark"] .kb-content .kb-queue-card,
html[data-kb-theme="dark"] .kb-content .kb-member-stat,
html[data-kb-theme="dark"] .kb-content .kb-members-toolbar,
html[data-kb-theme="dark"] .kb-content .kb-member-card,
html[data-kb-theme="dark"] .kb-content .kb-members-empty,
html[data-kb-theme="dark"] .kb-content .kb-year-end-ui-shell,
html[data-kb-theme="dark"] .kb-content .kb-year-end-stage,
html[data-kb-theme="dark"] .kb-content .kb-year-end-card,
html[data-kb-theme="dark"] .kb-content .kb-year-end-note,
html[data-kb-theme="dark"] .kb-content .kb-sms-summary-card {
    color: var(--kb-dark-text) !important;
    background: var(--kb-dark-surface) !important;
    border-color: var(--kb-dark-border) !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .18) !important;
}

html[data-kb-theme="dark"] .kb-content .kb-empty p,
html[data-kb-theme="dark"] .kb-content .kb-finance-note,
html[data-kb-theme="dark"] .kb-content .kb-repayment-summary small,
html[data-kb-theme="dark"] .kb-content .kb-history-summary small,
html[data-kb-theme="dark"] .kb-content .kb-guarantee-stat small,
html[data-kb-theme="dark"] .kb-content .kb-guarantee-card p,
html[data-kb-theme="dark"] .kb-content .kb-guarantee-grid small,
html[data-kb-theme="dark"] .kb-content .kb-member-dividend-context .kb-year-end-muted,
html[data-kb-theme="dark"] .kb-content .kb-report-view-help,
html[data-kb-theme="dark"] .kb-content .kb-action-state span,
html[data-kb-theme="dark"] .kb-content .kb-action-state p,
html[data-kb-theme="dark"] .kb-content .kb-queue-card p,
html[data-kb-theme="dark"] .kb-content .kb-member-stat-head > span:not(.kb-member-stat-icon),
html[data-kb-theme="dark"] .kb-content .kb-member-meta,
html[data-kb-theme="dark"] .kb-content .kb-member-meta-row span,
html[data-kb-theme="dark"] .kb-content .kb-member-contact,
html[data-kb-theme="dark"] .kb-content .kb-year-end-muted,
html[data-kb-theme="dark"] .kb-content .kb-year-end-ui-next p,
html[data-kb-theme="dark"] .kb-content .kb-sms-summary-label {
    color: var(--kb-dark-muted) !important;
}

html[data-kb-theme="dark"] .kb-content .kb-guarantee-stat strong,
html[data-kb-theme="dark"] .kb-content .kb-member-stat strong,
html[data-kb-theme="dark"] .kb-content .kb-sms-summary-value {
    color: var(--kb-dark-text) !important;
}

html[data-kb-theme="dark"] .kb-content .kb-member-open,
html[data-kb-theme="dark"] .kb-content .kb-report-reset-link,
html[data-kb-theme="dark"] .kb-content .kb-report-empty-reset a,
html[data-kb-theme="dark"] .kb-content .kb-year-end-ui-link {
    color: var(--kb-dark-accent) !important;
}

/* Guarantor tabs are application controls, not ordinary content links. */
html[data-kb-theme="light"] .kb-content .kb-guarantee-tab,
html[data-kb-theme="light"] .kb-content .kb-guarantee-tab:link,
html[data-kb-theme="light"] .kb-content .kb-guarantee-tab:visited {
    color: #17456b !important;
    background: #eaf2f9 !important;
    border: 1px solid #ccdeeb;
    text-decoration: none !important;
}

html[data-kb-theme="light"] .kb-content .kb-guarantee-tab:hover,
html[data-kb-theme="light"] .kb-content .kb-guarantee-tab:focus-visible {
    color: #073eaf !important;
    background: #dcecff !important;
    border-color: #8db8eb;
    text-decoration: none !important;
}

html[data-kb-theme="light"] .kb-content .kb-guarantee-tab.is-active,
html[data-kb-theme="light"] .kb-content .kb-guarantee-tab.is-active:link,
html[data-kb-theme="light"] .kb-content .kb-guarantee-tab.is-active:visited,
html[data-kb-theme="light"] .kb-content .kb-guarantee-tab.is-active:hover,
html[data-kb-theme="light"] .kb-content .kb-guarantee-tab.is-active:focus-visible {
    color: #ffffff !important;
    background: #0b63db !important;
    border-color: #0b63db !important;
}

html[data-kb-theme="dark"] .kb-content .kb-guarantee-tab {
    color: #dbe9ff !important;
    background: #173b65 !important;
    border: 1px solid var(--kb-dark-border);
}

html[data-kb-theme="dark"] .kb-content .kb-guarantee-tab.is-active {
    color: #ffffff !important;
    background: #176bd6 !important;
}

html[data-kb-theme="dark"] .kb-content .kb-member-stat:hover,
html[data-kb-theme="dark"] .kb-content .kb-member-stat:focus-visible,
html[data-kb-theme="dark"] .kb-content .kb-member-card:hover,
html[data-kb-theme="dark"] .kb-content .kb-queue-card:hover,
html[data-kb-theme="dark"] .kb-content .kb-queue-card:focus-visible {
    background: var(--kb-dark-surface-raised) !important;
    border-color: #6b91be !important;
}

/* Member summary cards are complete click targets. The global content-link
   hover rule must never turn their labels or values into underlined links. */
.kb-content a.kb-member-stat,
.kb-content a.kb-member-stat:link,
.kb-content a.kb-member-stat:visited,
.kb-content a.kb-member-stat:hover,
.kb-content a.kb-member-stat:focus,
.kb-content a.kb-member-stat:focus-visible,
.kb-content a.kb-member-stat:active {
    text-decoration: none !important;
}

html[data-kb-theme="dark"] .kb-content .kb-year-end-ui-next,
html[data-kb-theme="dark"] .kb-content .kb-year-end-list li,
html[data-kb-theme="dark"] .kb-content .kb-year-end-step,
html[data-kb-theme="dark"] .kb-content .kb-member-dividend-empty-help {
    border-color: var(--kb-dark-border) !important;
}

html[data-kb-theme="dark"] .kb-content .kb-year-end-badge,
html[data-kb-theme="dark"] .kb-content .kb-year-end-ui-badge {
    color: #dbe9ff !important;
    background: #173b65 !important;
    border-color: var(--kb-dark-border) !important;
}

html[data-kb-theme="dark"] .kb-content .kb-year-end-ready {
    color: #9aebc4 !important;
    background: #10362d !important;
}

html[data-kb-theme="dark"] .kb-content .kb-year-end-blocked {
    color: #ffb3bd !important;
    background: #3c1c25 !important;
}

html[data-kb-theme="dark"] .kb-content .kb-year-end-warning {
    color: #ffd58c !important;
    background: #3c2b15 !important;
}

/* Official member intelligence profile.
   The profile component predates the shared theme and defines fixed light
   colours in kikobar-design-system.css. Keep every surface and its copy paired
   so all seven tabs remain readable for administrators and officials. */
html[data-kb-theme="dark"] .kb-content .kb-member-profile {
    color: var(--kb-dark-text);
}

html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-kpi,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-tabs,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-panel,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-admin,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-card,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-record,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-action-card,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-timeline__content,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-empty--card {
    color: var(--kb-dark-text) !important;
    background: var(--kb-dark-surface) !important;
    border-color: var(--kb-dark-border) !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .20) !important;
}

html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-card--highlight,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-record-details,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-exit-summary {
    color: var(--kb-dark-text) !important;
    background: var(--kb-dark-surface-raised) !important;
    border-color: var(--kb-dark-border) !important;
}

/* Let record details read as part of the existing card in dark mode.
   Row dividers remain visible through the shared definition-list rule below. */
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-record-details {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-kpi__label,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-kpi small,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-definition-list dt,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-next-payment,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-notes,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-record p,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-record small,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-empty,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-empty p,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-timeline__content time,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-timeline__content small,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-timeline__content p,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-action-card p,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-exit-summary,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-exit-clearance__summary,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-exit-clearance__metric span {
    color: var(--kb-dark-muted) !important;
}

html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-kpi strong,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-section-heading h2,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-card h3,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-record > strong,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-definition-list dd,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-empty strong,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-timeline__content strong,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-action-card h3,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-action-card label,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-exit-clearance h3,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-exit-clearance__item strong {
    color: var(--kb-dark-text) !important;
}

html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-section-heading > div > span,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-next-payment strong,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-record-details summary {
    color: var(--kb-dark-accent) !important;
}

html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-definition-list div,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-record-details,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-timeline__item:not(:last-child)::before {
    border-color: var(--kb-dark-border) !important;
}

html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-tab {
    color: #dbe9ff !important;
    background: #173b65 !important;
    border-color: var(--kb-dark-border) !important;
}

html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-tab:hover,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-tab:focus-visible {
    color: #ffffff !important;
    background: #205080 !important;
    border-color: #78afff !important;
}

html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-tab.is-active {
    color: #ffffff !important;
    background: #176bd6 !important;
    border-color: #5d9cff !important;
}

html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-kpi:hover,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-kpi:focus-visible {
    background: var(--kb-dark-surface-raised) !important;
    border-right-color: #6b91be !important;
    border-bottom-color: #6b91be !important;
    border-left-color: #6b91be !important;
}

html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-kpi__icon,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-record__icon,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-empty > span {
    color: #9fc6ff !important;
    background: #173b65 !important;
}

html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-alert--success {
    color: #b8f5d4 !important;
    background: #10362d !important;
    border-color: #287558 !important;
}

html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-alert--danger {
    color: #ffc1c9 !important;
    background: #3c1c25 !important;
    border-color: #8d4052 !important;
}

html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-alert__icon {
    color: inherit !important;
    background: rgba(255, 255, 255, .08) !important;
}

html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-admin {
    border-color: #8d6b34 !important;
}

html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-admin__warning,
html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-admin__notice {
    color: #ffd58c !important;
}

html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-profile-admin__notice {
    background: #3c2b15 !important;
    border-color: #8d6b34 !important;
}

html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-exit-clearance {
    color: var(--kb-dark-text) !important;
    background: linear-gradient(135deg, #102d50, #10233a) !important;
    border-color: #416b9e !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .20) !important;
}

html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-exit-clearance.is-blocked {
    background: linear-gradient(135deg, #3c1c25, #10233a) !important;
    border-color: #8d4052 !important;
}

html[data-kb-theme="dark"] .kb-content .kb-member-profile .kb-exit-clearance__item {
    background: rgba(16, 35, 58, .92) !important;
    border-color: #6f3444 !important;
}

/* Official deposit matching is the only other interactive official surface
   with a fixed light-only component namespace. */
html[data-kb-theme="dark"] .kb-content .dm-panel,
html[data-kb-theme="dark"] .kb-content .dm-card {
    color: var(--kb-dark-text) !important;
    background: var(--kb-dark-surface) !important;
    border-color: var(--kb-dark-border) !important;
}

html[data-kb-theme="dark"] .kb-content .dm-ref,
html[data-kb-theme="dark"] .kb-content .dm-fact strong {
    color: var(--kb-dark-text) !important;
}

html[data-kb-theme="dark"] .kb-content .dm-fact,
html[data-kb-theme="dark"] .kb-content .dm-bridge {
    color: var(--kb-dark-text) !important;
    background: var(--kb-dark-surface-raised) !important;
    border-color: var(--kb-dark-border) !important;
}

html[data-kb-theme="dark"] .kb-content .dm-fact small,
html[data-kb-theme="dark"] .kb-content .dm-bridge-note,
html[data-kb-theme="dark"] .kb-content .dm-empty {
    color: var(--kb-dark-muted) !important;
}

html[data-kb-theme="dark"] .kb-content .dm-tab,
html[data-kb-theme="dark"] .kb-content .dm-badge {
    color: #dbe9ff !important;
    background: #173b65 !important;
    border-color: var(--kb-dark-border) !important;
}

html[data-kb-theme="dark"] .kb-content .dm-tab.is-active {
    color: #ffffff !important;
    background: #176bd6 !important;
}

html[data-kb-theme="dark"] .kb-content .dm-warning {
    color: #ffd58c !important;
    background: #3c2b15 !important;
}

html[data-kb-theme="dark"] .kb-content .dm-status {
    color: #9aebc4 !important;
    background: #10362d !important;
}

html[data-kb-theme="dark"] .kb-content .dm-errors {
    color: #ffb3bd !important;
    background: #3c1c25 !important;
}

html[data-kb-theme="dark"] .kb-content .dm-actions,
html[data-kb-theme="dark"] .kb-content .dm-bridge {
    border-color: var(--kb-dark-border) !important;
}

html[data-kb-theme="dark"] .kb-content .dm-back {
    color: var(--kb-dark-accent) !important;
}

/* Public website */
html[data-kb-theme="dark"] {
    --navy: #d9e8ff;
    --blue: #78afff;
    --bright: #5d9cff;
    --ink: #edf5ff;
    --muted: #acbdd2;
    --line: #29415f;
    --wash: #0b1c30;
    --white: #10233a;
    --green: #70d4b1;
    --orange: #ffbd70;
    --shadow: 0 24px 70px rgba(0, 0, 0, .30);
}

.public-theme-control {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    margin-left: 0;
}

.public-theme-control .kb-theme-toggle {
    color: var(--navy);
    background: var(--white);
    border-color: var(--line);
    box-shadow: none;
}

html[data-kb-theme="dark"] .site-header {
    background: rgba(7, 20, 38, .95);
    border-color: #29415f;
}

html[data-kb-theme="dark"] body,
html[data-kb-theme="dark"] .hero,
html[data-kb-theme="dark"] .page-hero,
html[data-kb-theme="dark"] .page-content {
    color: var(--ink);
    background-color: #071426;
}

html[data-kb-theme="dark"] .hero {
    background: radial-gradient(circle at 88% 8%, rgba(93, 156, 255, .17), transparent 34%), linear-gradient(145deg, #071426, #0b1d32 60%, #08172a);
}

html[data-kb-theme="dark"] .page-hero {
    background: radial-gradient(circle at 85% 10%, rgba(93, 156, 255, .15), transparent 32%), #0b1c30;
}

html[data-kb-theme="dark"] .portal-preview,
html[data-kb-theme="dark"] .card,
html[data-kb-theme="dark"] .story article,
html[data-kb-theme="dark"] .fact-card,
html[data-kb-theme="dark"] .empty-state,
html[data-kb-theme="dark"] .faq-list details,
html[data-kb-theme="dark"] .cta,
html[data-kb-theme="dark"] .preview-grid div {
    color: var(--ink);
    background: #10233a;
    border-color: #29415f;
}

html[data-kb-theme="dark"] .portal-preview > p {
    color: #9ed9c8;
    background: #12352f;
}

html[data-kb-theme="dark"] .preview-head {
    color: #f7fbff;
    background: linear-gradient(120deg, #123d78, #0b4fc5);
    border: 1px solid #315c90;
}

html[data-kb-theme="dark"] .preview-head strong,
html[data-kb-theme="dark"] .preview-head span {
    color: #f7fbff;
}

html[data-kb-theme="dark"] .preview-head span {
    background: rgba(255, 255, 255, .15);
}

html[data-kb-theme="dark"] .trust-band {
    color: #f7fbff;
    background: #082a5a;
}

html[data-kb-theme="dark"] .trust-band article {
    border-color: rgba(202, 222, 247, .24);
}

html[data-kb-theme="dark"] .trust-band span {
    color: #c7dcf5;
}

html[data-kb-theme="dark"] .site-header .brand-copy,
html[data-kb-theme="dark"] .nav-links > a:not(.button),
html[data-kb-theme="dark"] .hero h1,
html[data-kb-theme="dark"] .page-hero h1,
html[data-kb-theme="dark"] .page-content h2,
html[data-kb-theme="dark"] .page-content h3,
html[data-kb-theme="dark"] .card h2,
html[data-kb-theme="dark"] .card h3,
html[data-kb-theme="dark"] .cta h2,
html[data-kb-theme="dark"] .faq-list summary {
    color: var(--ink);
}

html[data-kb-theme="dark"] .brand-copy small,
html[data-kb-theme="dark"] .hero .lead,
html[data-kb-theme="dark"] .page-hero .lead,
html[data-kb-theme="dark"] .section-head p,
html[data-kb-theme="dark"] .card p,
html[data-kb-theme="dark"] .story p,
html[data-kb-theme="dark"] .fact-card p,
html[data-kb-theme="dark"] .empty-state p,
html[data-kb-theme="dark"] .faq-list p,
html[data-kb-theme="dark"] .cta p,
html[data-kb-theme="dark"] .quiet,
html[data-kb-theme="dark"] .preview-grid small {
    color: var(--muted);
}

html[data-kb-theme="dark"] .values span {
    color: #9fc6ff;
    background: #173b65;
}

html[data-kb-theme="dark"] .card .icon,
html[data-kb-theme="dark"] .empty-icon {
    color: #9fc6ff;
    background: #173b65;
}

html[data-kb-theme="dark"] .card:nth-child(2n) .icon {
    color: #8be0d4;
    background: #123b40;
}

html[data-kb-theme="dark"] .card:nth-child(3n) .icon {
    color: #ffbd70;
    background: #3c2b15;
}

html[data-kb-theme="dark"] .text-link,
html[data-kb-theme="dark"] .preview-grid b {
    color: var(--blue);
}

html[data-kb-theme="dark"] .nav-links > a:not(.button):hover,
html[data-kb-theme="dark"] .nav-links > a:not(.button).active {
    color: #9fc6ff;
    border-color: #78afff;
}

html[data-kb-theme="dark"] .button-secondary,
html[data-kb-theme="dark"] .menu-button {
    color: var(--ink);
    background: #10233a;
    border-color: #36506f;
}

html[data-kb-theme="dark"] .skip {
    color: #071426;
    background: #ffffff;
}

@media (max-width: 900px) {
    .public-theme-control {
        margin-left: auto;
    }

    html[data-kb-theme="dark"] .nav-links {
        background: #10233a;
        border-color: #29415f;
    }
}

@media (max-width: 620px) {
    .kb-theme-toggle {
        width: 44px;
        padding: 0;
    }

    .kb-theme-toggle [data-kb-theme-label] {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    .kb-theme-toggle {
        transition: none;
    }
}

/* Stage-only leadership visual audit mode */
.kb-visual-audit-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
    padding: 16px 18px;
    color: #402600;
    background: #fff2c7;
    border: 2px solid #e0a429;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(102, 68, 0, .10);
}

.kb-visual-audit-banner div,
.kb-visual-audit-banner span {
    display: block;
}

.kb-visual-audit-banner span {
    margin-top: 4px;
    color: #6d4d0a;
}

.kb-visual-audit-exit {
    min-height: 44px;
    padding: 0 16px;
    color: #ffffff;
    background: #8b1f2d;
    border: 0;
    border-radius: 12px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.kb-visual-audit-panel {
    max-width: 920px;
    margin: 0 auto;
}

.kb-visual-audit-kicker {
    color: #9a5d00;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
}

.kb-visual-audit-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 24px 0;
}

.kb-content button.kb-visual-audit-role {
    width: 100%;
    min-height: 112px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 18px;
    color: #133d7a;
    background: #edf4ff;
    border: 1px solid #c7daf7;
    border-radius: 16px;
    font: inherit;
    cursor: pointer;
    text-align: left;
}

.kb-content button.kb-visual-audit-role span,
.kb-content button.kb-visual-audit-role small {
    display: block;
}

.kb-content button.kb-visual-audit-role span {
    color: #133d7a;
    font-size: 18px;
    font-weight: 850;
}

.kb-content button.kb-visual-audit-role small {
    margin-top: 6px;
    color: #587194;
}

.kb-content button.kb-visual-audit-role:hover,
.kb-content button.kb-visual-audit-role:focus-visible {
    background: #dfeaff;
    border-color: #6e9ee1;
}

.kb-visual-audit-current,
.kb-visual-audit-safety {
    margin: 20px 0;
    padding: 16px 18px;
    background: #f5f8fc;
    border: 1px solid #dce5f1;
    border-radius: 14px;
}

.kb-visual-audit-current span {
    display: block;
    margin-top: 5px;
    color: #5c6d82;
}

html[data-kb-theme="dark"] .kb-visual-audit-banner {
    color: #ffe8a8;
    background: #392d12;
    border-color: #bb8a2b;
}

html[data-kb-theme="dark"] .kb-visual-audit-banner span {
    color: #f0d38a;
}

html[data-kb-theme="dark"] .kb-content button.kb-visual-audit-role,
html[data-kb-theme="dark"] .kb-visual-audit-current,
html[data-kb-theme="dark"] .kb-visual-audit-safety {
    color: var(--kb-dark-text);
    background: var(--kb-dark-surface-raised);
    border-color: var(--kb-dark-border);
}

html[data-kb-theme="dark"] .kb-content button.kb-visual-audit-role span {
    color: var(--kb-dark-text);
}

html[data-kb-theme="dark"] .kb-content button.kb-visual-audit-role small,
html[data-kb-theme="dark"] .kb-visual-audit-current span {
    color: var(--kb-dark-muted);
}

body[data-kb-visual-audit-active="true"] form button:disabled,
body[data-kb-visual-audit-active="true"] form input[type="submit"]:disabled {
    cursor: not-allowed !important;
    opacity: .56;
}

@media (max-width: 760px) {
    .kb-visual-audit-banner {
        align-items: stretch;
        flex-direction: column;
    }

    .kb-visual-audit-grid {
        grid-template-columns: 1fr;
    }
}
