/* Zefir Chantiers — feuille de style unique, sans dépendance externe */
:root {
  --ink: #1b2a3a;
  --ink-2: #33475b;
  --muted: #64748b;
  --line: #dcd7cf;
  --line-2: #ebe7e0;
  --bg: #f4f2ee;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --accent: #e8590c;
  --ok: #2b8a3e;
  --ok-bg: #e6f4ea;
  --warn: #b35c00;
  --warn-bg: #fff1db;
  --danger: #c92a2a;
  --danger-bg: #fdeaea;
  --info: #1c5d99;
  --info-bg: #e7f0fa;
  --radius: 10px;
  --rail-w: 88px;
  --panel-w: 300px;
  --top-h: 56px;
  --shadow: 0 1px 2px rgba(27, 42, 58, .06), 0 4px 16px rgba(27, 42, 58, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 var(--font); color: var(--ink); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
img { max-width: 100%; display: block; }
a { color: var(--info); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); }
.icon { width: 22px; height: 22px; flex: none; }
.inline { display: inline; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
code { background: var(--line-2); padding: 1px 5px; border-radius: 4px; font-size: .9em; }

/* ---- Barre du haut ---- */
.topbar { position: sticky; top: 0; z-index: 40; height: var(--top-h); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 12px 0 16px; background: var(--ink); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 800; font-size: .9rem; letter-spacing: .02em; flex: none; }
.brand-logo { height: 34px; width: auto; max-width: 120px; object-fit: contain; background: #fff; border-radius: 6px; padding: 2px; }
.brand-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; display: inline-grid; place-items: center; min-width: 44px; height: 44px; border-radius: 8px; color: inherit; background: transparent; border: 0; cursor: pointer; list-style: none; }
.icon-btn:hover { background: rgba(255, 255, 255, .1); }
.icon-btn::-webkit-details-marker { display: none; }
.badge { position: absolute; top: 4px; right: 0; min-width: 18px; height: 18px; padding: 0 4px; border: 1.5px solid currentColor; border-radius: 0; background: var(--ink); color: #ff922b; font-size: .72rem; font-weight: 700; line-height: 15px; text-align: center; }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #fff; color: var(--ink); font-weight: 700; font-size: .8rem; }
.usermenu { position: relative; }
.usermenu-pop { position: absolute; right: 0; top: 50px; width: 260px; background: var(--surface); color: var(--ink); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0, 0, 0, .2); padding: 6px; z-index: 60; }
.usermenu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.usermenu-sep { padding: 8px 10px 2px; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.menu-item { display: block; width: 100%; text-align: left; padding: 10px; border-radius: 6px; color: var(--ink); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; }
.menu-item:hover, .menu-item.is-active { background: var(--line-2); }
.sync-pill { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 17px; background: rgba(255, 255, 255, .12); color: #fff; text-decoration: none; font-size: .85rem; font-weight: 600; }
.sync-pill .icon { width: 18px; height: 18px; }
.sync-pill.is-pending { background: var(--accent); }
.sync-pill.is-offline { background: #6b7280; }
.support-banner { background: #fff3bf; color: #5c4400; padding: 8px 16px; display: flex; gap: 12px; align-items: center; justify-content: center; font-size: .9rem; flex-wrap: wrap; }
.offline-banner { background: #374151; color: #fff; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px; font-size: .9rem; }

/* ---- Structure : contenu + panneaux + barre de droite ---- */
.shell { flex: 1; display: flex; align-items: stretch; min-height: calc(100vh - var(--top-h) - 44px); }
.main { flex: 1; min-width: 0; padding: 20px 24px 32px; max-width: 1280px; margin: 0 auto; width: 100%; }
.rail { width: var(--rail-w); flex: none; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; padding: 12px 8px; position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); }
.rail-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 4px; border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--ink-2); font: 600 .74rem/1.2 var(--font); text-align: center; cursor: pointer; }
.rail-btn .icon { width: 28px; height: 28px; }
.rail-btn:hover { background: var(--surface-2); border-color: var(--line); }
.rail-btn.is-open { background: var(--ink); color: #fff; }
.rail-btn-small { margin-top: auto; padding: 10px 4px; }
.panel { width: var(--panel-w); flex: none; background: var(--surface); border-right: 1px solid var(--line); padding: 14px 12px 24px; position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); overflow-y: auto; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.panel-head h2 { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; margin: 0; }
.panel-head .icon-btn:hover { background: var(--line-2); }
.panel-label { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 6px 4px 4px; }
.project-switch { width: 100%; margin-bottom: 10px; }
.panel-sep { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 16px 6px 6px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.panel-nav { display: flex; flex-direction: column; gap: 2px; }
.panel-nav a { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: .95rem; }
.panel-nav a .icon { width: 20px; height: 20px; color: var(--muted); }
.panel-nav a:hover { background: var(--surface-2); }
.panel-nav a.is-active { background: var(--line-2); font-weight: 600; }
.panel-nav a.is-active .icon { color: var(--accent); }
.count { margin-left: auto; background: transparent; color: var(--accent); border: 1.5px solid currentColor; border-radius: 0; font-size: .75rem; font-weight: 700; padding: 0 7px; }

.footer { text-align: center; padding: 12px 16px; font-size: .85rem; color: var(--muted); border-top: 1px solid var(--line); background: var(--surface-2); }
.bottomnav, .fab { display: none; }

/* ---- Mobile ---- */
@media (max-width: 1023px) {
  .main { padding: 14px 14px 110px; }
  .rail { display: none; }
  body.menu-open .rail { display: flex; position: fixed; left: 8px; right: 8px; bottom: 76px; top: auto; height: auto; width: auto; flex-direction: row; z-index: 70; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
  body.menu-open .rail-btn { flex: 1; }
  body.menu-open .rail-btn-small { margin-top: 0; flex: 0 0 64px; }
  .panel { position: fixed; top: 0; left: 0; bottom: 0; width: min(88vw, 340px); height: 100%; z-index: 80; box-shadow: 10px 0 40px rgba(0, 0, 0, .25); }
  .scrim { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 65; }
  .bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .bottomnav a, .bottomnav button { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 1px; min-height: 56px; justify-content: center; color: var(--ink-2); text-decoration: none; font: 600 .68rem/1.1 var(--font); text-align: center; background: none; border: 0; border-radius: 8px; }
  .bottomnav a.is-active { color: var(--accent); }
  .bottomnav .dot { position: absolute; top: 6px; right: calc(50% - 18px); width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
  .fab { display: flex; position: fixed; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 55; align-items: center; gap: 8px; height: 56px; padding: 0 20px 0 16px; border-radius: 28px; background: var(--accent); color: #fff; font-weight: 700; text-decoration: none; box-shadow: 0 6px 20px rgba(232, 89, 12, .45); }
  .footer { padding-bottom: 80px; }
  .brand-name { max-width: 46vw; }
  .sync-pill span { display: none; }
}
@media (min-width: 1024px) {
  .scrim { display: none; }
}

/* ---- Éléments communs ---- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin: 2px 0 0; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty .icon { width: 40px; height: 40px; margin: 0 auto 8px; color: var(--line); }
hr { border: 0; border-top: 1px solid var(--line-2); margin: 16px 0; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--ink); background: var(--ink); color: #fff; font: 600 .95rem var(--font); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { filter: brightness(1.12); }
.btn .icon { width: 18px; height: 18px; }
.btn-accent { background: var(--accent); border-color: var(--accent); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); filter: none; }
.btn-danger { background: var(--surface); color: var(--danger); border-color: #f1b5b5; }
.btn-small { min-height: 34px; padding: 0 10px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn-icon { min-width: 36px; min-height: 36px; padding: 0; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; color: var(--info); font: inherit; cursor: pointer; text-decoration: underline; }

/* Formulaires */
label { font-weight: 600; font-size: .9rem; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .82rem; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=search], input[type=color], select, textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid #c9c2b6; border-radius: 8px; background: #fff; color: var(--ink); font: 16px var(--font);
}
input[type=color] { padding: 4px; width: 80px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; min-height: 32px; }
.check input { width: 20px; height: 20px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 14px; }
.filters .field { margin: 0; min-width: 150px; }
.filters .field label { font-size: .78rem; color: var(--muted); }

/* Messages */
.flash { padding: 12px 14px; border-radius: var(--radius); margin-bottom: 12px; border: 1px solid; font-weight: 500; }
.flash-success { background: var(--ok-bg); border-color: #b2dfbd; color: #1e5f2b; }
.flash-error { background: var(--danger-bg); border-color: #f1b5b5; color: #8c1d1d; }
.flash-info { background: var(--info-bg); border-color: #b8d0ea; color: #174a7a; }
.flash-warning { background: var(--warn-bg); border-color: #f5cf8f; color: #7a4100; }
.callout { padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px dashed var(--line); font-size: .92rem; }

/* Étiquettes d'état : carrées, fond transparent, couleur portée par le contour et le texte */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border: 1.5px solid currentColor; border-radius: 0; background: transparent; font-size: .78rem; font-weight: 700; white-space: nowrap; color: var(--ink-2); }
.tag-late, .tag-danger, .tag-expired { color: var(--danger); }
.tag-not_started, .tag-at_risk, .tag-warn, .tag-soon { color: var(--warn); }
.tag-upcoming, .tag-info { color: var(--info); }
.tag-done, .tag-ok, .tag-valid { color: var(--ok); }
.tag-en_cours { color: var(--info); }
.tag-receptionne { color: var(--ok); }
.tag-suspendu { color: var(--warn); }
.pcard-img .tag { background: var(--surface); }

/* Indicateurs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.kpi-label { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.kpi-value { font-size: 1.7rem; font-weight: 800; line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .85rem; color: var(--muted); }
.kpi.is-bad .kpi-value { color: var(--danger); }
.kpi.is-good .kpi-value { color: var(--ok); }
.kpi.is-warn .kpi-value { color: var(--warn); }

/* Barres d'avancement */
.bar { position: relative; height: 10px; background: var(--line-2); border-radius: 5px; overflow: hidden; }
.bar > span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink); border-radius: 5px; }
.bar > i { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--accent); }
.bar.is-late > span { background: var(--danger); }
.bar-lg { height: 16px; border-radius: 8px; }
.lotbars { display: flex; flex-direction: column; gap: 12px; }
.lotbar-head { display: flex; justify-content: space-between; font-size: .9rem; margin-bottom: 4px; gap: 8px; }
.legend { display: flex; gap: 16px; font-size: .82rem; color: var(--muted); flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 4px; margin-right: 6px; vertical-align: middle; background: var(--ink); border-radius: 2px; }
.legend .lg-planned::before { background: var(--accent); }
.legend .lg-ref::before { background: #b8b1a5; }

/* Tableaux */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { padding: 10px 8px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; background: var(--surface-2); }
.table tr:hover td { background: #fcfbf8; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions-cell { white-space: nowrap; text-align: right; }

/* Cartes projets (vue d'ensemble) */
.project-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.pcard.is-stale { border-color: var(--danger); box-shadow: 0 0 0 2px var(--danger-bg); }
.pcard-img { aspect-ratio: 16 / 7; background: var(--line-2) center / cover no-repeat; position: relative; }
.pcard-img .tag { position: absolute; left: 10px; top: 10px; }
.pcard-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pcard-title { font-weight: 700; font-size: 1.05rem; }
.pcard-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: .85rem; }
.pcard-meta b { font-variant-numeric: tabular-nums; }

/* Listes d'activités */
.alist { list-style: none; margin: 0; padding: 0; }
.aitem { display: flex; gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line-2); }
.aitem:last-child { border-bottom: 0; }
.aitem-thumb { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; flex: none; background: var(--line-2); display: grid; place-items: center; color: var(--muted); }
.aitem-body { flex: 1; min-width: 0; }
.aitem-title { font-weight: 700; }
.aitem-meta { font-size: .85rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.aitem .bar { margin-top: 6px; }
.lot-title { margin: 18px 0 4px; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

/* Plan de travail */
.plan-lot { margin-bottom: 18px; }
.plan-lot-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--ink); color: #fff; border-radius: 8px 8px 0 0; flex-wrap: wrap; }
.plan-lot-head h3 { margin: 0; font-size: 1rem; flex: 1; }
.plan-lot-head .btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .3); }
.plan-table td { vertical-align: middle; }
.plan-table .sel { width: 32px; }
.history-item { font-size: .88rem; padding: 6px 0; border-bottom: 1px solid var(--line-2); }

/* Gantt */
.gantt { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.gantt svg { display: block; }
.gantt text { font-family: var(--font); }

/* Photothèque */
.day-group { margin-bottom: 22px; }
.day-group h3 { position: sticky; top: var(--top-h); background: var(--bg); padding: 8px 0; z-index: 5; font-size: 1rem; text-transform: capitalize; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.photo-tile { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--line-2); border: 0; padding: 0; cursor: pointer; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; }
.photo-tile .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; font-size: .75rem; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .75)); text-align: left; line-height: 1.25; }
.photo-tile .flag { position: absolute; top: 6px; right: 6px; background: var(--surface); color: var(--danger); border: 1.5px solid currentColor; border-radius: 0; font-size: .7rem; padding: 0 6px; font-weight: 700; }
.photo-tile.is-pending { display: grid; place-items: center; color: var(--muted); font-size: .8rem; }
.photo-pick { position: relative; }
.photo-pick input { position: absolute; top: 8px; left: 8px; width: 22px; height: 22px; z-index: 2; }

/* Visionneuse */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(10, 14, 20, .94); display: grid; grid-template-columns: 1fr 360px; color: #fff; }
.lb-stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 16px; }
.lb-stage img { max-width: 100%; max-height: calc(100vh - 32px); object-fit: contain; border-radius: 4px; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 64px; border: 0; background: rgba(255, 255, 255, .12); color: #fff; font-size: 1.6rem; border-radius: 8px; cursor: pointer; }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.lb-close { position: absolute; top: 12px; right: 12px; z-index: 3; }
.lb-side { background: var(--surface); color: var(--ink); overflow-y: auto; padding: 18px; }
.lb-side dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .9rem; margin: 10px 0; }
.lb-side dt { color: var(--muted); }
.lb-side dd { margin: 0; }
.comment { padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: .9rem; }
.comment b { font-size: .85rem; }
@media (max-width: 860px) {
  .lightbox { grid-template-columns: 1fr; grid-template-rows: 55vh 1fr; }
  .lb-stage img { max-height: 52vh; }
}

/* Feuille de remontée (mobile) */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 90; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 16px; } }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.sheet-head h2 { margin: 0; font-size: 1.1rem; }
.shot-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 110px; border: 2px dashed var(--accent); border-radius: 12px; background: #fff7f2; color: var(--accent); font: 700 1rem var(--font); cursor: pointer; }
.shot-btn .icon { width: 34px; height: 34px; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; margin: 10px 0; }
.shot { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--line-2); }
.shot img { width: 100%; height: 100%; object-fit: cover; }
.shot button { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .65); color: #fff; font-size: 1rem; }
.shot small { position: absolute; left: 4px; bottom: 4px; background: rgba(0, 0, 0, .6); color: #fff; padding: 0 5px; border-radius: 4px; font-size: .7rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; }
.chip span { display: inline-flex; align-items: center; min-height: 44px; min-width: 56px; justify-content: center; padding: 0 14px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); font-weight: 700; }
.chip input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); }
details.more { border-top: 1px solid var(--line-2); margin-top: 12px; padding-top: 8px; }
details.more summary { cursor: pointer; font-weight: 600; padding: 8px 0; color: var(--ink-2); }

/* File d'envoi */
.qitem { display: flex; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.qitem img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; }
.qstate { font-size: .8rem; font-weight: 700; }
.qstate.s-queued { color: var(--warn); }
.qstate.s-sending { color: var(--info); }
.qstate.s-sent { color: var(--ok); }
.qstate.s-error { color: var(--danger); }

/* Notifications, divers */
.notif { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.notif.is-unread { font-weight: 600; }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--ink-2); border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 600; }
.tabs a.is-active { border-color: var(--accent); color: var(--ink); }
.att-list { list-style: none; padding: 0; margin: 0; }
.att-list li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: .92rem; }
.att-list li a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dossier-section { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; background: var(--surface); }
.dossier-section-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line-2); background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; flex-wrap: wrap; }
.dossier-section-head h3 { margin: 0; flex: 1; font-size: 1rem; }
.dossier-section-body { padding: 10px 12px; }
.mask { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: .88rem; padding: 8px 0; }
.sorter { display: inline-flex; gap: 2px; }
.sorter button { width: 32px; height: 32px; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; display: grid; place-items: center; cursor: pointer; }
.sorter button .icon { width: 16px; height: 16px; }
.scurve { width: 100%; height: auto; }
.scurve text { font: 11px var(--font); fill: var(--muted); }

/* Pages invité */
body.guest { background: var(--ink); }
.guest-main { flex: 1; display: grid; place-items: center; padding: 24px 16px; }
.guest-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 14px; padding: 28px 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.guest-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; margin-bottom: 18px; }
body.guest .footer { background: transparent; color: #aab4c0; border: 0; }

@media print {
  .topbar, .rail, .panel, .bottomnav, .fab, .actions, .filters { display: none !important; }
  .main { padding: 0; }
  body { background: #fff; }
}
