/* Faktena — interface d'administration */

:root {
  --p: #4B3BFF;
  --p-d: #2E20C9;
  --a: #00D3A7;
  --ink: #0E1220;
  --muted: #6B7280;
  --muted-2: #9AA1AE;
  --line: #E6E8F0;
  --line-2: #F0F1F5;
  --bg: #F5F6FA;
  --card: #FFFFFF;
  --warn: #FF8A3D;
  --danger: #F4436C;
  --r: 12px;
  --r-lg: 16px;
  --sh: 0 1px 2px rgba(14, 18, 32, .04), 0 8px 24px -16px rgba(14, 18, 32, .18);
  --sh-lg: 0 24px 64px -24px rgba(14, 18, 32, .3);
  --sidebar: 236px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--p); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.02em; line-height: 1.25; }
h1 { font-size: 25px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 12px; }
:focus-visible { outline: 2px solid var(--p); outline-offset: 2px; border-radius: 6px; }

/* ─────────────────────────────── Structure ──────────────────────────────── */

#app { min-height: 100%; }

.shell { display: flex; min-height: 100vh; }

.side {
  width: var(--sidebar);
  flex: none;
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand b { font-size: 17px; font-weight: 800; letter-spacing: -.03em; }

.nav-lbl {
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted-2); padding: 16px 10px 6px;
}

.nav {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: 10px;
  color: #414A5C; font-weight: 500; font-size: 14.5px;
  cursor: pointer; transition: background .12s, color .12s;
}
.nav:hover { background: #F4F5FA; text-decoration: none; }
.nav.on { background: color-mix(in srgb, var(--p) 9%, #fff); color: var(--p); font-weight: 650; }
.nav svg { width: 18px; height: 18px; flex: none; stroke-width: 1.8; }
.nav .count {
  margin-left: auto; font-size: 11.5px; font-weight: 700;
  background: var(--line-2); color: var(--muted); padding: 1px 7px; border-radius: 999px;
}
.nav.on .count { background: color-mix(in srgb, var(--p) 15%, #fff); color: var(--p); }

.side-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line-2); }
.uchip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.uchip:hover { background: #F4F5FA; }
.ava {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--p), var(--p-d));
  color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.uchip .n { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uchip .e { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.top {
  height: 62px; flex: none; display: flex; align-items: center; gap: 12px;
  padding: 0 24px; background: rgba(255, 255, 255, .82); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30;
}

/*
 * Application installée sur l'écran d'accueil : la page occupe tout l'écran,
 * y compris sous l'heure, le wifi et la barre de gestes. Sans ces marges, la
 * barre du haut passe derrière l'horloge. `env()` vaut zéro dans un navigateur
 * classique : la mise en page de bureau n'est pas touchée.
 */
.top {
  height: calc(62px + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
}
.content {
  padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
}
.side { padding-top: env(safe-area-inset-top, 0px); }
.top .burger { display: none; }
.search { flex: 1; max-width: 380px; position: relative; }
.search input[type=text] {
  width: 100%; height: 38px; padding: 0 12px 0 36px; border: 1px solid var(--line);
  border-radius: 10px; font: inherit; font-size: 14px; background: #FAFBFD;
}
.search svg { position: absolute; left: 11px; top: 10px; width: 17px; height: 17px; color: var(--muted-2); }

.content { padding: 26px 24px 60px; flex: 1; }
.content > .head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.head > .back { order: -1; flex: 1 0 100%; justify-content: flex-start; margin: 0 0 -4px -11px; }
.content > .head .sub { color: var(--muted); font-size: 14px; margin-top: 3px; }
.spacer { flex: 1; }

@media (max-width: 760px) {
  .top .search { display: none; }
}

@media (max-width: 900px) {
  .side {
    position: fixed; z-index: 60; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: var(--sh-lg); width: 250px;
  }
  .side.open { transform: none; }
  .top .burger { display: inline-grid; }
  .content { padding: 20px 16px 90px; }
  .top { padding: 0 14px; }
  .scrim { position: fixed; inset: 0; background: rgba(14,18,32,.4); z-index: 50; }
}

/* ─────────────────────────────── Composants ─────────────────────────────── */

.btn {
  appearance: none; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 14px;
  padding: 9px 16px; border-radius: 10px; cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; gap: 7px; transition: .13s; white-space: nowrap;
  background: var(--line-2); color: var(--ink); min-height: 44px;
}
.btn:hover { background: #E7E9F1; text-decoration: none; }
.btn svg { width: 16px; height: 16px; stroke-width: 2; }
.btn.p { background: var(--p); color: #fff; }
.btn.p:hover { background: var(--p-d); }
.btn.a { background: var(--a); color: #04201A; }
.btn.a:hover { filter: brightness(1.06); }
.btn.o { background: #fff; border-color: var(--line); }
.btn.o:hover { background: #FAFBFD; border-color: #D5D9E4; }
.btn.gh { background: transparent; color: var(--muted); }
.btn.gh:hover { background: var(--line-2); color: var(--ink); }
.btn.dg { background: transparent; color: var(--danger); }
.btn.dg:hover { background: #FEECF0; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; min-height: 36px; }
.btn.lg { padding: 12px 22px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.wide { width: 100%; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh); }
.card .cpad { padding: 20px 22px; }
.card .chead {
  padding: 16px 22px; border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card .chead .biblio {
  width: auto; min-width: 210px; max-width: 100%;
  font-size: 13px; min-height: 36px; padding: 6px 30px 6px 11px;
}
.card .chead h2 { font-size: 15.5px; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 800px) { .g2, .g3 { grid-template-columns: 1fr; } }
/* Les indicateurs restent à deux colonnes : empilés, ils occupaient tout l'écran. */
@media (max-width: 800px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
@media (max-width: 420px) {
  .kpi { padding: 13px 14px; }
  .kpi .v { font-size: 21px; margin-top: 4px; }
  .kpi .l { font-size: 11.5px; gap: 6px; }
  .kpi .d { font-size: 11.5px; }
}

.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 17px 19px; box-shadow: var(--sh); }
.kpi .l { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.kpi .v { font-size: 26px; font-weight: 800; letter-spacing: -.03em; margin-top: 7px; }
.kpi .d { font-size: 12.5px; color: var(--muted-2); margin-top: 3px; }
.kpi .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* Champs */
label.f { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #364152; }
label.f .opt { font-weight: 400; color: var(--muted-2); }
.field { margin-bottom: 15px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number],
input[type=tel], input[type=url], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: 14.5px; background: #fff; color: var(--ink); transition: .12s;
  min-height: 44px;
}
textarea { min-height: 92px; }
input:hover, select:hover, textarea:hover { border-color: #D5D9E4; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--p); box-shadow: 0 0 0 3px color-mix(in srgb, var(--p) 14%, #fff); }
input[disabled], textarea[disabled] { background: #F7F8FB; color: var(--muted); }
textarea { resize: vertical; min-height: 82px; line-height: 1.5; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 32px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.row { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.row > .field { margin-bottom: 0; }
.row > * { flex: 1; min-width: 140px; }
.row.tight > * { min-width: 0; }

.switch { display: flex; align-items: flex-start; gap: 11px; cursor: pointer; padding: 9px 0; }
.switch input { appearance: none; width: 40px; height: 23px; border-radius: 999px; background: #D8DCE6; position: relative; flex: none; cursor: pointer; transition: .16s; margin: 1px 0 0; }
.switch input::after { content: ''; position: absolute; top: 2.5px; left: 2.5px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .16s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked { background: var(--p); }
.switch input:checked::after { transform: translateX(17px); }
.switch .tx { font-size: 14px; }
.switch .tx small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 1px; }

/* Tableaux */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: #FBFCFE;
}
.tbl td { padding: 13px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { cursor: pointer; transition: background .1s; }
.tbl tbody tr:hover { background: #FAFBFE; }
.tbl .n { text-align: right; white-space: nowrap; }
.tbl .mono { font-variant-numeric: tabular-nums; font-weight: 600; }
.tbl .strong { font-weight: 650; }
.tbl .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; white-space: pre-line; }

/* Bloc de description d'une ligne : multiligne, grandit avec le texte. */
textarea.pousse {
  resize: none;
  overflow: hidden;
  line-height: 1.5;
  font-family: inherit;
}
.detail-ligne {
  margin-top: 5px;
  font-size: 13px;
  color: var(--muted);
  min-height: 46px;
}
.pv .det, .preview .det { white-space: pre-line; }
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Badges de statut */
.bg {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.bg::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.bg.gris { background: #EEF0F5; color: #6B7280; }
.bg.bleu { background: color-mix(in srgb, var(--p) 11%, #fff); color: var(--p); }
.bg.vert { background: color-mix(in srgb, var(--a) 15%, #fff); color: #05876C; }
.bg.orange { background: #FFF3E8; color: #B45A12; }
.bg.rouge { background: #FEECF0; color: #C0284B; }
.bg.violet { background: #F1ECFE; color: #6D28D9; }

/* Garde-fou : une icône SVG sans conteneur ne doit jamais s'étirer. */
.card svg:not([width]), .cpad > svg, .banner-info > svg { width: 18px; height: 18px; flex: none; }
.banner-info > svg { margin-top: 1px; color: var(--p); }

/* États vides */
.empty { text-align: center; padding: 54px 24px; }
.empty .ic { width: 56px; height: 56px; border-radius: 16px; background: var(--line-2); display: grid; place-items: center; margin: 0 auto 14px; color: var(--muted-2); }
.empty .ic svg { width: 26px; height: 26px; stroke-width: 1.6; }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--muted); font-size: 14px; max-width: 380px; margin: 0 auto 18px; }

/* Fenêtres modales */
dialog {
  border: 0; padding: 0; border-radius: 18px; max-width: 560px; width: calc(100% - 32px);
  box-shadow: var(--sh-lg); color: var(--ink); background: #fff;
}
dialog::backdrop { background: rgba(14, 18, 32, .48); backdrop-filter: blur(2px); }
dialog.wide { max-width: 780px; }
.dl { padding: 24px 26px; max-height: 86vh; overflow-y: auto; }
.dl h2 { margin-bottom: 4px; }
.dl .s { color: var(--muted); font-size: 13.5px; margin-bottom: 18px; }
.dl .acts { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }

/* Onglets */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tabs > * { white-space: nowrap; flex: none; }
.tab {
  padding: 10px 14px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.on { color: var(--p); border-bottom-color: var(--p); }

/* Filtres */
.chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  padding: 6px 13px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: #fff; border: 1px solid var(--line); color: var(--muted); cursor: pointer; transition: .12s;
}
.chip:hover { border-color: #D5D9E4; color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Notifications éphémères */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 9px; align-items: flex-end; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 17px; border-radius: 12px; font-size: 14px;
  font-weight: 500; box-shadow: var(--sh-lg); max-width: 380px; animation: pop .22s ease;
  display: flex; align-items: center; gap: 9px;
}
.toast.ok { background: #05876C; }
.toast.err { background: #C0284B; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.97); } }
@media (max-width: 600px) { #toasts { left: 14px; right: 14px; align-items: stretch; } .toast { max-width: none; } }

/* Chargement */
.load { display: grid; place-items: center; padding: 70px 0; }
.spin { width: 26px; height: 26px; border: 2.5px solid var(--line); border-top-color: var(--p); border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.skel { background: linear-gradient(90deg, #EEF0F5 25%, #F6F7FA 50%, #EEF0F5 75%); background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

/* Page d'authentification */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth .pane { display: grid; place-items: center; padding: 40px 24px; }
.auth .box { width: 100%; max-width: 380px; }
.auth .visual {
  background: linear-gradient(150deg, var(--p) 0%, var(--p-d) 60%, #1B1240 100%);
  color: #fff; position: relative; overflow: hidden;
}
.auth .visual .in { max-width: 400px; padding: 40px; position: relative; z-index: 2; }
.auth .visual h2 { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.18; }
.auth .visual p { opacity: .82; margin-top: 14px; font-size: 15.5px; }
.auth .visual ul { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 12px; }
.auth .visual li { display: flex; gap: 11px; align-items: flex-start; font-size: 14.5px; opacity: .95; }
.auth .visual li svg { width: 19px; height: 19px; flex: none; margin-top: 1px; color: var(--a); }
.auth .visual::after {
  content: ''; position: absolute; width: 460px; height: 460px; border-radius: 50%;
  background: rgba(255, 255, 255, .07); right: -160px; bottom: -180px;
}
@media (max-width: 880px) { .auth { grid-template-columns: 1fr; } .auth .visual { display: none; } }

/* Éditeur de document */
.lines { width: 100%; border-collapse: collapse; }
.lines th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; text-align: left; padding: 0 8px 8px; }
.lines th.n { text-align: right; }
.lines td { padding: 4px 4px; vertical-align: top; }
.lines input, .lines textarea, .lines select { padding: 8px 10px; font-size: 14px; border-radius: 8px; }
.lines input.n { text-align: right; }
.lines .grab { color: var(--muted-2); cursor: grab; padding: 12px 2px 0; user-select: none; }
.lines .del { color: var(--muted-2); cursor: pointer; padding: 10px 4px 0; background: none; border: 0; }
.lines .del:hover { color: var(--danger); }
.lines tr.drag { opacity: .4; }
.lines tr.over td { box-shadow: inset 0 2px 0 var(--p); }
.lines .tot { padding-top: 17px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 900px) {
  .lines, .lines tbody, .lines td { display: block; width: 100%; }
  .lines thead { display: none; }
  .lines tr {
    display: flex; flex-wrap: wrap; column-gap: 10px; align-items: flex-start;
    border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px 10px;
    margin-bottom: 12px; position: relative; background: #fff;
  }
  .lines td { flex: 1 1 100%; width: auto; min-width: 0; padding: 0 0 10px; }
  .lines td:last-child { padding-bottom: 0; }
  .lines td[data-l]:not([data-l=""])::before {
    content: attr(data-l);
    display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--muted-2); margin-bottom: 4px;
  }
  .lines td.mini { flex: 0 1 calc(50% - 5px); }
  .lines .grab { display: none; }
  .lines .del { position: absolute; right: 8px; top: 8px; padding: 4px; }
  .lines .tot {
    text-align: left; padding: 10px 0 0; border-top: 1px solid var(--line-2);
    display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  }
  .lines .tot::before { color: var(--muted); }
}

/* Panneau de totaux */
.sums { margin-left: auto; max-width: 320px; }
.sums .l { display: flex; justify-content: space-between; gap: 14px; padding: 6px 0; font-size: 14px; color: var(--muted); }
.sums .l b { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.sums .big { display: flex; justify-content: space-between; align-items: center; gap: 14px; background: var(--ink); color: #fff; border-radius: 12px; padding: 12px 16px; margin-top: 9px; }
.sums .big span { font-weight: 600; font-size: 14px; }
.sums .big b { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Sélecteur de couleur */
.colorf { display: flex; align-items: center; gap: 10px; }
.colorf input[type=color] { width: 44px; height: 40px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.colorf input[type=text] { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; text-transform: uppercase; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.sw { width: 26px; height: 26px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; transition: .12s; }
.sw:hover { transform: scale(1.1); }
.sw.on { border-color: var(--ink); }

/* Aperçu du document */
.preview { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; font-size: 11px; }
.preview .pv-bar { height: 5px; }
.preview .pv-in { padding: 16px 18px; }
.preview .pv-head { display: flex; justify-content: space-between; gap: 12px; }
.preview .pv-co { font-weight: 800; font-size: 13px; }
.preview .pv-meta { color: var(--muted); font-size: 10px; line-height: 1.5; margin-top: 3px; }
.preview .pv-kind { font-size: 9px; letter-spacing: .1em; text-transform: uppercase; font-weight: 800; text-align: right; }
.preview .pv-num { font-size: 15px; font-weight: 800; text-align: right; letter-spacing: -.02em; }
.preview table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 10px; }
.preview th { text-align: left; font-size: 8px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 5px 4px; border-bottom: 1px solid var(--line); }
.preview td { padding: 6px 4px; border-bottom: 1px solid var(--line-2); }
.preview .pv-ttc { display: flex; justify-content: space-between; color: #fff; border-radius: 8px; padding: 8px 11px; margin-top: 12px; font-weight: 700; font-size: 12px; }
.preview .pv-logo { max-height: 30px; max-width: 110px; }

/* Chronologie */
.tl { list-style: none; padding: 0; margin: 0; }
.tl li { display: flex; gap: 12px; padding: 9px 0; font-size: 13.5px; }
.tl .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: none; margin-top: 6px; position: relative; }
.tl li:not(:last-child) .dot::after { content: ''; position: absolute; left: 3.5px; top: 12px; width: 2px; height: calc(100% + 8px); background: var(--line-2); }
.tl .dot.p { background: var(--p); }
.tl .dot.a { background: var(--a); }
.tl .dot.r { background: var(--danger); }
.tl .tt { font-weight: 550; }
.tl .dd { color: var(--muted-2); font-size: 12px; margin-top: 1px; }

/* Recherche d'entreprise */
.ac { position: relative; }
.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 5px); background: #fff;
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh-lg); z-index: 40;
  max-height: 290px; overflow-y: auto; padding: 5px;
}
.ac-item { padding: 9px 11px; border-radius: 8px; cursor: pointer; }
.ac-item:hover, .ac-item.on { background: #F4F5FA; }
.ac-item .t { font-weight: 600; font-size: 14px; }
.ac-item .d { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.ac-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* Divers */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; background: var(--line-2); color: var(--muted); padding: 3px 9px; border-radius: 7px; }
.sep { height: 1px; background: var(--line-2); margin: 20px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt0 { margin-top: 0; }
.copy { cursor: pointer; }
.bar-chart { display: flex; align-items: flex-end; gap: 5px; height: 96px; }
.bar-chart .b { flex: 1; background: color-mix(in srgb, var(--p) 22%, #fff); border-radius: 5px 5px 2px 2px; min-height: 3px; position: relative; transition: .2s; }
.bar-chart .b:hover { background: var(--p); }
.bar-chart .b span { position: absolute; bottom: -19px; left: 0; right: 0; text-align: center; font-size: 9.5px; color: var(--muted-2); }

.banner-info {
  display: flex; gap: 12px; align-items: flex-start; background: color-mix(in srgb, var(--p) 6%, #fff);
  border: 1px solid color-mix(in srgb, var(--p) 22%, #fff); border-radius: 12px;
  padding: 13px 16px; font-size: 13.5px; margin-bottom: 18px;
}
.banner-info b { display: block; margin-bottom: 2px; }
.banner-warn { background: #FFF7EF; border-color: #FBD9BC; }

.notif-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 340px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh-lg); z-index: 50; max-height: 420px; overflow-y: auto; }
.notif-panel .it { padding: 12px 15px; border-bottom: 1px solid var(--line-2); font-size: 13.5px; cursor: pointer; }
.notif-panel .it:hover { background: #FAFBFE; }
.notif-panel .it.unread { background: color-mix(in srgb, var(--p) 4%, #fff); }
.notif-panel .it .t { font-weight: 600; }
.notif-panel .it .d { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: transparent; border: 0; cursor: pointer; color: var(--muted); position: relative; }
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
.icon-btn svg { width: 19px; height: 19px; stroke-width: 1.8; }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid #fff; }

@media print { .side, .top, .actions { display: none; } }

/* ── Retours d'erreur lisibles au doigt ─────────────────────────────────────
   Un bandeau flottant se rate sur téléphone : les erreurs de connexion
   s'affichent aussi sous le champ concerné, là où l'œil les cherche. */
.banner-err {
  background: #FEF2F3; border: 1px solid #F6C9CE; color: #A32232;
  border-radius: 12px; padding: 12px 14px; font-size: 13.5px;
  line-height: 1.5; margin: 4px 0 14px;
}

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Reprise mobile de l'espace de travail ──────────────────────────────────
   Sur téléphone, les tableaux se déplient en fiches et chaque cellule porte le
   nom de sa colonne (posé par etiqueterTableaux), sinon on lit des cases
   anonymes. Les grilles à deux colonnes passent sur une seule. */

.libelle-cellule {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted-2); margin-bottom: 3px;
}

@media (max-width: 760px) {
  .head { flex-wrap: wrap; gap: 10px; }
  .head .spacer { flex-basis: 100%; height: 0; }
  .head .btn:not(.back) { flex: 1 1 auto; justify-content: center; }

  .grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .sums { max-width: none; margin-left: 0; }

  /* Les listes deviennent des fiches : plus rien ne sort de l'écran. */
  .tbl-wrap { overflow-x: visible; }
  .tbl { min-width: 0; display: block; font-size: 14.5px; }
  .tbl thead { display: none; }
  .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tbody tr {
    border: 1px solid var(--line); border-radius: 14px; padding: 13px 15px;
    margin-bottom: 10px; background: #fff;
  }
  .tbl tbody tr:last-child { margin-bottom: 0; }
  .tbl td { border: 0; padding: 4px 0; text-align: left; white-space: normal; }
  .tbl td:empty { display: none; }
  .tbl td[data-l]:not([data-l=""])::before {
    content: attr(data-l);
    display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--muted-2); margin-bottom: 2px;
  }
  .tbl td.n { text-align: left; }
  .tbl td.nowrap { display: flex; gap: 4px; padding-top: 8px; }

  .banner-info { flex-wrap: wrap; }
  .banner-info input[type=text] { min-width: 0; width: 100%; font-size: 12px; }

  .cpad { padding: 15px; }
  h1 { font-size: 23px; }
}

@media (max-width: 560px) {
  .row > * { flex: 1 1 100%; min-width: 0; }
  .row.tight > * { flex: 1; }
}

@media (max-width: 420px) {
  .btn-row .btn { flex: 1 1 100%; justify-content: center; }
}


/* Une ligne de titre n'a pas de total : on ne lui colle pas d'étiquette vide. */
.lines .tot:empty { display: none; }

@media (max-width: 760px) {
  .card .chead { padding: 14px 15px; }
  .card .chead .biblio { flex: 1 1 100%; min-width: 0; }
  .card .chead .btn { flex: 1 1 auto; }
}

/* Lien d'action discret sous un champ (créer un client, par exemple). */
.lien-discret {
  appearance: none; background: none; border: 0; padding: 6px 0 0;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--p);
  cursor: pointer; text-align: left; min-height: 0;
}
.lien-discret:hover { text-decoration: underline; }

/* ───────────────── Onglet Application : installation & notifications ────── */

/* Sélecteur iPhone / Android */
.segments { display: inline-flex; background: var(--line-2); border-radius: 11px; padding: 3px; gap: 3px; margin-bottom: 16px; }
.segments .seg {
  appearance: none; border: 0; background: none; font: inherit; font-weight: 600; font-size: 13.5px;
  color: var(--muted); padding: 8px 16px; border-radius: 9px; cursor: pointer; min-height: 38px; transition: .14s;
}
.segments .seg.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(14,18,32,.12); }

/* Étapes en carrousel : on avance au pouce plutôt qu'en scrollant la page */
/* min-width:0 : sans lui, les fiches d’étapes gonflent la page au lieu de
   défiler dans leur rail, et tout l’écran part en largeur. */
.pas-piste { min-width: 0; }
.pas-scroll {
  min-width: 0;
  display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding-bottom: 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.pas-scroll::-webkit-scrollbar { display: none; }
.pas {
  flex: 0 0 min(74%, 250px); scroll-snap-align: start; background: var(--line-2);
  border-radius: 14px; padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 4px;
}
.pas-n {
  width: 26px; height: 26px; border-radius: 50%; background: var(--p); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 750; margin-bottom: 6px;
}
.pas-t { font-weight: 650; font-size: 14.5px; line-height: 1.35; }
.pas-x { font-size: 13px; color: var(--muted); line-height: 1.5; }
.pas-points { display: flex; justify-content: center; gap: 6px; margin-top: 12px; }
.pas-points span { width: 6px; height: 6px; border-radius: 999px; background: var(--line); transition: .16s; }
.pas-points span.on { width: 20px; background: var(--p); }

.ligne-appareil {
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
}
.ligne-appareil:last-child { border-bottom: 0; }

/* Mode d'emploi en quatre lignes, pour les écrans qui expliquent une manip */
.mode-emploi {
  margin-top: 14px; padding: 13px 15px; border-radius: 12px;
  background: var(--line-2); display: grid; gap: 7px;
}
.pas-court { font-size: 13.5px; line-height: 1.5; }
.pas-court b { font-weight: 700; }

/* ── Domaines d'activité ───────────────────────────────────────────────────── */
.dom-liste { display: grid; gap: 8px; }
.dom-item {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #FAFBFD;
}
.dom-nom { font-weight: 600; font-size: 14.5px; }
.dom-n { font-size: 12.5px; color: var(--muted); margin-left: auto; }
.dom-titre {
  display: flex; align-items: center; gap: 9px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); margin: 20px 0 9px;
}
.dom-titre:first-child { margin-top: 0; }
.dom-titre span {
  font-size: 11px; letter-spacing: 0; background: var(--line); color: var(--muted);
  border-radius: 999px; padding: 1px 8px;
}
.segments .seg-n {
  font-size: 11.5px; opacity: .62; margin-left: 5px;
  font-variant-numeric: tabular-nums;
}
/* La barre de filtres doit tenir sur un téléphone, même avec plusieurs domaines. */
#pr-filtres { display: flex; flex-wrap: wrap; max-width: 100%; }
