/* =========================================================
   CRM Theme Tokens + Light Theme Overrides
   Uses: html[data-theme="dark"] / html[data-theme="light"]
   ========================================================= */

html:not([data-theme]) {
    color-scheme: dark;
}

html[data-theme="dark"] {
    color-scheme: dark;

    --bg: #141624;
    --bg2: #101221;

    --surface: #1c1c25;
    --surface2: #282932;
    --surface3: rgba(0, 182, 255, 0.10);

    --text: #e7e8ed;
    --muted: #a7a8b1;
    --muted2: #94959e;

    --border: rgba(255, 255, 255, 0.12);
    --border2: rgba(255, 255, 255, 0.08);

    --shadow-sm: 0 6px 16px rgba(0, 0, 0, .30);
    --shadow: 0 14px 40px rgba(0, 0, 0, .45);

    --primary: #0077fe;
    --primaryHover: #1a86ff;
    --primarySoft: rgba(0, 119, 254, .16);

    --success: #19d3a2;
    --warning: #f2b34b;
    --danger: #ff4d4d;

    --focus: 0 0 0 3px rgba(0, 182, 255, .18);

    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 10px;

    --topbar-bg: linear-gradient(90deg, rgb(29 28 28) 20%, rgb(45 55 106) 100%);
    --topbar-surface: rgba(20, 26, 38, .85);
    --topbar-surface-hover: #2a3447;
    --topbar-panel: #121826;
    --topbar-panel-2: #151a26;
}

html[data-theme="light"] {
    color-scheme: light;

    --bg: #f4f6f9;
    --bg2: #eef2f7;

    --surface: #ffffff;
    --surface2: #f8fafc;
    --surface3: #eef6ff;

    --text: #0b1f44;
    --muted: #425466;
    --muted2: #6b7a90;

    --border: #dfe3ea;
    --border2: #cfd6e4;

    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
    --shadow: 0 6px 18px rgba(16, 24, 40, .10);

    --primary: #0176d3;
    --primaryHover: #0162b0;
    --primarySoft: rgba(1, 118, 211, .10);

    --success: #2e844a;
    --warning: #b95000;
    --danger: #ba0517;

    --focus: 0 0 0 3px rgba(1, 118, 211, .25);

    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 10px;

    --topbar-bg: linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
    --topbar-surface: #ffffff;
    --topbar-surface-hover: #f3f7fd;
    --topbar-panel: #ffffff;
    --topbar-panel-2: #ffffff;
}

/* ---------------------------------------------------------
   Backward-compatible aliases used by existing component CSS
   --------------------------------------------------------- */
html[data-theme="dark"],
html[data-theme="light"] {
    --c-bg: var(--bg);
    --c-chrome: var(--surface);
    --c-input: var(--surface2);
    --c-btn: var(--primary);
    --c-btn-hover: var(--primaryHover);
    --c-line: var(--border2);
    --c-text: var(--text);
    --c-muted: var(--muted);
    --c-row-fg: var(--text);
    --c-row-bg: var(--surface);
    --c-input-bg: var(--surface2);
    --c-input-fg: var(--text);
    --c-head-fg: var(--text);
    --c-head: var(--text);
    --c-accent: var(--primary);
    --c-accent-2: #4b59a8;
    --c-pill: var(--surface2);
    --c-pill-active: var(--primarySoft);
    --c-elev: var(--surface);
    --c-elev-2: var(--surface2);
    --c-active: var(--primarySoft);

    --shadow-1: var(--shadow-sm);
    --shadow-2: var(--shadow);
    --ring-accent: var(--focus);
    --ring-edit: 0 0 0 2px rgba(80, 126, 255, .24);

    --danger-bg: color-mix(in srgb, var(--danger) 12%, transparent);
    --danger-fg: color-mix(in srgb, var(--danger) 72%, #ffffff 28%);
    --danger-fg-strong: color-mix(in srgb, var(--danger) 82%, #ffffff 18%);

    --df-head-bg: color-mix(in srgb, var(--surface2) 90%, var(--primarySoft) 10%);
    --df-head-line: var(--border);
    --df-head-text: var(--text);
    --df-muted: var(--muted);

    --c-sec-head: var(--text);
    --c-sec-muted: var(--muted);
    --c-sec-fill: var(--surface2);
    --c-sec-fill-strong: var(--surface);
    --c-sec-outline: var(--border);
    --c-sec-head-bg: var(--surface2);
    --c-sec-head-border: var(--border);

    --hist-accent: var(--primary);
    --hist-accent-border: var(--border);
    --hist-accent-soft: var(--primarySoft);

    --cc-primary: var(--primary);
    --cc-cyan: #38bdf8;
    --cc-danger: var(--danger);
    --cc-text: var(--text);
    --cc-muted: var(--muted);
    --cc-bg: var(--surface);
    --cc-surface: var(--surface);
    --cc-surface-2: var(--surface2);
    --cc-border: var(--border);
    --cc-border-soft: var(--border2);
    --cc-glow: var(--primarySoft);
    --cc-radius: 14px;

    --cdv-primary: var(--primary);
    --cdv-cyan: #38bdf8;
    --cdv-danger: var(--danger);
    --cdv-text: var(--text);
    --cdv-muted: var(--muted);
    --cdv-bg: var(--surface);
    --cdv-surface: var(--surface);
    --cdv-surface-2: var(--surface2);
    --cdv-border: var(--border);
    --cdv-border-soft: var(--border2);

    --g-bg: color-mix(in srgb, var(--success) 18%, var(--surface));
    --g-bg-2: color-mix(in srgb, var(--success) 25%, var(--surface));
    --g-border: color-mix(in srgb, var(--success) 40%, var(--border));
    --g-border-strong: color-mix(in srgb, var(--success) 60%, var(--border));
    --g-text: color-mix(in srgb, var(--success) 35%, var(--text));
    --g-neon: color-mix(in srgb, var(--success) 28%, transparent);

    --c-badge-admin-bg: color-mix(in srgb, var(--danger) 14%, transparent);
    --c-badge-admin-border: color-mix(in srgb, var(--danger) 50%, transparent);
    --c-badge-admin-text: color-mix(in srgb, var(--danger) 85%, var(--text));
    --c-card-bg: var(--surface);

    --clienti-surface: var(--surface);
    --clienti-surface-2: var(--surface2);
    --clienti-outline: var(--border);
    --clienti-blue: var(--primary);
}

html,
body {
    background: linear-gradient(180deg, var(--bg2), var(--bg));
    color: var(--text);
}

a {
    color: var(--primary);
}

a:hover {
    color: var(--primaryHover);
}

/* Related tabs list headers on ClientiDetail */
.clienti-page .related-section .rl-head,
.clienti-page .panel-no-shell .related-section .rl-head {
    background: var(--primary) !important;
    background-image: none !important;
    border-bottom-color: color-mix(in srgb, #ffffff 28%, var(--primary)) !important;
}

.clienti-page .related-section .rl-title,
.clienti-page .panel-no-shell .related-section .rl-title {
    color: #ffffff !important;
}

.clienti-page .related-section .rl-count,
.clienti-page .panel-no-shell .related-section .rl-count {
    border-color: rgba(255, 255, 255, .4) !important;
    background: rgba(255, 255, 255, .18) !important;
    color: #ffffff !important;
}

/* Remove reload action from related tabs lists in ClientiDetail */
.clienti-page .related-section .rl-actions .rl-btn.ghost {
    display: none !important;
}

/* =========================================================
   Light theme visual remap (no layout changes)
   ========================================================= */

html[data-theme="light"] .chrome,
html[data-theme="light"] .shell,
html[data-theme="light"] .workspace,
html[data-theme="light"] .clienti-page,
html[data-theme="light"] .utr-page {
    background: transparent;
    color: var(--text);
}

html[data-theme="light"] .clienti-page::before,
html[data-theme="light"] .clienti-page::after,
html[data-theme="light"] .utr-page::before,
html[data-theme="light"] .utr-page::after {
    display: none !important;
}

html[data-theme="light"] .topbar {
    background: var(--topbar-bg) !important;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(15, 23, 42, .04);
}

html[data-theme="light"] .brand-link:hover {
    color: var(--text);
}

html[data-theme="light"] .brand-logo {
    filter: drop-shadow(0 1px 3px rgba(15, 23, 42, .14));
}

html[data-theme="light"] .top-bell,
html[data-theme="light"] .top-menu-toggle,
html[data-theme="light"] .top-search-toggle,
html[data-theme="light"] .topnav-btn,
html[data-theme="light"] .top-search,
html[data-theme="light"] .top-action.outline,
html[data-theme="light"] .theme-toggle,
html[data-theme="light"] .top-search-item,
html[data-theme="light"] .topnav-subitem,
html[data-theme="light"] .topnav-subicon {
    background: var(--topbar-surface);
    border-color: var(--border);
    color: var(--text);
    box-shadow: none;
}

html[data-theme="light"] .top-bell:hover,
html[data-theme="light"] .top-bell.active,
html[data-theme="light"] .top-menu-toggle:hover,
html[data-theme="light"] .top-search-toggle:hover,
html[data-theme="light"] .topnav-btn:hover,
html[data-theme="light"] .top-search-item:hover,
html[data-theme="light"] .top-search-item.active,
html[data-theme="light"] .topnav-subitem:hover,
html[data-theme="light"] .top-action.outline:hover,
html[data-theme="light"] .theme-toggle:hover {
    background: var(--topbar-surface-hover);
    border-color: var(--border2);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

html[data-theme="light"] .topnav-btn.active {
    background: var(--primarySoft);
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

html[data-theme="light"] .topnav-btn:focus-visible,
html[data-theme="light"] .top-search:focus,
html[data-theme="light"] .theme-toggle:focus-visible,
html[data-theme="light"] .top-action:focus-visible,
html[data-theme="light"] .top-bell:focus-visible {
    outline: none;
    box-shadow: var(--focus);
}

html[data-theme="light"] .top-search:focus {
    background: #ffffff !important;
    color: var(--text) !important;
    border-color: color-mix(in srgb, var(--primary) 42%, var(--border2)) !important;
    box-shadow: var(--focus) !important;
}

html[data-theme="light"] .topnav-panel,
html[data-theme="light"] .topbar.topbar-compact .topnav-wrap,
html[data-theme="light"] .topbar.topbar-compact .top-search-wrap.open,
html[data-theme="light"] .top-search-dropdown,
html[data-theme="light"] .notif-panel {
    background: var(--topbar-panel);
    border-color: var(--border);
    box-shadow: var(--shadow);
}

html[data-theme="light"] .topnav-panel::before {
    background: var(--topbar-panel);
    border-left-color: var(--border);
    border-top-color: var(--border);
}

html[data-theme="light"] .topnav-subdesc,
html[data-theme="light"] .top-search-item.muted,
html[data-theme="light"] .notif-subtitle,
html[data-theme="light"] .notif-time,
html[data-theme="light"] .top-search-meta,
html[data-theme="light"] .top-search-meta-item {
    color: var(--muted2);
}

html[data-theme="light"] .top-search-history-head {
    border-bottom-color: var(--border2);
}

html[data-theme="light"] .top-search-history-title {
    color: var(--muted);
}

html[data-theme="light"] .top-search-history-clear {
    color: var(--primary);
}

html[data-theme="light"] .top-search-history-clear:hover {
    color: var(--primaryHover);
}

html[data-theme="light"] .notif-head,
html[data-theme="light"] .notif-foot,
html[data-theme="light"] .notif-item,
html[data-theme="light"] .notif-mark,
html[data-theme="light"] .notif-more {
    border-color: var(--border2);
    color: var(--text);
}

html[data-theme="light"] .notif-item:hover {
    background: color-mix(in srgb, var(--surface) 92%, var(--primarySoft));
}

html[data-theme="light"] .notif-dot {
    background: color-mix(in srgb, var(--muted2) 60%, #fff 40%);
}

html[data-theme="light"] .notif-item.unread .notif-dot {
    background: var(--primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 20%, transparent);
}

html[data-theme="light"] .notif-switch {
    background: var(--surface2);
    border-color: var(--border);
}

html[data-theme="light"] .notif-toggle input:checked + .notif-switch {
    background: var(--primary);
    border-color: var(--primary);
}

html[data-theme="light"] .notif-toggle input:checked + .notif-switch::after {
    background: #ffffff;
}

html[data-theme="light"] .bell-badge {
    background: var(--primary);
    color: #fff;
    border-color: rgba(1, 62, 117, .25);
}

html[data-theme="light"] .menu-overlay {
    background: rgba(15, 23, 42, .08);
}

html[data-theme="light"] .top-action {
    background: var(--primary);
    border-color: transparent;
    color: #fff;
}

html[data-theme="light"] .top-action.setup-action,
html[data-theme="light"] .top-action.setup-action .label,
html[data-theme="light"] .top-action.setup-action .cog {
    color: #fff !important;
}

html[data-theme="light"] .top-action:hover {
    background: var(--primaryHover);
}

html[data-theme="light"] .avatar {
    background: #edf2fb;
    border: 1px solid var(--border);
    color: #19315c;
}

/* Core container surfaces */
html[data-theme="light"] .card,
html[data-theme="light"] .panel,
html[data-theme="light"] .widget,
html[data-theme="light"] .box,
html[data-theme="light"] .list-card,
html[data-theme="light"] .event-card,
html[data-theme="light"] .df-section,
html[data-theme="light"] .cal-header,
html[data-theme="light"] .sarcini-panel,
html[data-theme="light"] .page-head,
html[data-theme="light"] .page-shell,
html[data-theme="light"] .clienti-page .top-row,
html[data-theme="light"] .utr-card,
html[data-theme="light"] .related-section .list-card,
html[data-theme="light"] .related-section .list-card .list-scroll,
html[data-theme="light"] .related-section .list-card .table {
    background: var(--surface) !important;
    border-color: var(--border) !important;
    color: var(--text);
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="light"] .page-head {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%) !important;
}

html[data-theme="light"] .attention-banner {
    background: color-mix(in srgb, #facc15 15%, #ffffff 85%);
    border-color: color-mix(in srgb, #b95000 50%, #facc15 50%);
    color: #7a3f00;
}

html[data-theme="light"] .attention-value {
    color: #6b3a00;
}

html[data-theme="light"] .verify-banner {
    background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%) !important;
    border-color: var(--border) !important;
    color: var(--text);
}

html[data-theme="light"] .verify-date,
html[data-theme="light"] .verify-label,
html[data-theme="light"] .subtitle,
html[data-theme="light"] .client-title,
html[data-theme="light"] .sarcini-sub,
html[data-theme="light"] .sarcina-meta,
html[data-theme="light"] .head-note,
html[data-theme="light"] .head-note strong {
    color: var(--text) !important;
}

html[data-theme="light"] .verify-label,
html[data-theme="light"] .subtitle,
html[data-theme="light"] .sarcina-meta,
html[data-theme="light"] .field-key,
html[data-theme="light"] .label,
html[data-theme="light"] .muted {
    color: var(--muted2) !important;
}

html[data-theme="light"] .sarcini-panel {
    background: linear-gradient(180deg, #fff, #fffaf3) !important;
    border-color: color-mix(in srgb, var(--warning) 45%, var(--border)) !important;
}

html[data-theme="light"] .sarcina-item {
    background: #ffffff !important;
    border-color: var(--border) !important;
}

/* Inputs */
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea,
html[data-theme="light"] .form-control,
html[data-theme="light"] .form-select,
html[data-theme="light"] .top-search,
html[data-theme="light"] .mud-input-slot,
html[data-theme="light"] .mud-input-root,
html[data-theme="light"] .mud-input-input,
html[data-theme="light"] .mud-select-input,
html[data-theme="light"] .mud-select,
html[data-theme="light"] .mud-picker,
html[data-theme="light"] .mud-popover,
html[data-theme="light"] .mud-dialog,
html[data-theme="light"] .mud-paper,
html[data-theme="light"] .mud-table,
html[data-theme="light"] .mud-snackbar {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border2);
}

html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder,
html[data-theme="light"] .form-control::placeholder,
html[data-theme="light"] .mud-input-input::placeholder,
html[data-theme="light"] .mud-select-input::placeholder {
    color: var(--muted2);
    opacity: 1;
}

html[data-theme="light"] input:focus,
html[data-theme="light"] select:focus,
html[data-theme="light"] textarea:focus,
html[data-theme="light"] .form-control:focus,
html[data-theme="light"] .form-select:focus,
html[data-theme="light"] .mud-input-root:focus-within,
html[data-theme="light"] .mud-input-control:focus-within {
    outline: none;
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border2));
    box-shadow: var(--focus);
}

html[data-theme="light"] .btn-primary,
html[data-theme="light"] .btnPrimary,
html[data-theme="light"] .rl-btn.primary,
html[data-theme="light"] .mud-button-filled-primary {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}

html[data-theme="light"] .btn-primary:hover,
html[data-theme="light"] .btnPrimary:hover,
html[data-theme="light"] .rl-btn.primary:hover,
html[data-theme="light"] .mud-button-filled-primary:hover {
    background: var(--primaryHover) !important;
    border-color: var(--primaryHover) !important;
}

html[data-theme="light"] .btn-outline-secondary,
html[data-theme="light"] .btnSecondary,
html[data-theme="light"] .btnGhost,
html[data-theme="light"] .rl-btn.ghost,
html[data-theme="light"] .mud-button-outlined {
    background: color-mix(in srgb, var(--surface) 95%, var(--primarySoft));
    border-color: var(--border2);
    color: var(--text);
}

html[data-theme="light"] .btn-outline-secondary:hover,
html[data-theme="light"] .btnSecondary:hover,
html[data-theme="light"] .btnGhost:hover,
html[data-theme="light"] .rl-btn.ghost:hover,
html[data-theme="light"] .mud-button-outlined:hover {
    background: color-mix(in srgb, var(--surface) 88%, var(--primarySoft));
    border-color: var(--border);
}

html[data-theme="light"] .btn-danger,
html[data-theme="light"] .btnDanger,
html[data-theme="light"] .rl-btn.danger,
html[data-theme="light"] .mud-button-text-error {
    background: color-mix(in srgb, var(--surface) 92%, rgba(186, 5, 23, .11));
    border-color: color-mix(in srgb, var(--danger) 38%, var(--border2));
    color: var(--danger);
}

html[data-theme="light"] .btn-danger:hover,
html[data-theme="light"] .btnDanger:hover,
html[data-theme="light"] .rl-btn.danger:hover {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

/* Tabs / pills */
html[data-theme="light"] .tab,
html[data-theme="light"] .pill,
html[data-theme="light"] [role="tab"],
html[data-theme="light"] .tabs button,
html[data-theme="light"] .tab-btn,
html[data-theme="light"] .segment-btn,
html[data-theme="light"] .client-tabs .tab-chip,
html[data-theme="light"] .detail-tabs .tab-link {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--muted);
}

html[data-theme="light"] .tab.active,
html[data-theme="light"] .pill.active,
html[data-theme="light"] [role="tab"][aria-selected="true"],
html[data-theme="light"] .tabs button.active,
html[data-theme="light"] .tab-btn.active,
html[data-theme="light"] .segment-btn.active,
html[data-theme="light"] .client-tabs .tab-chip.active,
html[data-theme="light"] .detail-tabs .tab-link.active {
    background: var(--primarySoft);
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
    color: var(--text);
}

/* Tables */
html[data-theme="light"] table,
html[data-theme="light"] .table,
html[data-theme="light"] .mud-table,
html[data-theme="light"] .list-card .table {
    color: var(--text);
    background: transparent;
}

html[data-theme="light"] thead th,
html[data-theme="light"] .table thead th,
html[data-theme="light"] .mud-table thead th,
html[data-theme="light"] .list-card .table thead th {
    background: var(--surface2) !important;
    color: var(--muted) !important;
    border-bottom: 1px solid var(--border) !important;
}

html[data-theme="light"] tbody td,
html[data-theme="light"] .table tbody td,
html[data-theme="light"] .mud-table tbody td,
html[data-theme="light"] .list-card .table tbody tr td {
    color: var(--text) !important;
    border-bottom: 1px solid var(--border2) !important;
    background: #fff !important;
}

html[data-theme="light"] tbody tr:hover td,
html[data-theme="light"] .table tbody tr:hover td,
html[data-theme="light"] .mud-table tbody tr:hover td,
html[data-theme="light"] .list-card .table tbody tr:hover td {
    background: color-mix(in srgb, var(--surface) 88%, var(--primarySoft)) !important;
}

/* Home dashboard sections */
html[data-theme="light"] .kpi,
html[data-theme="light"] .card-calendar,
html[data-theme="light"] .card-tasks,
html[data-theme="light"] .eventscol,
html[data-theme="light"] .calendar-row,
html[data-theme="light"] .calendar-empty,
html[data-theme="light"] .calendar-chip,
html[data-theme="light"] .task-row,
html[data-theme="light"] .task-card,
html[data-theme="light"] .task-item {
    background: var(--surface) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="light"] .card-calendar:hover,
html[data-theme="light"] .card-tasks:hover,
html[data-theme="light"] .calendar-row:hover,
html[data-theme="light"] .task-row:hover {
    background: color-mix(in srgb, var(--surface) 92%, var(--primarySoft)) !important;
    border-color: color-mix(in srgb, var(--primary) 30%, var(--border)) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="light"] .kpi-title,
html[data-theme="light"] .kpi-sub,
html[data-theme="light"] .calendar-sub,
html[data-theme="light"] .calendar-time,
html[data-theme="light"] .timecol,
html[data-theme="light"] .timecol .hour,
html[data-theme="light"] .calendar-empty,
html[data-theme="light"] .t-desc.empty {
    color: var(--muted) !important;
}

html[data-theme="light"] .calendar-title,
html[data-theme="light"] .calendar-subject,
html[data-theme="light"] .kpi-value,
html[data-theme="light"] .tasks-title,
html[data-theme="light"] .t-sub,
html[data-theme="light"] .t-desc,
html[data-theme="light"] .t-meta {
    color: var(--text) !important;
}

/* Home calendar quick popup (light theme) */
html[data-theme="light"] .calendar-modal.quick-modal {
    background: var(--surface) !important;
    border-color: var(--border) !important;
    box-shadow: var(--shadow) !important;
}

html[data-theme="light"] .calendar-modal.quick-modal .modal-head,
html[data-theme="light"] .calendar-modal.quick-modal .modal-body,
html[data-theme="light"] .calendar-modal.quick-modal .modal-foot {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

html[data-theme="light"] .calendar-modal.quick-modal .btn-x {
    color: var(--text) !important;
}

html[data-theme="light"] .calendar-modal.quick-modal .quick-label {
    color: var(--muted) !important;
}

html[data-theme="light"] .calendar-modal.quick-modal .quick-input,
html[data-theme="light"] .calendar-modal.quick-modal .quick-duration,
html[data-theme="light"] .calendar-modal.quick-modal .quick-time-group,
html[data-theme="light"] .calendar-modal.quick-modal .quick-time-group .time-select,
html[data-theme="light"] .calendar-modal.quick-modal .client-search-input {
    background: var(--surface2) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

html[data-theme="light"] .calendar-modal.quick-modal .quick-time-group .time-sep {
    color: var(--muted) !important;
}

html[data-theme="light"] .calendar-modal.quick-modal .quick-input:focus,
html[data-theme="light"] .calendar-modal.quick-modal .quick-time-group:focus-within,
html[data-theme="light"] .calendar-modal.quick-modal .client-search-input:focus {
    border-color: color-mix(in srgb, var(--primary) 44%, var(--border)) !important;
    box-shadow: var(--focus) !important;
}

html[data-theme="light"] .calendar-modal.quick-modal .quick-datetime input[type="date"] {
    color-scheme: light;
}

html[data-theme="light"] .calendar-modal.quick-modal .quick-datetime input[type="date"]::-webkit-calendar-picker-indicator {
    filter: none;
    opacity: .8;
}

html[data-theme="light"] .calendar-modal.quick-modal .quick-advanced-toggle {
    color: var(--muted) !important;
    border-color: var(--border) !important;
    background: transparent !important;
}

html[data-theme="light"] .calendar-modal.quick-modal .quick-advanced-toggle:hover {
    color: var(--text) !important;
    border-color: color-mix(in srgb, var(--primary) 32%, var(--border)) !important;
    background: color-mix(in srgb, var(--surface) 90%, var(--primarySoft)) !important;
}

html[data-theme="light"] .calendar-modal.quick-modal .client-search-dropdown {
    background: var(--surface) !important;
    border-color: var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="light"] .calendar-modal.quick-modal .client-search-item {
    color: var(--text) !important;
}

html[data-theme="light"] .calendar-modal.quick-modal .client-search-item:hover {
    background: color-mix(in srgb, var(--surface) 90%, var(--primarySoft)) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .calendar-modal.quick-modal .client-search-item.muted {
    color: var(--muted) !important;
}

html[data-theme="light"] .calendar-modal.quick-modal .btn-outline {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .calendar-modal.quick-modal .btn-outline:hover {
    background: color-mix(in srgb, var(--surface) 90%, var(--primarySoft)) !important;
    border-color: color-mix(in srgb, var(--primary) 30%, var(--border)) !important;
}

html[data-theme="light"] .calendar-modal.quick-modal .btn-outline-danger {
    background: color-mix(in srgb, var(--surface) 92%, rgba(186, 5, 23, .1)) !important;
    border-color: color-mix(in srgb, var(--danger) 35%, var(--border)) !important;
    color: color-mix(in srgb, var(--danger) 86%, var(--text)) !important;
}

html[data-theme="light"] .calendar-modal.quick-modal .btn-outline-danger:hover {
    background: var(--danger) !important;
    border-color: var(--danger) !important;
    color: #ffffff !important;
}

html[data-theme="light"] .calendar-chip,
html[data-theme="light"] .meta-chip,
html[data-theme="light"] .due-chip {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .calendar-chip svg,
html[data-theme="light"] .meta-chip svg,
html[data-theme="light"] .due-chip svg {
    stroke: var(--text) !important;
}

/* Global BrandLoader light theme */
html[data-theme="light"] .brand-loader {
    --loader-accent: #0d76cb;
    --loader-accent-2: #37a8ff;
    background: radial-gradient(1200px circle at 50% 35%, rgba(229, 237, 248, .9), rgba(215, 227, 242, .94)) !important;
}

html[data-theme="light"] .brand-loader__card {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .brand-loader__logo img {
    filter: drop-shadow(0 4px 8px rgba(7, 76, 131, .16));
}

html[data-theme="light"] .brand-loader__glow {
    background: radial-gradient(circle, rgba(13, 118, 203, .2), transparent 60%) !important;
}

html[data-theme="light"] .brand-loader__text {
    color: var(--text) !important;
}

html[data-theme="light"] .brand-loader__bar {
    background: var(--border2) !important;
}

html[data-theme="light"] .form-select.xs,
html[data-theme="light"] .btn-icon {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

html[data-theme="light"] .btn-icon:hover {
    background: color-mix(in srgb, var(--surface) 86%, var(--primarySoft)) !important;
    border-color: color-mix(in srgb, var(--primary) 30%, var(--border)) !important;
}

html[data-theme="light"] .btn-icon svg {
    stroke: var(--text) !important;
}

html[data-theme="light"] .hour-line {
    background: var(--border2) !important;
}

/* Side nav */
html[data-theme="light"] .menu,
html[data-theme="light"] .sidebar {
    background: #f7f9fc !important;
    color: var(--text);
}

html[data-theme="light"] .item,
html[data-theme="light"] .subitem,
html[data-theme="light"] .collapse-toggle {
    color: var(--text);
    border-color: transparent;
    background: transparent;
}

html[data-theme="light"] .item:hover,
html[data-theme="light"] .subitem:hover,
html[data-theme="light"] .collapse-toggle:hover {
    background: #ecf3fb;
    border-color: var(--border);
}

html[data-theme="light"] .item.active,
html[data-theme="light"] .subitem.active {
    background: var(--primarySoft);
    border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
}

html[data-theme="light"] .menu-section {
    color: var(--muted2);
}

html[data-theme="light"] .sidebar.sidebar-rail {
    background: #074c83 !important;
    border-right-color: color-mix(in srgb, #ffffff 34%, #074c83) !important;
}

html[data-theme="light"] .rail-item {
    background: transparent !important;
    border: 0 !important;
    color: #f6fbff !important;
    box-shadow: none !important;
}

html[data-theme="light"] .rail-item:hover {
    background: rgba(255,255,255,.16) !important;
}

html[data-theme="light"] .rail-item.active {
    background: rgba(255,255,255,.24) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .rail-icon {
    color: var(--primary) !important;
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border2)) !important;
    background: #ffffff !important;
}

html[data-theme="light"] .rail-item:hover .rail-icon {
    border-color: color-mix(in srgb, var(--primary) 50%, var(--border2)) !important;
    background: color-mix(in srgb, var(--surface) 88%, var(--primarySoft)) !important;
}

html[data-theme="light"] .rail-item.active .rail-icon {
    color: var(--primaryHover) !important;
    border-color: color-mix(in srgb, var(--primary) 60%, var(--border2)) !important;
    background: color-mix(in srgb, var(--surface) 80%, var(--primarySoft)) !important;
}

html[data-theme="light"] .rail-label {
    color: #f6fbff !important;
}

/* =========================================================
   /clienti + /clienti/{id} dedicated light theme cleanup
   ========================================================= */
html[data-theme="light"] .entity-root.clienti-page,
html[data-theme="light"] .clienti-page {
    --c-bg: var(--bg) !important;
    --c-chrome: var(--surface) !important;
    --c-input: var(--surface) !important;
    --c-btn: var(--primary) !important;
    --c-btn-hover: var(--primaryHover) !important;
    --c-line: var(--border2) !important;
    --c-text: var(--text) !important;
    --c-muted: var(--muted2) !important;
    --c-row-fg: var(--text) !important;
    --c-head-fg: var(--muted) !important;
    --c-head: var(--muted) !important;
    --df-head-bg: var(--surface2) !important;
    --df-head-line: var(--border) !important;
    --df-head-text: var(--text) !important;
    --df-muted: var(--muted2) !important;
    --cc-bg: var(--surface) !important;
    --cc-surface: var(--surface) !important;
    --cc-surface-2: var(--surface2) !important;
    --cc-border: var(--border) !important;
    --cc-border-soft: var(--border2) !important;
    --cc-text: var(--text) !important;
    --cc-muted: var(--muted2) !important;
    --cc-primary: var(--primary) !important;
    --cc-cyan: var(--primary) !important;
    --cc-danger: var(--danger) !important;
    --cdv-bg: var(--surface) !important;
    --cdv-surface: var(--surface) !important;
    --cdv-surface-2: var(--surface2) !important;
    --cdv-border: var(--border) !important;
    --cdv-border-soft: var(--border2) !important;
    --cdv-text: var(--text) !important;
    --cdv-muted: var(--muted2) !important;
    --cdv-primary: var(--primary) !important;
    --cdv-cyan: var(--primary) !important;
    --cdv-danger: var(--danger) !important;
    --clienti-surface: var(--surface) !important;
    --clienti-surface-2: var(--surface2) !important;
    --clienti-outline: var(--border2) !important;
    --clienti-blue: var(--primary) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .entity-root.clienti-page {
    background: transparent !important;
    box-shadow: none !important;
}

html[data-theme="light"] .clienti-page .panel-no-shell {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
}

html[data-theme="light"] .entity-root.clienti-page::before,
html[data-theme="light"] .entity-root.clienti-page::after,
html[data-theme="light"] .clienti-page::before,
html[data-theme="light"] .clienti-page::after {
    display: none !important;
}

html[data-theme="light"] .entity-root.clienti-page .entity-header,
html[data-theme="light"] .clienti-page .page-head,
html[data-theme="light"] .clienti-page .card,
html[data-theme="light"] .clienti-page .list-card,
html[data-theme="light"] .clienti-page .toolbar-card,
html[data-theme="light"] .clienti-page .list-search,
html[data-theme="light"] .clienti-page .list-meta,
html[data-theme="light"] .clienti-page .list-meta-footer,
html[data-theme="light"] .clienti-page .list-scroll,
html[data-theme="light"] .clienti-page .inline-related-block,
html[data-theme="light"] .clienti-page .details-card,
html[data-theme="light"] .clienti-page .activity-card,
html[data-theme="light"] .clienti-page .event-card,
html[data-theme="light"] .clienti-page .history-visibility-panel,
html[data-theme="light"] .clienti-page .history-attachments-panel,
html[data-theme="light"] .clienti-page .history-attachment,
html[data-theme="light"] .clienti-page .call-panel,
html[data-theme="light"] .clienti-page .contact-add-modal,
html[data-theme="light"] .clienti-page .rl-modal,
html[data-theme="light"] .clienti-page .rt-modal,
html[data-theme="light"] .clienti-page .panel-no-shell .related-section .list-card,
html[data-theme="light"] .clienti-page .rl-modal .related-section .list-card {
    background: var(--surface) !important;
    background-image: none !important;
    border-color: var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .entity-root.clienti-page .entity-header {
    border-bottom-color: var(--border) !important;
}

html[data-theme="light"] .clienti-page .head-tabs {
    border-top-color: var(--border2) !important;
}

html[data-theme="light"] .clienti-page .hierarchy-btn {
    background: var(--primary) !important;
    border-color: transparent !important;
    color: #ffffff !important;
    box-shadow: 0 6px 14px rgba(1, 118, 211, .24) !important;
}

html[data-theme="light"] .clienti-page .hierarchy-btn:hover {
    background: var(--primaryHover) !important;
    color: #ffffff !important;
    box-shadow: 0 8px 18px rgba(1, 98, 176, .28) !important;
}

html[data-theme="light"] .entity-root.clienti-page .page-title,
html[data-theme="light"] .entity-root.clienti-page .page-sub,
html[data-theme="light"] .entity-root.clienti-page .list-title,
html[data-theme="light"] .entity-root.clienti-page .list-count,
html[data-theme="light"] .clienti-page .client-title,
html[data-theme="light"] .clienti-page .section-head,
html[data-theme="light"] .clienti-page .inline-related-title,
html[data-theme="light"] .clienti-page .activity-head-title,
html[data-theme="light"] .clienti-page .event-body,
html[data-theme="light"] .clienti-page .event-user,
html[data-theme="light"] .clienti-page .field .value,
html[data-theme="light"] .clienti-page .ir-val,
html[data-theme="light"] .clienti-page .history-attachment,
html[data-theme="light"] .clienti-page .vis-option,
html[data-theme="light"] .clienti-page .vis-user,
html[data-theme="light"] .clienti-page .modal-head,
html[data-theme="light"] .clienti-page .modal-body,
html[data-theme="light"] .clienti-page .modal-panel {
    color: var(--text) !important;
}

html[data-theme="light"] .entity-root.clienti-page .page-sub,
html[data-theme="light"] .clienti-page .subtitle,
html[data-theme="light"] .clienti-page .verify-label,
html[data-theme="light"] .clienti-page .sarcini-sub,
html[data-theme="light"] .clienti-page .sarcini-meta,
html[data-theme="light"] .clienti-page .field .label,
html[data-theme="light"] .clienti-page .ir-label,
html[data-theme="light"] .clienti-page .event .time,
html[data-theme="light"] .clienti-page .title,
html[data-theme="light"] .clienti-page .text-muted,
html[data-theme="light"] .clienti-page .inline-related-empty,
html[data-theme="light"] .clienti-page .history-visibility-title,
html[data-theme="light"] .clienti-page .history-attachments-title {
    color: var(--muted2) !important;
}

html[data-theme="light"] .clienti-page .attention-banner {
    background: color-mix(in srgb, #facc15 10%, #ffffff 90%) !important;
    border-color: color-mix(in srgb, #b95000 32%, var(--border)) !important;
    color: #7a3f00 !important;
}

html[data-theme="light"] .clienti-page .attention-value {
    color: #6b3a00 !important;
}

html[data-theme="light"] .clienti-page .verify-banner {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .clienti-page .planif-banner {
    background: color-mix(in srgb, var(--primary) 10%, #ffffff 90%) !important;
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border)) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .clienti-page .sarcini-panel {
    background: linear-gradient(180deg, #fff, #fffaf3) !important;
    border-color: color-mix(in srgb, var(--warning) 40%, var(--border)) !important;
}

html[data-theme="light"] .clienti-page .sarcini-item {
    background: #fff !important;
    border-color: var(--border) !important;
}

html[data-theme="light"] .clienti-page .inline-related-head,
html[data-theme="light"] .clienti-page .details-card .section-head,
html[data-theme="light"] .clienti-page .activity-head {
    background: #fff !important;
    border-bottom-color: var(--border2) !important;
}

html[data-theme="light"] .clienti-page .inline-related-row {
    background: #fff !important;
    border-color: var(--border2) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .clienti-page .inline-related-row.clickable:hover {
    background: color-mix(in srgb, var(--surface) 90%, var(--primarySoft)) !important;
    border-color: color-mix(in srgb, var(--primary) 34%, var(--border)) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="light"] .clienti-page .inline-related-row.contact-merged-row {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

html[data-theme="light"] .clienti-page .inline-related-row.contact-merged-row.clickable:hover {
    background: color-mix(in srgb, var(--surface) 92%, var(--primarySoft)) !important;
    border: 0 !important;
    border-radius: 8px !important;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 22%, transparent), 0 6px 12px rgba(15, 23, 42, .08) !important;
    transform: translateX(2px) !important;
}

html[data-theme="light"] .clienti-page .contact-group-divider {
    background: var(--border2) !important;
}

html[data-theme="light"] .clienti-page .contact-item-icon {
    color: var(--muted2) !important;
}

html[data-theme="light"] .clienti-page .contact-add-overlay {
    background: rgba(15, 23, 42, .16) !important;
}

html[data-theme="light"] .clienti-page .contact-add-option {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .clienti-page .contact-add-option:hover,
html[data-theme="light"] .clienti-page .contact-add-option.active {
    background: color-mix(in srgb, var(--surface) 90%, var(--primarySoft)) !important;
    border-color: color-mix(in srgb, var(--primary) 34%, var(--border)) !important;
}

html[data-theme="light"] .clienti-page .contact-add-option-state,
html[data-theme="light"] .clienti-page .contact-add-subtitle {
    color: var(--muted2) !important;
}

html[data-theme="light"] .entity-root.clienti-page .search-native,
html[data-theme="light"] .entity-root.clienti-page .search-input .mud-input-root,
html[data-theme="light"] .entity-root.clienti-page .search-control,
html[data-theme="light"] .entity-root.clienti-page .filter-input,
html[data-theme="light"] .entity-root.clienti-page .sort-select,
html[data-theme="light"] .entity-root.clienti-page .page-size,
html[data-theme="light"] .clienti-page .details-grid .form-control,
html[data-theme="light"] .clienti-page .details-grid .form-select,
html[data-theme="light"] .clienti-page .details-grid .ta,
html[data-theme="light"] .clienti-page .history-attachments-upload {
    background: #fff !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .entity-root.clienti-page .search-control::placeholder,
html[data-theme="light"] .entity-root.clienti-page .filter-input::placeholder {
    color: var(--muted2) !important;
    opacity: 1 !important;
}

html[data-theme="light"] .entity-root.clienti-page .search-icon,
html[data-theme="light"] .entity-root.clienti-page .clear-btn,
html[data-theme="light"] .entity-root.clienti-page .list-num {
    color: var(--muted) !important;
    border-color: var(--border) !important;
    background: var(--surface2) !important;
}

html[data-theme="light"] .clienti-page .btn-close {
    color: #ffffff !important;
    border-color: var(--primary) !important;
    background: var(--primary) !important;
    box-shadow: 0 6px 14px rgba(1, 118, 211, .24) !important;
}

html[data-theme="light"] .clienti-page .btn-close:hover {
    color: #ffffff !important;
    border-color: var(--primaryHover) !important;
    background: var(--primaryHover) !important;
    box-shadow: 0 8px 18px rgba(1, 98, 176, .28) !important;
}

html[data-theme="light"] .entity-root.clienti-page .btn.btn-primary,
html[data-theme="light"] .clienti-page .btn.btn-primary {
    background: var(--primary) !important;
    background-image: none !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}

html[data-theme="light"] .entity-root.clienti-page .btn.btn-primary:hover,
html[data-theme="light"] .clienti-page .btn.btn-primary:hover {
    background: var(--primaryHover) !important;
    border-color: var(--primaryHover) !important;
}

html[data-theme="light"] .entity-root.clienti-page .btn.btn-outline-secondary,
html[data-theme="light"] .entity-root.clienti-page .clear-btn,
html[data-theme="light"] .entity-root.clienti-page .filter-toggle,
html[data-theme="light"] .entity-root.clienti-page .list-pager .btn,
html[data-theme="light"] .clienti-page .mini-add-btn,
html[data-theme="light"] .clienti-page .mini-send-btn,
html[data-theme="light"] .clienti-page .activity-add,
html[data-theme="light"] .clienti-page .event-icon-btn {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .entity-root.clienti-page .btn.btn-outline-secondary:hover,
html[data-theme="light"] .entity-root.clienti-page .clear-btn:hover,
html[data-theme="light"] .entity-root.clienti-page .filter-toggle:hover,
html[data-theme="light"] .entity-root.clienti-page .list-pager .btn:hover,
html[data-theme="light"] .clienti-page .mini-add-btn:hover,
html[data-theme="light"] .clienti-page .mini-send-btn:hover,
html[data-theme="light"] .clienti-page .activity-add:hover,
html[data-theme="light"] .clienti-page .event-icon-btn:hover,
html[data-theme="light"] .clienti-page .event-icon-btn.active {
    background: color-mix(in srgb, var(--surface) 90%, var(--primarySoft)) !important;
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border)) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .clienti-page .mini-del-btn,
html[data-theme="light"] .clienti-page .bin-btn,
html[data-theme="light"] .clienti-page .att-delete,
html[data-theme="light"] .clienti-page .fin-doc-delete {
    color: var(--muted2) !important;
    border-color: var(--border) !important;
    background: var(--surface2) !important;
}

html[data-theme="light"] .clienti-page .mini-del-btn:hover,
html[data-theme="light"] .clienti-page .bin-btn:hover,
html[data-theme="light"] .clienti-page .att-delete:hover,
html[data-theme="light"] .clienti-page .fin-doc-delete:hover {
    background: var(--danger) !important;
    border-color: var(--danger) !important;
    color: #fff !important;
}

html[data-theme="light"] .entity-root.clienti-page .table,
html[data-theme="light"] .clienti-page .table,
html[data-theme="light"] .clienti-page .related-section .table {
    background: transparent !important;
}

html[data-theme="light"] .entity-root.clienti-page .table thead th,
html[data-theme="light"] .entity-root.clienti-page .filter-row th,
html[data-theme="light"] .clienti-page .table thead th,
html[data-theme="light"] .clienti-page .panel-no-shell .related-section .table thead th,
html[data-theme="light"] .clienti-page .rl-modal .related-section .table thead th {
    background: var(--surface2) !important;
    background-image: none !important;
    color: var(--muted) !important;
    border-bottom-color: var(--border) !important;
    border-left-color: transparent !important;
    border-right-color: transparent !important;
}

html[data-theme="light"] .entity-root.clienti-page .table tbody tr td,
html[data-theme="light"] .clienti-page .table tbody tr td,
html[data-theme="light"] .clienti-page .panel-no-shell .related-section .table tbody tr td,
html[data-theme="light"] .clienti-page .rl-modal .related-section .table tbody tr td {
    background: #fff !important;
    background-image: none !important;
    color: var(--text) !important;
    border-top-color: transparent !important;
    border-bottom-color: var(--border2) !important;
    border-left-color: transparent !important;
    border-right-color: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

html[data-theme="light"] .entity-root.clienti-page .table tbody tr:hover td,
html[data-theme="light"] .clienti-page .table tbody tr:hover td,
html[data-theme="light"] .clienti-page .panel-no-shell .related-section .table tbody tr:hover td {
    background: color-mix(in srgb, var(--surface) 88%, var(--primarySoft)) !important;
    border-bottom-color: color-mix(in srgb, var(--primary) 35%, var(--border)) !important;
}

html[data-theme="light"] .entity-root.clienti-page .table tbody tr:nth-child(even) td,
html[data-theme="light"] .clienti-page .panel-no-shell .related-section .table tbody tr:nth-child(even) td {
    background: color-mix(in srgb, var(--surface) 96%, var(--primarySoft)) !important;
}

html[data-theme="light"] .entity-root.clienti-page .no-results,
html[data-theme="light"] .clienti-page .panel-loading {
    color: var(--muted2) !important;
}

html[data-theme="light"] .clienti-page .tabs .tab,
html[data-theme="light"] .clienti-page .tab,
html[data-theme="light"] .clienti-page .rl-modal-tabs .pill,
html[data-theme="light"] .clienti-page .rl-modal-tabs .pill {
    background: var(--surface2) !important;
    background-image: none !important;
    border-color: var(--border) !important;
    color: var(--muted) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .clienti-page .tabs .tab:hover,
html[data-theme="light"] .clienti-page .tab:hover,
html[data-theme="light"] .clienti-page .rl-modal-tabs .pill:hover,
html[data-theme="light"] .clienti-page .rl-modal-tabs .pill:hover {
    background: color-mix(in srgb, var(--surface) 90%, var(--primarySoft)) !important;
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border)) !important;
    color: var(--text) !important;
    box-shadow: var(--shadow-sm) !important;
    transform: translateY(-1px);
}

html[data-theme="light"] .clienti-page .tabs .tab.active,
html[data-theme="light"] .clienti-page .tab.active {
    background: var(--primary) !important;
    background-image: none !important;
    border-color: var(--primary) !important;
    color: #ffffff !important;
    box-shadow: 0 6px 14px rgba(1, 118, 211, .24), inset 0 0 0 1px rgba(255,255,255,.08) !important;
}

html[data-theme="light"] .clienti-page .rl-modal-tabs .pill.active {
    background: var(--primarySoft) !important;
    background-image: none !important;
    border-color: color-mix(in srgb, var(--primary) 50%, var(--border)) !important;
    color: var(--text) !important;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 20%, transparent) !important;
}

html[data-theme="light"] .clienti-page .details-card .details-grid .field {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

html[data-theme="light"] .clienti-page .details-card .details-grid .field:nth-child(n+3),
html[data-theme="light"] .clienti-page .details-card .edit-actions {
    border-color: var(--border2) !important;
    background: transparent !important;
}

html[data-theme="light"] .clienti-page .day-sep .line,
html[data-theme="light"] .clienti-page .marker .stem {
    background: var(--border2) !important;
}

html[data-theme="light"] .clienti-page .event-user,
html[data-theme="light"] .clienti-page .history-visibility-panel,
html[data-theme="light"] .clienti-page .history-attachments-panel,
html[data-theme="light"] .clienti-page .history-attachment {
    border-color: var(--border) !important;
}

html[data-theme="light"] .clienti-page .event-user {
    background: color-mix(in srgb, var(--surface) 90%, var(--primarySoft)) !important;
}

html[data-theme="light"] .clienti-page .event-card {
    background: #fff !important;
    background-image: none !important;
    border-color: var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="light"] .clienti-page .event-card::before {
    width: 2px !important;
    opacity: .55 !important;
    background: color-mix(in srgb, var(--primary) 72%, #ffffff 28%) !important;
}

html[data-theme="light"] .clienti-page .event-card.clickable:hover {
    border-color: color-mix(in srgb, var(--primary) 28%, var(--border)) !important;
    box-shadow: 0 4px 12px rgba(16, 24, 40, .10) !important;
}

html[data-theme="light"] .clienti-page .marker .bullet {
    background: #fff !important;
    color: var(--primary) !important;
    border-color: color-mix(in srgb, var(--primary) 25%, var(--border)) !important;
    box-shadow: var(--shadow-sm) !important;
}

/* Popup / modal harmonization (global light mode) */
html[data-theme="light"] .modal-backdrop,
html[data-theme="light"] .calendar-modal-backdrop,
html[data-theme="light"] .qa-backdrop,
html[data-theme="light"] .confirm-backdrop,
html[data-theme="light"] .rl-overlay,
html[data-theme="light"] .rt-backdrop,
html[data-theme="light"] .iscir-modal-backdrop,
html[data-theme="light"] .mail-modal-backdrop,
html[data-theme="light"] .stock-modal-backdrop,
html[data-theme="light"] .mode-modal-backdrop,
html[data-theme="light"] .te-modal-backdrop,
html[data-theme="light"] .contact-add-overlay,
html[data-theme="light"] .mud-overlay {
    background: rgba(15, 23, 42, .34) !important;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

html[data-theme="light"] .modal-card,
html[data-theme="light"] .modal-panel,
html[data-theme="light"] .calendar-modal,
html[data-theme="light"] .qa-modal,
html[data-theme="light"] .confirm-card,
html[data-theme="light"] .rl-modal,
html[data-theme="light"] .rt-modal,
html[data-theme="light"] .iscir-modal,
html[data-theme="light"] .mail-modal,
html[data-theme="light"] .stock-modal,
html[data-theme="light"] .mode-modal,
html[data-theme="light"] .te-modal,
html[data-theme="light"] .mud-dialog,
html[data-theme="light"] .mud-popover {
    background: var(--surface) !important;
    background-image: none !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
    box-shadow: var(--shadow) !important;
}

html[data-theme="light"] .modal-head,
html[data-theme="light"] .modal-foot,
html[data-theme="light"] .qa-head,
html[data-theme="light"] .qa-foot,
html[data-theme="light"] .rl-modal-header,
html[data-theme="light"] .rl-modal-footer,
html[data-theme="light"] .iscir-modal-head,
html[data-theme="light"] .iscir-modal-actions,
html[data-theme="light"] .stock-modal-head,
html[data-theme="light"] .te-modal-header,
html[data-theme="light"] .te-modal-footer,
html[data-theme="light"] .mud-dialog-title,
html[data-theme="light"] .mud-dialog-actions {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

html[data-theme="light"] .modal-body,
html[data-theme="light"] .qa-body,
html[data-theme="light"] .rl-modal-body,
html[data-theme="light"] .iscir-modal-body,
html[data-theme="light"] .stock-modal-body,
html[data-theme="light"] .te-modal-body,
html[data-theme="light"] .mud-dialog-content {
    background: var(--surface) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .modal-title,
html[data-theme="light"] .qa-title,
html[data-theme="light"] .stock-modal-title,
html[data-theme="light"] .mode-modal-title,
html[data-theme="light"] .modal-from,
html[data-theme="light"] .modal-subject,
html[data-theme="light"] .confirm-title,
html[data-theme="light"] .te-modal-header h5 {
    color: var(--text) !important;
}

html[data-theme="light"] .modal-sub,
html[data-theme="light"] .modal-date,
html[data-theme="light"] .stock-modal-sub,
html[data-theme="light"] .mode-modal-sub,
html[data-theme="light"] .qa-subtitle,
html[data-theme="light"] .qa-card-desc,
html[data-theme="light"] .confirm-message,
html[data-theme="light"] .te-modal .text-muted,
html[data-theme="light"] .te-modal .small {
    color: var(--muted) !important;
}

html[data-theme="light"] .qa-modal .form-label,
html[data-theme="light"] .iscir-modal-body .form-label,
html[data-theme="light"] .modal-card .form-label,
html[data-theme="light"] .modal-panel .form-label,
html[data-theme="light"] .mail-modal .modal-head,
html[data-theme="light"] .mail-modal .modal-body,
html[data-theme="light"] .mail-modal .attachment-list .title,
html[data-theme="light"] .mail-modal .attachment-size,
html[data-theme="light"] .stock-option-title,
html[data-theme="light"] .transfer-block label,
html[data-theme="light"] .transfer-qty label,
html[data-theme="light"] .stock-tech-select label,
html[data-theme="light"] .user-search-item,
html[data-theme="light"] .client-search-item {
    color: var(--text) !important;
}

html[data-theme="light"] .qa-card,
html[data-theme="light"] .qa-card-icon,
html[data-theme="light"] .stock-option,
html[data-theme="light"] .techstock-group,
html[data-theme="light"] .listaj-table,
html[data-theme="light"] .mail-modal .modal-body,
html[data-theme="light"] .mail-modal .attachment-preview,
html[data-theme="light"] .mail-modal .attachment,
html[data-theme="light"] .user-search-dropdown,
html[data-theme="light"] .client-search-dropdown,
html[data-theme="light"] .file-preview-frame-wrap {
    background: var(--surface2) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="light"] .listaj-table thead th,
html[data-theme="light"] .listaj-table tbody td,
html[data-theme="light"] .techstock-summary-row,
html[data-theme="light"] .techstock-meta,
html[data-theme="light"] .techstock-total,
html[data-theme="light"] .stock-option-sub,
html[data-theme="light"] .transfer-block label,
html[data-theme="light"] .transfer-qty label,
html[data-theme="light"] .stock-tech-select label,
html[data-theme="light"] .modal-body .text-muted {
    color: var(--muted) !important;
    border-color: var(--border2) !important;
    background-image: none !important;
}

html[data-theme="light"] .qa-modal .form-control,
html[data-theme="light"] .qa-modal .form-select,
html[data-theme="light"] .rt-modal .form-check-input,
html[data-theme="light"] .iscir-modal-body .form-control,
html[data-theme="light"] .iscir-modal-body .ta,
html[data-theme="light"] .iscir-modal-body .iscir-input,
html[data-theme="light"] .iscir-modal-body input[type="date"].iscir-input,
html[data-theme="light"] .modal-card .form-control,
html[data-theme="light"] .modal-card .form-select,
html[data-theme="light"] .modal-panel .form-control,
html[data-theme="light"] .modal-panel .form-select,
html[data-theme="light"] .modal-panel .ta,
html[data-theme="light"] .stock-modal select,
html[data-theme="light"] .stock-modal input,
html[data-theme="light"] .stock-modal textarea {
    background: var(--surface2) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .qa-modal .form-control:focus,
html[data-theme="light"] .qa-modal .form-select:focus,
html[data-theme="light"] .iscir-modal-body .form-control:focus,
html[data-theme="light"] .iscir-modal-body .ta:focus,
html[data-theme="light"] .iscir-modal-body .iscir-input:focus,
html[data-theme="light"] .iscir-modal-body input[type="date"].iscir-input:focus,
html[data-theme="light"] .modal-card .form-control:focus,
html[data-theme="light"] .modal-card .form-select:focus,
html[data-theme="light"] .modal-panel .form-control:focus,
html[data-theme="light"] .modal-panel .form-select:focus,
html[data-theme="light"] .modal-panel .ta:focus,
html[data-theme="light"] .stock-modal select:focus,
html[data-theme="light"] .stock-modal input:focus,
html[data-theme="light"] .stock-modal textarea:focus {
    border-color: color-mix(in srgb, var(--primary) 44%, var(--border)) !important;
    box-shadow: var(--focus) !important;
    outline: none;
}

html[data-theme="light"] .iscir-modal-body input[type="date"].iscir-input {
    color-scheme: light;
}

html[data-theme="light"] .iscir-modal-body input[type="date"].iscir-input::-webkit-datetime-edit {
    color: var(--text) !important;
}

html[data-theme="light"] .iscir-modal-body input[type="date"].iscir-input::-webkit-calendar-picker-indicator {
    filter: none;
    opacity: .8;
}

html[data-theme="light"] .confirm-btn.cancel {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .confirm-btn.cancel:hover {
    background: color-mix(in srgb, var(--surface) 90%, var(--primarySoft)) !important;
    border-color: color-mix(in srgb, var(--primary) 30%, var(--border)) !important;
}

html[data-theme="light"] .confirm-btn.danger {
    background: var(--danger) !important;
    border-color: var(--danger) !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

html[data-theme="light"] .clienti-page {
    --cdv-bg: var(--bg);
    --cdv-surface: var(--surface);
    --cdv-surface-2: var(--surface2);
    --cdv-border: var(--border);
    --cdv-border-soft: var(--border2);
    --cdv-text: var(--text);
    --cdv-muted: var(--muted2);
    --cdv-primary: var(--primary);
    --cdv-cyan: var(--primary);
    --cdv-danger: var(--danger);
    --cc-bg: var(--bg);
    --cc-surface: var(--surface);
    --cc-surface-2: var(--surface2);
    --cc-border: var(--border);
    --cc-border-soft: var(--border2);
    --cc-text: var(--text);
    --cc-muted: var(--muted2);
    --cc-primary: var(--primary);
    --cc-cyan: var(--primary);
    --cc-danger: var(--danger);
}

html[data-theme="light"] .clienti-page .rl-modal,
html[data-theme="light"] .clienti-page .related-section .rl-modal,
html[data-theme="light"] .related-section .rl-modal {
    background: var(--surface) !important;
    border-color: var(--border) !important;
    box-shadow: var(--shadow) !important;
    --c-sec-head: var(--text) !important;
    --c-sec-muted: var(--muted) !important;
    --c-sec-fill: var(--surface) !important;
    --c-sec-fill-strong: var(--surface) !important;
    --c-sec-outline: var(--border) !important;
    --c-sec-head-bg: var(--surface2) !important;
    --c-sec-head-border: var(--border) !important;
    --c-label: var(--text) !important;
    --c-text: var(--text) !important;
}

html[data-theme="light"] .rl-modal .df-section-head,
html[data-theme="light"] .rl-modal .df-section,
html[data-theme="light"] .rl-modal .df-section .row,
html[data-theme="light"] .rl-modal .form-label,
html[data-theme="light"] .rl-modal .rl-modal-title,
html[data-theme="light"] .rl-modal .rl-modal-footer-label,
html[data-theme="light"] .rl-modal .rl-modal-footer-line,
html[data-theme="light"] .rl-modal .rl-modal-footer-value {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

html[data-theme="light"] .clienti-page .rl-modal-tabs .pill,
html[data-theme="light"] .rl-modal-tabs .pill {
    background: var(--surface2) !important;
    border: 1px solid var(--border) !important;
    color: var(--muted) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .clienti-page .rl-modal-tabs .pill:hover,
html[data-theme="light"] .rl-modal-tabs .pill:hover {
    background: color-mix(in srgb, var(--surface) 90%, var(--primarySoft)) !important;
    border-color: color-mix(in srgb, var(--primary) 34%, var(--border)) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .clienti-page .rl-modal-tabs .pill.active,
html[data-theme="light"] .rl-modal-tabs .pill.active {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #ffffff !important;
    box-shadow: 0 6px 14px rgba(1, 118, 211, .24) !important;
}

html[data-theme="light"] .clienti-page .rl-modal .related-section .list-card,
html[data-theme="light"] .clienti-page .panel-no-shell .related-section .list-card,
html[data-theme="light"] .clienti-page .related-section .list-card {
    background: var(--surface) !important;
    border-color: var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="light"] .clienti-page .rl-modal .related-section .table thead th,
html[data-theme="light"] .clienti-page .panel-no-shell .related-section .table thead th,
html[data-theme="light"] .clienti-page .related-section .table thead th {
    background: var(--surface2) !important;
    color: var(--muted) !important;
    border-bottom-color: var(--border) !important;
}

html[data-theme="light"] .clienti-page .rl-modal .related-section .table tbody tr td,
html[data-theme="light"] .clienti-page .panel-no-shell .related-section .table tbody tr td,
html[data-theme="light"] .clienti-page .related-section .table tbody tr td {
    background: #ffffff !important;
    color: var(--text) !important;
    border-bottom-color: var(--border2) !important;
}

html[data-theme="light"] .clienti-page .rl-modal .related-section .table tbody tr:nth-child(even) td,
html[data-theme="light"] .clienti-page .panel-no-shell .related-section .table tbody tr:nth-child(even) td,
html[data-theme="light"] .clienti-page .related-section .table tbody tr:nth-child(even) td {
    background: color-mix(in srgb, var(--surface) 96%, var(--primarySoft)) !important;
}

html[data-theme="light"] .clienti-page .rl-modal .related-section .table tbody tr:hover td,
html[data-theme="light"] .clienti-page .panel-no-shell .related-section .table tbody tr:hover td,
html[data-theme="light"] .clienti-page .related-section .table tbody tr:hover td {
    background: color-mix(in srgb, var(--surface) 88%, var(--primarySoft)) !important;
    border-bottom-color: color-mix(in srgb, var(--primary) 34%, var(--border)) !important;
}

html[data-theme="light"] .clienti-page .hier-card,
html[data-theme="light"] .clienti-page .root-node > .hier-card,
html[data-theme="light"] .clienti-page .child-card {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .clienti-page .root-node > .hier-card {
    background: color-mix(in srgb, var(--surface) 86%, var(--primarySoft)) !important;
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border)) !important;
}

html[data-theme="light"] .clienti-page .hier-name {
    color: var(--text) !important;
}

html[data-theme="light"] .clienti-page .hier-role {
    color: var(--muted2) !important;
}

html[data-theme="light"] .clienti-page .hier-line-vert,
html[data-theme="light"] .clienti-page .hier-line-horiz,
html[data-theme="light"] .clienti-page .hier-children {
    background: var(--border2) !important;
    border-color: var(--border2) !important;
}

/* ---------------------------------------------------------
   Facturare pages: complete light theme remap
   --------------------------------------------------------- */
html[data-theme="light"] .facturi-page,
html[data-theme="light"] .facturare-produse-page,
html[data-theme="light"] .nota-receptie-page {
    color: var(--text);
}

html[data-theme="light"] .facturi-page .text-muted,
html[data-theme="light"] .facturare-produse-page .text-muted,
html[data-theme="light"] .nota-receptie-page .text-muted,
html[data-theme="light"] .iscir-page .text-muted {
    color: var(--muted) !important;
}

html[data-theme="light"] .facturi-page .products-card,
html[data-theme="light"] .facturare-produse-page .products-card,
html[data-theme="light"] .nota-receptie-page .products-card {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .facturi-page .products-title,
html[data-theme="light"] .facturare-produse-page .products-title,
html[data-theme="light"] .nota-receptie-page .products-title {
    color: var(--text) !important;
}

html[data-theme="light"] .facturi-page .products-sub,
html[data-theme="light"] .facturare-produse-page .products-sub,
html[data-theme="light"] .nota-receptie-page .products-sub,
html[data-theme="light"] .facturi-page .client-lookup-label,
html[data-theme="light"] .facturare-produse-page .settings-sub,
html[data-theme="light"] .facturare-produse-page .settings-group label,
html[data-theme="light"] .facturare-produse-page .techstock-meta,
html[data-theme="light"] .facturare-produse-page .transfer-block label,
html[data-theme="light"] .facturare-produse-page .transfer-qty label,
html[data-theme="light"] .facturare-produse-page .stock-tech-select label,
html[data-theme="light"] .facturi-page .stock-modal-sub,
html[data-theme="light"] .facturare-produse-page .modal-sub,
html[data-theme="light"] .facturare-produse-page .techstock-summary,
html[data-theme="light"] .nota-receptie-page .products-sub {
    color: var(--muted) !important;
}

html[data-theme="light"] .facturi-page .products-refresh,
html[data-theme="light"] .facturare-produse-page .products-refresh,
html[data-theme="light"] .nota-receptie-page .products-refresh {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .facturi-page .products-refresh:hover,
html[data-theme="light"] .facturare-produse-page .products-refresh:hover,
html[data-theme="light"] .nota-receptie-page .products-refresh:hover {
    background: color-mix(in srgb, var(--surface) 90%, var(--primarySoft)) !important;
    border-color: color-mix(in srgb, var(--primary) 36%, var(--border)) !important;
}

html[data-theme="light"] .facturi-page .products-refresh.is-loading::after,
html[data-theme="light"] .facturare-produse-page .products-refresh.is-loading::after,
html[data-theme="light"] .nota-receptie-page .products-refresh.is-loading::after {
    border-color: color-mix(in srgb, var(--primary) 22%, #ffffff) !important;
    border-top-color: var(--primary) !important;
}

html[data-theme="light"] .facturare-produse-page .products-settings {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #ffffff !important;
}

html[data-theme="light"] .facturare-produse-page .products-settings:hover {
    background: var(--primaryHover) !important;
    border-color: var(--primaryHover) !important;
}

html[data-theme="light"] .facturi-page .client-lookup {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .facturi-page .client-lookup-info {
    color: var(--muted) !important;
}

html[data-theme="light"] .facturi-page .client-search-dropdown {
    background: #ffffff !important;
    border-color: var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="light"] .facturi-page .client-search-item {
    color: var(--text) !important;
}

html[data-theme="light"] .facturi-page .client-search-item.muted {
    color: var(--muted) !important;
}

html[data-theme="light"] .facturi-page .client-search-item:hover {
    background: color-mix(in srgb, var(--surface) 88%, var(--primarySoft)) !important;
}

html[data-theme="light"] .facturi-page .products-table,
html[data-theme="light"] .facturare-produse-page .products-table,
html[data-theme="light"] .nota-receptie-page .products-table {
    color: var(--text) !important;
}

html[data-theme="light"] .facturi-page .products-table thead th,
html[data-theme="light"] .facturare-produse-page .products-table thead th,
html[data-theme="light"] .nota-receptie-page .products-table thead th {
    background: var(--surface2) !important;
    color: var(--muted) !important;
    border-bottom-color: var(--border) !important;
}

html[data-theme="light"] .facturi-page .products-row td,
html[data-theme="light"] .facturare-produse-page .products-row td,
html[data-theme="light"] .nota-receptie-page .products-row td {
    background: #ffffff !important;
    border-top-color: var(--border2) !important;
    border-bottom-color: var(--border2) !important;
}

html[data-theme="light"] .facturi-page .products-row td:first-child,
html[data-theme="light"] .facturare-produse-page .products-row td:first-child,
html[data-theme="light"] .nota-receptie-page .products-row td:first-child {
    border-left-color: var(--border2) !important;
}

html[data-theme="light"] .facturi-page .products-row td:last-child,
html[data-theme="light"] .facturare-produse-page .products-row td:last-child,
html[data-theme="light"] .nota-receptie-page .products-row td:last-child {
    border-right-color: var(--border2) !important;
}

html[data-theme="light"] .facturi-page .products-row.dirty td,
html[data-theme="light"] .facturare-produse-page .products-row.dirty td,
html[data-theme="light"] .nota-receptie-page .products-row.dirty td {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 30%, transparent) !important;
}

html[data-theme="light"] .facturi-page .products-table tbody tr:hover td,
html[data-theme="light"] .facturare-produse-page .products-table tbody tr:hover td,
html[data-theme="light"] .nota-receptie-page .products-table tbody tr:hover td {
    background: color-mix(in srgb, var(--surface) 88%, var(--primarySoft)) !important;
    border-bottom-color: color-mix(in srgb, var(--primary) 32%, var(--border)) !important;
}

html[data-theme="light"] .facturi-page .new-row td,
html[data-theme="light"] .facturare-produse-page .new-row td,
html[data-theme="light"] .nota-receptie-page .new-row td {
    background: color-mix(in srgb, var(--surface) 94%, var(--primarySoft)) !important;
    border-color: color-mix(in srgb, var(--primary) 26%, var(--border)) !important;
}

html[data-theme="light"] .facturi-page .products-empty td,
html[data-theme="light"] .facturare-produse-page .products-empty td,
html[data-theme="light"] .nota-receptie-page .products-empty td,
html[data-theme="light"] .facturi-page .col-index,
html[data-theme="light"] .facturare-produse-page .col-index,
html[data-theme="light"] .nota-receptie-page .col-index {
    color: var(--muted) !important;
}

html[data-theme="light"] .facturi-page .prod-input,
html[data-theme="light"] .facturi-page .prod-select,
html[data-theme="light"] .facturare-produse-page .prod-input,
html[data-theme="light"] .facturare-produse-page .prod-select,
html[data-theme="light"] .facturare-produse-page .settings-textarea,
html[data-theme="light"] .nota-receptie-page .prod-input,
html[data-theme="light"] .nota-receptie-page .prod-select {
    background: #ffffff !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .facturi-page .prod-input::placeholder,
html[data-theme="light"] .facturare-produse-page .prod-input::placeholder,
html[data-theme="light"] .facturare-produse-page .settings-textarea::placeholder,
html[data-theme="light"] .nota-receptie-page .prod-input::placeholder {
    color: var(--muted2) !important;
}

html[data-theme="light"] .facturi-page .prod-input:focus,
html[data-theme="light"] .facturi-page .prod-select:focus,
html[data-theme="light"] .facturare-produse-page .prod-input:focus,
html[data-theme="light"] .facturare-produse-page .prod-select:focus,
html[data-theme="light"] .facturare-produse-page .settings-textarea:focus,
html[data-theme="light"] .nota-receptie-page .prod-input:focus,
html[data-theme="light"] .nota-receptie-page .prod-select:focus {
    border-color: color-mix(in srgb, var(--primary) 44%, var(--border)) !important;
    box-shadow: var(--focus) !important;
}

html[data-theme="light"] .facturi-page .prod-input.readonly,
html[data-theme="light"] .facturare-produse-page .prod-input.readonly,
html[data-theme="light"] .facturare-produse-page .products-row.readonly .prod-input,
html[data-theme="light"] .facturare-produse-page .products-row.readonly .prod-select,
html[data-theme="light"] .nota-receptie-page .prod-input.readonly {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--muted) !important;
}

html[data-theme="light"] .facturi-page .prod-check,
html[data-theme="light"] .facturare-produse-page .prod-check,
html[data-theme="light"] .nota-receptie-page .prod-check {
    accent-color: var(--primary);
}

html[data-theme="light"] .facturi-page .prod-action,
html[data-theme="light"] .facturare-produse-page .prod-action,
html[data-theme="light"] .nota-receptie-page .prod-action {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .facturi-page .prod-action:hover,
html[data-theme="light"] .facturare-produse-page .prod-action:hover,
html[data-theme="light"] .nota-receptie-page .prod-action:hover {
    background: color-mix(in srgb, var(--surface) 90%, var(--primarySoft)) !important;
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border)) !important;
    color: var(--text) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="light"] .facturi-page .prod-action.primary,
html[data-theme="light"] .facturare-produse-page .prod-action.primary,
html[data-theme="light"] .nota-receptie-page .prod-action.primary {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #ffffff !important;
}

html[data-theme="light"] .facturi-page .prod-action.primary:hover,
html[data-theme="light"] .facturare-produse-page .prod-action.primary:hover,
html[data-theme="light"] .nota-receptie-page .prod-action.primary:hover {
    background: var(--primaryHover) !important;
    border-color: var(--primaryHover) !important;
}

html[data-theme="light"] .facturi-page .prod-action.danger,
html[data-theme="light"] .facturare-produse-page .prod-action.danger,
html[data-theme="light"] .nota-receptie-page .prod-action.danger {
    color: color-mix(in srgb, var(--danger) 78%, var(--text)) !important;
    border-color: color-mix(in srgb, var(--danger) 40%, var(--border)) !important;
}

html[data-theme="light"] .facturi-page .prod-action.success,
html[data-theme="light"] .facturare-produse-page .prod-action.success,
html[data-theme="light"] .nota-receptie-page .prod-action.success {
    color: color-mix(in srgb, var(--success) 72%, var(--text)) !important;
    border-color: color-mix(in srgb, var(--success) 45%, var(--border)) !important;
}

html[data-theme="light"] .facturare-produse-page .products-table .prod-action.icon {
    border-color: color-mix(in srgb, var(--primary) 36%, var(--border)) !important;
    color: var(--primary) !important;
    background: color-mix(in srgb, #ffffff 88%, var(--primarySoft)) !important;
}

html[data-theme="light"] .facturare-produse-page .products-table .prod-action.icon:hover {
    border-color: color-mix(in srgb, var(--primary) 56%, var(--border)) !important;
    background: color-mix(in srgb, #ffffff 76%, var(--primarySoft)) !important;
}

html[data-theme="light"] .facturi-page .prod-action:disabled,
html[data-theme="light"] .facturare-produse-page .prod-action:disabled,
html[data-theme="light"] .nota-receptie-page .prod-action:disabled {
    color: var(--muted2) !important;
    border-color: var(--border) !important;
    background: var(--surface2) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .facturi-page .invoice-totals-card {
    background: #ffffff !important;
    border-color: var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="light"] .facturi-page .invoice-total-label {
    color: var(--muted) !important;
}

html[data-theme="light"] .facturi-page .invoice-total-value {
    color: var(--text) !important;
}

html[data-theme="light"] .facturi-page .invoice-total-row.total {
    color: var(--text) !important;
    border-top-color: var(--border) !important;
}

html[data-theme="light"] .facturi-page .inline-loading,
html[data-theme="light"] .facturare-produse-page .inline-loading,
html[data-theme="light"] .nota-receptie-page .inline-loading {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .facturi-page .spinner,
html[data-theme="light"] .facturare-produse-page .spinner,
html[data-theme="light"] .nota-receptie-page .spinner {
    border-color: color-mix(in srgb, var(--primary) 22%, #ffffff) !important;
    border-top-color: var(--primary) !important;
}

html[data-theme="light"] .facturi-page .stock-option,
html[data-theme="light"] .facturare-produse-page .stock-option,
html[data-theme="light"] .facturare-produse-page .techstock-group,
html[data-theme="light"] .facturare-produse-page .listaj-table,
html[data-theme="light"] .facturare-produse-page .file-preview-frame-wrap {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .facturare-produse-page .techstock-summary-row,
html[data-theme="light"] .facturare-produse-page .listaj-table thead th,
html[data-theme="light"] .facturare-produse-page .listaj-table tbody td,
html[data-theme="light"] .facturare-produse-page .techstock-items-head,
html[data-theme="light"] .facturare-produse-page .techstock-item {
    color: var(--text) !important;
    border-color: var(--border2) !important;
}

html[data-theme="light"] .facturare-produse-page .techstock-total,
html[data-theme="light"] .facturare-produse-page .listaj-doc {
    color: var(--primary) !important;
}

/* ---------------------------------------------------------
   ISCIR page: full light theme completion
   --------------------------------------------------------- */
html[data-theme="light"] .iscir-page {
    color: var(--text) !important;
    background: transparent !important;
}

html[data-theme="light"] .iscir-title {
    color: var(--text) !important;
    font-size: clamp(2rem, 4vw, 2.75rem) !important;
    letter-spacing: -.02em !important;
}

html[data-theme="light"] .iscir-subtitle {
    margin-top: .2rem;
    color: var(--muted) !important;
    font-size: .92rem;
}

html[data-theme="light"] .iscir-kpi {
    background: #ffffff !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="light"] .iscir-kpi .kpi-label,
html[data-theme="light"] .iscir-kpi .kpi-hint {
    color: var(--muted) !important;
}

html[data-theme="light"] .iscir-kpi .kpi-value {
    color: var(--text) !important;
}

html[data-theme="light"] .iscir-kpi .kpi-icon {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--primary) !important;
}

html[data-theme="light"] .iscir-kpi.danger {
    border-left-color: var(--border) !important;
}

html[data-theme="light"] .iscir-kpi.warning {
    border-left-color: var(--border) !important;
}

html[data-theme="light"] .iscir-kpi.notice {
    border-left-color: var(--border) !important;
}

html[data-theme="light"] .iscir-kpi.info {
    border-left-color: var(--border) !important;
}

html[data-theme="light"] .iscir-kpi.ok {
    border-left-color: var(--border) !important;
}

html[data-theme="light"] .iscir-tabs {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: var(--surface2) !important;
    border: 1px solid var(--border) !important;
}

html[data-theme="light"] .iscir-tab {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    border: 1px solid transparent !important;
    background: transparent !important;
    color: var(--muted) !important;
    font-weight: 700 !important;
    box-shadow: none !important;
    transform: none !important;
    padding: .45rem .78rem !important;
}

html[data-theme="light"] .iscir-tab:hover {
    background: color-mix(in srgb, var(--surface) 88%, var(--primarySoft)) !important;
    color: var(--text) !important;
    border-color: color-mix(in srgb, var(--primary) 26%, var(--border)) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .iscir-tab.active {
    background: #ffffff !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="light"] .iscir-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    background: #e6ebf2;
    color: #4d5f78;
    font-size: .78rem;
    font-weight: 700;
    line-height: 1;
}

html[data-theme="light"] .iscir-tab.active .iscir-tab-count {
    background: #e2e8f0;
    color: #44566f;
}

html[data-theme="light"] .iscir-card {
    background: #ffffff !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
    transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}

html[data-theme="light"] .iscir-card:hover {
    transform: translateY(-3px);
    border-color: var(--border) !important;
    box-shadow: 0 14px 26px rgba(8, 34, 67, .14) !important;
}

html[data-theme="light"] .iscir-card.card-danger {
    border-color: var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="light"] .iscir-card.card-delegated {
    border-color: var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="light"] .iscir-card.card-danger:hover,
html[data-theme="light"] .iscir-card.card-delegated:hover {
    border-color: var(--border) !important;
    box-shadow: 0 14px 26px rgba(8, 34, 67, .14) !important;
}

html[data-theme="light"] .iscir-pill {
    border: 1px solid transparent;
}

html[data-theme="light"] .pill-danger {
    background: color-mix(in srgb, var(--danger) 14%, #ffffff) !important;
    color: color-mix(in srgb, var(--danger) 82%, var(--text)) !important;
    border-color: color-mix(in srgb, var(--danger) 36%, var(--border)) !important;
}

html[data-theme="light"] .pill-warning,
html[data-theme="light"] .pill-notice {
    background: color-mix(in srgb, #d17f0f 18%, #ffffff) !important;
    color: #7a4803 !important;
    border-color: color-mix(in srgb, #d17f0f 36%, var(--border)) !important;
}

html[data-theme="light"] .pill-info {
    background: color-mix(in srgb, var(--primary) 16%, #ffffff) !important;
    color: color-mix(in srgb, var(--primary) 78%, var(--text)) !important;
    border-color: color-mix(in srgb, var(--primary) 34%, var(--border)) !important;
}

html[data-theme="light"] .pill-ok {
    background: color-mix(in srgb, var(--success) 18%, #ffffff) !important;
    color: color-mix(in srgb, var(--success) 72%, var(--text)) !important;
    border-color: color-mix(in srgb, var(--success) 34%, var(--border)) !important;
}

html[data-theme="light"] .pill-delegated {
    background: color-mix(in srgb, #d17f0f 22%, #ffffff) !important;
    color: #7a4803 !important;
    border-color: color-mix(in srgb, #d17f0f 36%, var(--border)) !important;
}

html[data-theme="light"] .iscir-name,
html[data-theme="light"] .iscir-dates .value {
    color: var(--text) !important;
}

html[data-theme="light"] .iscir-name-row .iscir-pill {
    margin-left: auto;
}

html[data-theme="light"] .iscir-meta,
html[data-theme="light"] .iscir-dates .label,
html[data-theme="light"] .iscir-empty {
    color: var(--muted) !important;
}

html[data-theme="light"] .iscir-divider {
    background: var(--border2) !important;
}

html[data-theme="light"] .iscir-dates .value.danger {
    color: color-mix(in srgb, var(--danger) 82%, var(--text)) !important;
}

html[data-theme="light"] .iscir-page .iscir-actions .btn-primary.small,
html[data-theme="light"] .iscir-page .iscir-modal-actions .btn-primary,
html[data-theme="light"] .iscir-call-panel .btn-ghost:not(.danger):hover {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

html[data-theme="light"] .iscir-page .iscir-actions .btn-primary.small,
html[data-theme="light"] .iscir-page .btn-open {
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease !important;
}

html[data-theme="light"] .iscir-page .iscir-actions .btn-primary.small:hover,
html[data-theme="light"] .iscir-page .iscir-modal-actions .btn-primary:hover {
    background: var(--primaryHover) !important;
    border-color: var(--primaryHover) !important;
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(7, 76, 131, .2) !important;
}

html[data-theme="light"] .iscir-page .btn-delegate {
    background: #f4b740 !important;
    border-color: #d9991f !important;
    color: #553200 !important;
    box-shadow: none !important;
}

html[data-theme="light"] .iscir-page .btn-delegate:hover {
    background: #e7aa34 !important;
    border-color: #cc8f16 !important;
}

html[data-theme="light"] .iscir-page .btn-open {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .iscir-page .btn-open:hover {
    background: color-mix(in srgb, var(--surface) 90%, var(--primarySoft)) !important;
    border-color: color-mix(in srgb, var(--primary) 34%, var(--border)) !important;
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(8, 34, 67, .16) !important;
}

html[data-theme="light"] .iscir-page .contact-options {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
}

html[data-theme="light"] .iscir-page .contact-btn,
html[data-theme="light"] .iscir-page .contact-select,
html[data-theme="light"] .iscir-page .contact-confirm,
html[data-theme="light"] .iscir-page .btn-ghost {
    background: #ffffff !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .iscir-page .contact-btn.sms {
    background: color-mix(in srgb, var(--success) 18%, #ffffff) !important;
    border-color: color-mix(in srgb, var(--success) 40%, var(--border)) !important;
    color: color-mix(in srgb, var(--success) 74%, var(--text)) !important;
}

html[data-theme="light"] .iscir-page .contact-btn.email,
html[data-theme="light"] .iscir-page .contact-btn.call,
html[data-theme="light"] .iscir-page .contact-confirm {
    background: color-mix(in srgb, var(--primary) 16%, #ffffff) !important;
    border-color: color-mix(in srgb, var(--primary) 38%, var(--border)) !important;
    color: color-mix(in srgb, var(--primary) 74%, var(--text)) !important;
}

html[data-theme="light"] .iscir-page .contact-btn:hover:not(:disabled),
html[data-theme="light"] .iscir-page .contact-confirm:hover,
html[data-theme="light"] .iscir-page .btn-ghost:hover {
    background: color-mix(in srgb, var(--surface) 88%, var(--primarySoft)) !important;
    border-color: color-mix(in srgb, var(--primary) 34%, var(--border)) !important;
}

html[data-theme="light"] .iscir-page .btn-ghost.danger {
    color: color-mix(in srgb, var(--danger) 80%, var(--text)) !important;
    border-color: color-mix(in srgb, var(--danger) 34%, var(--border)) !important;
}

html[data-theme="light"] .iscir-call-panel {
    background: #ffffff !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    box-shadow: var(--shadow) !important;
}

html[data-theme="light"] .iscir-call-panel .call-icon {
    background: color-mix(in srgb, var(--primary) 14%, #ffffff) !important;
}

html[data-theme="light"] .iscir-call-panel .call-status {
    color: var(--muted) !important;
}

html[data-theme="light"] .iscir-call-panel .call-error {
    color: color-mix(in srgb, var(--danger) 80%, var(--text)) !important;
}

html[data-theme="light"] .iscir-readonly {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .iscir-page .mc-toast {
    background: #ffffff !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    box-shadow: var(--shadow) !important;
}

html[data-theme="light"] .iscir-page .mc-x {
    color: var(--muted) !important;
}

/* ---------------------------------------------------------
   Rapoarte page: light theme completion
   --------------------------------------------------------- */
html[data-theme="light"] .report-page {
    background: transparent !important;
    color: var(--text) !important;
}

html[data-theme="light"] .report-page .report-hero,
html[data-theme="light"] .report-page .card,
html[data-theme="light"] .report-page .mode-modal {
    background: #ffffff !important;
    border-color: var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .report-page .report-hero h1,
html[data-theme="light"] .report-page .card-title,
html[data-theme="light"] .report-page .mode-modal-title {
    color: var(--text) !important;
}

html[data-theme="light"] .report-page .report-hero p,
html[data-theme="light"] .report-page .eyebrow,
html[data-theme="light"] .report-page .control-card .hint,
html[data-theme="light"] .report-page .hint,
html[data-theme="light"] .report-page .system-field label,
html[data-theme="light"] .report-page .and-label,
html[data-theme="light"] .report-page .mode-modal-sub {
    color: var(--muted) !important;
}

html[data-theme="light"] .report-page .eyebrow {
    color: var(--primary) !important;
}

html[data-theme="light"] .report-page .system-filters,
html[data-theme="light"] .report-page .filter-row,
html[data-theme="light"] .report-page .empty-filter,
html[data-theme="light"] .report-page .empty-state {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--muted) !important;
}

html[data-theme="light"] .report-page .mc-select,
html[data-theme="light"] .report-page .mc-input {
    background: #ffffff !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .report-page .mc-select:focus,
html[data-theme="light"] .report-page .mc-input:focus {
    border-color: color-mix(in srgb, var(--primary) 44%, var(--border)) !important;
    box-shadow: var(--focus) !important;
}

html[data-theme="light"] .report-page .radio-option {
    color: var(--text) !important;
}

html[data-theme="light"] .report-page .icon-btn,
html[data-theme="light"] .report-page .btn-ghost {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .report-page .icon-btn:hover,
html[data-theme="light"] .report-page .btn-ghost:not(:disabled):hover {
    background: color-mix(in srgb, var(--surface) 88%, var(--primarySoft)) !important;
    border-color: color-mix(in srgb, var(--primary) 36%, var(--border)) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .report-page .alert.danger {
    background: color-mix(in srgb, var(--danger) 10%, #ffffff) !important;
    border-color: color-mix(in srgb, var(--danger) 30%, var(--border)) !important;
    color: color-mix(in srgb, var(--danger) 70%, var(--text)) !important;
}

html[data-theme="light"] .report-page .alert.muted {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--muted) !important;
}

html[data-theme="light"] .report-page .mc-table th {
    color: var(--muted) !important;
    border-bottom-color: var(--border) !important;
    background: var(--surface2) !important;
}

html[data-theme="light"] .report-page .mc-table td {
    color: var(--text) !important;
    border-bottom-color: var(--border2) !important;
}

html[data-theme="light"] .report-page .mc-table tr:hover td {
    background: color-mix(in srgb, var(--surface) 88%, var(--primarySoft)) !important;
    box-shadow: none !important;
    transform: none !important;
}

html[data-theme="light"] .report-page .mail-loading {
    color: var(--text) !important;
}

html[data-theme="light"] .report-page .mail-loading .glow {
    background: linear-gradient(90deg, transparent, var(--primary), var(--primaryHover), transparent) !important;
}

/* ---------------------------------------------------------
   Email page: light theme completion
   --------------------------------------------------------- */
html[data-theme="light"] .mail-page {
    background: transparent !important;
    color: var(--text) !important;
}

html[data-theme="light"] .mail-page .mail-hero,
html[data-theme="light"] .mail-page .mail-table,
html[data-theme="light"] .mail-page .mail-modal {
    background: #ffffff !important;
    border-color: var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .mail-page .mail-hero h1,
html[data-theme="light"] .mail-page .modal-from,
html[data-theme="light"] .mail-page .modal-subject,
html[data-theme="light"] .mail-page .mail-row .subj {
    color: var(--text) !important;
}

html[data-theme="light"] .mail-page .mail-hero p,
html[data-theme="light"] .mail-page .hero-actions .hint,
html[data-theme="light"] .mail-page .mail-header,
html[data-theme="light"] .mail-page .mail-row .preview,
html[data-theme="light"] .mail-page .mail-row .date,
html[data-theme="light"] .mail-page .modal-date,
html[data-theme="light"] .mail-page .attachment-size,
html[data-theme="light"] .mail-page .empty-state,
html[data-theme="light"] .mail-page .mail-loading {
    color: var(--muted) !important;
}

html[data-theme="light"] .mail-page .eyebrow {
    color: var(--primary) !important;
}

html[data-theme="light"] .mail-page .btn-ghost {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .mail-page .btn-ghost:not(:disabled):hover {
    background: color-mix(in srgb, var(--surface) 88%, var(--primarySoft)) !important;
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border)) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .mail-page .alert.danger {
    background: color-mix(in srgb, var(--danger) 10%, #ffffff) !important;
    border-color: color-mix(in srgb, var(--danger) 30%, var(--border)) !important;
    color: color-mix(in srgb, var(--danger) 70%, var(--text)) !important;
}

html[data-theme="light"] .mail-page .alert.muted {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--muted) !important;
}

html[data-theme="light"] .mail-page .mail-loading .glow {
    background: linear-gradient(90deg, transparent, var(--primary), var(--primaryHover), transparent) !important;
}

html[data-theme="light"] .mail-page .empty-state {
    border-color: var(--border) !important;
    background: var(--surface2) !important;
}

html[data-theme="light"] .mail-page .mail-header {
    background: var(--surface2) !important;
    border-bottom: 1px solid var(--border) !important;
}

html[data-theme="light"] .mail-page .mail-row {
    border-bottom-color: var(--border2) !important;
}

html[data-theme="light"] .mail-page .mail-row:hover {
    background: color-mix(in srgb, var(--surface) 88%, var(--primarySoft)) !important;
    transform: none !important;
}

html[data-theme="light"] .mail-page .mail-row .from-text {
    color: var(--text) !important;
}

html[data-theme="light"] .mail-page .avatar {
    background: color-mix(in srgb, var(--primary) 15%, #ffffff) !important;
    color: var(--primary) !important;
}

html[data-theme="light"] .mail-page .pill {
    background: var(--surface2) !important;
    border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border)) !important;
    color: var(--primary) !important;
}

html[data-theme="light"] .mail-page .modal-body,
html[data-theme="light"] .mail-page .attachment-preview {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .mail-page .attachment-list .title {
    color: var(--text) !important;
}

html[data-theme="light"] .mail-page .attachment {
    background: #ffffff !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .mail-page .attachment:hover {
    background: color-mix(in srgb, var(--surface) 88%, var(--primarySoft)) !important;
    border-color: color-mix(in srgb, var(--primary) 34%, var(--border)) !important;
}

/* ---------------------------------------------------------
   Clienti detail: financial docs light completion
   --------------------------------------------------------- */
html[data-theme="light"] .clienti-page .fin-docs-count {
    color: var(--muted) !important;
    border-color: var(--border) !important;
    background: var(--surface2) !important;
}

html[data-theme="light"] .clienti-page .fin-doc-upload {
    border-color: var(--border) !important;
    background: var(--surface2) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .clienti-page .fin-doc-upload:hover:not(.disabled) {
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border)) !important;
    background: color-mix(in srgb, var(--surface) 88%, var(--primarySoft)) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="light"] .clienti-page .fin-docs-error {
    color: color-mix(in srgb, var(--danger) 75%, var(--text)) !important;
    background: color-mix(in srgb, var(--danger) 10%, #ffffff) !important;
    border-color: color-mix(in srgb, var(--danger) 30%, var(--border)) !important;
}

html[data-theme="light"] .clienti-page .fin-docs-empty {
    color: var(--muted) !important;
    border-color: var(--border) !important;
    background: var(--surface2) !important;
}

html[data-theme="light"] .clienti-page .fin-doc-card {
    border-color: var(--border) !important;
    background: #ffffff !important;
    color: var(--text) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="light"] .clienti-page .fin-doc-card:not(.is-disabled):hover {
    border-color: color-mix(in srgb, var(--primary) 34%, var(--border)) !important;
    background: color-mix(in srgb, var(--surface) 90%, var(--primarySoft)) !important;
    box-shadow: var(--shadow) !important;
}

html[data-theme="light"] .clienti-page .fin-doc-icon {
    background: color-mix(in srgb, var(--primary) 12%, #ffffff) !important;
    border-color: color-mix(in srgb, var(--primary) 24%, var(--border)) !important;
}

html[data-theme="light"] .clienti-page .fin-doc-title {
    color: var(--text) !important;
}

html[data-theme="light"] .clienti-page .fin-doc-meta,
html[data-theme="light"] .clienti-page .fin-doc-action {
    color: var(--muted) !important;
}

html[data-theme="light"] .entity-root.clienti-page .fin-docs-panel,
html[data-theme="light"] .clienti-page .fin-docs-panel {
    background: transparent !important;
    color: var(--text) !important;
}

html[data-theme="light"] .entity-root.clienti-page .fin-docs-head,
html[data-theme="light"] .entity-root.clienti-page .fin-docs-title,
html[data-theme="light"] .entity-root.clienti-page .fin-docs-actions,
html[data-theme="light"] .clienti-page .fin-docs-head,
html[data-theme="light"] .clienti-page .fin-docs-title,
html[data-theme="light"] .clienti-page .fin-docs-actions {
    background: transparent !important;
    color: var(--text) !important;
}

html[data-theme="light"] .entity-root.clienti-page .fin-docs-title .section-head,
html[data-theme="light"] .clienti-page .fin-docs-title .section-head {
    color: var(--text) !important;
}

html[data-theme="light"] .entity-root.clienti-page .fin-doc-open,
html[data-theme="light"] .clienti-page .fin-doc-open {
    background: transparent !important;
    color: var(--text) !important;
}

html[data-theme="light"] .entity-root.clienti-page .fin-doc-open:disabled,
html[data-theme="light"] .clienti-page .fin-doc-open:disabled {
    color: var(--muted) !important;
}

html[data-theme="light"] .entity-root.clienti-page .fin-doc-card.is-disabled,
html[data-theme="light"] .clienti-page .fin-doc-card.is-disabled {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    opacity: .72;
}

html[data-theme="light"] .entity-root.clienti-page .fin-doc-actions,
html[data-theme="light"] .clienti-page .fin-doc-actions {
    background: transparent !important;
}

html[data-theme="light"] .entity-root.clienti-page .fin-doc-action,
html[data-theme="light"] .clienti-page .fin-doc-action {
    color: var(--primary) !important;
}

html[data-theme="light"] .entity-root.clienti-page .fin-doc-delete,
html[data-theme="light"] .clienti-page .fin-doc-delete {
    border-color: var(--border) !important;
    background: var(--surface2) !important;
    color: var(--muted) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .entity-root.clienti-page .fin-doc-delete:disabled,
html[data-theme="light"] .clienti-page .fin-doc-delete:disabled {
    border-color: var(--border) !important;
    background: var(--surface2) !important;
    color: var(--muted2) !important;
    box-shadow: none !important;
}

/* ---------------------------------------------------------
   Documente Financiare entity page light cleanup
   --------------------------------------------------------- */
html[data-theme="light"] .entity-root.entity-api-documentefinanciare {
    color: var(--text) !important;
}

html[data-theme="light"] .entity-root.entity-api-documentefinanciare .card,
html[data-theme="light"] .entity-root.entity-api-documentefinanciare .list-card,
html[data-theme="light"] .entity-root.entity-api-documentefinanciare .df-section {
    background: var(--surface) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="light"] .entity-root.entity-api-documentefinanciare .entity-header,
html[data-theme="light"] .entity-root.entity-api-documentefinanciare .card-head,
html[data-theme="light"] .entity-root.entity-api-documentefinanciare .editor-head {
    border-color: var(--border) !important;
}

html[data-theme="light"] .entity-root.entity-api-documentefinanciare .editor-pane,
html[data-theme="light"] .entity-root.entity-api-documentefinanciare .editor-scroll {
    background: var(--surface) !important;
}

html[data-theme="light"] .entity-root.entity-api-documentefinanciare .editor-head {
    background: var(--surface2) !important;
}

html[data-theme="light"] .entity-root.entity-api-documentefinanciare .page-title,
html[data-theme="light"] .entity-root.entity-api-documentefinanciare .list-title,
html[data-theme="light"] .entity-root.entity-api-documentefinanciare .form-label,
html[data-theme="light"] .entity-root.entity-api-documentefinanciare .df-section-title {
    color: var(--text) !important;
}

html[data-theme="light"] .entity-root.entity-api-documentefinanciare .page-sub,
html[data-theme="light"] .entity-root.entity-api-documentefinanciare .list-meta,
html[data-theme="light"] .entity-root.entity-api-documentefinanciare .table-pager,
html[data-theme="light"] .entity-root.entity-api-documentefinanciare .no-results,
html[data-theme="light"] .entity-root.entity-api-documentefinanciare .df-muted .df-section-title {
    color: var(--muted) !important;
}

html[data-theme="light"] .entity-root.entity-api-documentefinanciare .search-native,
html[data-theme="light"] .entity-root.entity-api-documentefinanciare .search-input .mud-input-root,
html[data-theme="light"] .entity-root.entity-api-documentefinanciare .search-control,
html[data-theme="light"] .entity-root.entity-api-documentefinanciare .clear-btn,
html[data-theme="light"] .entity-root.entity-api-documentefinanciare .page-size,
html[data-theme="light"] .entity-root.entity-api-documentefinanciare .filter-input,
html[data-theme="light"] .entity-root.entity-api-documentefinanciare .editor-pane .form-control,
html[data-theme="light"] .entity-root.entity-api-documentefinanciare .editor-pane .form-select {
    background: #ffffff !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .entity-root.entity-api-documentefinanciare .search-control::placeholder,
html[data-theme="light"] .entity-root.entity-api-documentefinanciare .filter-input::placeholder {
    color: var(--muted) !important;
}

html[data-theme="light"] .entity-root.entity-api-documentefinanciare .table thead th {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--muted) !important;
}

html[data-theme="light"] .entity-root.entity-api-documentefinanciare .filter-row th {
    background: color-mix(in srgb, var(--surface) 88%, var(--surface2)) !important;
    border-left-color: var(--border) !important;
    border-right-color: var(--border) !important;
    border-bottom-color: var(--border) !important;
}

html[data-theme="light"] .entity-root.entity-api-documentefinanciare .table tbody tr td {
    background: #ffffff !important;
    color: var(--text) !important;
    border-top-color: var(--border2) !important;
    border-bottom-color: var(--border2) !important;
}

html[data-theme="light"] .entity-root.entity-api-documentefinanciare .table tbody tr td:first-child,
html[data-theme="light"] .entity-root.entity-api-documentefinanciare .table tbody tr td:last-child {
    border-left-color: var(--border2) !important;
    border-right-color: var(--border2) !important;
}

html[data-theme="light"] .entity-root.entity-api-documentefinanciare .table tbody tr:hover td {
    background: color-mix(in srgb, var(--surface) 88%, var(--primarySoft)) !important;
    border-top-color: color-mix(in srgb, var(--primary) 26%, var(--border2)) !important;
    border-bottom-color: color-mix(in srgb, var(--primary) 26%, var(--border2)) !important;
}

html[data-theme="light"] .entity-root.entity-api-documentefinanciare .pill {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--muted) !important;
}

html[data-theme="light"] .entity-root.entity-api-documentefinanciare .pill.active {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #ffffff !important;
}

html[data-theme="light"] .entity-root.entity-api-documentefinanciare .bin-btn {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--muted2) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .entity-root.entity-api-documentefinanciare .bin-btn:hover {
    background: color-mix(in srgb, var(--danger) 10%, #ffffff) !important;
    border-color: color-mix(in srgb, var(--danger) 34%, var(--border)) !important;
    color: var(--danger) !important;
}

/* ---------------------------------------------------------
   Documentatie Interna page: light theme completion
   --------------------------------------------------------- */
html[data-theme="light"] .docu-wrap {
    color: var(--text) !important;
}

html[data-theme="light"] .docu-hero {
    background: #ffffff !important;
    border-color: var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="light"] .docu-hero-left h1 {
    color: var(--text) !important;
}

html[data-theme="light"] .docu-hero-left p,
html[data-theme="light"] .docu-count,
html[data-theme="light"] .docu-model,
html[data-theme="light"] .docu-source {
    color: var(--muted) !important;
}

html[data-theme="light"] .docu-eyebrow,
html[data-theme="light"] .docu-section-title {
    color: var(--muted2) !important;
}

html[data-theme="light"] .docu-btn {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

html[data-theme="light"] .docu-btn:hover {
    background: var(--primaryHover) !important;
    border-color: var(--primaryHover) !important;
    transform: none !important;
}

html[data-theme="light"] .docu-btn.ghost {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .docu-btn.ghost:hover {
    background: color-mix(in srgb, var(--surface) 88%, var(--primarySoft)) !important;
    border-color: color-mix(in srgb, var(--primary) 34%, var(--border)) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .docu-search-input,
html[data-theme="light"] .docu-select {
    background: #ffffff !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .docu-search-input::placeholder {
    color: var(--muted) !important;
}

html[data-theme="light"] .docu-search-input:focus,
html[data-theme="light"] .docu-select:focus {
    border-color: color-mix(in srgb, var(--primary) 44%, var(--border)) !important;
    box-shadow: var(--focus) !important;
    outline: none;
}

html[data-theme="light"] .docu-search-icon {
    opacity: .75;
}

html[data-theme="light"] .docu-card {
    background: #ffffff !important;
    border-color: var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="light"] .docu-card:hover {
    border-color: color-mix(in srgb, var(--primary) 34%, var(--border)) !important;
    box-shadow: var(--shadow) !important;
    transform: translateY(-1px);
}

html[data-theme="light"] .docu-code {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .docu-model {
    background: color-mix(in srgb, var(--surface) 90%, var(--primarySoft)) !important;
    border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--border)) !important;
}

html[data-theme="light"] .docu-desc,
html[data-theme="light"] .docu-section ul {
    color: var(--text) !important;
}

html[data-theme="light"] .docu-source a {
    color: var(--primary) !important;
}

html[data-theme="light"] .docu-source a:hover {
    color: var(--primaryHover) !important;
}

html[data-theme="light"] .docu-empty {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--muted) !important;
}

/* Scrollbars */
html[data-theme="light"] * {
    scrollbar-color: #aeb9cc #eef2f7;
}

html[data-theme="light"] *::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

html[data-theme="light"] *::-webkit-scrollbar-track {
    background: #eef2f7;
}

html[data-theme="light"] *::-webkit-scrollbar-thumb {
    background: #b8c3d6;
    border-radius: 999px;
    border: 2px solid #eef2f7;
}

html[data-theme="light"] *::-webkit-scrollbar-thumb:hover {
    background: #a4b2c9;
}

/* Theme toggle icons */
.theme-icon-light {
    display: none;
}

html[data-theme="light"] .theme-icon-light {
    display: inline;
}

html[data-theme="light"] .theme-icon-dark {
    display: none;
}

html[data-theme="dark"] .theme-icon-light {
    display: none;
}

html[data-theme="dark"] .theme-icon-dark {
    display: inline;
}

@media (prefers-reduced-motion: no-preference) {
    html[data-theme="light"] *,
    html[data-theme="dark"] * {
        transition: background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
    }
}
