/* Mon atelier : téléphone d'abord, gros boutons, clair et sombre. */
:root {
  --fond: #faf6f0; --carte: #fff; --encre: #2a211c; --doux: #6f6259; --trait: #e4dacd;
  --terre: #b4552d; --terre-fonce: #8f3f1e; --sur-terre: #fff; --creme: #f3e7d8;
  --alerte: #a13a12; --alerte-fond: #fbe9df; --ok: #2f6b4a;
  --rayon: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #1c1714; --carte: #27201c; --encre: #f3ebe2; --doux: #b7a99c; --trait: #3d332d;
    --terre: #d9774b; --terre-fonce: #e8936b; --sur-terre: #1c1714; --creme: #33291f;
    --alerte: #f0a383; --alerte-fond: #3b241a; --ok: #8fcaa8;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--encre);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p, ul, dl, dd { margin: 0; }
h1 { font-size: 1.55rem; line-height: 1.15; letter-spacing: -0.01em; text-wrap: balance; }
h2 { font-size: 1.12rem; line-height: 1.25; }
h3 { font-size: 0.95rem; color: var(--doux); font-weight: 600; }
ul { list-style: none; padding: 0; }
a { color: var(--terre-fonce); }
small { font-size: 0.85rem; color: var(--doux); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--terre); outline-offset: 2px; }

main { max-width: 620px; margin: 0 auto; padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); display: grid; gap: 16px; }
main > section { display: grid; gap: 10px; }
.solo { min-height: 100dvh; align-content: center; padding-bottom: 18px; }
.loading { text-align: center; padding: 40vh 16px 0; color: var(--doux); }

.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.back { text-decoration: none; font-size: 0.95rem; min-height: 32px; display: inline-flex; align-items: center; }
.eyebrow { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--terre-fonce); font-weight: 700; }
.muted { color: var(--doux); font-size: 0.93rem; }
.warn { color: var(--alerte); font-size: 0.93rem; font-weight: 600; }
.empty { color: var(--doux); background: var(--creme); border-radius: var(--rayon); padding: 16px; display: grid; gap: 12px; justify-items: start; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.big { font-size: 2.3rem; font-weight: 750; line-height: 1.05; font-variant-numeric: tabular-nums; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.big small { font-size: 0.9rem; font-weight: 400; }
.amount, .price { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.price { color: var(--terre-fonce); }
.tag, .pill { font-size: 0.78rem; font-weight: 650; padding: 3px 9px; border-radius: 99px; background: var(--creme); color: var(--encre); white-space: nowrap; }
.tag.warn, .pill { background: var(--alerte-fond); color: var(--alerte); }
.chev { color: var(--doux); font-size: 1.3rem; }

.hero { gap: 4px !important; }

.btn {
  appearance: none; border: 1.5px solid var(--terre); background: var(--terre); color: var(--sur-terre);
  font: inherit; font-weight: 650; min-height: 48px; padding: 10px 18px; border-radius: 12px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; text-align: center;
}
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--terre-fonce); border-color: var(--trait); }
.btn.danger { background: transparent; color: var(--alerte); border-color: transparent; }
.btn.small { min-height: 44px; padding: 8px 14px; font-size: 0.93rem; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--creme); padding: 4px; border-radius: 14px; }
.seg button { appearance: none; border: 0; background: transparent; color: var(--doux); font: inherit; font-size: 0.93rem; font-weight: 600; min-height: 44px; border-radius: 10px; cursor: pointer; padding: 4px 6px; }
.seg button.on { background: var(--carte); color: var(--encre); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
.tile {
  appearance: none; font: inherit; color: var(--encre); text-align: left; cursor: pointer;
  background: var(--carte); border: 1.5px solid var(--trait); border-radius: var(--rayon); padding: 14px;
  min-height: 108px; display: grid; gap: 2px; align-content: space-between;
}
.tile b { font-size: 1.08rem; line-height: 1.2; overflow-wrap: anywhere; }
.tile .price { font-size: 1.3rem; }
.tile:active { background: var(--creme); border-color: var(--terre); }
.tile.out small { color: var(--alerte); }

.lines { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); overflow: hidden; }
.lines > li + li { border-top: 1px solid var(--trait); }
.line { appearance: none; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; text-decoration: none; width: 100%; min-height: 56px; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.line > span:first-child { display: grid; min-width: 0; }
.line b { overflow-wrap: anywhere; font-weight: 600; }
.lines.plain { border: 0; background: none; border-radius: 0; }
.lines.plain > li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; }

.cards { display: grid; gap: 12px; }
.card { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 16px; display: grid; gap: 10px; }
.card.alert { border-color: var(--alerte); background: var(--alerte-fond); }
.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.piece img { width: 100%; max-height: 360px; object-fit: cover; border-radius: 10px; background: var(--creme); }
.piece.sold img { opacity: 0.55; }
.bilan .big { color: var(--ok); }
.facts { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; font-size: 0.95rem; }
.facts dt { color: var(--doux); }
.facts dd { text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; max-width: 60vw; }
details { border-top: 1px solid var(--trait); padding-top: 8px; }
summary { cursor: pointer; font-weight: 650; min-height: 44px; display: flex; align-items: center; }
details > * + * { margin-top: 8px; }
.copy { display: grid; gap: 4px; }
.copy-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.form, .auth { display: grid; gap: 14px; }
label { display: grid; gap: 5px; font-size: 0.93rem; font-weight: 600; }
label.check { grid-template-columns: auto 1fr; align-items: start; gap: 10px; font-weight: 500; }
label.check small { grid-column: 2; }
input, select, textarea {
  font: inherit; font-size: 17px; color: var(--encre); background: var(--carte);
  border: 1.5px solid var(--trait); border-radius: 10px; padding: 11px 12px; width: 100%; min-height: 48px;
}
input[type="checkbox"] { width: 24px; height: 24px; min-height: 0; accent-color: var(--terre); margin: 2px 0 0; }
label small { font-weight: 400; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; }

.sheet { position: fixed; inset: 0; background: rgb(0 0 0 / 0.45); display: grid; align-items: end; z-index: 20; }
.sheet-in { background: var(--fond); border-radius: 20px 20px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); max-height: 92dvh; overflow-y: auto; width: 100%; max-width: 620px; margin: 0 auto; display: grid; gap: 14px; }
.sheet header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.x { appearance: none; border: 0; background: var(--creme); color: var(--encre); width: 44px; height: 44px; border-radius: 50%; font-size: 1.5rem; line-height: 1; cursor: pointer; flex: none; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--carte); border-top: 1px solid var(--trait); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding-bottom: env(safe-area-inset-bottom); }
.tabs a { position: relative; min-height: 58px; display: grid; place-items: center; text-decoration: none; color: var(--doux); font-size: 0.86rem; font-weight: 600; border-top: 3px solid transparent; }
.tabs a.on { color: var(--terre-fonce); border-top-color: var(--terre); }
.dot { position: absolute; top: 10px; right: calc(50% - 24px); width: 9px; height: 9px; border-radius: 50%; background: var(--alerte); }

.sync { position: sticky; top: 0; z-index: 5; text-align: center; font-size: 0.85rem; font-weight: 600; padding: 6px 12px; background: var(--creme); color: var(--encre); }
.toast { position: fixed; left: 12px; right: 12px; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 30; max-width: 596px; margin: 0 auto; background: var(--encre); color: var(--fond); border-radius: 12px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 0.95rem; }
.toast button { appearance: none; border: 0; background: none; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; min-height: 44px; padding: 0 6px; cursor: pointer; }

/* Conversation */
.stack { display: grid; gap: 14px; }
.thread { display: grid; gap: 8px; }
.msg { justify-self: start; max-width: 86%; background: var(--carte); border: 1px solid var(--trait); border-radius: 16px 16px 16px 4px; padding: 10px 12px; display: grid; gap: 4px; overflow-wrap: anywhere; }
.msg.mine { justify-self: end; background: var(--creme); border-color: transparent; border-radius: 16px 16px 4px 16px; }
.msg > small:last-child { font-size: 0.75rem; }
.composer { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }

/* Pages publiques et page de Flo */
.pub { padding-bottom: 32px; }
.pub-in { display: grid; gap: 14px; }
.lead { color: var(--doux); }
.list { display: grid; gap: 12px; }
.pub-foot { text-align: center; color: var(--doux); font-size: 0.85rem; }
.notice { background: var(--creme); border-radius: 12px; padding: 12px 14px; }
.inline { display: inline-block; margin-right: 6px; }
.copy-src { font-size: 0.85rem; }
