/* =========================================================================
   Intelegis — thème clair
   Surcouche : ne remplace rien, s'active via <html data-theme="light">.
   Le thème sombre reste le défaut, sans modification.
   ========================================================================= */

html[data-theme="light"] {
	/* Charte (or et teal assombris pour rester lisibles sur blanc) */
	--navy: #0B1F3A;
	--gold: #B8901F;
	--gold-soft: rgba(184, 144, 31, .18);
	--teal: #0E6B78;
	--slate: #475569;

	/* Fonds */
	--bg-app: #F4F7FB;
	--bg-sidebar: #FFFFFF;
	--bg-header: #FFFFFF;
	--bg-card: #FFFFFF;
	--bg-elev: #F7FAFD;
	--bg-user-msg: #157C8C;
	--bg-assistant-msg: transparent;
	--bg-input: #FFFFFF;
	--bg-input-focus: #F1F5F9;

	/* Texte */
	--text-primary: #0B1F3A;
	--text-secondary: #475569;
	--text-placeholder: #94A3B8;

	/* Traits et états */
	--border-color: #D7E0EA;
	--hover-color: #EEF3F9;
	--active-color: #E4EDF6;
	--accent: #B8901F;
	--accent-hover: #C9A227;
	--accent-strong: #9A7718;
	--danger: #C0392B;
	--warning: #B8901F;

	color-scheme: light;
}

/* ---------- Base ---------- */
html[data-theme="light"] body:not(.login-page) {
	background: var(--bg-app);
	color: var(--text-primary);
}

html[data-theme="light"] .sidebar,
html[data-theme="light"] .header,
html[data-theme="light"] .audit-topbar {
	border-color: var(--border-color);
	box-shadow: 0 1px 0 rgba(11, 31, 58, .06);
}

/* Message de l'utilisateur : fond blanc, texte navy.
   !important obligatoire : app-extras.css force background:#123152 !important. */
html[data-theme="light"] .message.user .message-content {
	background: #FFFFFF !important;
	border: 1px solid var(--border-color);
	border-right: 3px solid var(--gold);
	color: var(--text-primary);
}

/* Les liens gardent leur couleur d'accent */
html[data-theme="light"] .message.user .message-content a {
	color: var(--teal);
}

html[data-theme="light"] .message.assistant .message-content {
	color: var(--text-primary);
}

/* ---------- Champs (audit.css fige #262626) ---------- */
html[data-theme="light"] textarea,
html[data-theme="light"] input[type="text"],
html[data-theme="light"] input[type="search"],
html[data-theme="light"] input[type="email"],
html[data-theme="light"] input[type="password"],
html[data-theme="light"] select,
html[data-theme="light"] .trace-filters input,
html[data-theme="light"] .trace-filters select {
	background: #FFFFFF;
	color: var(--text-primary);
	border-color: var(--border-color);
}

html[data-theme="light"] textarea::placeholder,
html[data-theme="light"] input::placeholder {
	color: var(--text-placeholder);
}

/* ---------- Badges et libellés figés en gris foncé ---------- */
html[data-theme="light"] .audit-badge {
	background: #E2E8F0;
	color: #334155;
}

html[data-theme="light"] .audit-badge.indeterminee,
html[data-theme="light"] .audit-badge.gravite-faible {
	background: #E2E8F0;
	color: #475569;
}

/* Badges colorés : les teintes pastel d'audit.css sont faites pour le sombre.
   Sur blanc il faut du texte plus foncé et un fond un peu plus dense. */
html[data-theme="light"] .audit-badge.extracted,
html[data-theme="light"] .audit-badge.done,
html[data-theme="light"] .audit-badge.native,
html[data-theme="light"] .audit-badge.ref-verifiee {
	background: rgba(16, 163, 127, .14);
	color: #0B6B52;
}

html[data-theme="light"] .audit-badge.ref-sourcee {
	background: rgba(16, 163, 127, .10);
	color: #0F7A5F;
}

html[data-theme="light"] .audit-badge.ocr,
html[data-theme="light"] .audit-badge.potentielle,
html[data-theme="light"] .audit-badge.ref-non_reverifiee,
html[data-theme="light"] .audit-badge.ref-a_verifier,
html[data-theme="light"] .audit-badge.gravite-moyenne {
	background: rgba(184, 144, 31, .18);
	color: #7F5F0A;
}

html[data-theme="light"] .audit-badge.vision,
html[data-theme="light"] .audit-badge.extracting,
html[data-theme="light"] .audit-badge.queued,
html[data-theme="light"] .audit-badge.analyzing {
	background: rgba(21, 124, 140, .14);
	color: #0E5F6B;
}

html[data-theme="light"] .audit-badge.error,
html[data-theme="light"] .audit-badge.averee,
html[data-theme="light"] .audit-badge.ref-introuvable,
html[data-theme="light"] .audit-badge.gravite-critique {
	background: rgba(192, 57, 43, .12);
	color: #A93226;
}

html[data-theme="light"] .audit-badge.gravite-elevee {
	background: rgba(192, 57, 43, .10);
	color: #B03A2E;
}

html[data-theme="light"] .audit-badge.uploaded {
	background: #E2E8F0;
	color: #475569;
}

/* En attente : neutre, distinct de « en cours » */
html[data-theme="light"] .audit-badge.pending {
	background: #E7ECF3;
	color: #55657A;
}

html[data-theme="light"] .trace-cat.support {
	background: #E2E8F0;
	color: #334155;
}

html[data-theme="light"] .audit-list,
html[data-theme="light"] .audit-anomaly p {
	color: #334155;
}

html[data-theme="light"] .audit-progress {
	background: #E2E8F0;
}

/* ---------- Cartes, tableaux, blocs ---------- */
html[data-theme="light"] .audit-card,
html[data-theme="light"] .audit-table,
html[data-theme="light"] .dossier-card {
	background: var(--bg-card);
	border-color: var(--border-color);
}

html[data-theme="light"] .audit-table th {
	background: #EEF3F9;
	color: var(--text-primary);
}

html[data-theme="light"] .audit-table tr:hover td {
	background: var(--hover-color);
}

html[data-theme="light"] pre,
html[data-theme="light"] code {
	background: #F1F5F9;
	color: #0B1F3A;
}

/* ---------- Marque : le dessin du logo est navy, ce sont les textes qui étaient blancs ---------- */
html[data-theme="light"] .sidebar-name,
html[data-theme="light"] .header-title,
html[data-theme="light"] .audit-brand span {
	color: var(--text-primary);
}

html[data-theme="light"] .header-tagline {
	color: var(--text-secondary);
}

/* Pastilles du logo : blanc sur blanc, on rend la limite visible */
html[data-theme="light"] .brand-mark,
html[data-theme="light"] .sidebar-logo,
html[data-theme="light"] .welcome-logo,
html[data-theme="light"] .avatar-logo,
html[data-theme="light"] .login-logo {
	background: #FFFFFF;
	box-shadow: 0 0 0 1px var(--border-color);
}

/* ---------- Bouton « remonter en haut » (figé en gris foncé dans app-extras) ---------- */
html[data-theme="light"] #backtop {
	background: rgba(255, 255, 255, .96);
	border: 1px solid var(--border-color);
	color: var(--text-primary);
	box-shadow: 0 2px 10px rgba(11, 31, 58, .14);
}

html[data-theme="light"] #backtop:hover {
	background: var(--hover-color);
	border-color: var(--accent);
	color: var(--accent-strong);
}

/* ---------- Bouton de bascule ---------- */
.theme-toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: transparent;
	border: 1px solid var(--border-color);
	color: var(--text-secondary);
	border-radius: 999px;
	padding: 5px 12px;
	font-size: 12px;
	font-family: inherit;
	cursor: pointer;
	line-height: 1;
	transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.theme-toggle:hover {
	background: var(--hover-color);
	color: var(--text-primary);
	border-color: var(--accent);
}

.theme-toggle i { font-size: 13px; }

@media (max-width: 768px) {
	.theme-toggle span { display: none; }
	.theme-toggle { padding: 6px 9px; }
}
