/* ═══ Jetons — identité « cahier d'ingénieur » du site vitrine Kiana Conseil ═══
   Contrastes mesurés le 18/11/2026 (WCAG) : tous ≥ 4,5:1 sur papier, carte, survol et fond de tampon, en clair et en sombre. */
:root {
  --paper: #F2ECE1; --paper-2: #E8DFD0; --card: #F8F3EA;
  --ink: #1E1C19; --ink-2: #55504A;
  --accent: #9E3F1C; --on-accent: #FBF7F0;
  --ok: #2E5A3C; --wait: #7A5A00; --alert: #8E1F1F;
  --rule: rgba(30,28,25,.18); --rule-strong: #1E1C19;
  --grid-minor: rgba(158,63,28,.05); --grid-major: rgba(158,63,28,.10);
  --tint: 11%;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Atkinson Hyperlegible Next", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --gutter: clamp(16px, 3.5vw, 40px);
  --maxw: 1320px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #16140F; --paper-2: #201D17; --card: #1D1B15;
    --ink: #EEE7DA; --ink-2: #B3AA9B;
    --accent: #E3906A; --on-accent: #16140F;
    --ok: #93C9A1; --wait: #E2B860; --alert: #F2938A;
    --rule: rgba(238,231,218,.16); --rule-strong: #EEE7DA;
    --grid-minor: rgba(227,144,106,.04); --grid-major: rgba(227,144,106,.08);
    --tint: 14%;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #16140F; --paper-2: #201D17; --card: #1D1B15;
  --ink: #EEE7DA; --ink-2: #B3AA9B;
  --accent: #E3906A; --on-accent: #16140F;
  --ok: #93C9A1; --wait: #E2B860; --alert: #F2938A;
  --rule: rgba(238,231,218,.16); --rule-strong: #EEE7DA;
  --grid-minor: rgba(227,144,106,.04); --grid-major: rgba(227,144,106,.08);
  --tint: 14%;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid-minor) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px);
  background-size: 60px 60px, 60px 60px, 12px 12px, 12px 12px;
  background-position: -1px -1px;
  color: var(--ink);
  font: 400 1rem/1.55 var(--sans);
  overflow-x: hidden;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 430; line-height: 1.1; margin: 0; letter-spacing: -.012em; }
p { margin: 0; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
/* Titre focalisé par le script à chaque changement d'écran (annoncé aux lecteurs d'écran) : pas un contrôle, pas de cadre. */
h1[tabindex="-1"]:focus, h1[tabindex="-1"]:focus-visible { outline: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, .tab-num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.mono { font-family: var(--mono); font-size: .72rem; letter-spacing: .09em; text-transform: uppercase; }
.muted { color: var(--ink-2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; } /* sinon .msg / .actions (display:flex) l'emportent sur l'attribut */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.skip { position: absolute; left: 12px; top: -80px; z-index: 50; background: var(--ink); color: var(--paper); padding: 12px 16px; font-weight: 700; }
.skip:focus { top: 12px; }


/* ═══ Écrans ═══ */
.screen { display: none; }
.screen.on { display: block; animation: arrive .38s ease-out both; }
@keyframes arrive { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.stagger > * { animation: arrive .45s ease-out both; }
.stagger > *:nth-child(2) { animation-delay: .05s; } .stagger > *:nth-child(3) { animation-delay: .1s; }
.stagger > *:nth-child(4) { animation-delay: .15s; } .stagger > *:nth-child(5) { animation-delay: .2s; }
.stagger > *:nth-child(6) { animation-delay: .25s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ═══ En-tête de l'application ═══ */
.app-head { border-bottom: 1px solid var(--rule); background: color-mix(in srgb, var(--paper) 88%, transparent); }
.app-head .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding-block: 10px; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; min-height: 44px; }
.brand svg { width: 32px; height: 32px; flex: none; }
.brand-name { font-family: var(--serif); font-size: 1.2rem; font-weight: 500; line-height: 1; }
.brand-name small { display: block; margin-top: 5px; font-family: var(--mono); font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); font-weight: 400; }
.app-nav { display: flex; gap: 2px; }
.app-nav a, .app-nav button {
  min-height: 44px; display: inline-flex; align-items: center; padding: 0 12px; text-decoration: none;
  border: 0; background: none; cursor: pointer; font-weight: 600; font-size: .95rem; border-bottom: 2px solid transparent;
}
.app-nav [aria-current="page"] { border-bottom-color: var(--accent); }
.app-head .right { margin-left: auto; display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; }
.sync-pill { display: inline-flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--ink-2); }
.sync-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.sync-pill.stale i { background: var(--wait); box-shadow: 0 0 0 3px color-mix(in srgb, var(--wait) 22%, transparent); }
.who { display: inline-flex; align-items: center; gap: 10px; font-size: .9rem; }
.role { font-family: var(--mono); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; border: 1px solid var(--rule-strong); padding: 2px 6px; }
.role.sopra { border-color: var(--wait); color: var(--wait); }
.who a, .msg a, .toast a, .cartouche dd a { display: inline-flex; align-items: center; min-height: 44px; } /* cible ≥ 44 px */

/* ═══ Boutons & champs ═══ */
.btn {
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 18px; border: 1.5px solid var(--rule-strong); background: transparent; cursor: pointer;
  font-weight: 700; font-size: .95rem; text-decoration: none; border-radius: 1px;
  transition: background-color .15s, color .15s, transform .15s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); transform: translateY(-1px); }
.btn-danger { border-color: var(--alert); color: var(--alert); }
.btn-danger:hover { background: var(--alert); color: var(--paper); }
.btn-danger.solid { background: var(--alert); color: var(--paper); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn[disabled]:hover { background: transparent; color: inherit; }
.btn-primary[disabled]:hover, .btn-danger.solid[disabled]:hover { background: var(--accent); color: var(--on-accent); }
.btn-danger.solid[disabled]:hover { background: var(--alert); color: var(--paper); }
.link-btn { background: none; border: 0; padding: 0 2px; min-height: 44px; cursor: pointer; text-decoration: underline; text-underline-offset: .2em; font-weight: 600; }
.link-btn[disabled] { color: var(--ink-2); text-decoration: none; cursor: default; font-weight: 400; }
.field { display: grid; gap: 6px; align-content: start; } /* une aide longue à côté n'étire pas le champ voisin */
.field label, .field .lbl { font-weight: 700; font-size: .92rem; }
.field .hint { font-size: .84rem; color: var(--ink-2); }
.input, select.input, textarea.input {
  min-height: 48px; width: 100%; padding: 10px 12px; background: var(--card);
  border: 1.5px solid var(--ink-2); border-radius: 1px;
}
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.input[readonly] { background: transparent; border-style: dashed; color: var(--ink-2); }
.input.err { border-color: var(--alert); }
.pw { position: relative; }
.pw .input { padding-right: 96px; }
.pw button { position: absolute; right: 2px; top: 2px; bottom: 2px; min-width: 88px; border: 0; background: none; cursor: pointer; font-weight: 600; text-decoration: underline; text-underline-offset: .2em; }
.check { display: flex; gap: 12px; align-items: flex-start; min-height: 44px; cursor: pointer; padding-block: 8px; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.msg { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-left: 4px solid currentColor; font-size: .93rem; }
.msg b { font-weight: 700; }
.msg .code { font-family: var(--mono); font-size: .72rem; opacity: .85; white-space: nowrap; }
.msg.alert { color: var(--alert); background: color-mix(in srgb, var(--alert) var(--tint), transparent); }
.msg.wait { color: var(--wait); background: color-mix(in srgb, var(--wait) var(--tint), transparent); }
.msg.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) var(--tint), transparent); }
.msg.info { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.msg > span:last-child { color: var(--ink); }
.msg .ico { font-family: var(--mono); font-weight: 500; flex: none; }

/* ═══ Tampons de statut (texte + icône, jamais la couleur seule) ═══ */
.stamp {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-family: var(--mono); font-size: .68rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase;
  border: 1.5px solid currentColor; padding: 3px 8px 3px 7px; border-radius: 2px;
  background: color-mix(in srgb, currentColor var(--tint), transparent);
}
.stamp::before { font-size: .85rem; line-height: 1; }
.st-po-ah    { color: var(--ink-2); } .st-po-ah::before    { content: "◌"; }
.st-po-int   { color: var(--wait); }  .st-po-int::before   { content: "◔"; }
.st-a-fact   { color: var(--accent); } .st-a-fact::before  { content: "→"; }
.st-facture  { color: var(--wait); }  .st-facture::before  { content: "◑"; }
.st-solde    { color: var(--ok); }    .st-solde::before    { content: "✓"; }
.st-refusee  { color: var(--alert); } .st-refusee::before  { content: "✕"; }
.stamp.big { font-size: .8rem; padding: 6px 12px; transform: rotate(-1.2deg); border-width: 2px; box-shadow: inset 0 0 0 2px var(--paper), inset 0 0 0 3.5px currentColor; }

/* Origine d'un chiffre */
.tag { font-family: var(--mono); font-size: .6rem; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--rule-strong); padding: 1px 5px; white-space: nowrap; color: var(--ink-2); border-color: currentColor; }
.tag.estime { color: var(--wait); border-style: dashed; }
.tag.pennylane, .tag.qonto { color: var(--ok); }
.tag.calcule { border-style: dotted; }

/* Mini-flux tripartite dans le tableau : PO AH · PO interm. · facture · virement */
.flux { display: inline-flex; align-items: center; }
.flux i { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--ink-2); display: block; position: relative; }
.flux i + i { margin-left: 12px; }
.flux i + i::before { content: ""; position: absolute; right: 100%; top: 50%; width: 13.5px; height: 1.5px; background: var(--rule-strong); opacity: .35; transform: translateY(-50%); }
.flux i.ok { background: var(--ink); border-color: var(--ink); }
.flux i.att { border-color: var(--wait); border-style: dashed; background: color-mix(in srgb, var(--wait) 18%, transparent); }
.flux i.ko { border-color: var(--alert); background: var(--alert); }
.flux i.ko::after { content: "×"; position: absolute; inset: -4px 0 0; color: var(--paper); font-size: 12px; line-height: 16px; text-align: center; font-weight: 700; }

/* ═══ Connexion ═══ */
.login { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 460px); gap: 48px; align-items: start; padding-block: clamp(28px, 6vw, 72px); }
.login-intro h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); font-weight: 380; }
.login-intro h1 em { font-style: normal; color: var(--accent); }
.login-intro .lead { margin-top: 16px; font-size: 1.08rem; color: var(--ink-2); max-width: 46ch; }
.cartouche { margin-top: 32px; border: 2px solid var(--rule-strong); background: var(--paper); max-width: 520px; }
.cartouche-head { background: var(--ink); color: var(--paper); padding: 8px 14px; display: flex; justify-content: space-between; gap: 10px; }
.cartouche dl { display: grid; grid-template-columns: 1fr 1fr; margin: 0; }
.cartouche dl > div { padding: 10px 14px 12px; border-bottom: 1px solid var(--rule); min-width: 0; }
.cartouche dl > div:nth-child(odd) { border-right: 1px solid var(--rule); }
.cartouche dl > div:nth-last-child(-n+2) { border-bottom: 0; }
.cartouche dt { font-family: var(--mono); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.cartouche dd { margin: 4px 0 0; font-size: .95rem; }
.card { background: var(--card); border: 1.5px solid var(--rule-strong); box-shadow: 6px 6px 0 var(--rule); }
.login-card { padding: clamp(20px, 4vw, 32px); display: grid; gap: 18px; }
.step { display: none; gap: 18px; }
.step.on { display: grid; animation: arrive .3s ease-out both; }
.step-head { display: grid; gap: 6px; }
.step-head .mono { color: var(--accent); }
.step-head h2 { font-size: 1.7rem; }
.step-head p { color: var(--ink-2); }
.otp { font-family: var(--mono); font-size: 1.7rem; letter-spacing: .38em; text-align: center; padding-left: .38em; }
.pw-rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .9rem; }
.pw-rules li::before { content: "○ "; font-family: var(--mono); }
.pw-rules li.okk { color: var(--ok); }
.pw-rules li.okk::before { content: "✓ "; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ═══ Pages de l'application ═══ */
.page { padding-block: 28px 64px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 22px; }
.page-head h1 { font-size: clamp(1.8rem, 3.6vw, 2.7rem); font-weight: 400; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; color: var(--ink-2); margin-bottom: 10px; }
.eyebrow::before { content: ""; width: 26px; height: 1px; background: currentColor; }
.flow-line { font-family: var(--mono); font-size: .76rem; letter-spacing: .04em; color: var(--ink-2); }
.flow-line b { color: var(--ink); font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.banner { margin-bottom: 18px; }

/* Indicateurs façon cartouche */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border: 2px solid var(--rule-strong); background: var(--card); margin-bottom: 26px; }
.kpi { padding: 14px 16px 16px; border-right: 1px solid var(--rule); min-width: 0; }
.kpi:last-child { border-right: 0; }
.kpi dt { font-family: var(--mono); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.kpi dd { margin: 6px 0 0; }
.kpi .v { font-family: var(--serif); font-size: clamp(1.4rem, 2.3vw, 2rem); font-weight: 400; font-variant-numeric: tabular-nums lining-nums; line-height: 1; white-space: nowrap; }
.kpi .v small { font-size: .55em; color: var(--ink-2); }
.kpi .s { display: block; margin-top: 6px; font-size: .8rem; color: var(--ink-2); }
.kpi.hot .v { color: var(--alert); }
.kpi.hot dt { color: var(--alert); }

/* Onglets */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--rule-strong); flex-wrap: wrap; }
.tabs button {
  min-height: 48px; padding: 0 18px; border: 0; background: none; cursor: pointer; font-family: var(--serif); font-size: 1.15rem;
  border-bottom: 3px solid transparent; margin-bottom: -2px; display: inline-flex; align-items: center; gap: 8px;
}
.tabs button .n { font-family: var(--mono); font-size: .72rem; color: var(--ink-2); }
.tabs button[aria-selected="true"] { border-bottom-color: var(--accent); }
.tabs .lock { margin-left: auto; align-self: center; font-size: .82rem; color: var(--ink-2); padding: 6px 0; }
.tabpanel[hidden] { display: none; }

.filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; padding: 16px 0 14px; }
.filters .field { min-width: 150px; flex: 1 1 150px; max-width: 220px; }
.filters .field label { font-size: .78rem; font-family: var(--mono); font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.filters .count { margin-left: auto; font-size: .88rem; color: var(--ink-2); padding-bottom: 12px; }

/* Grand livre */
.ledger-wrap { border: 1.5px solid var(--rule-strong); background: var(--card); }
table.ledger { width: 100%; border-collapse: collapse; font-size: .92rem; }
.ledger caption { text-align: left; padding: 10px 14px; font-size: .84rem; color: var(--ink-2); border-bottom: 1px solid var(--rule); caption-side: top; }
.ledger th { font-family: var(--mono); font-weight: 500; font-size: .64rem; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-2); text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--rule-strong); vertical-align: bottom; }
.ledger td { padding: 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.ledger .r { text-align: right; }
.ledger td.r { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger tbody tr { position: relative; transition: background-color .12s; }
.ledger tbody tr:hover { background: var(--paper-2); }
.ledger .who-cell a { font-weight: 700; text-decoration: none; }
.ledger .who-cell a::after { content: ""; position: absolute; inset: 0; }
.ledger .who-cell a:hover { color: var(--accent); }
.ledger .who-cell .sub { display: block; font-size: .82rem; color: var(--ink-2); }
.ledger .next { display: block; margin-top: 6px; font-size: .82rem; color: var(--ink-2); max-width: 30ch; }
.ledger tfoot td { font-weight: 700; border-top: 2px solid var(--rule-strong); border-bottom: 0; background: var(--paper-2); }
.ledger .est { color: var(--wait); }
.ledger .est::after { content: " *"; }
.ledger-foot { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 14px; font-size: .8rem; color: var(--ink-2); border-top: 1px solid var(--rule); }

@media (max-width: 920px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(3n) { border-right: 0; }
  .kpi:nth-child(-n+3) { border-bottom: 1px solid var(--rule); }
  table.ledger thead { display: none; }
  .ledger caption { display: block; }
  table.ledger, .ledger tbody, .ledger tfoot { display: block; }
  .ledger tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; padding: 14px; border-bottom: 1px solid var(--rule); }
  .ledger td { border: 0; padding: 0; }
  .ledger td[data-l]::before { content: attr(data-l); display: block; font-family: var(--mono); font-size: .6rem; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-2); font-weight: 400; }
  .ledger td.r { text-align: left; }
  .ledger .who-cell, .ledger .status-cell, .ledger .wide { grid-column: 1 / -1; }
  .ledger tfoot tr { background: var(--paper-2); }
  .ledger tfoot td { border: 0; background: none; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { border-right: 1px solid var(--rule) !important; border-bottom: 1px solid var(--rule); }
  .kpi:nth-child(2n) { border-right: 0 !important; }
  .kpi:nth-last-child(-n+2) { border-bottom: 0; }
  .tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tabs button { justify-content: center; flex-wrap: wrap; gap: 2px 6px; padding: 6px 4px; font-size: 1rem; line-height: 1.15; text-align: center; }
}

/* ═══ Fiche d'une ligne ═══ */
.crumb { font-size: .9rem; margin-bottom: 14px; }
.crumb a { min-height: 44px; display: inline-flex; align-items: center; }
.fiche-head { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.fiche-head h1 { font-size: clamp(1.8rem, 3.8vw, 2.8rem); font-weight: 400; }
.fiche-head .sub { margin-top: 8px; color: var(--ink-2); }
.schema { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-bottom: 30px; position: relative; }
.station { position: relative; padding: 0 18px 0 0; }
.station .rail { height: 22px; position: relative; margin-bottom: 14px; }
.station .rail::before { content: ""; position: absolute; left: 22px; right: -4px; top: 50%; height: 2px; background: var(--rule-strong); transform-origin: left; animation: trace .7s ease-out both; }
.station:last-child .rail::before { display: none; }
.station:nth-child(2) .rail::before { animation-delay: .15s; } .station:nth-child(3) .rail::before { animation-delay: .3s; }
@keyframes trace { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.station .node { position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper); display: grid; place-items: center; font-size: .72rem; font-weight: 700; font-family: var(--mono); }
.station.ok .node { background: var(--ink); color: var(--paper); }
.station.att .node { border-color: var(--wait); border-style: dashed; color: var(--wait); }
.station.ko .node { border-color: var(--alert); background: var(--alert); color: var(--paper); }
.station.vide .node { border-color: var(--ink-2); color: var(--ink-2); }
.station .cut { position: absolute; top: -2px; right: 6px; font-family: var(--mono); font-size: .64rem; letter-spacing: .06em; background: var(--paper); padding: 0 6px; color: var(--accent); z-index: 1; }
.station h3 { font-family: var(--mono); font-size: .66rem; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.station .big { font-family: var(--serif); font-size: 1.55rem; margin-top: 4px; font-variant-numeric: tabular-nums; }
.station .meta { margin-top: 6px; font-size: .84rem; color: var(--ink-2); display: grid; gap: 3px; }
.station .meta .tag { justify-self: start; }
.cols { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.panel { background: var(--card); border: 1.5px solid var(--rule-strong); }
.panel + .panel { margin-top: 22px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--rule); }
.panel-head h2 { font-size: 1.25rem; }
.panel-body { padding: 14px 16px 16px; }
.figs { margin: 0; display: grid; }
.figs > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; padding: 10px 0; border-bottom: 1px dotted var(--rule); align-items: baseline; }
.figs > div:last-child { border-bottom: 0; }
.figs dt { font-size: .92rem; }
.figs dt .tag { margin-left: 6px; vertical-align: 1px; }
.figs dd { margin: 0; font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.figs .why { grid-column: 1 / -1; font-size: .78rem; color: var(--ink-2); }
.figs .edit-in { display: none; }
.editing .figs .edit-in { display: block; grid-column: 1 / -1; }
.editing .figs dd.saisi { display: none; }
.next-box { border-left: 4px solid var(--accent); padding: 12px 14px; background: color-mix(in srgb, var(--accent) 7%, transparent); display: grid; gap: 4px; }
.next-box b { font-family: var(--serif); font-size: 1.15rem; font-weight: 500; }
.locked { display: inline-flex; gap: 6px; align-items: center; font-family: var(--mono); font-size: .64rem; letter-spacing: .08em; text-transform: uppercase; color: var(--alert); }
.locked::before { content: "🔒"; font-size: .8rem; }
.notes { white-space: pre-wrap; font-size: .95rem; }
.comment { padding: 12px 0; border-bottom: 1px dotted var(--rule); display: grid; gap: 4px; }
.comment:first-child { padding-top: 0; }
.comment .by { font-size: .82rem; color: var(--ink-2); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.comment .by b { color: var(--ink); }
.comment-form { display: grid; gap: 10px; padding-top: 14px; }
.hist { list-style: none; margin: 0; padding: 0; position: relative; }
.hist li { position: relative; padding: 0 0 14px 22px; font-size: .9rem; }
.hist li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.hist li::after { content: ""; position: absolute; left: 7.5px; top: 18px; bottom: 2px; width: 1px; background: var(--rule-strong); opacity: .35; }
.hist li:last-child::after { display: none; }
.hist time { display: block; font-family: var(--mono); font-size: .72rem; color: var(--ink-2); }
.hist .chg { font-family: var(--mono); font-size: .82rem; }
.hist del { color: var(--ink-2); }
.hist ins { text-decoration: none; font-weight: 500; }
.empty { padding: 26px 18px; text-align: center; color: var(--ink-2); display: grid; gap: 10px; justify-items: center; }
.empty .glyph { font-family: var(--serif); font-size: 2.4rem; color: var(--rule-strong); opacity: .35; line-height: 1; }
.empty b { color: var(--ink); font-family: var(--serif); font-size: 1.2rem; font-weight: 500; }

@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; gap: 28px; }
  .cols { grid-template-columns: 1fr; }
  .schema { grid-template-columns: 1fr; gap: 0; }
  .station { padding: 0 0 30px 36px; }
  .station .rail { position: absolute; left: 0; top: 0; bottom: 0; width: 22px; height: auto; margin: 0; }
  .station .rail::before { left: 10px; right: auto; top: 22px; bottom: -4px; width: 2px; height: auto; transform-origin: top; animation-name: trace-v; }
  .station .cut { top: auto; right: auto; left: 30px; bottom: 6px; white-space: nowrap; padding: 0 4px; }
  @keyframes trace-v { from { transform: scaleY(0); } to { transform: scaleY(1); } }
}

/* ═══ Dialogues ═══ */
dialog { border: 2px solid var(--rule-strong); background: var(--card); color: var(--ink); padding: 0; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 40px); box-shadow: 10px 10px 0 rgba(0,0,0,.18); }
dialog::backdrop { background: rgba(20,18,14,.55); }
.dlg-head { padding: 14px 18px; border-bottom: 1px solid var(--rule); display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.dlg-head h2 { font-size: 1.45rem; }
.dlg-body { padding: 16px 18px; display: grid; gap: 14px; }
.dlg-foot { padding: 14px 18px; border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.danger-list { margin: 0; padding: 12px 14px 12px 34px; border: 1.5px solid var(--alert); background: color-mix(in srgb, var(--alert) 7%, transparent); display: grid; gap: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.calc-note { grid-column: 1 / -1; font-size: .86rem; color: var(--ink-2); border-top: 1px dotted var(--rule); padding-top: 10px; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.x { min-width: 44px; min-height: 44px; border: 0; background: none; font-size: 1.4rem; cursor: pointer; }

/* ═══ Comptes ═══ */
.acc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 26px; }
.acc { padding: 16px; display: grid; gap: 10px; align-content: start; }
.acc h3 { font-size: 1.3rem; }
.acc .kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .88rem; }
.acc .kv span:nth-child(odd) { color: var(--ink-2); }
.acc .actions .btn { padding: 0 12px; font-size: .86rem; }
.devices { list-style: none; margin: 0; padding: 0; }
.devices li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 14px; padding: 10px 0; border-bottom: 1px dotted var(--rule); font-size: .9rem; }
.devices li:last-child { border-bottom: 0; }
.log-table td, .log-table th { font-size: .84rem; }
@media (max-width: 920px) { .acc-grid { grid-template-columns: 1fr; } }

/* ═══ États & erreurs ═══ */
.states { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.state { display: grid; gap: 10px; align-content: start; }
.state > .mono { color: var(--accent); }
.skel { display: grid; gap: 10px; padding: 16px; }
.skel i { display: block; height: 14px; background: linear-gradient(90deg, var(--paper-2) 0%, color-mix(in srgb, var(--paper-2) 40%, var(--card)) 50%, var(--paper-2) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.skel .k { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.skel .k i { height: 44px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 40; background: var(--ink); color: var(--paper); padding: 12px 18px; display: flex; gap: 14px; align-items: center; box-shadow: 6px 6px 0 rgba(0,0,0,.2); max-width: calc(100vw - 32px); }
.toast[hidden] { display: none; }
.toast.static { position: static; transform: none; box-shadow: none; }
@media (max-width: 860px) { .states { grid-template-columns: 1fr; } }

/* ═══ Journal (logs) ═══ */
.logs { position: fixed; top: 0; right: 0; bottom: 0; z-index: 45; width: min(620px, 100vw); background: var(--card); border-left: 2px solid var(--rule-strong); display: grid; grid-template-rows: auto auto 1fr; box-shadow: -10px 0 0 rgba(0,0,0,.08); transform: translateX(105%); transition: transform .22s ease-out; }
.logs.open { transform: none; }
.logs .dlg-head { background: var(--ink); color: var(--paper); }
.logs .dlg-head .x { color: var(--paper); }
.logs-tools { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--rule); align-items: center; }
.logs pre { margin: 0; padding: 14px; overflow: auto; font-family: var(--mono); font-size: .74rem; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.logs pre .WARN { color: var(--wait); } .logs pre .ERROR { color: var(--alert); }
.logs textarea { display: none; margin: 0 14px 14px; }
.logs textarea.show { display: block; }

/* Pied */
.foot { border-top: 1px solid var(--rule); padding-block: 18px 40px; font-size: .8rem; color: var(--ink-2); }
.foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; }

/* ═══ Application : ajouts à la maquette ═══
   La politique de sécurité (CSP) interdit les attributs style= : les réglages ponctuels de la maquette
   deviennent des classes utilitaires. */
.brand svg .fond { fill: var(--accent); }
.brand svg .trait { fill: none; stroke: var(--on-accent); stroke-width: 3; stroke-linecap: square; }
.mt-8 { margin-top: 8px; } .mt-10 { margin-top: 10px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mt-22 { margin-top: 22px; } .mt-34 { margin-top: 34px; } .mb-10 { margin-bottom: 10px; } .mb-16 { margin-bottom: 16px; }
.my-16 { margin-block: 16px; }
.fs-82 { font-size: .82rem; } .fs-84 { font-size: .84rem; } .fs-86 { font-size: .86rem; } .fs-90 { font-size: .9rem; }
.fs-125 { font-size: 1.25rem; }
.start { justify-self: start; } .centre { justify-content: center; } .aligne { align-items: center; gap: 14px; }
.c-wait { color: var(--wait); } .c-alert { color: var(--alert); } .c-ok { color: var(--ok); } .c-herite { color: inherit; }
.w-60 { width: 60%; } .w-80 { width: 80%; } .mw-62 { max-width: 62ch; }
.pile { display: grid; gap: 10px; } .sans-puce { list-style: none; padding: 0; } .p-0 { padding: 0; } .py-12 { padding-block: 12px; }
.ecart { display: block; margin-top: 4px; font-size: .78rem; color: var(--wait); }
.mentions { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .9rem; }
.mentions dt { color: var(--ink-2); } .mentions dd { margin: 0; font-family: var(--mono); overflow-wrap: anywhere; }
.secret-once { font-family: var(--mono); font-size: 1.1rem; padding: 12px 14px; border: 2px dashed var(--accent); background: var(--paper); overflow-wrap: anywhere; user-select: all; }
.alerte-ligne { display: grid; gap: 10px; padding: 14px 0; border-bottom: 1px dotted var(--rule); }
.alerte-ligne:last-child { border-bottom: 0; }
.alerte-ligne .actions { align-items: flex-end; }
.alerte-ligne .field { min-width: 220px; flex: 1 1 260px; max-width: 420px; }
.nav-n { font-family: var(--mono); font-size: .7rem; margin-left: 6px; padding: 1px 6px; border: 1px solid currentColor; }
.nav-n.hot { color: var(--alert); }
.panel-body > .empty { padding: 12px 0; }
.ledger td .link-btn { min-height: 44px; text-align: left; text-decoration: none; font-weight: 700; }
.ledger td .link-btn:hover { color: var(--accent); }
.dlg-body .msg { margin: 0; }
.erreur-chargement { margin-block: 22px; }
