/* ChantierPro — version équipe. Palette ASP Management : bleu nuit du logo (#282751) comme couleur de base, or du logo (#DCB360) en accent. */
:root {
  --ground: #eeeef4;
  --surface: #ffffff;
  --surface-2: #f6f6fa;
  --line: #dadae6;
  --line-soft: #eaeaf1;
  --ink: #282751;
  --ink-2: #45446f;
  --muted: #66658a;
  --accent: #282751;
  --accent-ink: #ffffff;
  --accent-hover: #1c1b3d;
  --accent-soft: #e8e8f3;
  --gold: #dcb360;
  --gold-ink: #86661f;
  --gold-soft: #f8efdc;
  --link: #3b3992;
  --side: #282751;
  --side-ink: #c8c7e0;
  --side-hover: rgba(255, 255, 255, .08);
  --ok: #1b7f48;      --ok-bg: #e2f3e9;
  --warn: #93600c;    --warn-bg: #fbf0d6;
  --danger: #c0352f;  --danger-bg: #fbe7e6;
  --info: #3b3992;    --info-bg: #e7e7f6;
  --neutral: #82819e; --neutral-bg: #eaeaf1;
  --bar-info: #c7c6e8; --bar-ok: #a9dcbd; --bar-danger: #f1b8b5; --bar-warn: #f1d9a2; --bar-muted: #dedee8;
  --field: #ffffff;
  --field-line: #c9c9d9;
  --overlay: rgba(20, 19, 45, .55);
  --shadow: 0 1px 2px rgba(40, 39, 81, .06), 0 1px 3px rgba(40, 39, 81, .07);
  --shadow-lg: 0 18px 48px rgba(20, 19, 45, .25);
  --radius: 10px;
  --display: "Archivo", "Arial Narrow", "Segoe UI", system-ui, sans-serif;
  --body: "Public Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground: #131228; --surface: #1c1b37; --surface-2: #232242; --line: #33325a; --line-soft: #2a294c;
    --ink: #ecebf6; --ink-2: #cfcde6; --muted: #a2a1c2;
    --accent: #dcb360; --accent-ink: #282751; --accent-hover: #e7c57f; --accent-soft: #3a3323;
    --gold: #dcb360; --gold-ink: #e7c57f; --gold-soft: #3a3323; --link: #bdbbf2;
    --side: #0e0d21; --side-ink: #b3b2d2;
    --ok: #5cc98a; --ok-bg: #173627; --warn: #e5b25a; --warn-bg: #3a2c12; --danger: #f07e76; --danger-bg: #3d1c1a;
    --info: #a9a7f2; --info-bg: #27264b; --neutral: #9594b3; --neutral-bg: #2a294a;
    --bar-info: #3b3a72; --bar-ok: #1f5237; --bar-danger: #5e2825; --bar-warn: #5a4418; --bar-muted: #302f52;
    --field: #15142b; --field-line: #3b3a63; --overlay: rgba(0, 0, 0, .65);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 18px 48px rgba(0, 0, 0, .55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #131228; --surface: #1c1b37; --surface-2: #232242; --line: #33325a; --line-soft: #2a294c;
  --ink: #ecebf6; --ink-2: #cfcde6; --muted: #a2a1c2;
  --accent: #dcb360; --accent-ink: #282751; --accent-hover: #e7c57f; --accent-soft: #3a3323;
  --gold: #dcb360; --gold-ink: #e7c57f; --gold-soft: #3a3323; --link: #bdbbf2;
  --side: #0e0d21; --side-ink: #b3b2d2;
  --ok: #5cc98a; --ok-bg: #173627; --warn: #e5b25a; --warn-bg: #3a2c12; --danger: #f07e76; --danger-bg: #3d1c1a;
  --info: #a9a7f2; --info-bg: #27264b; --neutral: #9594b3; --neutral-bg: #2a294a;
  --bar-info: #3b3a72; --bar-ok: #1f5237; --bar-danger: #5e2825; --bar-warn: #5a4418; --bar-muted: #302f52;
  --field: #15142b; --field-line: #3b3a63; --overlay: rgba(0, 0, 0, .65);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 18px 48px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }
body { background: var(--ground); color: var(--ink); font-family: var(--body); font-size: 14px; line-height: 1.45; display: flex; min-height: 100vh; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 700; letter-spacing: -.005em; text-wrap: balance; }
h1 { font-size: 24px; font-stretch: 92%; }
h2 { font-size: 16px; }
h3 { font-size: 15px; }
svg.i { flex: none; vertical-align: middle; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-line; }
.eyebrow { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }

/* ---------- Layout ---------- */
.sidebar { width: 224px; flex: none; background: var(--side); color: var(--side-ink); position: sticky; top: env(safe-area-inset-top, 0px); height: 100vh; display: flex; flex-direction: column; padding: 16px 12px; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 2px 8px 16px; margin-bottom: 8px; border-bottom: 1px solid rgba(220, 179, 96, .25); }
.brand-name { color: #dcb360; font-family: var(--display); font-weight: 700; font-size: 12px; letter-spacing: .22em; text-transform: uppercase; }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; width: 150px; height: auto; margin: 0 auto; }
.brand-mark { display: none; width: 36px; height: auto; border-radius: 6px; }
#nav { display: flex; flex-direction: column; gap: 2px; }
#nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--side-ink); font-weight: 500; }
#nav a:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
#nav a.active { background: rgba(220, 179, 96, .16); color: #fff; box-shadow: inset 3px 0 0 #dcb360; }
#nav a.active svg { color: #dcb360; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 8px; font-size: 12px; }
.me { display: flex; align-items: center; gap: 8px; color: #ecebf6; }
.me img { width: 28px; height: 28px; border-radius: 50%; }
.me small { display: block; color: #9f9ec4; font-size: 11.5px; }
.sync { display: flex; align-items: center; gap: 6px; color: #9f9ec4; }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: #9f9ec4; display: inline-block; }
.sync.ok i { background: #3cc47a; } .sync.warn i { background: #e5a33a; } .sync.err i { background: #e0574f; }
.stale { background: #dcb360; color: #282751; border: 0; border-radius: 7px; padding: 7px 10px; font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
main { flex: 1; min-width: 0; padding-block: 24px 60px; padding-inline: 28px; max-width: 1420px; }
.boot { padding: 60px 0; text-align: center; color: var(--muted); }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); margin-bottom: 10px; font-weight: 500; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.toolbar label.inline { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.note { background: var(--info-bg); color: var(--info); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }
.note.warn { background: var(--warn-bg); color: var(--warn); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card > h2 { margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 16px 18px 0; }
.grid-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 16px; box-shadow: var(--shadow); }
.kpi .l { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi .v { font-family: var(--display); font-size: 22px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; font-stretch: 92%; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.danger { border-left: 3px solid var(--danger); }
.kpi.danger .v, .kpi.danger .s { color: var(--danger); }
.kpi.ok .s { color: var(--ok); }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 8px 13px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-bg); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.sm { padding: 5px 9px; font-size: 13px; }
.icon-btn { border: 0; background: transparent; cursor: pointer; padding: 6px; border-radius: 6px; color: var(--muted); display: inline-grid; place-items: center; font: inherit; }
.icon-btn:hover { background: var(--neutral-bg); color: var(--ink); }
.icon-btn.danger:hover { background: var(--danger-bg); color: var(--danger); }
.icon-btn.sm { padding: 3px 5px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--field-line); border-radius: 7px; padding: 7px 9px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
input[type=checkbox] { width: auto; accent-color: var(--accent); }
input[type=range] { accent-color: var(--accent); padding: 0; border: 0; background: transparent; }
textarea { resize: vertical; }
.toolbar input, .toolbar select { width: auto; max-width: 100%; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field > span i { color: var(--danger); font-style: normal; }
.field small { color: var(--muted); font-size: 12px; }
.full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 99px; padding: 5px 12px; cursor: pointer; font: inherit; font-size: 13px; }
.chip.active { background: var(--ink); color: var(--surface); border-color: var(--ink); }

/* ---------- Badges, progress, people ---------- */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.muted { background: var(--neutral-bg); color: var(--ink-2); }
.progress { position: relative; height: 8px; background: var(--neutral-bg); border-radius: 99px; min-width: 70px; }
.progress .bar { height: 100%; background: var(--gold); border-radius: 99px; max-width: 100%; }
.progress .marker { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--ink); border-radius: 2px; }
.prog-line { display: flex; align-items: center; gap: 10px; }
.prog-line .progress { flex: 1; }
.prog-line b { min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.who { font-weight: 600; }
.who:empty::before { content: "…"; color: var(--muted); }

/* ---------- Tables & lists ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover { background: var(--surface-2); }
.table tfoot td { font-weight: 700; border-top: 1px solid var(--line); }
.table td.acts { white-space: nowrap; text-align: right; width: 1%; }
.table small { display: block; color: var(--muted); font-size: 12px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); align-items: center; }
.list li:last-child { border-bottom: 0; }
.list small { display: block; color: var(--muted); }
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty h2 { color: var(--ink); margin: 12px 0 6px; font-size: 19px; }
.empty .actions { justify-content: center; margin-top: 16px; }
.empty-sm { color: var(--muted); padding: 8px 0; margin: 0; }
dl.info { display: grid; grid-template-columns: 170px 1fr; gap: 8px 12px; margin: 0; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; font-weight: 500; }

.pcard { display: flex; flex-direction: column; gap: 10px; color: inherit; margin: 0; transition: border-color .15s, box-shadow .15s; }
.pcard:hover { text-decoration: none; border-color: var(--gold); }
.pcard .top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.pcard .meta { color: var(--muted); font-size: 13px; }
.pcard .foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line-soft); padding-top: 10px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 10px 13px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--ink); border-bottom-color: var(--gold); }
.tabs .count { background: var(--neutral-bg); color: var(--muted); font-size: 11.5px; padding: 0 7px; border-radius: 99px; }

/* ---------- Gantt ---------- */
.gantt-wrap { overflow-x: auto; }
.gantt { min-width: 760px; }
.g-row { display: grid; grid-template-columns: 230px 1fr; align-items: center; min-height: 34px; }
.g-row + .g-row { border-top: 1px solid var(--line-soft); }
.g-row.click { cursor: pointer; }
.g-row.click:hover { background: var(--surface-2); }
.g-label { padding: 4px 10px 4px 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 500; }
.g-label small { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
.g-track { position: relative; height: 34px; }
.g-head .g-track { height: 26px; }
.g-head .g-label { color: var(--muted); font-size: 12px; }
.g-month { position: absolute; top: 4px; font-size: 11.5px; color: var(--muted); padding-left: 5px; border-left: 1px solid var(--line); height: 22px; overflow: hidden; white-space: nowrap; text-transform: capitalize; }
.g-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line-soft); }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); opacity: .7; z-index: 2; }
.g-bar { position: absolute; top: 9px; height: 16px; border-radius: 5px; overflow: hidden; background: var(--bar-info); min-width: 4px; }
.g-fill { height: 100%; background: var(--info); }
.g-bar.ok { background: var(--bar-ok); } .g-bar.ok .g-fill { background: var(--ok); }
.g-bar.danger { background: var(--bar-danger); } .g-bar.danger .g-fill { background: var(--danger); }
.g-bar.warn { background: var(--bar-warn); } .g-bar.warn .g-fill { background: var(--warn); }
.g-bar.muted { background: var(--bar-muted); } .g-bar.muted .g-fill { background: var(--neutral); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- Photos ---------- */
.dropzone { border: 2px dashed transparent; border-radius: var(--radius); transition: .15s; }
.dropzone.over { border-color: var(--gold); background: var(--gold-soft); }
.day-group { margin-bottom: 20px; }
.day-group h3 { font-size: 14px; margin-bottom: 10px; display: flex; gap: 8px; align-items: baseline; }
.day-group h3::first-letter { text-transform: uppercase; }
.day-group h3 span { color: var(--muted); font-weight: 400; font-family: var(--body); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.photo { position: relative; border-radius: 8px; overflow: hidden; background: var(--neutral-bg); aspect-ratio: 4/3; cursor: pointer; border: 0; padding: 0; display: block; width: 100%; max-width: 100%; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.photo:hover img { transform: scale(1.04); }
.photo .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; background: linear-gradient(transparent, rgba(0,0,0,.72)); color: #fff; font-size: 11.5px; text-align: left; }
.photo .cap b { display: block; font-weight: 600; }
.strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }

.lightbox { position: fixed; inset: 0; background: rgba(8,10,13,.95); z-index: 50; display: flex; flex-direction: column; color: #fff; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.lb-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 14px 18px; }
.lb-cap { color: #c7ced6; margin-top: 3px; }
.lb-actions { display: flex; gap: 4px; }
.lightbox .icon-btn { color: #d5dbe1; }
.lightbox .icon-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.lb-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; padding: 0 60px 30px; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.1); border: 0; color: #fff; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.lb-nav:hover { background: rgba(255,255,255,.2); }
.lb-nav.prev { left: 10px; } .lb-nav.next { right: 10px; }
.lb-count { position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; color: #9aa4ae; font-size: 12px; }

/* ---------- Journal ---------- */
.journal header { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 12px; flex-wrap: wrap; }
.journal h3::first-letter { text-transform: uppercase; }
.jr { display: grid; grid-template-columns: 190px 1fr; gap: 6px 14px; margin: 0; }
.jr dt { color: var(--muted); font-weight: 500; }
.jr dd { margin: 0; white-space: pre-line; }
.jr-photos { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.jr-photos img { width: 84px; height: 63px; object-fit: cover; border-radius: 6px; }

/* ---------- Plans & réserves ---------- */
.plan-card { padding: 0; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; margin: 0; text-align: left; font: inherit; color: inherit; }
.plan-card:hover { border-color: var(--gold); }
.plan-card .thumb { aspect-ratio: 4/3; background: var(--surface-2) center/contain no-repeat; border-bottom: 1px solid var(--line-soft); display: grid; place-items: center; color: var(--muted); }
.plan-card .body { padding: 12px 14px; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.plan-view { position: relative; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); max-height: 75vh; }
.plan-canvas { position: relative; margin: 0 auto; }
.plan-canvas img { display: block; width: 100%; max-width: none; user-select: none; -webkit-user-drag: none; }
.plan-canvas.adding { cursor: crosshair; }
.pin { position: absolute; transform: translate(-50%, -100%); border: 0; padding: 0; background: none; cursor: pointer; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); }
.pin span { display: grid; place-items: center; min-width: 26px; height: 26px; padding: 0 5px; border-radius: 13px 13px 13px 2px; transform: rotate(0); color: #fff; font-weight: 700; font-size: 12px; font-family: var(--display); border: 2px solid #fff; }
.pin.s-ouverte span { background: #c0352f; } .pin.s-levee span { background: #c98a12; } .pin.s-validee span { background: #1b7f48; }
.pin.dim { opacity: .25; }
.pin.hi span { outline: 3px solid var(--gold); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.s-ouverte { background: #c0352f; } .dot.s-levee { background: #c98a12; } .dot.s-validee { background: #1b7f48; }

/* ---------- Editors (factures, CR) ---------- */
.lines td { padding: 6px 5px; vertical-align: top; }
.lines input, .lines textarea { padding: 6px 7px; }
.lines textarea { min-height: 34px; resize: vertical; }
.lines .w-ref { width: 80px; } .lines .w-unit { width: 72px; } .lines .w-qty { width: 90px; } .lines .w-price { width: 120px; } .lines .w-date { width: 150px; } .lines .w-who { width: 190px; } .lines .w-st { width: 120px; }
.lines tr.sec td { background: var(--surface-2); }
.lines tr.sec input { font-weight: 700; }
.lines td.num { padding-top: 13px; }
.totals { margin-left: auto; width: min(380px, 100%); margin-top: 14px; }
.totals div { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-variant-numeric: tabular-nums; }
.totals .grand { border-top: 2px solid var(--ink); font-weight: 700; font-size: 16px; margin-top: 4px; padding-top: 9px; }
.totals .due { color: var(--danger); font-weight: 700; }
.banner { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-weight: 500; }

/* ---------- Modal & toasts ---------- */
.backdrop { position: fixed; inset: 0; background: var(--overlay); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--surface); color: var(--ink); border-radius: 12px; width: min(620px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.modal.wide { width: min(880px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
#toasts { position: fixed; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); right: 18px; left: 18px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; z-index: 200; pointer-events: none; }
.toast { background: #282751; color: #fff; padding: 11px 16px; border-radius: 9px; box-shadow: 0 8px 24px rgba(0,0,0,.25); border-left: 4px solid #3cc47a; transition: opacity .3s, transform .3s; max-width: 380px; pointer-events: auto; }
.toast.warn { border-left-color: #f0a030; } .toast.error { border-left-color: #e0574f; }
.toast.out { opacity: 0; transform: translateY(8px); }
.busy { position: fixed; inset: 0; background: color-mix(in srgb, var(--ground) 80%, transparent); display: grid; place-items: center; z-index: 300; font-weight: 600; font-size: 15px; color: var(--ink); }

/* In-app preview of printable documents: always paper */
.doc-shell { overflow-x: auto; }

@media (max-width: 980px) { .grid-main, .grid-2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; height: auto; z-index: 40; flex-direction: row; align-items: center; padding: 8px 10px; gap: 6px; }
  .brand { padding: 0; margin: 0; border: 0; }
  .brand-logo, .brand-name { display: none; }
  .brand-mark { display: block; }
  #nav { flex-direction: row; overflow-x: auto; flex: 1; }
  #nav a { padding: 8px 10px; font-size: 13px; white-space: nowrap; }
  #nav a span { display: none; }
  #nav a.active span { display: inline; }
  .side-foot { display: none; }
  .side-foot.has-stale { display: flex; margin: 0; padding: 0; }
  .side-foot.has-stale > :not(.stale) { display: none; }
  main { padding-block: 16px 50px; padding-inline: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .jr, dl.info { grid-template-columns: 1fr; }
  .jr dt, dl.info dt { margin-top: 6px; }
  .lb-stage { padding: 0 8px 30px; }
  .gantt { min-width: 640px; }
  .g-row { grid-template-columns: 140px 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Comptes : profil, logo d'organisme (commun avec ForesitePro) ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.me img.me-logo { border-radius: 6px; background: #fff; object-fit: contain; padding: 2px; width: 32px; height: 32px; }
.me-profile { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; padding: 0; border: 0; background: none; color: #dcb360; font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer; }
.me-profile:hover { text-decoration: underline; }
.me-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #e0574f; }
.pf .full, .form-grid .full { grid-column: 1 / -1; }
.pf-logo-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pf-logo { width: 150px; height: 72px; border: 1px dashed var(--line); border-radius: 8px; display: flex; align-items: center; justify-content: center; background: #fff; padding: 6px; font-size: 12px; text-align: center; }
.pf-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pf-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pf-lock { display: inline-flex; gap: 6px; align-items: flex-start; max-width: 380px; color: var(--muted); }
.org-logo { height: 26px; max-width: 90px; object-fit: contain; vertical-align: middle; margin-right: 8px; background: #fff; border-radius: 4px; padding: 1px 3px; }
.acct-badge { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 99px; font-size: 11px; font-weight: 600; background: var(--ok-bg); color: var(--ok); vertical-align: middle; }

/* Téléphones : pas d'agrandissement automatique du texte par le navigateur (Chrome Android « text autosizing »),
   qui grossissait certains paragraphes des documents et des PDF. */
html { -webkit-text-size-adjust: 100%; -moz-text-size-adjust: 100%; text-size-adjust: 100%; }

/* Assistant IA local (ai-assist.js) — couleur or de la marque pour le distinguer */
:root { --ai: #dcb360; --ai-ink: #282751; --ai-soft: #fcf7ea; --ai-text: #8a6a22; --ai-line: #e6cf9c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ai-soft: #29261c; --ai-text: #e7c57f; --ai-line: #5c4d2a; } }
:root[data-theme="dark"] { --ai-soft: #29261c; --ai-text: #e7c57f; --ai-line: #5c4d2a; }
.ai-dim { position: fixed; inset: 0; background: rgba(20, 19, 45, .25); z-index: 60; }
.ai-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); z-index: 61; background: var(--surface); border-left: 3px solid var(--ai);
  box-shadow: -12px 0 40px rgba(20, 19, 45, .22); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.ai-dh { display: flex; align-items: center; gap: 10px; padding: 16px 18px 10px; border-bottom: 1px solid var(--line-soft); background: linear-gradient(180deg, var(--ai-soft), var(--surface)); }
.ai-dh h3 { margin: 0; font-size: 18px; display: flex; gap: 8px; align-items: center; }
.ai-dh h3 .i { color: var(--ai-text); }
.ai-dh .ai-model { font-size: 12px; margin-left: auto; }
.ai-dh .icon-btn { margin-left: 4px; }
.ai-dh h3 + .icon-btn { margin-left: auto; }
.ai-body { flex: 1; overflow: auto; padding: 14px 18px 18px; }
.ai-notes { width: 100%; min-height: 130px; resize: vertical; }
.ai-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.ai-hint { font-size: 12.5px; color: var(--muted); }
.btn.ai-btn { background: var(--ai); border-color: var(--ai); color: var(--ai-ink); }
.btn.ai-btn:hover { filter: brightness(1.05); background: var(--ai); }
.btn.rec-on { color: var(--danger); border-color: var(--danger); }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); display: inline-block; animation: aipulse 1s infinite; }
@keyframes aipulse { 50% { opacity: .3; } }
.ai-spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: aispin .8s linear infinite; }
@keyframes aispin { to { transform: rotate(360deg); } }
.ai-prop { border: 1px dashed var(--ai-line); border-radius: 10px; padding: 12px 14px; background: var(--surface); margin-top: 12px; }
.ai-prop h4 { margin: 0 0 6px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ai-text); display: flex; gap: 6px; align-items: center; }
.ai-sec { padding: 9px 0; border-top: 1px solid var(--line-soft); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.ai-prop h4 + .ai-sec { border-top: 0; }
.ai-sec.ai-block { display: block; }
.ai-sec.ai-block > b { display: block; margin-bottom: 4px; }
.ai-sec b { font-size: 13px; }
.ai-sec p { margin: 2px 0 0; font-size: 13px; white-space: pre-line; }
.ai-sec.done p { color: var(--muted); }
.ai-sec .table td, .ai-sec .table th { padding: 6px 8px; }

.ai-link { background: none; border: 0; padding: 2px 0; margin: 0 0 8px; font: inherit; font-size: 13px; font-weight: 600; color: var(--ai-text); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.ai-link:hover { text-decoration: underline; }
.ai-dict { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; background: var(--surface-2); }
.ai-dict h4 { margin: 0 0 4px; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.ai-dict-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 2px; max-height: 180px; overflow: auto; }
.ai-dict-list li { display: flex; align-items: center; gap: 6px; font-size: 13px; padding: 3px 0; border-bottom: 1px solid var(--line-soft); }
.ai-dict-list li .icon-btn { margin-left: auto; }
.ai-dict-add { display: grid; gap: 6px; }
.ai-dict-add .btn { justify-self: start; }

/* destinataires de l'envoi d'un compte rendu */
.mail-rcpt { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow: auto; border: 1px solid var(--line-soft); border-radius: 8px; }
.mail-rcpt li { padding: 6px 10px; border-top: 1px solid var(--line-soft); font-size: 13px; }
.mail-rcpt li:first-child { border-top: 0; }

/* Assistant IA : profils autorisés (page Utilisateurs) */
.ai-prof-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 18px; }
.ai-prof { align-items: flex-start; font-weight: 500; line-height: 1.35; padding: 3px 0; }
.ai-prof input { margin-top: 2px; }
.ai-grp { margin: 12px 0 4px; }

/* Logo du chantier dans la fiche chantier (création / modification) */
.pl-logo { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-top: 16px; padding: 14px; border-radius: 10px; background: var(--surface-2); }
.pl-logo-box { width: 150px; height: 80px; flex: none; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; font-size: 12.5px; }
.pl-logo-box img { display: block; width: auto; height: auto; max-width: 138px; max-height: 68px; object-fit: contain; }
.pl-logo-tx { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.pl-logo-tx .muted { font-size: 12.5px; }
.pl-logo-act { display: flex; gap: 8px; margin-top: 6px; }
/* R5 : ordre des personnes dans un organisme (Annuaire) */
.rank-btns { display: inline-flex; flex-direction: column; vertical-align: middle; margin: -4px 8px -4px -6px; }
.rank-btns .icon-btn { padding: 0 6px; font-size: 11px; line-height: 1.15; }
.rank-btns .icon-btn:disabled { opacity: .25; cursor: default; }
.rank-btns .icon-btn:not(:disabled):hover { color: var(--accent, currentColor); background: var(--line-soft, rgba(0,0,0,.05)); }
/* R6 : aperçu des logos (import d'une fiche, bouton « + Logo » de l'Annuaire) */
.logo-pick { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 12px; border-radius: 10px; background: var(--surface-2); }
.logo-pick-tx { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.logo-pick-act { display: flex; gap: 8px; flex-wrap: wrap; }
.logo-prev { width: 160px; height: 84px; flex: none; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--line); border-radius: 8px; background: #fff; overflow: hidden; font-size: 12.5px; }
.logo-prev.dark { background: #1f2933; border-style: solid; border-color: #1f2933; margin-top: 8px; }
.logo-prev img { display: block; width: auto; height: auto; max-width: 146px; max-height: 70px; object-fit: contain; }
.logo-cmp { display: flex; gap: 24px; flex-wrap: wrap; }
.logo-cmp figure { margin: 0; }
.logo-cmp figcaption { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.form-grid input[readonly] { background: var(--surface-2); color: var(--muted); cursor: default; }
