/* Rideaux Couture : écrans de visite.
   Mise en page : une colonne de saisie, gros boutons tactiles, barre collante en haut ; deux colonnes sur grand écran.
   Couleurs reprises du logo (or bruni sur blanc). */
:root {
  --bg: #F5F4F1;
  --surface: #FFFFFF;
  --surface-2: #F8F7F4;
  --ink: #2A251E;
  --muted: #6A6358;
  --line: #E0DCD4;
  --gold: #8A6727;
  --gold-ink: #FFFFFF;
  --gold-soft: #F3EBDB;
  --todo: #A4501B;
  --todo-soft: #FBEADF;
  --ok: #2D6F4E;
  --ok-soft: #E1F0E6;
  --font-ui: "Jost", "Avenir Next", "Helvetica Neue", system-ui, sans-serif;
  --font-title: "Cormorant Garamond", "Iowan Old Style", Garamond, Georgia, serif;
  --r: 12px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-ui); font-size: 16px; line-height: 1.45; padding-bottom: env(safe-area-inset-bottom, 0px); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.gut { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* Barre du haut */
.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.bar-in { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; gap: 12px; min-height: 64px; }
.back { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); font-size: 22px; line-height: 1; }
.crumbs { min-width: 0; flex: 1; display: flex; flex-wrap: wrap; gap: 2px 6px; font-size: 14px; color: var(--muted); }
.crumbs button { border: 0; background: none; padding: 2px 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.crumbs .here { color: var(--ink); font-weight: 500; }
.logo { height: 44px; width: auto; flex: none; }
.etat { font-size: 13px; color: var(--muted); white-space: nowrap; }
.etat.alerte { color: var(--todo); font-weight: 500; }
@media (max-width: 600px) { .logo { height: 36px; } .etat { display: none; } .etat.alerte { display: inline; } }

.bandeau { background: var(--todo-soft); color: var(--todo); border-bottom: 1px solid var(--todo); }
.bandeau-in { max-width: 1080px; margin: 0 auto; padding-block: 10px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }

main { max-width: 1080px; margin: 0 auto; padding-block: 20px 120px; display: grid; gap: 20px; }
h1 { font-variant-numeric: lining-nums; font-family: var(--font-title); font-weight: 600; font-size: clamp(30px, 4.4vw, 40px); line-height: 1.1; margin: 0; text-wrap: balance; }
h2 { font-variant-numeric: lining-nums; font-family: var(--font-title); font-weight: 600; font-size: 26px; margin: 0; }
h3 { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0; }
.sub { color: var(--muted); margin: 0; }
.head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; }
.head > div { min-width: 0; }
.pile { display: grid; gap: 12px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: grid; gap: 16px; min-width: 0; }
.cols { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .cols { grid-template-columns: 1fr 1fr; align-items: start; } }

.field { display: grid; gap: 6px; min-width: 0; }
.label { font-size: 14px; font-weight: 500; color: var(--muted); }
.txt { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 16px; }
textarea.txt { min-height: 110px; resize: vertical; }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.grid2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.num { position: relative; }
.num .txt { padding-right: 44px; font-variant-numeric: tabular-nums; }
.num span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; pointer-events: none; }
.num.empty .txt { border-color: var(--todo); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 15px; }
.chip[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); font-weight: 500; }
.chip.ad { border-style: dashed; color: var(--muted); }
.chip.ad[aria-pressed="true"] { background: var(--todo-soft); color: var(--todo); border-color: var(--todo); border-style: solid; }
.chip.flag[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }

.btn { min-height: 48px; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn.main { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.btn.quiet { border-color: transparent; background: none; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.btn.danger { color: var(--todo); }
.btn.danger.armed { background: var(--todo); border-color: var(--todo); color: var(--surface); }
.btn:disabled { opacity: .6; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.ends { justify-content: space-between; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.badge.todo { background: var(--todo-soft); color: var(--todo); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.tag { font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }

.list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 10px; min-width: 0; }
.card.tap { cursor: pointer; }
.card.tap:hover { border-color: var(--gold); }
.card .t { font-weight: 600; font-size: 17px; overflow-wrap: anywhere; }
.card .meta { color: var(--muted); font-size: 14px; }
.win { display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: start; }
.win-info { display: grid; gap: 6px; min-width: 0; }
.thumb { width: 84px; height: 108px; border-radius: 8px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-size: 12px; color: var(--muted); text-align: center; }
.vide { border: 1px dashed var(--line); border-radius: var(--r); padding: 28px 18px; text-align: center; color: var(--muted); display: grid; gap: 12px; justify-items: center; }

.tabs { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; overflow-x: auto; }
.tabs button { flex: 1 0 auto; min-height: 44px; border: 0; border-radius: 9px; background: none; padding: 8px 14px; font-weight: 500; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }

.photos { display: flex; flex-wrap: wrap; gap: 10px; }
.photo { position: relative; width: 132px; height: 170px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo a { display: block; width: 100%; height: 100%; }
.photo button { position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgb(0 0 0 / .55); color: #fff; font-size: 18px; line-height: 1; }
.addphoto { position: relative; width: 132px; height: 170px; border-radius: 10px; border: 2px dashed var(--line); display: grid; place-items: center; text-align: center; color: var(--muted); font-weight: 500; padding: 10px; cursor: pointer; }
.addphoto input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.couche { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.couche-h { width: 100%; border: 0; background: none; text-align: left; padding: 14px 16px; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.couche-h > span:nth-child(2) { min-width: 0; }
.couche-n { width: 34px; height: 34px; border-radius: 50%; background: var(--gold-soft); color: var(--gold); display: grid; place-items: center; font-weight: 600; }
.couche-t { font-weight: 600; }
.couche-s { color: var(--muted); font-size: 14px; display: block; }
.couche-b { padding: 4px 16px 18px; display: grid; gap: 18px; border-top: 1px solid var(--line); }
.sec { display: grid; gap: 14px; padding-top: 14px; }
@media (max-width: 520px) { .couche-h { grid-template-columns: auto 1fr; } .couche-h .badge { grid-column: 2; justify-self: start; } }

.side-note { font-size: 14px; color: var(--muted); border-left: 3px solid var(--gold); padding-left: 12px; margin: 0; }
.item { display: grid; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--surface-2); }

.sheet-bg { position: fixed; inset: 0; background: rgb(20 16 10 / .45); z-index: 20; display: grid; align-items: end; justify-items: center; }
.sheet { width: min(640px, 100%); background: var(--surface); border-radius: 18px 18px 0 0; padding: 20px max(16px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); display: grid; gap: 14px; }
.big { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.big button { min-height: 72px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); text-align: left; padding: 12px 14px; display: grid; gap: 2px; }
.big b { font-weight: 600; }
.big small { color: var(--muted); font-size: 13px; }

.docs { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.doc { border: 1px dashed var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 2px; color: var(--muted); }
.doc b { color: var(--ink); font-weight: 500; }

.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--line); padding-block: 10px calc(10px + env(safe-area-inset-bottom, 0px)); }
.nav-in { max-width: 1080px; margin: 0 auto; display: flex; justify-content: space-between; gap: 10px; }
.chargement { padding: 60px 0; text-align: center; color: var(--muted); }

/* Page de connexion */
.connexion { min-height: 100vh; display: grid; place-items: center; padding-block: 32px; }
.connexion form { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px 24px; display: grid; gap: 18px; }
.connexion .logo-grand { width: min(300px, 80%); height: auto; justify-self: center; }
.erreur { color: var(--todo); background: var(--todo-soft); border-radius: 8px; padding: 10px 12px; margin: 0; }

@media (prefers-reduced-motion: no-preference) { .chip, .btn, .card { transition: background-color .15s, border-color .15s; } }
