/* Doli4 — Espace client : clair, rassurant, lisible sur téléphone comme sur ordinateur */
:root {
	--primary: #0a2042; --accent: #c2620c; --bg: #f3f5f8; --card: #fff; --line: #e3e8ee; --text: #14202b; --muted: #5b6b7a;
	--ok: #14633d; --okbg: #e3f3ea; --warn: #8a4b00; --warnbg: #fff4e5; --bad: #b42318; --badbg: #fde8e7; --info: #1e3a8a; --infobg: #dbeafe;
	--r: 16px; color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot, .empty { text-align: center; color: var(--muted); padding: 40px 16px; }
#app { min-height: 100vh; display: flex; flex-direction: column; }

/* En-tête et onglets */
.top { background: var(--primary); color: #fff; position: sticky; top: 0; z-index: 5; }
.top-in { max-width: 980px; margin: 0 auto; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 8px; display: flex; align-items: center; gap: 12px; }
.top .logo { height: 34px; max-width: 120px; object-fit: contain; }
.top .sub { font-size: 12px; opacity: .75; text-transform: uppercase; letter-spacing: .06em; }
.top b { font-size: 17px; }
.grow { flex: 1; min-width: 0; }
.top select { max-width: 40vw; border-radius: 10px; border: 0; padding: 6px 8px; background: rgba(255, 255, 255, .15); color: #fff; }
.top select option { color: var(--text); }
.icon { width: 42px; height: 42px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .12); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon svg { width: 20px; height: 20px; }
.tabs { max-width: 980px; margin: 0 auto; display: flex; gap: 4px; padding: 0 10px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { color: #cfd8e3; text-decoration: none; display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 600; font-size: 15px; }
.tabs a svg { width: 18px; height: 18px; }
.tabs a.on { color: #fff; border-bottom-color: var(--accent); }

main { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 18px 16px 30px; display: flex; flex-direction: column; gap: 12px; }
h1 { margin: 4px 0 2px; font-size: 24px; }
h1.hello { font-size: 26px; }
h2 { margin: 14px 0 0; font-size: 18px; }
.muted { color: var(--muted); font-size: 14px; }
.card { background: var(--card); border-radius: var(--r); padding: 14px 16px; box-shadow: 0 1px 4px rgba(10, 32, 66, .07); display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; }
a.card:hover { box-shadow: 0 3px 12px rgba(10, 32, 66, .12); }
.card .k { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.card .k svg { width: 18px; height: 18px; color: var(--accent); }
.card .big { font-size: 22px; font-weight: 800; }
.hero { background: var(--primary); color: #fff; }
.hero .k, .hero .muted { color: #cfd8e3; }
.hero .k svg { color: #fff; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.tile.warn { border-left: 5px solid #e09f3e; } .tile.bad { border-left: 5px solid var(--bad); } .tile.ok { border-left: 5px solid #2e8b57; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.amount { font-size: 19px; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #eef2f6; white-space: nowrap; }
.chip.ok { background: var(--okbg); color: var(--ok); } .chip.warn { background: var(--warnbg); color: var(--warn); } .chip.bad { background: var(--badbg); color: var(--bad); } .chip.info { background: var(--infobg); color: var(--info); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.dates { font-size: 14px; line-height: 1.7; }

/* Boutons et champs */
.btn { min-height: 48px; border: 0; border-radius: 14px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; font-size: 16px; cursor: pointer; text-decoration: none; }
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.ghost { background: #fff; color: var(--primary); border: 2px solid var(--primary); }
.btn.small { min-height: 40px; font-size: 14px; padding: 0 12px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; color: var(--muted); }
.field { font-weight: 400; width: 100%; min-height: 48px; border: 2px solid #c5cfda; border-radius: 12px; padding: 10px 12px; background: #fff; font-size: 16px; color: var(--text); }
textarea.field { min-height: 130px; resize: vertical; }
.urg { border: 0; padding: 0; margin: 4px 0; display: flex; flex-direction: column; gap: 6px; }
.urg legend { font-weight: 700; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.urg label { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; color: var(--text); font-size: 15px; }
.urg input { width: 22px; height: 22px; flex: none; accent-color: var(--primary); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.photos img, .photos .add { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; }
.photos .add { border: 2px dashed #8a9bac; background: #fff; display: flex; align-items: center; justify-content: center; color: var(--primary); cursor: pointer; }
.photos .add svg { width: 28px; height: 28px; }
.note { border-radius: 12px; padding: 10px 12px; font-size: 15px; background: var(--warnbg); color: #6b3a00; }
.note.ok { background: var(--okbg); color: var(--ok); } .note.bad { background: var(--badbg); color: var(--bad); }
.note svg { width: 18px; height: 18px; vertical-align: -3px; }
.pay .payinfo { font-size: 15px; }

/* Étapes du chantier */
.steps { list-style: none; margin: 6px 0 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.steps li { flex: 1 1 110px; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); background: var(--bg); border-radius: 12px; padding: 8px 10px; }
.steps li span { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #dde3ea; font-weight: 800; font-size: 13px; flex: none; }
.steps li span svg { width: 16px; height: 16px; }
.steps li.done { color: var(--ok); } .steps li.done span { background: var(--ok); color: #fff; }
.steps li.now { color: var(--primary); font-weight: 700; } .steps li.now span { background: var(--accent); color: #fff; }

/* Connexion, confirmation */
.login { max-width: 440px; margin: 0 auto; min-height: 100vh; padding: 32px 22px; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.login .logo-big { max-width: 220px; max-height: 80px; object-fit: contain; }
.login form { display: flex; flex-direction: column; gap: 12px; }
.done { text-align: center; padding: 30px 10px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.done .ok { width: 70px; height: 70px; border-radius: 50%; background: var(--okbg); color: var(--ok); display: flex; align-items: center; justify-content: center; }
.done .ok svg { width: 36px; height: 36px; }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)); }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #14202b; color: #fff; padding: 12px 16px; border-radius: 12px; font-weight: 600; z-index: 50; }
@media (min-width: 700px) { h1 { font-size: 28px; } .tabs a { font-size: 15px; } }
.btn.listening { background: #c62828; border-color: #c62828; color: #fff; }

/* Assistant (Aide IA) : bouton flottant, feuille plein écran sur téléphone, panneau sur ordinateur */
.ai-fab { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 30; height: 54px; padding: 0 18px 0 14px; border: 0; border-radius: 999px; display: inline-flex; align-items: center; gap: 8px;
	color: #fff; font-weight: 800; font-size: 15px; cursor: pointer; background: var(--primary); background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 55%, var(--accent)));
	box-shadow: 0 10px 26px rgba(10, 32, 66, .32), inset 0 1px 0 rgba(255, 255, 255, .25); animation: ai-rise .5s cubic-bezier(.2, 1.4, .4, 1) both; }
.ai-fab svg { width: 24px; height: 24px; animation: ai-twinkle 4s ease-in-out infinite; }
.ai.on .ai-fab { display: none; }
.ai-sheet { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: flex; flex-direction: column; animation: ai-up .3s cubic-bezier(.2, .8, .2, 1) both; }
.ai-sheet[hidden] { display: none; }
html.ai-lock, html.ai-lock body { overflow: hidden; }
.ai-head { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px 14px; color: #fff; background: var(--primary);
	background: linear-gradient(120deg, var(--primary), color-mix(in srgb, var(--primary) 70%, var(--accent))); }
.ai-head b { display: block; font-size: 17px; }
.ai-head small { display: block; font-size: 12.5px; opacity: .8; }
.ai-orb { width: 64px; height: 64px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; flex: none; background: var(--primary);
	background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--accent) 80%, #fff), var(--primary) 72%); box-shadow: 0 8px 22px rgba(10, 32, 66, .25); }
.ai-orb svg { width: 32px; height: 32px; }
.ai-orb.sm { width: 38px; height: 38px; background: rgba(255, 255, 255, .18); box-shadow: none; }
.ai-orb.sm svg { width: 22px; height: 22px; }
.ai-orb.xs { width: 30px; height: 30px; box-shadow: none; }
.ai-orb.xs svg { width: 17px; height: 17px; }
.ai-body { flex: 1; overflow-y: auto; padding: 16px 14px 10px; display: flex; flex-direction: column; gap: 12px; -webkit-overflow-scrolling: touch; }
.ai-wait { margin: auto; color: var(--primary); }
.ai-wait svg { width: 40px; height: 40px; animation: ai-spin 1.4s linear infinite; }
.ai-hello { margin: auto 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 4px 16px; animation: ai-fade .4s ease both; }
.ai-hello h2 { margin: 8px 0 0; font-size: 24px; }
.ai-hello p { margin: 0; color: var(--muted); max-width: 360px; }
.ai-chips { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 420px; margin-top: 12px; }
.ai-chips button { text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 13px 14px; font-weight: 600; font-size: 15.5px; cursor: pointer; box-shadow: 0 1px 3px rgba(10, 32, 66, .05); }
.ai-chips button:active { transform: scale(.98); border-color: var(--primary); }
.ai-msg { display: flex; gap: 8px; align-items: flex-start; animation: ai-fade .25s ease both; }
.ai-msg.me { justify-content: flex-end; }
.ai-bub { background: #fff; border-radius: 4px 18px 18px 18px; padding: 11px 14px; box-shadow: 0 1px 4px rgba(10, 32, 66, .07); max-width: 88%; overflow-wrap: anywhere; font-size: 15.5px; }
.ai-msg.me .ai-bub { background: var(--primary); color: #fff; border-radius: 18px 18px 4px 18px; }
.ai-msg.err .ai-bub { background: var(--badbg); color: var(--bad); }
.ai-bub p { margin: 0 0 6px; }
.ai-bub p:last-child { margin-bottom: 0; }
.ai-bub ul { margin: 4px 0 6px; padding-left: 20px; }
.ai-bub a { font-weight: 700; }
.ai-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ai-think { color: var(--muted); font-weight: 600; margin-left: 8px; }
.ai-typing { display: inline-flex; gap: 4px; vertical-align: middle; }
.ai-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); opacity: .35; animation: ai-dot 1.2s infinite; }
.ai-typing i:nth-child(2) { animation-delay: .2s; }
.ai-typing i:nth-child(3) { animation-delay: .4s; }
.ai-in { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 6px; background: #fff; border-top: 1px solid var(--line); }
.ai-in textarea { flex: 1; resize: none; border: 2px solid #c5cfda; border-radius: 16px; padding: 11px 13px; font-size: 16px; max-height: 140px; background: #fff; outline: none; }
.ai-in textarea:focus { border-color: var(--primary); }
.ai-btn { width: 48px; height: 48px; flex: none; border: 0; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.ai-btn svg { width: 22px; height: 22px; }
.ai-send { background: var(--accent); color: #fff; }
.ai-send[disabled] { opacity: .5; }
.ai-mic { background: var(--bg); color: var(--primary); }
.ai-mic.listening { background: #c62828; color: #fff; animation: ai-pulse 1.2s infinite; }
.ai-foot { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); padding: 0 14px calc(10px + env(safe-area-inset-bottom, 0px)); background: #fff; }
.ai-call { margin-left: auto; font-weight: 700; }
@media (min-width: 701px) {
	.ai-sheet { inset: auto 20px 20px auto; width: 420px; height: min(680px, calc(100vh - 40px)); border-radius: 20px; overflow: hidden; box-shadow: 0 20px 50px rgba(10, 32, 66, .28); }
	.ai-head { padding-top: 12px; }
}
@keyframes ai-rise { from { opacity: 0; transform: translateY(20px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes ai-up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes ai-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes ai-spin { to { transform: rotate(360deg); } }
@keyframes ai-twinkle { 0%, 100% { transform: rotate(0) scale(1); } 50% { transform: rotate(12deg) scale(1.12); } }
@keyframes ai-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@keyframes ai-pulse { 0% { box-shadow: 0 0 0 0 rgba(198, 40, 40, .5); } 100% { box-shadow: 0 0 0 12px rgba(198, 40, 40, 0); } }
@media (prefers-reduced-motion: reduce) { .ai *, .ai-fab, .ai-sheet { animation: none !important; } }
main { padding-bottom: 90px; }
