/* ImmoAgent — composants de l'interface. */

* { box-sizing: border-box; }

html, body {
	margin: 0;
	padding: 0;
	height: 100%;
}

body {
	font-family: var(--font);
	background: var(--background);
	color: var(--text-primary);
	font-size: 15px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	overscroll-behavior-y: none;
}

button { font-family: inherit; }

a { color: var(--primary); text-decoration: none; }

/* ─── Structure ─────────────────────────────────────────── */

#app {
	min-height: 100%;
	display: flex;
	flex-direction: column;
	max-width: 480px;
	margin-inline: auto;
	background: var(--background);
}

.view {
	flex: 1;
	padding: var(--gap-5) var(--gap-4);
	padding-bottom: calc(var(--nav-height) + var(--gap-5));
}

.view--plain { padding-bottom: var(--gap-5); }

.view--centered {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	text-align: center;
}

/* ─── Typographie ───────────────────────────────────────── */

h1 { font-size: 28px; font-weight: 700; margin: 0 0 var(--gap-2); letter-spacing: -0.02em; }
h2 { font-size: 20px; font-weight: 600; margin: 0 0 var(--gap-3); letter-spacing: -0.01em; }
h3 { font-size: 16px; font-weight: 600; margin: 0 0 var(--gap-2); }

.subtitle { color: var(--text-secondary); margin: 0; }
.muted { color: var(--text-muted); font-size: 13px; }

/* ─── Logo ──────────────────────────────────────────────── */

.logo {
	width: 96px;
	height: 96px;
	border-radius: 24px;
	background: var(--primary);
	display: grid;
	place-items: center;
	box-shadow: var(--shadow);
}

.logo svg { width: 48px; height: 48px; fill: #fff; }

/* ─── Boutons ───────────────────────────────────────────── */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--gap-2);
	width: 100%;
	padding: 14px 20px;
	border-radius: var(--radius);
	border: none;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s, opacity 0.15s;
}

.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-dark); }

.btn--outline {
	background: var(--surface);
	color: var(--text-primary);
	border: 1px solid var(--border);
}
.btn--outline:hover { background: var(--border-light); }

.btn--ghost { background: transparent; color: var(--text-secondary); }

.btn[disabled] { opacity: 0.55; cursor: default; }

.btn svg { width: 20px; height: 20px; }

/* ─── Encarts ───────────────────────────────────────────── */

.notice {
	display: flex;
	gap: var(--gap-3);
	align-items: flex-start;
	padding: var(--gap-3) var(--gap-4);
	border-radius: var(--radius);
	font-size: 14px;
	text-align: left;
	width: 100%;
}

.notice--info { background: var(--primary-light); color: var(--primary-dark); }
.notice--error { background: var(--danger-bg); color: var(--danger); }
.notice--success { background: var(--success-bg); color: var(--success); }

.notice svg { width: 20px; height: 20px; flex: none; }

/* ─── Cartes ────────────────────────────────────────────── */

.card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: var(--gap-4);
	box-shadow: var(--shadow-sm);
}

.card + .card { margin-top: var(--gap-3); }

/* ─── Formulaires ───────────────────────────────────────── */

.field { margin-bottom: var(--gap-4); text-align: left; }

.field label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: var(--text-secondary);
	margin-bottom: var(--gap-2);
}

.field input,
.field select,
.field textarea {
	width: 100%;
	padding: 12px 14px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	font-family: inherit;
	font-size: 15px;
	background: var(--surface);
	color: var(--text-primary);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
	outline: 2px solid var(--primary);
	outline-offset: -1px;
	border-color: transparent;
}

/* ─── États de chargement ───────────────────────────────── */

.spinner {
	width: 22px;
	height: 22px;
	border: 2.5px solid var(--primary-lighter);
	border-top-color: var(--primary);
	border-radius: 50%;
	animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading {
	display: flex;
	justify-content: center;
	padding: var(--gap-6);
}

@media (prefers-reduced-motion: reduce) {
	.spinner { animation-duration: 2s; }
}

/* ─── Écran d'accueil ───────────────────────────────────── */

.onboarding-hero {
	height: 380px;
	background: linear-gradient(135deg, var(--primary), var(--primary-dark));
	border-radius: 0 0 32px 32px;
	display: grid;
	place-items: center;
}

.onboarding-hero__mark svg {
	width: 100px;
	height: 100px;
	fill: #fff;
}

/* ─── En-tête de page ───────────────────────────────────── */

.page-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--gap-3);
	margin-bottom: var(--gap-4);
}

.page-head h1 { margin: 0; }

.back {
	display: inline-block;
	color: var(--text-secondary);
	font-size: 14px;
	font-weight: 500;
	margin-bottom: var(--gap-3);
}

/* ─── Avatars ───────────────────────────────────────────── */

.avatar {
	width: 44px;
	height: 44px;
	border-radius: var(--radius-full);
	background: var(--primary);
	color: #fff;
	display: grid;
	place-items: center;
	font-weight: 700;
	flex: none;
}

.avatar--soft {
	background: linear-gradient(135deg, var(--primary-light), var(--primary-lighter));
	color: var(--primary-dark);
	font-size: 14px;
}

.avatar--big { width: 72px; height: 72px; font-size: 24px; }

/* ─── Badges de statut ──────────────────────────────────── */

.badge {
	display: inline-block;
	padding: 4px 10px;
	border-radius: var(--radius-full);
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
}

.badge--info    { background: var(--info-bg);    color: var(--info); }
.badge--warning { background: var(--warning-bg); color: var(--warning); }
.badge--success { background: var(--success-bg); color: var(--success); }
.badge--danger  { background: var(--danger-bg);  color: var(--danger); }
.badge--purple  { background: #E9D5FF;           color: #7C3AED; }
.badge--neutral { background: var(--border-light); color: var(--text-secondary); }

/* ─── Indicateurs ───────────────────────────────────────── */

.kpi-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--gap-3);
}

.kpi {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: var(--gap-4);
	display: flex;
	flex-direction: column;
	gap: var(--gap-1);
	color: inherit;
}

.kpi--primary {
	background: linear-gradient(135deg, var(--primary), var(--primary-dark));
	border-color: transparent;
	color: #fff;
}

.kpi__value { font-size: 28px; font-weight: 700; line-height: 1; }
.kpi__label { font-size: 13px; opacity: 0.85; }

/* ─── Sélecteur de période ──────────────────────────────── */

.segmented {
	display: flex;
	gap: 2px;
	background: var(--border-light);
	border-radius: var(--radius);
	padding: 3px;
	margin-bottom: var(--gap-4);
}

.segmented button {
	flex: 1;
	border: none;
	background: transparent;
	padding: 8px 4px;
	border-radius: 9px;
	font-size: 13px;
	font-weight: 600;
	color: var(--text-secondary);
	cursor: pointer;
}

.segmented button.is-active {
	background: var(--surface);
	color: var(--primary);
	box-shadow: var(--shadow-sm);
}

/* ─── Entonnoir ─────────────────────────────────────────── */

.funnel-row {
	display: grid;
	grid-template-columns: 110px 1fr 40px;
	align-items: center;
	gap: var(--gap-3);
	padding: 6px 0;
}

.funnel-row__label { font-size: 13px; color: var(--text-secondary); }

.funnel-row__bar {
	height: 8px;
	background: var(--border-light);
	border-radius: var(--radius-full);
	overflow: hidden;
}

.funnel-row__fill { display: block; height: 100%; border-radius: var(--radius-full); }
.funnel-row__fill--info    { background: var(--info); }
.funnel-row__fill--warning { background: var(--warning); }
.funnel-row__fill--success { background: var(--success); }
.funnel-row__fill--purple  { background: #7C3AED; }

.funnel-row__value { font-size: 14px; font-weight: 600; text-align: right; }

/* ─── Listes ────────────────────────────────────────────── */

.row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--gap-3);
	color: inherit;
}

.lead-card {
	display: flex;
	align-items: center;
	gap: var(--gap-3);
	color: inherit;
}

.lead-card__body {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.lead-card__body .muted { font-size: 12px; }
.lead-card__body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Recherche et filtres ──────────────────────────────── */

.search {
	width: 100%;
	height: 44px;
	padding: 0 14px;
	border: 1.5px solid var(--border);
	border-radius: 10px;
	font-family: inherit;
	font-size: 15px;
	margin-bottom: var(--gap-3);
}

.search:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }

.chips {
	display: flex;
	gap: var(--gap-2);
	overflow-x: auto;
	padding-bottom: var(--gap-2);
	margin-bottom: var(--gap-3);
	scrollbar-width: none;
}

.chips::-webkit-scrollbar { display: none; }

.chips button {
	flex: none;
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--text-secondary);
	padding: 7px 14px;
	border-radius: var(--radius-full);
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
	cursor: pointer;
}

.chips button.is-active {
	background: var(--primary-light);
	border-color: var(--primary-lighter);
	color: var(--primary-dark);
}

/* ─── Détail ────────────────────────────────────────────── */

.lead-hero { text-align: center; margin-bottom: var(--gap-4); }
.lead-hero .avatar { margin-inline: auto; }

.actions { display: flex; gap: var(--gap-3); }

.kv {
	display: flex;
	justify-content: space-between;
	gap: var(--gap-4);
	padding: 8px 0;
	border-bottom: 1px solid var(--border-light);
}

.kv:last-child { border-bottom: none; }
.kv__label { color: var(--text-secondary); font-size: 14px; flex: none; }
.kv__value { text-align: right; font-weight: 500; word-break: break-word; }

/* ─── Divers ────────────────────────────────────────────── */

.btn-round {
	width: 44px;
	height: 44px;
	border-radius: var(--radius);
	background: var(--primary);
	color: #fff;
	display: grid;
	place-items: center;
	font-size: 24px;
	font-weight: 400;
	line-height: 1;
	flex: none;
}

.empty {
	text-align: center;
	padding: var(--gap-6) var(--gap-4);
	color: var(--text-secondary);
}

.pager {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--gap-3);
	margin-top: var(--gap-4);
}

.pager .btn { width: auto; padding: 10px 16px; }

/* ─── Barre de navigation ───────────────────────────────── */

.navbar {
	position: fixed;
	bottom: 0;
	left: 50%;
	transform: translateX(-50%);
	width: 100%;
	max-width: 480px;
	height: var(--nav-height);
	background: var(--surface);
	border-top: 1px solid var(--border);
	display: flex;
	padding-bottom: env(safe-area-inset-bottom);
}

.navbar__item {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 3px;
	font-size: 11px;
	font-weight: 600;
	color: var(--text-muted);
}

.navbar__item svg { width: 22px; height: 22px; }

.navbar__item.is-active { color: var(--primary); }

.navbar__item.is-disabled { opacity: 0.4; pointer-events: none; }

/* ─── Planning ──────────────────────────────────────────── */

.day-head {
	font-size: 14px;
	font-weight: 600;
	color: var(--text-secondary);
	text-transform: capitalize;
	margin: var(--gap-5) 0 var(--gap-2);
}

.day-head.is-today { color: var(--primary); }

.slot { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.slot__time { font-size: 13px; font-weight: 600; color: var(--text-secondary); }

/* ─── Graphique en barres ───────────────────────────────── */

.bars {
	display: flex;
	align-items: flex-end;
	gap: 6px;
	height: 150px;
	overflow-x: auto;
	padding-bottom: var(--gap-2);
	scrollbar-width: none;
}

.bars::-webkit-scrollbar { display: none; }

.bars__col {
	flex: 1 0 32px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--gap-2);
	height: 100%;
}

.bars__stack {
	flex: 1;
	width: 100%;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	gap: 2px;
}

.bars__bar {
	width: 10px;
	background: var(--primary);
	border-radius: 3px 3px 0 0;
	min-height: 2px;
}

.bars__bar--win { background: var(--success); }

.bars__label { font-size: 10px; color: var(--text-muted); text-align: center; line-height: 1.2; }

.dot {
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	vertical-align: middle;
}

.dot--primary { background: var(--primary); }
.dot--success { background: var(--success); }

/* ─── Notifications et FAQ ──────────────────────────────── */

.card--unread { border-left: 3px solid var(--primary); }

.faq summary {
	cursor: pointer;
	font-weight: 600;
	list-style: none;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
	content: '+';
	float: right;
	color: var(--primary);
	font-weight: 400;
}

.faq[open] summary::after { content: '−'; }

/* ─── Back-office ───────────────────────────────────────── */

.pastille {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	vertical-align: middle;
	margin-right: 6px;
	flex: none;
}

.case {
	display: flex;
	align-items: center;
	gap: var(--gap-2);
	padding: 8px 0;
	font-weight: 500;
	cursor: pointer;
}

.case input[type="checkbox"] {
	width: 18px;
	height: 18px;
	accent-color: var(--primary);
	flex: none;
	margin: 0;
}

.ligne-couleur {
	display: flex;
	align-items: center;
	gap: var(--gap-3);
	padding: 6px 0;
	border-bottom: 1px solid var(--border-light);
}

.ligne-couleur:last-child { border-bottom: none; }

.ligne-couleur input[type="color"] {
	width: 44px;
	height: 32px;
	padding: 2px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--surface);
	flex: none;
	cursor: pointer;
}

.alerte-contraste { font-size: 12px; color: var(--warning); }
