/*
 * Copyright (C) 2026 SASU LEMON
 * Copyright (C) 2026 MATER Stéphane (co-auteur)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 * Proto-CRM — feuille de styles (protocrm.css)
 */

/* ========== FORM CONTAINER ========== */
.mod-protocrm {
	/* Mini design system (scopé au module) */
	--lcrm-radius-sm: 8px;
	--lcrm-radius-md: 10px;
	--lcrm-radius-lg: 12px;
	--lcrm-border: 1px solid var(--colorboxstatsborder, #e5e7eb);
	--lcrm-bg: var(--colorbackbody, #fff);
	--lcrm-bg-soft: var(--colorbackbody, #f9fafb);
	--lcrm-text: var(--colortext, #374151);
	--lcrm-text-muted: #6b7280;
	--lcrm-text-weak: #9ca3af;
	--lcrm-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
	--lcrm-shadow-md: 0 10px 20px rgba(0, 0, 0, 0.08);
	--lcrm-focus: 0 0 0 3px rgba(37, 99, 235, 0.18);
	--lcrm-accent: var(--butactionbg, #F7C948);
	--lcrm-accent-text: var(--textbutaction, #422006);
	color: var(--lcrm-text);
}

.mod-protocrm * {
	box-sizing: border-box;
}

/* Accessibilité: focus visible clair (clavier) */
.mod-protocrm :focus {
	outline: none;
}
.mod-protocrm :focus-visible {
	box-shadow: var(--lcrm-focus);
	border-radius: 6px;
}

/* Respect des préférences utilisateur (réduction animations) */
@media (prefers-reduced-motion: reduce) {
	.mod-protocrm * {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
		scroll-behavior: auto !important;
	}
}

.protocrm-form {
	max-width: 720px;
	margin: 0 auto;
	padding-top: 8px;
}

/* ========== TYPE BAR ========== */
.lcrm-type-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 16px;
}

.lcrm-type-pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 16px;
	border: 2px solid #e5e7eb;
	border-radius: 10px;
	background: #fff;
	cursor: pointer;
	font-size: 0.88em;
	color: #4b5563;
	transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
	font-family: inherit;
}

.lcrm-type-pill input[type="radio"] {
	display: none;
}

.lcrm-type-pill:hover {
	border-color: #9ca3af;
	background: #f9fafb;
	transform: translateY(-1px);
}

.lcrm-type-pill:has(input:checked) {
	border-color: #F7C948;
	background: #FFFBEB;
	color: #92400e;
	font-weight: 600;
	box-shadow: 0 0 0 3px rgba(247, 201, 72, 0.15);
}

.lcrm-type-pill .fa {
	font-size: 1.1em;
}

.lcrm-type-label {
	white-space: nowrap;
}

/* ========== CONTEXT BAR (who + when) ========== */
.lcrm-context {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	margin-bottom: 12px;
	flex-wrap: wrap;
}

.lcrm-context-who {
	display: flex;
	gap: 8px;
	flex: 1;
	min-width: 300px;
}

.lcrm-context-when {
	display: flex;
	align-items: center;
	gap: 4px;
}

.lcrm-select,
.lcrm-context-who select,
.lcrm-context-who .select2-container {
	flex: 1;
}

/* ========== ADAPTIVE ZONE ========== */
.lcrm-adaptive {
	margin-bottom: 12px;
}

/* ========== PILL ROWS ========== */
.lcrm-pill-row {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	align-items: center;
}

.lcrm-pill-label {
	font-size: 0.78em;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #9ca3af;
	margin-right: 4px;
}

.lcrm-pill-sep {
	width: 1px;
	height: 24px;
	background: #e5e7eb;
	margin: 0 6px;
}

.lcrm-pill {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 7px 14px;
	border: 1.5px solid #e5e7eb;
	border-radius: var(--lcrm-radius-sm);
	background: #fff;
	cursor: pointer;
	font-size: 0.85em;
	color: #4b5563;
	transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
	font-family: inherit;
}

.lcrm-pill:hover {
	border-color: #9ca3af;
	transform: translateY(-1px);
}

.lcrm-pill.active {
	border-color: var(--pill-color, #F7C948);
	background: color-mix(in srgb, var(--pill-color, #F7C948) 10%, #fff);
	color: #111827;
	font-weight: 600;
}

.lcrm-pill .fa {
	font-size: 0.95em;
}

/* Direction pills */
.lcrm-dir.active {
	--pill-color: #F7C948;
}

/* Outcome pills */
.lcrm-outcome.active {
	--pill-color: #3b82f6;
}

/* Followup mode pills */
.lcrm-fmode.active {
	--pill-color: #8b5cf6;
}

/* Add pill (+) button */
.lcrm-add-pill {
	border-style: dashed;
	color: #9ca3af;
	padding: 7px 10px;
}

.lcrm-add-pill:hover {
	color: #4b5563;
	border-color: #6b7280;
}

/* Inline field (duration etc) */
.lcrm-field-inline {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 10px;
	font-size: 0.88em;
	color: #6b7280;
}

.lcrm-input-mini {
	width: 70px;
	padding: 6px 8px;
	border: 1.5px solid #d1d5db;
	border-radius: 6px;
	font-size: 0.95em;
	text-align: center;
}

.lcrm-input-mini:focus {
	outline: none;
	border-color: #F7C948;
	box-shadow: 0 0 0 2px rgba(247, 201, 72, 0.2);
}

/* ========== WYSIWYG EDITOR ========== */
.lcrm-editor-toolbar {
	display: flex;
	gap: 2px;
	padding: 6px 8px;
	border: 1.5px solid #d1d5db;
	border-bottom: none;
	border-radius: 10px 10px 0 0;
	background: #f9fafb;
}

.lcrm-tb-btn {
	width: 30px;
	height: 28px;
	border: none;
	background: none;
	cursor: pointer;
	border-radius: 4px;
	font-size: 0.85em;
	color: #4b5563;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: inherit;
}

.lcrm-tb-btn:hover {
	background: #e5e7eb;
}

.lcrm-tb-sep {
	width: 1px;
	background: #d1d5db;
	margin: 2px 4px;
}

.lcrm-editor {
	width: 100%;
	min-height: 100px;
	max-height: 400px;
	overflow-y: auto;
	padding: 12px 14px;
	border: 1.5px solid #d1d5db;
	border-radius: 0 0 10px 10px;
	font-size: 0.95em;
	font-family: inherit;
	color: #111827;
	line-height: 1.6;
	outline: none;
	box-sizing: border-box;
	transition: border-color 0.12s, box-shadow 0.12s;
	resize: vertical;
}

.lcrm-editor:focus {
	border-color: #F7C948;
	box-shadow: 0 0 0 3px rgba(247, 201, 72, 0.15);
}

.lcrm-editor.empty:before {
	content: attr(data-placeholder);
	color: #9ca3af;
	pointer-events: none;
}

.lcrm-editor ul, .lcrm-editor ol {
	margin: 4px 0;
	padding-left: 20px;
}

/* ========== SUMMARY (fallback) ========== */
.lcrm-summary textarea {
	width: 100%;
	padding: 14px 16px;
	border: 1.5px solid #d1d5db;
	border-radius: 10px;
	font-size: 0.95em;
	font-family: inherit;
	color: #111827;
	resize: vertical;
	min-height: 100px;
	box-sizing: border-box;
	transition: border-color 0.12s, box-shadow 0.12s;
}

.lcrm-summary textarea:focus {
	outline: none;
	border-color: #F7C948;
	box-shadow: 0 0 0 3px rgba(247, 201, 72, 0.15);
}

.lcrm-summary textarea::placeholder {
	color: #9ca3af;
}

/* ========== DETAILS TOGGLE ========== */
.lcrm-details-toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 0;
	margin: 4px 0;
	cursor: pointer;
	font-size: 0.85em;
	font-weight: 500;
	color: #6b7280;
	user-select: none;
	transition: color 0.12s;
}

.lcrm-details-toggle:hover {
	color: #374151;
}

.lcrm-details-toggle.open {
	color: #374151;
}

/* ========== DETAILS SECTION ========== */
.lcrm-details,
.lcrm-followup-section {
	background: var(--lcrm-bg-soft);
	border: var(--lcrm-border);
	border-radius: var(--lcrm-radius-md);
	padding: 16px;
	margin-bottom: 8px;
}

.lcrm-detail-group {
	margin-bottom: 14px;
}

.lcrm-detail-group:last-child {
	margin-bottom: 0;
}

.lcrm-detail-label {
	display: block;
	font-size: 0.78em;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #9ca3af;
	margin-bottom: 8px;
}

/* ========== FOLLOWUP SECTION ========== */
.lcrm-followup-section textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1.5px solid #d1d5db;
	border-radius: 8px;
	font-size: 0.9em;
	font-family: inherit;
	resize: vertical;
	min-height: 50px;
	box-sizing: border-box;
}

.lcrm-followup-section textarea:focus {
	outline: none;
	border-color: #F7C948;
	box-shadow: 0 0 0 2px rgba(247, 201, 72, 0.2);
}

.lcrm-row {
	display: flex;
	gap: 12px;
	margin-top: 10px;
	align-items: flex-start;
}

.lcrm-field {
	flex: 1;
}

.lcrm-input {
	padding: 8px 12px;
	border: 1.5px solid #d1d5db;
	border-radius: 8px;
	font-size: 0.9em;
}

.lcrm-input:focus {
	outline: none;
	border-color: #F7C948;
}

.lcrm-label {
	display: block;
	font-size: 0.8em;
	font-weight: 600;
	color: #4b5563;
	margin-bottom: 4px;
}

/* Quick dates */
.lcrm-quick-dates {
	display: flex;
	gap: 6px;
	margin-top: 10px;
}

.lcrm-quick-date {
	padding: 5px 12px;
	border: 1.5px solid #e5e7eb;
	border-radius: 6px;
	background: #fff;
	cursor: pointer;
	font-size: 0.8em;
	color: #6b7280;
	font-family: inherit;
	transition: all 0.12s;
}

.lcrm-quick-date:hover {
	border-color: #9ca3af;
}

.lcrm-quick-date.active {
	border-color: #8b5cf6;
	background: #f5f3ff;
	color: #6d28d9;
	font-weight: 600;
}

/* Lien « Nouvelle activité Sites2 » (même gabarit visuel que les raccourcis date, sans la classe lcrm-quick-date) */
a.lcrm-sites2-newactivity {
	padding: 5px 12px;
	border: 1.5px solid #e5e7eb;
	border-radius: 6px;
	background: #fff;
	font-size: 0.8em;
	color: #6b7280;
	font-family: inherit;
	text-decoration: none;
	display: inline-block;
	transition: all 0.12s;
}
a.lcrm-sites2-newactivity:hover {
	border-color: #9ca3af;
	color: #374151;
}

/* ========== SUBMIT ========== */
.lcrm-submit {
	display: flex;
	gap: 10px;
	justify-content: flex-end;
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid #e5e7eb;
}

.lcrm-btn-save {
	padding: 11px 28px;
	border: none;
	border-radius: var(--lcrm-radius-sm);
	background: var(--lcrm-accent);
	color: var(--lcrm-accent-text);
	font-size: 0.92em;
	font-weight: 600;
	cursor: pointer;
	font-family: inherit;
	transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
}

.lcrm-btn-save:hover {
	filter: brightness(0.95);
	box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
	transform: translateY(-1px);
}

.lcrm-btn-save:active {
	transform: translateY(0);
	box-shadow: var(--lcrm-shadow-sm);
}

.lcrm-btn-cancel {
	padding: 11px 20px;
	border: 1.5px solid #d1d5db;
	border-radius: var(--lcrm-radius-sm);
	background: var(--lcrm-bg);
	color: var(--lcrm-text-muted);
	font-size: 0.92em;
	cursor: pointer;
	font-family: inherit;
	transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.lcrm-btn-cancel:hover {
	background: #f3f4f6;
	transform: translateY(-1px);
}

.lcrm-btn-cancel:active {
	transform: translateY(0);
}

/* ========== VIEW MODE ========== */
.lcrm-view-header {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-bottom: 16px;
}

.lcrm-view-type-icon {
	font-size: 2em;
	color: #F7C948;
	width: 48px;
	text-align: center;
}

.lcrm-view-ref {
	font-size: 1.2em;
	font-weight: 700;
	color: #111827;
}

.lcrm-view-meta {
	font-size: 0.88em;
	color: #6b7280;
	margin-top: 2px;
}

.lcrm-badge {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	padding: 2px 8px;
	border-radius: 4px;
	font-size: 0.85em;
	font-weight: 500;
}

.lcrm-badge-in {
	background: #dbeafe;
	color: #1d4ed8;
}

.lcrm-badge-out {
	background: #fef3c7;
	color: #92400e;
}

.lcrm-view-who {
	font-size: 0.92em;
	color: #374151;
	margin-bottom: 16px;
	padding: 10px 14px;
	background: #f9fafb;
	border-radius: 8px;
}

.lcrm-view-who .fa {
	color: #9ca3af;
	margin-right: 4px;
}

.lcrm-view-summary {
	padding: 16px;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	margin-bottom: 12px;
	line-height: 1.7;
	font-size: 0.95em;
	color: #111827;
}

.lcrm-view-tags {
	display: flex;
	gap: 8px;
	margin-bottom: 12px;
}

.lcrm-tag {
	display: inline-flex;
	align-items: center;
	padding: 4px 12px;
	border-radius: 6px;
	font-size: 0.82em;
	font-weight: 600;
	background: color-mix(in srgb, var(--tag-color, #6b7280) 12%, #fff);
	color: var(--tag-color, #6b7280);
	border: 1.5px solid color-mix(in srgb, var(--tag-color, #6b7280) 30%, transparent);
}

.lcrm-view-followup {
	background: #fffbeb;
	border: 1px solid #fde68a;
	border-radius: 10px;
	padding: 14px 16px;
	margin-bottom: 12px;
}

.lcrm-view-followup-header {
	font-weight: 600;
	font-size: 0.88em;
	color: #92400e;
	margin-bottom: 6px;
}

.lcrm-view-followup-body {
	font-size: 0.92em;
	color: #374151;
	line-height: 1.6;
	margin-bottom: 8px;
}

.lcrm-view-followup-date {
	font-size: 0.82em;
	color: #6b7280;
}

.lcrm-view-created {
	font-size: 0.78em;
	color: #9ca3af;
	margin-top: 12px;
}

/* ========== MODAL ========== */
.lcrm-modal-overlay {
	position: fixed;
	top: 0; left: 0; right: 0; bottom: 0;
	background: rgba(0,0,0,0.3);
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
}

.lcrm-modal {
	background: #fff;
	border-radius: 12px;
	padding: 24px;
	width: 360px;
	box-shadow: 0 20px 60px rgba(0,0,0,0.15);
	border: var(--lcrm-border);
}

.lcrm-modal-overlay[style*="display:none"] {
	/* évite de bloquer des clics si un style inline est mal manipulé */
	pointer-events: none;
	opacity: 0;
}

.lcrm-modal-overlay#lcrm-dict-modal {
	padding: 16px;
}

.lcrm-modal-overlay#lcrm-dict-modal .lcrm-modal {
	width: min(420px, 92vw);
}

.lcrm-modal-overlay#lcrm-dict-modal .lcrm-modal-title {
	display: flex;
	align-items: center;
	gap: 10px;
}

.lcrm-modal-overlay#lcrm-dict-modal .lcrm-modal-title:before {
	content: "\f055";
	font-family: "Font Awesome 5 Free";
	font-weight: 900;
	color: var(--colortextlink, #2563eb);
}

.lcrm-modal-overlay#lcrm-dict-modal .lcrm-input {
	height: 38px;
}

.lcrm-modal-overlay#lcrm-dict-modal .lcrm-modal-actions {
	margin-top: 14px;
}

.lcrm-modal-overlay#lcrm-dict-modal .lcrm-btn-save,
.lcrm-modal-overlay#lcrm-dict-modal .lcrm-btn-cancel {
	min-height: 38px;
}

/* Modale "lecture" du dashboard */
.mod-protocrm.page-dashboard .lcrm-modal-box {
	border-radius: 14px;
	border: var(--lcrm-border);
}

.mod-protocrm.page-dashboard #lcrm-modal-body a {
	text-decoration: none;
}

.lcrm-modal-title {
	font-size: 1.05em;
	font-weight: 700;
	color: #111827;
	margin-bottom: 16px;
}

.lcrm-modal .lcrm-field {
	margin-bottom: 12px;
}

.lcrm-modal .lcrm-input {
	width: 100%;
	box-sizing: border-box;
}

.lcrm-input-color {
	width: 60px;
	height: 36px;
	border: 1.5px solid #d1d5db;
	border-radius: 6px;
	cursor: pointer;
	padding: 2px;
}

.lcrm-modal-actions {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
	margin-top: 16px;
}

/* ========== STATS BAR (dashboard) ========== */
.protocrm-stats-bar {
	display: flex;
	gap: 16px;
	margin-bottom: 24px;
	flex-wrap: wrap;
}

/* ========== KPI CARDS (customer_stats.php) ========== */
.mod-protocrm.page-customer-stats .protocrm-kpis {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 12px;
	margin: 12px 0 18px 0;
}

.mod-protocrm.page-customer-stats .protocrm-kpi {
	padding: 14px 16px;
	border-radius: 10px;
	min-height: 92px;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	/* Ne pas dépendre du style Dolibarr .box : on fixe le “look” ici */
	background: #fff;
	border: 1px solid #e5e7eb;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.mod-protocrm.page-customer-stats .protocrm-kpi-title {
	color: #6b7280;
	font-size: 0.95em;
	display: flex;
	gap: 8px;
	align-items: center;
}

.mod-protocrm.page-customer-stats .protocrm-kpi-value {
	font-size: 1.9em;
	font-weight: 750;
	line-height: 1.1;
	color: #111827;
}

.mod-protocrm.page-customer-stats .protocrm-kpi-sub {
	color: #9ca3af;
	font-size: 0.85em;
	margin-top: 2px;
}

.mod-protocrm.page-customer-stats .protocrm-kpi-link {
	display: block;
	color: inherit;
	text-decoration: none;
}

.mod-protocrm.page-customer-stats .protocrm-kpi-clickable {
	transition: transform 120ms ease, box-shadow 120ms ease;
}

.mod-protocrm.page-customer-stats .protocrm-kpi-clickable:hover {
	transform: translateY(-1px);
	box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

.mod-protocrm.page-customer-stats .protocrm-kpi-chip {
	font-size: 0.82em;
	background: #f3f4f6;
	color: #374151;
	border-radius: 999px;
	padding: 2px 8px;
}

.protocrm-stat-card {
	flex: 1;
	min-width: 200px;
	padding: 24px;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	text-align: center;
	box-shadow: 0 1px 3px rgba(0,0,0,0.04);
	transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.protocrm-stat-card:hover {
	box-shadow: 0 4px 12px rgba(0,0,0,0.08);
	transform: translateY(-1px);
}

.protocrm-stat-card.protocrm-stat-alert {
	border-color: #fca5a5;
	background: linear-gradient(135deg, #fef2f2, #fff);
}

.protocrm-stat-number {
	font-size: 2.5em;
	font-weight: 700;
	color: #111827;
	line-height: 1.1;
}

.protocrm-stat-alert .protocrm-stat-number {
	color: #dc2626;
}

.protocrm-stat-label {
	font-size: 0.82em;
	font-weight: 500;
	color: #6b7280;
	margin-top: 8px;
}

/* Synthèse facturation (onglet CRM sur fiche tiers) */
.lcrm-soc-billing-wrap {
	margin-bottom: 20px;
	padding: 14px 16px;
	background: var(--colorbackbody, #f9fafb);
	border: 1px solid var(--colorboxstatsborder, #e5e7eb);
	border-radius: 10px;
}

.lcrm-soc-billing-title {
	font-weight: 600;
	font-size: 0.95em;
	color: var(--colortexttitle, #111827);
	margin-bottom: 12px;
}

.lcrm-soc-billing-title .fas {
	margin-right: 8px;
	opacity: 0.85;
	color: var(--colortextlink, #2563eb);
}

.lcrm-soc-billing-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

.lcrm-soc-billing-card {
	flex: 1;
	min-width: 130px;
	padding: 12px 14px;
	background: var(--colorbackbody, #fff);
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	text-align: center;
}

.lcrm-soc-billing-card.lcrm-soc-billing-warn {
	border-color: #fcd34d;
	background: linear-gradient(135deg, #fffbeb, #fff);
}

.lcrm-soc-billing-card.lcrm-soc-billing-alert {
	border-color: #fca5a5;
	background: linear-gradient(135deg, #fef2f2, #fff);
}

.lcrm-soc-billing-val {
	font-size: 1.35em;
	font-weight: 700;
	color: var(--colortexttitlenotab, #111827);
	line-height: 1.2;
}

.lcrm-soc-billing-alert .lcrm-soc-billing-val {
	color: #b91c1c;
}

.lcrm-soc-billing-lbl {
	font-size: 0.75em;
	font-weight: 500;
	color: #6b7280;
	margin-top: 6px;
	line-height: 1.3;
}

.lcrm-soc-billing-sub {
	font-size: 0.72em;
	color: #9ca3af;
	margin-top: 4px;
}

.lcrm-soc-billing-card-meta .lcrm-soc-billing-val {
	font-size: 1.6em;
}

.lcrm-soc-billing-card-meta a {
	font-weight: 600;
}

.lcrm-soc-billing-links {
	line-height: 1.45;
}

.lcrm-soc-billing-linksep {
	display: inline-block;
	margin: 0 6px;
	color: #9ca3af;
	font-weight: 400;
}

.lcrm-soc-billing-hint {
	font-size: 0.68em;
	color: #9ca3af;
	margin-top: 8px;
	line-height: 1.35;
	text-align: center;
	max-width: 280px;
	margin-left: auto;
	margin-right: auto;
}

/* ========== LIST ACCORDION ========== */
.lcrm-expand-cell {
	width: 20px;
	text-align: center;
	color: #9ca3af;
}

.lcrm-chevron {
	transition: transform 0.15s ease;
	font-size: 0.75em;
}

.lcrm-chevron.open {
	transform: rotate(90deg);
}

.lcrm-row-toggle:hover td {
	background-color: #f9fafb !important;
}

/* Liste: un peu plus de respiration */
.mod-protocrm.page-list table.noborder td,
.mod-protocrm.page-list table.noborder th {
	padding-top: 10px;
	padding-bottom: 10px;
}

.mod-protocrm.page-list table.noborder {
	border-radius: var(--lcrm-radius-lg);
	overflow: hidden;
}

.mod-protocrm.page-list .liste_titre th {
	background: var(--colorbacktitle1, #f3f4f6);
}

.mod-protocrm.page-list .liste_titre_filter td {
	background: var(--colorbackbody, #fff);
}

/* Champ de filtre: focus plus visible */
.mod-protocrm.page-list input.flat:focus,
.mod-protocrm.page-list select.flat:focus {
	box-shadow: var(--lcrm-focus);
	border-color: var(--colortextlink, #2563eb);
}

/* Lignes cliquables: plus “button-like” sans casser Dolibarr */
.lcrm-row-toggle td {
	transition: background-color 120ms ease;
}

.lcrm-row-toggle:active td {
	background-color: #f3f4f6 !important;
}

.lcrm-detail-row td {
	padding: 0 !important;
	border-top: none !important;
}

.lcrm-detail-content {
	display: flex;
	gap: 20px;
	padding: 14px 20px 14px 36px;
	background: #f9fafb;
	border-top: 1px dashed #e5e7eb;
}

@media (max-width: 900px) {
	/* Liste: détail sous la ligne, pas en 2 colonnes */
	.lcrm-detail-content {
		flex-direction: column;
		gap: 12px;
	}
	.lcrm-detail-right {
		order: -1;
	}
}

/* ========== LEFT MENU (sections) ========== */
/* Rend "Activité" / "Analyse" comme des titres, pas des liens */
a[href*="leftmenu=protocrm_section_activity"],
a[href*="leftmenu=protocrm_section_analytics"],
a[href*="leftmenu=protocrm_section_activity"]:hover,
a[href*="leftmenu=protocrm_section_analytics"]:hover {
	/* Ressemble au “titre module” (plus présent), mais reste non-cliquable visuellement */
	cursor: default !important;
	pointer-events: none; /* supprime réellement le clic */
	background: transparent !important;
	color: var(--colortexttitle, #111827) !important;
	text-transform: none;
	letter-spacing: 0;
	font-weight: 750;
	font-size: 1.02rem;
	line-height: 1.15;
	opacity: 1;
	padding-top: 14px;
	padding-bottom: 6px;
	margin-top: 10px;
	border-top: 1px solid rgba(229, 231, 235, 0.9);
	text-decoration: none !important;
	display: flex;
	align-items: center;
}

/* Sur certains thèmes, le menu utilise un <span> à l’intérieur du <a> */
a[href*="leftmenu=protocrm_section_activity"] span,
a[href*="leftmenu=protocrm_section_analytics"] span {
	color: inherit !important;
}

/* Icône de section: un peu plus discrète */
a[href*="leftmenu=protocrm_section_activity"] .pictofixedwidth,
a[href*="leftmenu=protocrm_section_analytics"] .pictofixedwidth,
a[href*="leftmenu=protocrm_section_activity"] .fas,
a[href*="leftmenu=protocrm_section_analytics"] .fas {
	opacity: 0.9;
}

/* Fallback robuste: ajoute l’icône via CSS même si le thème ignore "prefix" */
a[href*="leftmenu=protocrm_section_activity"]::before {
	content: "\f0e7"; /* bolt */
	font-family: "Font Awesome 5 Free";
	font-weight: 900;
	margin-right: 8px;
	opacity: 0.85;
}

a[href*="leftmenu=protocrm_section_analytics"]::before {
	content: "\f080"; /* chart-bar */
	font-family: "Font Awesome 5 Free";
	font-weight: 900;
	margin-right: 8px;
	opacity: 0.85;
}

.lcrm-detail-left {
	flex: 2;
}

.lcrm-detail-right {
	flex: 1;
	font-size: 0.88em;
	color: #6b7280;
}

.lcrm-detail-summary {
	font-size: 0.92em;
	line-height: 1.6;
	color: #374151;
	margin-bottom: 8px;
}

.lcrm-detail-tags {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
	margin-top: 6px;
}

.lcrm-detail-ref {
	font-size: 0.82em;
	margin-bottom: 8px;
}

.lcrm-detail-followup {
	background: #fffbeb;
	border: 1px solid #fde68a;
	border-radius: 8px;
	padding: 8px 10px;
	font-size: 0.85em;
	margin-top: 6px;
}

/* Mobile: évite les tableaux trop serrés */
@media (max-width: 768px) {
	.mod-protocrm.page-list .tdoverflowmax300 {
		max-width: 220px;
	}
	.mod-protocrm.page-list table.noborder td,
	.mod-protocrm.page-list table.noborder th {
		padding-top: 8px;
		padding-bottom: 8px;
	}
}

/* ========== LIST ROWS ========== */
tr.protocrm-overdue td:first-child {
	border-left: 3px solid #ef4444;
}
tr.protocrm-overdue td {
	background-color: #fef2f2 !important;
}

tr.protocrm-today td:first-child {
	border-left: 3px solid #f59e0b;
}
tr.protocrm-today td {
	background-color: #fffbeb !important;
}

tr.protocrm-done td:first-child {
	border-left: 3px solid #22c55e;
}
tr.protocrm-done td {
	background-color: #f0fdf4 !important;
}

/* ========== DASHBOARD ========== */
.mod-protocrm.page-dashboard .fichethirdleft {
	width: 38%;
}
.mod-protocrm.page-dashboard .fichetwothirdright {
	width: 60%;
}

/* Dashboard: tables plus lisibles */
.mod-protocrm.page-dashboard table.noborder {
	border-radius: var(--lcrm-radius-lg);
	overflow: hidden;
}

.mod-protocrm.page-dashboard .liste_titre th {
	background: var(--colorbacktitle1, #f3f4f6);
}

.mod-protocrm.page-dashboard table.noborder tr.oddeven:hover td {
	background: #f9fafb;
}

/* Lien “preview relance” plus agréable */
.protocrm-followup-preview {
	color: var(--lcrm-text);
	text-decoration: none;
}
.protocrm-followup-preview:hover {
	text-decoration: underline;
}

/* Modale dashboard: animation légère */
.mod-protocrm.page-dashboard .lcrm-modal-overlay {
	animation: lcrm-fadeOverlay 120ms ease;
}
@keyframes lcrm-fadeOverlay {
	from { opacity: 0; }
	to { opacity: 1; }
}

.mod-protocrm.page-dashboard .lcrm-modal-box {
	animation: lcrm-pop 140ms ease;
	transform-origin: 50% 20%;
}
@keyframes lcrm-pop {
	from { opacity: 0; transform: translateY(8px) scale(0.985); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Petit confort: cibles cliquables icônes (tâches/ok) */
.mod-protocrm.page-dashboard a[title] span.fas,
.mod-protocrm.page-dashboard a[title] span.fa {
	padding: 6px;
	border-radius: 8px;
	transition: background 120ms ease, color 120ms ease;
}
.mod-protocrm.page-dashboard a[title]:hover span.fas,
.mod-protocrm.page-dashboard a[title]:hover span.fa {
	background: rgba(0, 0, 0, 0.04);
}

/* ========== QUICK LOG BUTTON (global) ========== */
.lcrm-quicklog {
	position: fixed;
	top: 55px;
	right: 15px;
	/*
	 * Important:
	 * Dolibarr utilise aussi des fenêtres/modales (ex: ajout mode de règlement SEPA/prélèvement)
	 * avec leurs propres z-index. Un z-index trop élevé ici peut “passer au-dessus” et empêcher
	 * de cliquer sur des boutons (Ajouter/Annuler) situés au même endroit.
	 */
	z-index: 800;
}

@media print {
	.lcrm-quicklog { display: none !important; }
}

/* Couleurs = thème Dolibarr actif (--butactionbg / --textbutaction, comme .butAction) */
.lcrm-quicklog-btn {
	width: 38px;
	height: 38px;
	border-radius: 10px;
	border: none;
	background: var(--butactionbg, #F7C948);
	color: var(--textbutaction, #422006);
	font-size: 1.1em;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.15s ease;
	box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.lcrm-quicklog-btn:hover {
	filter: brightness(0.92);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
	transform: scale(1.05);
}

.lcrm-quicklog-panel {
	position: absolute;
	top: 46px;
	right: 0;
	width: 200px;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	box-shadow: 0 12px 40px rgba(0,0,0,0.12);
	padding: 8px;
	display: none;
}

.lcrm-quicklog-panel.open {
	display: block;
	animation: lcrm-fadeIn 0.12s ease;
}

@keyframes lcrm-fadeIn {
	from { opacity: 0; transform: translateY(-6px); }
	to { opacity: 1; transform: translateY(0); }
}

.lcrm-quicklog-context {
	display: flex;
	align-items: center;
	flex-wrap: nowrap;
	gap: 8px;
	padding: 8px 10px;
	margin-bottom: 4px;
	font-size: 0.82em;
	font-weight: 600;
	color: #374151;
	background: #f9fafb;
	border-radius: 6px;
	min-width: 0;
}

.lcrm-ctx-building {
	flex-shrink: 0;
	color: #9ca3af;
	font-size: 1em;
	line-height: 1;
	align-self: center;
}

/* Nom du tiers + icône lien sur la même ligne, alignés verticalement */
.lcrm-ctx-inline {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-width: 0;
	flex: 1 1 auto;
	line-height: 1.25;
}

.lcrm-ctx-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	min-width: 0;
	align-self: center;
}

.lcrm-ctx-link {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	margin: 0;
	border-radius: 8px;
	color: #6b7280;
	text-decoration: none;
	background: rgba(255, 255, 255, 0.65);
	border: 1px solid rgba(229, 231, 235, 0.9);
	vertical-align: middle;
}

.lcrm-ctx-link .fa {
	margin: 0;
	font-size: 0.85em;
	line-height: 1;
}

.lcrm-ctx-link:hover {
	background: #ffffff;
	color: #111827;
	text-decoration: none;
}

.lcrm-quicklog-title {
	font-size: 0.72em;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #9ca3af;
	padding: 4px 10px 8px;
}

.lcrm-quicklog-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 10px;
	border-radius: 8px;
	color: #374151;
	text-decoration: none;
	font-size: 0.88em;
	transition: background 0.1s;
}

.lcrm-quicklog-item:hover {
	background: #f9fafb;
	color: #111827;
}

.lcrm-quicklog-item .fa {
	width: 18px;
	text-align: center;
	color: #6b7280;
	font-size: 1em;
}

.lcrm-quicklog-item:hover .fa {
	color: var(--colortextlink, #2563eb);
}

/* Popup/lightweight mode form adjustments */
.drawer-mode .protocrm-form {
	max-width: 100%;
	padding-top: 0;
}

.drawer-mode .lcrm-type-bar {
	gap: 4px;
}

.drawer-mode .lcrm-type-pill {
	padding: 8px 12px;
	font-size: 0.82em;
}

.drawer-mode .lcrm-context {
	flex-direction: column;
}

.drawer-mode .lcrm-context-who {
	min-width: 0;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
	.lcrm-type-bar { gap: 4px; }
	.lcrm-type-pill { padding: 8px 10px; font-size: 0.82em; }
	.lcrm-type-label { display: none; }
	.lcrm-context { flex-direction: column; }
	.lcrm-context-who { min-width: 0; flex-wrap: wrap; }
	.lcrm-row { flex-direction: column; }
	.lcrm-pill-sep { display: none; }
}

/* Quicklog search */
.lcrm-quicklog-search { padding: 4px 8px 8px; position: relative; }
.lcrm-quicklog-search input { width: 100%; padding: 7px 10px; border: 1.5px solid #e5e7eb; border-radius: 6px; font-size: 0.85em; font-family: inherit; box-sizing: border-box; outline: none; }
.lcrm-quicklog-search input:focus { border-color: var(--colortextlink, #2563eb); }
#lcrm-search-results { max-height: 200px; overflow-y: auto; background: #fff; border: 1px solid #e5e7eb; border-radius: 6px; margin-top: 4px; }
.lcrm-search-item { display: block; padding: 8px 10px; color: #374151; text-decoration: none; font-size: 0.85em; border-bottom: 1px solid #f3f4f6; }
.lcrm-search-item:hover { background: #f9fafb; color: #111827; }
.lcrm-quicklog-item { text-decoration: none !important; }
.lcrm-quicklog-item:hover { text-decoration: none !important; }

/* Quicklog autocomplete (jQuery UI - comme Dolibarr) */
#lcrm-quicklog-panel .ui-autocomplete {
	max-height: 220px;
	overflow-y: auto;
	overflow-x: hidden;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	box-shadow: 0 12px 30px rgba(0,0,0,0.12);
	padding: 6px;
}

#lcrm-quicklog-panel .ui-autocomplete .ui-menu-item-wrapper {
	padding: 8px 10px;
	border-radius: 8px;
	font-size: 0.88em;
	color: #374151;
}

#lcrm-quicklog-panel .ui-autocomplete .ui-state-active {
	border: none;
	background: rgba(247, 201, 72, 0.25);
	color: #111827;
}

/* Thread styles - fond visible uniquement quand deplie, variable CSS Dolibarr */
tr.lcrm-thread-open > td { background: var(--colorbacklinepairchecked) !important; }
.lcrm-thread-banner { background: #FFFBEB; border: 1px solid #F7C948; border-radius: 8px; padding: 8px 14px; margin-bottom: 12px; font-size: 0.9em; color: #92400E; }
.lcrm-chain-btn { color: #d1d5db; font-size: 0.9em; transition: color 0.15s; }
.lcrm-chain-btn:hover { color: #F7C948; }
/* Chevron: starts as fa-chevron-down (open), toggled via JS to fa-chevron-right (closed) */
.lcrm-chevron { cursor: pointer; color: #9ca3af; font-size: 0.85em; }
/* Toggle cell: entire td clickable */
.lcrm-toggle-cell { cursor: pointer; text-align: center; }
/* Message cell */
.lcrm-msg-cell { cursor: pointer; }
.lcrm-msg-preview { color: #374151; }

/* Liens compacts « tout voir » sur le dashboard */
a.protocrm-dash-alllink {
	display: inline-block;
	font-size: 0.75rem;
	font-weight: normal;
	line-height: 1.25;
	padding: 0.15rem 0.45rem;
	vertical-align: middle;
	border-radius: 4px;
	border: 1px solid var(--colortopbordertitle1, #ccc);
	background: var(--colorbackbody, #f8f8f8);
	color: var(--colortext, #444);
	text-decoration: none;
	white-space: nowrap;
}
a.protocrm-dash-alllink:hover {
	filter: brightness(0.97);
	text-decoration: none;
}

/* Cycle de vie client (fiche tiers + dashboard) */
.protocrm-lc-pill {
	display: inline-block;
	font-size: 0.8rem;
	font-weight: 600;
	padding: 0.2rem 0.55rem;
	border-radius: 999px;
	line-height: 1.3;
	vertical-align: middle;
}
.protocrm-lc-lost { background: #fecaca; color: #7f1d1d; }
.protocrm-lc-prospect { background: #dbeafe; color: #1e3a8a; }
.protocrm-lc-new_client { background: #d9f99d; color: #365314; }
.protocrm-lc-dormant { background: #e5e7eb; color: #374151; }
.protocrm-lc-at_risk { background: #fed7aa; color: #9a3412; }
.protocrm-lc-active { background: #bbf7d0; color: #14532d; }
.protocrm-lc-strategic { background: #fde68a; color: #78350f; border: 1px solid #f59e0b; }
.protocrm-lifecycle-banner .button.small { font-size: 0.75rem; padding: 0.15rem 0.45rem; margin-left: 4px; }
