/* Relève — application web (SaaS) */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; color: var(--ink); text-decoration: none; }
.brand-light, .brand-light:hover { color: #fff; }

/* Connexion */
.login { min-height: 100vh; display: flex; flex-wrap: wrap; background: var(--bg); }
.login-aside { flex: 1 1 420px; background: var(--dark); color: #fff; padding: clamp(28px, 5vw, 64px); display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.login-pitch { display: flex; flex-direction: column; gap: 18px; max-width: 460px; }
.login-pitch h1 { font-size: clamp(32px, 3.6vw, 46px); line-height: 1.08; letter-spacing: -0.025em; }
.login-pitch p { font-size: 18px; color: var(--on-dark-muted); }
.login-tip { background: var(--dark-2); border-radius: 16px; padding: 18px; display: flex; gap: 14px; align-items: center; max-width: 460px; color: #E4E8E9; font-size: 15px; }
.login-tip svg { flex-shrink: 0; }
.login-main { flex: 1 1 460px; padding: clamp(28px, 5vw, 64px); display: flex; align-items: center; justify-content: center; }
.login-box { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 22px; }
.login-box h2 { font-size: 28px; }

/* Installation */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--bg-2); }
.auth-card { width: 100%; max-width: 480px; background: #fff; border-radius: 20px; padding: 32px; display: flex; flex-direction: column; gap: 18px; box-shadow: 0 20px 50px rgba(21,25,28,.08); }
.auth-card h1 { font-size: 28px; }
.checklist-mini { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.checklist-mini .ok { color: var(--ok-ink); } .checklist-mini .ko { color: #B91C1C; font-weight: 600; }

/* Coque de l'application */
.app { min-height: 100vh; display: flex; background: var(--bg-2); }
.sidebar { width: 248px; flex-shrink: 0; background: var(--dark); color: #fff; padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { color: #fff; padding: 0 10px 18px; }
.side-link { display: flex; align-items: center; gap: 10px; justify-content: space-between; text-decoration: none; color: var(--on-dark-muted); border-radius: 10px; padding: 11px 12px; font-size: 15px; }
.side-link:hover { background: var(--dark-2); color: #fff; }
.side-link[aria-current="page"] { background: var(--dark-2); color: #fff; font-weight: 600; }
.side-link .count { font-family: var(--mono); font-size: 12px; background: var(--accent); color: #fff; padding: 1px 8px; border-radius: 10px; }
.side-sep { height: 1px; background: var(--dark-2); margin: 10px 4px; }
.side-user { margin-top: auto; padding: 12px; border-radius: 12px; background: var(--dark-2); display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.side-user .who { display: flex; gap: 10px; align-items: center; }
.avatar { width: 36px; height: 36px; border-radius: 18px; background: var(--dark-3); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; flex-shrink: 0; }
.side-user button { font: inherit; background: none; border: none; color: var(--on-dark-muted); padding: 0; cursor: pointer; text-align: left; text-decoration: underline; font-size: 13px; }
.main { flex: 1; min-width: 0; padding: 36px clamp(16px, 4vw, 48px) 64px; display: flex; flex-direction: column; gap: 24px; }
.topbar { display: none; }

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .topbar { display: flex; align-items: center; justify-content: space-between; background: var(--dark); color: #fff; padding: 10px 16px; position: sticky; top: 0; z-index: 30; }
  .topbar .brand { color: #fff; font-size: 18px; }
  .topbar button { width: 44px; height: 44px; border-radius: 10px; border: none; background: var(--dark-2); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
  .sidebar { display: none; width: 100%; height: auto; position: static; }
  .sidebar.open { display: flex; }
  .sidebar > .brand { display: none; }
  .main { padding-top: 24px; }
}

/* En-têtes de page */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.page-head h1 { font-size: clamp(26px, 3vw, 32px); font-weight: 700; letter-spacing: -0.02em; }
.page-head p { color: var(--muted); font-size: 16px; margin-top: 6px; }
.crumb { font-size: 14px; color: var(--muted); text-decoration: none; display: inline-flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Blocs */
.box { background: #fff; border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.box h2 { font-size: 18px; font-weight: 600; }
.box-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.col-main { flex: 2 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.col-side { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); display: flex; flex-direction: column; gap: 12px; align-items: center; }

/* Statistiques */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.stat { background: #fff; border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 28px; line-height: 1.1; }
.stat span { font-size: 14px; color: var(--muted); }

/* Listes */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 4px; border-bottom: 1px solid #E3E8EA; text-decoration: none; color: var(--ink); min-height: 52px; }
.list-item:last-child { border-bottom: none; }
a.list-item:hover { background: #F7F8F8; color: var(--ink); }
.list-item .t { font-weight: 600; font-size: 15px; }
.list-item .s { font-size: 13px; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

/* Tableaux */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; border-bottom: 1px solid #D5DAD8; font-weight: 600; }
.table td { padding: 13px 12px; border-bottom: 1px solid #E3E8EA; vertical-align: top; }
.table tr:last-child td { border-bottom: none; }

/* Barre de progression */
.progress { height: 8px; border-radius: 4px; background: #E3E8EA; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.progress.danger > span { background: #8A2E0A; }

/* Fiche */
.fiche-sec { display: flex; flex-direction: column; gap: 4px; }
.fiche-sec .k { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.fiche-sec .v { font-size: 16px; line-height: 1.55; }
.safety { background: var(--warn-soft); color: var(--warn-ink); border-radius: 12px; padding: 12px 14px; display: flex; gap: 10px; font-size: 15px; line-height: 1.45; }
.tip { background: var(--warn-soft); color: #4A2600; border-radius: 12px; padding: 12px 14px; font-size: 15px; line-height: 1.45; }

/* Recherche */
.search-bar { display: flex; flex-wrap: wrap; gap: 10px; }
.search-bar input { flex: 1 1 360px; min-width: 0; font-size: 17px; min-height: 54px; border-radius: 14px; }
.search-bar .btn { min-height: 54px; }
.answer { background: #fff; border-radius: 18px; padding: 26px; display: flex; flex-direction: column; gap: 16px; }
.answer h2 { font-size: 22px; font-weight: 600; }

/* Écarts */
.ecart-vals { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.ecart-val { border: 1px solid #D5DAD8; border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.ecart-val.field { border: 2px solid var(--accent); }
.ecart-val .n { font-family: var(--mono); font-size: 26px; font-weight: 500; }

/* Checklist premiers pas */
.step { background: #fff; border-radius: 16px; padding: 18px 20px; display: flex; gap: 16px; align-items: center; }
.step.current { border: 2px solid var(--accent); }
.step-n { width: 40px; height: 40px; border-radius: 20px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: var(--mono); background: #E3E8EA; color: #2F3A40; }
.step.done .step-n { background: var(--ok-soft); color: var(--ok); }
.step.current .step-n { background: var(--accent); color: #fff; }
.step.done .t { text-decoration: line-through; color: var(--muted); }

/* Étiquettes QR à imprimer */
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.label-card { background: #fff; border: 1px solid #D5DAD8; border-radius: 14px; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; break-inside: avoid; }
.label-card .qr { width: 150px; height: 150px; }
.label-card .qr img, .label-card .qr canvas { width: 150px !important; height: 150px !important; }
.label-card .code { font-family: var(--mono); font-size: 18px; font-weight: 500; }
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .app, .main { background: #fff; padding: 0; }
  .labels { grid-template-columns: repeat(3, 1fr); }
  .label-card { border: 1px dashed #999; }
}

/* Facturation */
.tag-danger { background: #FDE2E1; color: #7F1D1D; font-weight: 600; }
.lines { display: flex; flex-direction: column; gap: 10px; }
.line-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 130px 44px; gap: 10px; align-items: end; }
.line-row .rm { width: 44px; height: 48px; border-radius: 12px; border: 1px solid var(--line-2); background: #fff; color: #B91C1C; font-size: 20px; cursor: pointer; }
@media (max-width: 640px) { .line-row { grid-template-columns: 1fr 1fr; } .line-row .field:first-child { grid-column: 1 / -1; } }
.money { font-family: var(--mono); white-space: nowrap; }
.total-box { background: var(--dark); color: #fff; border-radius: 14px; padding: 16px 18px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.total-box b { font-family: var(--mono); font-size: 22px; }

/* Divers */
.flashes { display: flex; flex-direction: column; gap: 8px; }
.inline-form { display: inline; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters select, .filters input { width: auto; min-width: 180px; min-height: 44px; }
.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line-2); background: #fff; color: var(--ink); text-decoration: none; font-size: 14px; }
.chip[aria-current="true"] { background: var(--dark); border-color: var(--dark); color: #fff; }
