/* Hugonnet Électricité — suivi de chantier. One column on phone; on desktop, progress band then étapes + journal. */
:root {
  --bg: #F3F4F0; --surface: #FFFFFF; --sunken: #E8EAE4; --ink: #111311; --muted: #5B6058; --line: #DADDD5;
  --brand: #2FCC2F; --brand-ink: #0E5C0E; --stripe: #111311; --warn: #B0521A; --danger: #B3261E;
  --logo-filter: none; --radius: 14px;
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F110F; --surface: #181B18; --sunken: #222622; --ink: #EEF0EC; --muted: #9DA39A; --line: #2B302B;
    --brand: #2FCC2F; --brand-ink: #6FE26F; --stripe: #0F110F; --warn: #EE9460; --danger: #F08A80;
    --logo-filter: invert(1) hue-rotate(180deg) saturate(1.4); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); }
img { max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.12; letter-spacing: -0.02em; text-wrap: balance; }
h2 { font-size: 1.2rem; font-weight: 800; }
.label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; font-weight: 600; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right)) 80px max(16px, env(safe-area-inset-left)); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 0 14px; flex-wrap: wrap; }
.brand { display: flex; flex-direction: column; gap: 4px; text-decoration: none; }
.brand img { height: 56px; width: auto; display: block; filter: var(--logo-filter); }
.brand span { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.nav { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 9px 16px; cursor: pointer; font-weight: 700; font-size: .9rem; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.green { background: var(--brand); color: #0B160B; border-color: var(--brand); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 5px 11px; font-size: .8rem; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: .85rem; }

.flash { background: var(--ink); color: var(--bg); border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; font-weight: 600; }
.error { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); border-radius: 10px; padding: 10px 14px; font-weight: 600; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 14px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 22px; margin-top: 22px; align-items: start; }
.col { display: grid; gap: 22px; min-width: 0; }
@media (max-width: 820px) { .grid { grid-template-columns: minmax(0, 1fr); } }

/* hero */
.hero { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: clamp(18px, 3vw, 28px); display: grid; gap: 22px; }
.hero-head { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.hero-title { min-width: 0; flex: 1 1 300px; display: grid; gap: 6px; }
.hero-title h1 { font-size: clamp(1.6rem, 4.6vw, 2.5rem); font-weight: 900; }
.muted { color: var(--muted); }
.pct { text-align: right; flex: none; }
.pct-num { font-weight: 900; font-size: clamp(3rem, 8.5vw, 4.2rem); line-height: .95; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.pct-num small { font-size: .45em; color: var(--muted); }
@media (max-width: 600px) { .pct { text-align: left; } }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; border: 1.5px solid currentColor; width: fit-content; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.s-en_cours { color: var(--brand-ink); } .s-termine { color: var(--brand-ink); } .s-pause { color: var(--warn); } .s-preparation { color: var(--muted); }
.bar { display: flex; gap: 3px; height: 16px; }
.seg { flex: 1 1 0; background: var(--sunken); border-radius: 3px; overflow: hidden; position: relative; }
.seg i { position: absolute; inset: 0 auto 0 0; background: var(--brand); }
.seg.doing i { background: repeating-linear-gradient(-45deg, var(--brand) 0 7px, var(--stripe) 7px 14px); }
.bar-legend { display: flex; justify-content: space-between; gap: 10px; font-size: .8rem; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.next { border-left: 4px solid var(--brand); display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: start; background: var(--sunken); border-radius: 12px; padding: 14px 16px; }
.next-date { grid-row: span 2; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; min-width: 64px; }
.next-date .d { font-weight: 900; font-size: 1.6rem; line-height: 1; }
.next-date .m { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.next p { margin: 0; font-weight: 500; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px 20px; border-top: 1px solid var(--line); padding-top: 18px; }
.fact { display: grid; gap: 3px; min-width: 0; }
.fact b { font-weight: 600; overflow-wrap: anywhere; }

/* étapes */
.phases { list-style: none; margin: 0; padding: 0; display: grid; }
.phase { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 0; border-top: 1px solid var(--line); align-items: center; }
.phase:first-child { border-top: 0; padding-top: 2px; }
.lot { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); grid-row: span 2; align-self: start; padding-top: 3px; }
.phase-name { font-weight: 600; min-width: 0; }
.phase-dates { font-size: .8rem; color: var(--muted); grid-column: 2; }
.chip { font-size: .74rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; white-space: nowrap; grid-row: span 2; }
.chip.todo { background: var(--sunken); color: var(--muted); }
.chip.doing { background: var(--brand); color: #0B160B; }
.chip.done { background: color-mix(in srgb, var(--brand) 18%, transparent); color: var(--brand-ink); }
.mini { grid-column: 2 / 4; height: 4px; background: var(--sunken); border-radius: 2px; overflow: hidden; }
.mini i { display: block; height: 100%; background: var(--brand); }
.phase.doing .mini i { background: repeating-linear-gradient(-45deg, var(--brand) 0 5px, var(--stripe) 5px 10px); }

/* journal */
.post { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 0 14px; }
.rail { position: relative; }
.rail::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: -8px; width: 2px; background: var(--line); }
.post:last-child .rail::before { display: none; }
.rail::after { content: ""; position: absolute; left: 1px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.post-body { padding-bottom: 22px; display: grid; gap: 6px; min-width: 0; }
.post h3 { font-size: 1.1rem; font-weight: 800; }
.post p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; margin-top: 4px; }
.photos a { display: block; border-radius: 8px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--sunken); }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.empty { color: var(--muted); font-size: .92rem; padding: 6px 0; }
.contact { display: grid; gap: 8px; }
.contact a { font-weight: 700; text-decoration: none; }
.foot { margin-top: 30px; font-size: .8rem; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* forms (artisan) */
.form { display: grid; gap: 12px; }
.row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.field { display: grid; gap: 4px; min-width: 0; }
.field input, .field textarea, .field select { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; font-size: 16px; }
.field textarea { min-height: 96px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.ephase { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.ephase:first-of-type { border-top: 0; }
.ephase-top { display: flex; gap: 8px; align-items: center; }
.ephase-top input[type=text] { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; font-size: 16px; }
.range { display: flex; align-items: center; gap: 10px; }
.range input { flex: 1; min-width: 0; accent-color: var(--brand); height: 28px; }
.range output { width: 56px; text-align: right; white-space: nowrap; }
.del { display: flex; gap: 6px; align-items: center; font-size: .82rem; color: var(--danger); font-weight: 600; white-space: nowrap; }
.share { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.share .label { color: color-mix(in srgb, var(--bg) 65%, transparent); }
.share-url { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; background: color-mix(in srgb, var(--bg) 12%, transparent); border-radius: 8px; padding: 10px 12px; overflow-wrap: anywhere; user-select: all; }
.share .btn { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 35%, transparent); }
.share .btn.green { background: var(--brand); color: #0B160B; border-color: var(--brand); }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.list { display: grid; gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; text-decoration: none; align-items: center; }
.card:hover { border-color: var(--muted); }
.card h3 { font-size: 1.05rem; font-weight: 800; }
.card .big { font-weight: 900; font-size: 1.8rem; letter-spacing: -0.03em; grid-row: span 2; }
.card .bar { grid-column: 1 / 3; height: 8px; }
.card.archived { opacity: .6; }
.center { max-width: 420px; margin: 8vh auto 0; }
details.panel summary { cursor: pointer; font-weight: 800; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
