/* Prisme Pose — app poseur. Charte Prisme Pilote (Lato, marine, fond lavande, couleurs de modules).
   Conçue pour le chantier : gros boutons, fort contraste, lisible au soleil. */
:root {
  color-scheme: light;
  --bg: #e9e9f2; --card: #fff; --ink: #16182e; --muted: #5d5e7a; --line: #d6d6e4;
  --primary: #19193e; --primary-2: #5b4bd6; --accent: #00a9aa; --magenta: #c70079; --plum: #791468; --teal: #00a9aa;
  --ok: #0f8a6a; --warn: #b45309; --err: #c70079; --info: #5b4bd6;
  --radius: 14px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.45 "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: var(--primary-2); }
main { padding: 12px 14px calc(96px + var(--safe-b)); max-width: 640px; margin: 0 auto; }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; background: #16182e; color: #fff; padding: calc(10px + var(--safe-t)) 12px 10px; min-height: 56px; }
.top h1 { flex: 1; font-size: 18px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .brand { display: flex; align-items: center; }
.top .brand img { width: 30px; height: 30px; display: block; }
.top h1 { font-weight: 900; }
.top .back { color: #fff; text-decoration: none; font-size: 34px; line-height: 1; padding: 0 10px 4px 2px; }
.top .bell { position: relative; text-decoration: none; padding: 4px; display: flex; }
.badge { position: absolute; top: -4px; right: -6px; background: var(--magenta); color: #fff; border-radius: 10px; font-size: 12px; padding: 1px 6px; font-weight: 700; }

nav.bottom { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; background: #fff; border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
nav.bottom a { flex: 1; text-align: center; text-decoration: none; color: var(--muted); font-size: 12px; padding: 8px 0 10px; }
nav.bottom a .ico { display: block; width: 24px; height: 24px; margin: 0 auto 2px; }
.ico { width: 22px; height: 22px; flex: none; }
.when-big .ico { vertical-align: -3px; color: var(--teal); }
.top .bell { color: #fff; }
.refresh { display: flex; align-items: center; justify-content: center; gap: 8px; }
.refresh .ico { width: 18px; height: 18px; }
nav.bottom a.on { color: var(--primary); font-weight: 900; box-shadow: inset 0 3px 0 var(--teal); }

.sticky { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; padding: 10px 14px calc(12px + var(--safe-b)); background: linear-gradient(transparent, var(--bg) 25%); }
.sticky .btn { max-width: 612px; margin: 0 auto; display: flex; }

h2 { font-size: 14px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; color: var(--ink); margin: 22px 4px 8px; }
h3 { font-size: 13px; font-weight: 900; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.muted { color: var(--muted); }
.tiny { color: var(--muted); font-size: 13px; text-align: center; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .err { color: var(--err); }
.spacer { height: 70px; }

.card { display: block; background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; text-decoration: none; color: inherit; border: 1px solid var(--line); border-top: 4px solid var(--c, var(--teal)); }
.card.st-blue { --c: var(--primary-2); } .card.st-orange { --c: var(--teal); } .card.st-green { --c: #0f8a6a; } .card.st-red { --c: var(--magenta); } .card.st-purple { --c: var(--plum); } .card.st-grey { --c: #a3a3b8; }
.card:active { transform: scale(.99); }
.card-top, .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.when { font-weight: 800; font-size: 18px; }
.when small { display: block; font-weight: 500; font-size: 14px; color: var(--muted); }
.client { font-weight: 900; font-size: 19px; margin-top: 6px; color: var(--ink); }
.client.big { font-size: 23px; }
.card-foot { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; font-size: 14px; }
.chip { background: #ecebfb; color: #3d30a8; padding: 2px 8px; border-radius: 10px; font-size: 13px; font-weight: 600; }
.chip.new { background: #fef3c7; color: #92400e; }

.pill { padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.pill.blue { background: #ecebfb; color: #3d30a8; } .pill.orange { background: #dff5f5; color: #006d6e; }
.pill.green { background: #e2f5ef; color: #0b6b52; } .pill.red { background: #fbe3ef; color: #9c0060; }
.pill.purple { background: #f5e4f1; color: #791468; } .pill.grey { background: #ececf2; color: #4a4b63; }

.head-card, .block { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; border: 1px solid var(--line); }
.when-big { font-size: 18px; font-weight: 700; margin-top: 10px; }
.addr-txt { font-size: 19px; font-weight: 600; margin-bottom: 10px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.actions .btn { flex: 1 1 140px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 10px 16px; border-radius: 10px; border: 2px solid var(--primary); background: #fff; color: var(--primary); font-size: 17px; font-weight: 900; text-decoration: none; cursor: pointer; font-family: inherit; }
.btn.big { min-height: 60px; font-size: 18px; width: 100%; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.nav { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.call { background: var(--primary-2); border-color: var(--primary-2); color: #fff; }
.btn.link { border: none; background: none; min-height: 44px; font-weight: 600; }
.btn.danger { color: var(--err); }
.btn:active { opacity: .8; }
.refresh { width: 100%; background: none; border: 1px dashed var(--line); border-radius: 12px; padding: 10px; color: var(--muted); font-size: 15px; }

.doc { display: flex; align-items: center; gap: 12px; width: 100%; background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.doc-ico { font-size: 28px; }
.doc-txt { flex: 1; min-width: 0; }
.doc-txt small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-off { font-size: 12px; color: var(--ok); font-weight: 700; }

.rep { border-top: 1px solid var(--line); padding: 10px 0; }
.rep:first-child { border-top: none; padding-top: 0; }
.thumbs { display: flex; gap: 6px; overflow-x: auto; margin-top: 8px; }
.thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; flex: none; }

.banner { display: block; margin: 8px 14px 0; padding: 10px 12px; border-radius: 12px; font-size: 15px; text-decoration: none; }
.head-card .banner { margin: 10px 0 0; }
.banner.off { background: #fef3c7; color: #78350f; }
.banner.up { background: #ecebfb; color: #2c2380; }
.banner.err { background: #fbe3ef; color: #9c0060; font-weight: 700; }
.banner.info { background: #dff5f5; color: #005556; }
.banner small { display: block; margin-top: 4px; }
.bar { height: 10px; background: #e5e7eb; border-radius: 6px; overflow: hidden; margin: 6px 0; }
.bar i { display: block; height: 100%; background: var(--teal); transition: width .3s; }
.bar.recu i { background: #0f8a6a; } .bar.refuse i { background: var(--err); }

.seg { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.seg button { flex: 1 1 0; min-height: 56px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font: inherit; font-weight: 700; color: var(--ink); cursor: pointer; padding: 6px; }
.seg button.on { border-color: var(--primary); background: var(--primary); color: #fff; }
.seg-outcome button { min-height: 64px; font-size: 16px; }
.seg-category button { min-height: 48px; font-size: 15px; flex: 1 1 22%; }
.seg.small button { min-height: 44px; font-size: 14px; }

.lbl { display: block; font-weight: 700; margin: 12px 0 4px; }
.lbl input, .lbl textarea, select { display: block; width: 100%; margin-top: 6px; font: inherit; font-weight: 400; padding: 12px; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); }
.lbl input:focus, .lbl textarea:focus { outline: none; border-color: var(--primary-2); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; min-height: 48px; }
.check input { width: 26px; height: 26px; }
.check.big { font-size: 17px; }
.team { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.tm { padding: 4px 0; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.ph { position: relative; }
.ph img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; }
.ph select { margin-top: 4px; padding: 6px; font-size: 14px; border-radius: 8px; }
.ph .del { position: absolute; top: 4px; right: 4px; width: 34px; height: 34px; border-radius: 50%; border: none; background: rgba(0,0,0,.65); color: #fff; font-size: 16px; cursor: pointer; }

.notif { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; text-decoration: none; color: inherit; }
.notif.unread { border-left: 5px solid var(--magenta); }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 10px; }
.kpis div { background: #fafafb; border-left: 3px solid var(--primary); border-radius: 4px; padding: 12px; }
.kpis b { display: block; font-size: 28px; font-weight: 900; color: var(--ink); }
.kpis span { font-size: 13px; color: var(--muted); }
.month-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; text-transform: capitalize; }
.month-nav .btn { min-width: 56px; }
.line { padding: 6px 0; border-top: 1px solid var(--line); }

.login { max-width: 420px; margin: 0 auto; padding: calc(60px + var(--safe-t)) 20px 20px; text-align: center; }
.login .mark { width: 72px; height: 72px; }
.login form { text-align: left; margin-top: 24px; }
.login .btn { margin-top: 18px; }
.logo { font-size: 32px; font-weight: 900; color: var(--ink); }
.logo b { color: var(--teal); font-weight: 900; }

.sheet-bg { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 50; display: flex; align-items: flex-end; }
.sheet { background: #fff; width: 100%; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + var(--safe-b)); display: grid; gap: 10px; }
.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translate(-50%, 20px); opacity: 0; background: #0f172a; color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 60; transition: .25s; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: var(--teal); } .toast.warn { background: var(--magenta); }

/* Boîtes de dialogue */
.dlg-back { position: fixed; inset: 0; background: rgba(22,24,46,.55); z-index: 150; display: flex; align-items: flex-end; justify-content: center; padding: 16px 12px calc(16px + var(--safe-b)); }
.dlg { background: #fff; border-radius: 16px; border-top: 4px solid var(--teal); width: 100%; max-width: 440px; padding: 20px; display: grid; gap: 14px; box-shadow: 0 20px 50px rgba(22,24,46,.3); }
.dlg h3 { margin: 0; font-size: 18px; font-weight: 900; color: var(--ink); text-transform: none; letter-spacing: 0; }
.dlg p { margin: 0; }
.dlg-text { user-select: all; }
.dlg-fields { display: grid; gap: 10px; }
.dlg-fields label { display: grid; gap: 4px; font-weight: 700; font-size: 14px; }
.dlg-fields input, .dlg-fields select, .dlg-fields textarea { font: inherit; font-weight: 400; padding: 10px; border: 1px solid #cfd0de; border-radius: 8px; width: 100%; }
.dlg-check { display: flex !important; align-items: center; gap: 8px; }
.dlg-check input { width: auto !important; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.btn.danger-fill { background: var(--magenta); border-color: var(--magenta); color: #fff; }

/* Bandeau d'aide (installer l'appli, activer les notifications) */
.tip { position: relative; display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--teal); border-radius: var(--radius); padding: 12px 36px 12px 14px; margin: 4px 0 12px; }
.tip > div { flex: 1; font-size: 15px; }
.tip small { color: var(--muted); }
.tip .btn { flex: none; }
.tip .x { position: absolute; top: 4px; right: 6px; border: 0; background: none; font-size: 22px; color: var(--muted); padding: 2px 6px; }
.need { background: #fbe3ef; color: #9c0060; border-radius: 10px; padding: 10px 12px; font-weight: 700; }

/* Discussion */
.chat-link { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 10px 0; text-decoration: none; color: var(--ink); }
.chat-link .ico { width: 28px; height: 28px; color: var(--primary-2); }
.chat-link span { flex: 1; display: flex; flex-direction: column; }
.chat-link small { color: var(--muted); }
.badge-in { flex: none !important; background: var(--magenta); color: #fff; border-radius: 12px; padding: 2px 9px; font-weight: 900; font-size: 14px; }
.chat-intro { text-align: center; margin: 4px 0 12px; }
.chat { display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 85%; align-self: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 8px 12px; overflow-wrap: anywhere; }
.msg b { display: block; font-size: 13px; color: var(--primary-2); }
.msg small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; text-align: right; }
.msg.me { align-self: flex-end; background: var(--primary); color: #fff; border-color: var(--primary); border-radius: 16px 16px 4px 16px; }
.msg.me small { color: #c9c9e0; }
.composer { display: flex; gap: 8px; align-items: flex-end; max-width: 612px; margin: 0 auto; }
.composer textarea { flex: 1; min-height: 52px; max-height: 160px; border-radius: 12px; border: 2px solid var(--line); padding: 12px; font: inherit; resize: none; background: #fff; }
.composer .btn { width: 56px; padding: 0; flex: none; }
.sticky .composer .btn { display: inline-flex; margin: 0; }
