:root {
  --bg: #0f1720; --panel: #17212c; --panel2: #1f2b38; --line: #2a3846;
  --text: #eef2f5; --muted: #93a1b0; --accent: #f5b942;
  --like: #3ccf8e; --nope: #ff6b6b; --info: #5aa9ff;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--nope); min-height: 1.4em; }
button { font: inherit; color: inherit; cursor: pointer; }
.btn { border: 0; border-radius: 12px; padding: 12px 16px; background: var(--panel2); font-weight: 600; }
.btn.primary { background: var(--accent); color: #1b1300; }
.btn.small { padding: 8px 12px; font-size: 14px; }

#login { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; }
#login-form { width: 100%; max-width: 340px; display: grid; gap: 12px; text-align: center; }
.logo { font-size: 34px; font-weight: 800; letter-spacing: -.5px; color: var(--accent); }
input, select { width: 100%; font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; }

#app { display: flex; flex-direction: column; height: 100%; }
#topbar { padding: calc(var(--safe-t) + 10px) 16px 8px; }
#topbar h1 { margin: 0; font-size: 26px; letter-spacing: -.3px; }
#view { flex: 1; overflow-y: auto; padding: 4px 16px 16px; -webkit-overflow-scrolling: touch; }
#tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); background: var(--panel);
  padding-bottom: var(--safe-b); }
#tabs button { background: none; border: 0; padding: 8px 0 10px; font-size: 11px; color: var(--muted); display: grid; justify-items: center; gap: 2px; position: relative; }
#tabs button span { font-size: 20px; }
#tabs button.on { color: var(--accent); }
#badge { position: absolute; top: 4px; left: 55%; background: var(--nope); color: #fff; font-size: 10px; border-radius: 9px; padding: 1px 5px; }

/* Découvrir */
.pile { position: relative; height: calc(100% - 84px); min-height: 420px; }
.carte { position: absolute; inset: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  overflow-y: auto; padding: 18px; touch-action: pan-y; transition: transform .25s ease, opacity .25s ease; will-change: transform; }
.carte.dessous { transform: scale(.96) translateY(10px); opacity: .6; pointer-events: none; }
.carte .tampon { position: sticky; top: 0; float: right; font-weight: 800; font-size: 20px; padding: 2px 10px; border: 3px solid; border-radius: 8px; opacity: 0; }
.carte .tampon.like { color: var(--like); } .carte .tampon.nope { color: var(--nope); }
.entreprise { color: var(--muted); font-size: 14px; text-transform: uppercase; letter-spacing: .6px; }
.carte h2 { margin: 4px 0 8px; font-size: 22px; line-height: 1.2; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pill { font-size: 13px; background: var(--panel2); border-radius: 999px; padding: 3px 10px; }
.score { display: flex; align-items: center; gap: 10px; background: var(--panel2); border-radius: 14px; padding: 10px 12px; margin-bottom: 14px; }
.score b { font-size: 26px; color: var(--accent); }
.score ul { margin: 0; padding-left: 18px; font-size: 14px; color: var(--muted); }
.carte h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 16px 0 6px; }
.carte p { margin: 0; }
.comps { display: flex; flex-wrap: wrap; gap: 6px; }
.comp { font-size: 13px; border-radius: 8px; padding: 4px 8px; border: 1px solid var(--line); }
.comp.ok { border-color: var(--like); color: var(--like); }
.comp.manque { border-color: var(--nope); color: var(--nope); }
.actions { display: flex; justify-content: center; gap: 28px; padding: 14px 0 4px; }
.rond { width: 62px; height: 62px; border-radius: 50%; border: 2px solid; background: var(--panel); font-size: 26px; display: grid; place-items: center; }
.rond.nope { color: var(--nope); border-color: var(--nope); }
.rond.like { color: var(--like); border-color: var(--like); }
.rond.lien { width: 48px; height: 48px; font-size: 18px; color: var(--info); border-color: var(--info); align-self: center; }
.vide { text-align: center; padding: 60px 12px; }
.vide .gros { font-size: 44px; }

/* Listes */
.groupe { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.ligne { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; }
.ligne .haut { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.ligne .t { font-weight: 600; }
.ligne .s { font-size: 14px; color: var(--muted); }
.etat { font-size: 12px; border-radius: 999px; padding: 2px 8px; white-space: nowrap; background: var(--panel2); }
.etat.entretien, .etat.offre { background: var(--like); color: #062014; }
.etat.refus, .etat.refus_apres_entretien { background: #3a2226; color: var(--nope); }
.etat.prete { background: var(--accent); color: #1b1300; }
.ligne .boutons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.msg.nonlu { border-color: var(--accent); }
.msg .corps { margin-top: 6px; font-size: 15px; white-space: pre-wrap; }

/* Tableau de bord */
.entonnoir { display: grid; gap: 6px; }
.etape { display: grid; grid-template-columns: 110px 1fr 40px; align-items: center; gap: 8px; font-size: 14px; }
.barre { height: 22px; background: var(--panel2); border-radius: 6px; overflow: hidden; }
.barre i { display: block; height: 100%; background: var(--accent); border-radius: 6px; min-width: 2px; }
.etape .n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.tuiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
.tuile { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.tuile b { display: block; font-size: 26px; }
.tuile span { font-size: 13px; color: var(--muted); }
.diag { border-left: 4px solid var(--info); background: var(--panel); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; font-size: 15px; }
.diag.alerte { border-color: var(--nope); } .diag.ok { border-color: var(--like); }
table.fam { width: 100%; border-collapse: collapse; font-size: 14px; }
table.fam td, table.fam th { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: right; }
table.fam td:first-child, table.fam th:first-child { text-align: left; }

#toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--safe-b) + 80px); background: var(--panel2); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; text-align: center; z-index: 10; }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 16px; width: calc(100% - 32px); max-width: 420px; }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog .boutons { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
