/* TONERBOX AI — interface interne (design « Registre » aux couleurs de tonerbox.fr : anthracite, blanc, filets, accent menthe
   décliné en teintes, dégradés et lueurs ; textures légères sur les fonds sans texte, panneaux et tableaux toujours blancs) */
:root {
  --bg: #f7f7f7;
  --panel: #ffffff;
  --field: #ffffff;
  --ink: #303030;
  --muted: #666666;
  --faint: #999999;
  --line: #d9d9d9;
  --line-soft: #ececec;
  --line-strong: #a6a6a6;
  --hover: #e6fbf6;
  /* Le menthe n'est lisible qu'en aplat sous du texte anthracite ou sur fond sombre (1,3:1 sur blanc) :
     sur fond clair, le texte, les filets et les contours prennent --accent-ink */
  --accent: #00ffcc;
  --accent-hover: #00cc99;
  --accent-ink: #007a62;
  --on-dark: #e1e1e1;
  --ok: #007a62;
  --mid: #b45309;
  --low: #8a8a8a;
  --bad: #b91c1c;
  /* Teintes des pastilles (score, statut) : fond clair, texte foncé de la même famille */
  --mint-tint: #dcfcf3;
  --mint-edge: #9ee9d4;
  --mint-deep: #00513f;
  --amber-tint: #fdf1de;
  --amber-edge: #f0d3a3;
  --amber-deep: #6b3600;
  --grey-tint: #f0f0f0;
  --grad-accent: linear-gradient(135deg, #00ffcc 0%, #00cc99 100%);
  --shadow-1: 0 1px 2px rgba(48, 48, 48, .05), 0 6px 18px -10px rgba(48, 48, 48, .22);
  --shadow-2: 0 2px 4px rgba(48, 48, 48, .06), 0 14px 30px -14px rgba(0, 122, 98, .4);
  /* Grain de papier (SVG en data:, autorisé par la CSP img-src) : anthracite sur fond clair, blanc sur l'anthracite */
  --grain-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .19 0 0 0 0 .19 0 0 0 0 .19 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)' opacity='.06'/%3E%3C/svg%3E");
  --grain-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)' opacity='.07'/%3E%3C/svg%3E");
  --hatch-dark: repeating-linear-gradient(135deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 8px);
  --radius: 5px;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, ui-monospace, monospace;
}
* { box-sizing: border-box; }
/* Un élément masqué (attribut hidden) le reste, même quand sa classe impose un affichage (.stack, boutons) */
[hidden] { display: none !important; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
/* Fond texturé : lueurs menthe en haut de page, trame de points, grain */
body {
  margin: 0; color: var(--ink); font-family: var(--font); line-height: 1.5;
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 520px at 100% -120px, rgba(0, 255, 204, .24), transparent 70%),
    radial-gradient(820px 420px at -10% -80px, rgba(0, 204, 153, .14), transparent 70%),
    radial-gradient(1000px 560px at 0 100%, rgba(0, 204, 153, .1), transparent 70%),
    radial-gradient(circle, rgba(48, 48, 48, .17) 1.1px, transparent 1.7px),
    var(--grain-dark);
  background-size: auto, auto, auto, 22px 22px, 180px 180px;
  background-repeat: no-repeat, no-repeat, no-repeat, repeat, repeat;
}
::selection { background: rgba(0, 255, 204, .4); color: var(--ink); }
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent-hover); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--ink); }
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.015em; line-height: 1.2; margin: 0 0 .75rem; }
h2 { font-size: 1rem; font-weight: 600; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1.25rem 0 .5rem; }
code, .mono, pre { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.small, small { font-size: .85rem; }
.warn { color: var(--mid); }
.ok { color: var(--ok); }
.nowrap { white-space: nowrap; }
.prewrap { white-space: pre-line; }

/* Barre supérieure : anthracite hachuré et grainé, lueur menthe derrière la marque */
body.app, body.guest { display: flex; flex-direction: column; min-height: 100vh; }
.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: stretch; gap: 2rem; height: 48px; padding: 0 1.5rem; color: var(--on-dark);
  background-color: var(--ink);
  background-image: radial-gradient(420px 120px at 0 0, rgba(0, 255, 204, .18), transparent 70%), var(--hatch-dark), var(--grain-light);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .25), 0 10px 24px -18px rgba(0, 0, 0, .7);
}
.brand { display: flex; align-items: center; color: #fff; font-weight: 700; font-size: 1.05rem; letter-spacing: .02em; text-decoration: none; white-space: nowrap; }
.brand em { font-style: normal; color: var(--accent); margin-left: .3em; text-shadow: 0 0 14px rgba(0, 255, 204, .55); }
.brand:hover { color: #fff; }
.topnav { flex: 1; display: flex; align-items: stretch; justify-content: space-between; gap: 1.5rem; min-width: 0; }
.mainnav { display: flex; align-items: stretch; gap: 1rem; }
.mainnav > a, .adminmenu > summary { display: flex; align-items: center; height: 48px; padding: 2px .4rem 0; color: var(--on-dark); font-size: .93rem; font-weight: 500; text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; transition: color .12s, background .12s; }
.mainnav > a:hover, .adminmenu > summary:hover { color: #fff; background: linear-gradient(to top, rgba(255, 255, 255, .06), transparent 80%); }
.mainnav > a.active, .adminmenu.active > summary { color: #fff; font-weight: 600; border-bottom-color: var(--accent); background: linear-gradient(to top, rgba(0, 255, 204, .18), transparent 80%); }
.adminmenu { position: relative; display: flex; }
.adminmenu > summary { cursor: pointer; list-style: none; }
.adminmenu > summary::-webkit-details-marker { display: none; }
.adminmenu > summary::after { content: "▾"; font-family: var(--mono); font-size: .7rem; margin-left: .4rem; }
.adminlinks { position: absolute; top: 100%; left: -.35rem; min-width: 220px; display: flex; flex-direction: column; padding: .35rem 0; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--accent-hover); border-radius: 0 0 var(--radius) var(--radius); box-shadow: 0 18px 36px -16px rgba(0, 0, 0, .4); }
.adminlinks a { padding: .45rem .9rem; border-left: 3px solid transparent; color: var(--ink); text-decoration: none; font-size: .93rem; }
.adminlinks a:hover { background: var(--hover); border-left-color: var(--mint-edge); }
.adminlinks a.active { font-weight: 600; border-left-color: var(--accent-ink); }
.topnav > .userbox:only-child { margin-left: auto; }
.userbox { display: flex; align-items: center; gap: 1.1rem; font-size: .86rem; white-space: nowrap; }
.navadd { background: var(--grad-accent); color: var(--ink); padding: .3rem .8rem; border-radius: var(--radius); font-weight: 600; text-decoration: none; box-shadow: 0 0 0 1px rgba(0, 255, 204, .35), 0 4px 16px -4px rgba(0, 255, 204, .55); transition: box-shadow .12s, transform .12s; }
.navadd:hover, .navadd.active { background: var(--accent-hover); color: var(--ink); box-shadow: 0 0 0 1px rgba(0, 255, 204, .5), 0 6px 20px -4px rgba(0, 255, 204, .7); }
/* Avancement de la mise en route : contour menthe, discret à côté de la saisie */
.navsetup { color: var(--accent); border: 1px solid var(--accent-hover); padding: .25rem .65rem; border-radius: var(--radius); text-decoration: none; font-family: var(--mono); font-size: .8rem; }
.navsetup:hover, .navsetup.active { background: #3d3d3d; color: #fff; }
.userlink { color: var(--on-dark); font-weight: 500; text-decoration: none; }
.userlink:hover { color: #fff; }
.userbox form { display: flex; align-items: center; padding-left: 1.1rem; border-left: 1px solid #555555; }
.userbox button.link { color: var(--faint); font-size: .86rem; padding: 0; }
.userbox button.link:hover { color: #fff; }
.navtoggle { position: absolute; opacity: 0; width: 1px; height: 1px; }
.navtoggle-btn { display: none; }
.demobar { background: #f6ead2; color: #7a3e00; border-bottom: 1px solid #e3cfa5; text-align: center; font-family: var(--mono); font-size: .76rem; padding: .3rem 1rem; }
.sysbar { background: #f8e7e3; color: #8f1d14; border-bottom: 1px solid #e7b9b2; text-align: center; font-family: var(--mono); font-size: .76rem; padding: .35rem 1rem; }
.sysbar.ai { background: #f6ead2; color: #7a3e00; border-bottom-color: #e3cfa5; }
/* Préproduction : bleu, pour ne la confondre ni avec la démonstration (ambre) ni avec une panne (rouge) */
.demobar.preprodbar { background: #e3ecf8; color: #1d3f73; border-bottom-color: #b9cbe7; }

main { width: 100%; max-width: 1520px; margin: 0 auto; padding: 1.6rem 2rem 1rem; flex: 1; }
main.wide { max-width: 1520px; }
.foot { border-top: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: .76rem; padding: 1rem 2rem 1.2rem; margin-top: 2.5rem; }

/* Blocs : blancs, légère ombre ; titre souligné d'un trait menthe sur un filet gris */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1.1rem; box-shadow: var(--shadow-1); }
.panel.narrow, .narrow { max-width: 640px; }
.panel > h2:first-child {
  font-size: 1.08rem; font-weight: 650; letter-spacing: -.005em; padding-bottom: .55rem; margin-bottom: .9rem;
  background: linear-gradient(90deg, var(--accent-hover), var(--accent)) left bottom / 2.75rem 3px no-repeat, linear-gradient(var(--line), var(--line)) left bottom / 100% 1px no-repeat;
}
/* Titre de page : filet gris et trait menthe dégradé à gauche */
.pagehead { position: relative; display: flex; align-items: baseline; justify-content: space-between; gap: .75rem 1rem; flex-wrap: wrap; padding-bottom: .7rem; margin-bottom: 1.4rem; border-bottom: 1px solid var(--line); }
.pagehead::after, .dethead::after { content: ""; position: absolute; left: 0; bottom: -2px; width: 72px; height: 3px; border-radius: 3px; background: var(--grad-accent); }
.pagehead h1 { margin: 0 auto 0 0; }
.pagehead p { margin: 0; flex-basis: 100%; }
/* Actions de la page, à droite du titre */
.headactions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.count { font-family: var(--mono); font-size: .95rem; font-weight: 400; color: var(--muted); margin-left: .35rem; letter-spacing: 0; vertical-align: baseline; }
.crumbs { margin: 0 0 .6rem; font-size: .86rem; color: var(--muted); }
.empty { padding: 3rem; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); background: rgba(255, 255, 255, .75); }
.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 1.1rem; align-items: start; }
.cols.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

/* Alertes */
.alert { padding: .6rem .9rem; border-radius: var(--radius); border: 1px solid; border-left-width: 4px; margin: 0 0 1rem; background: var(--panel); }
.alert.ok { border-color: #a8e0d2; border-left-color: var(--accent-hover); background: #e6f7f2; }
.alert.error { border-color: #e7b9b2; border-left-color: var(--bad); background: #f8e7e3; }
.alert.warn { border-color: #e3cfa5; border-left-color: var(--mid); background: #f6ead2; }
.alert.info { border-color: var(--line); border-left-color: var(--ink); }
.alert a, .sysbar a { text-decoration-color: currentColor; }
code.secret { font-size: 1.1rem; padding: .15rem .4rem; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); user-select: all; }

/* Formulaires */
input, select, textarea, button, .button { font: inherit; }
input, select, textarea { border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem .6rem; background: var(--field); color: var(--ink); min-width: 0; font-size: .93rem; transition: border-color .12s, box-shadow .12s; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: #adadad; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-ink); box-shadow: 0 0 0 3px rgba(0, 204, 153, .22); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent-ink); }
textarea { width: 100%; resize: vertical; }
/* Une seule action principale par bloc (menthe dégradé) ; les autres boutons sont secondaires : fond blanc, contour gris */
button, .button { display: inline-block; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); padding: .38rem .8rem; border-radius: var(--radius); cursor: pointer; font-size: .93rem; font-weight: 500; text-decoration: none; transition: background .12s, border-color .12s, color .12s, box-shadow .12s, transform .12s; }
button:hover, .button:hover { border-color: var(--accent-ink); background: var(--hover); color: var(--ink); }
button.small, .button.small { padding: .2rem .55rem; font-size: .86rem; }
button.primary, .button.primary { background: var(--grad-accent); border-color: #00e0b4; color: var(--ink); font-weight: 600; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 4px 14px -6px rgba(0, 204, 153, .85); }
button.primary:hover, .button.primary:hover { background: linear-gradient(135deg, #00f0c0 0%, #00b88a 100%); border-color: var(--accent-hover); color: var(--ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 8px 20px -8px rgba(0, 204, 153, .95); transform: translateY(-1px); }
button.primary:active, .button.primary:active { transform: none; }
button.danger { color: var(--bad); border-color: var(--bad); }
button.danger:hover { background: var(--bad); color: #fff; }
/* Après .danger : un bouton grisé l'est quelle que soit sa couleur */
button:disabled, button:disabled:hover { background: transparent; border-color: var(--line); color: var(--faint); cursor: not-allowed; box-shadow: none; transform: none; }
button.link { border: 0; background: none; padding: 0 .2rem; color: var(--ink); font-weight: 400; text-decoration: underline; text-decoration-color: var(--accent-hover); text-underline-offset: 2px; }
button.link:hover { background: none; color: var(--ink); text-decoration-color: var(--ink); }
button.link.danger { color: var(--bad); text-decoration-color: currentColor; }
.stack { display: flex; flex-direction: column; gap: .8rem; }
.stack label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .88rem; }
.stack label small { font-weight: 400; color: var(--muted); }
.stack label.check, label.check { flex-direction: row; align-items: center; gap: .4rem; font-weight: 400; }
.stack > button { align-self: flex-start; }
/* Aide sous un champ : l'écart du formulaire suffit, sans la marge d'un paragraphe */
.stack > p { margin: 0; }
/* Choix exclusif décrit (mode d'analyse de l'IA) */
fieldset.modes { border: 1px solid var(--line); border-radius: var(--radius); margin: 0; padding: .45rem .8rem .6rem; display: flex; flex-direction: column; gap: .2rem; }
fieldset.modes legend { font-weight: 600; font-size: .88rem; padding: 0 .3rem; }
fieldset.countries { border: 1px solid var(--line); border-radius: var(--radius); margin: 0; padding: .45rem .8rem .6rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .2rem .8rem; }
fieldset.countries legend { font-weight: 600; font-size: .88rem; padding: 0 .3rem; }
fieldset.modes p { margin: 0 0 .35rem 1.45rem; }
/* Réglages propres au type d'une source ; les réglages fins sont repliés */
fieldset.kindfields { border: 1px solid var(--line); border-radius: var(--radius); margin: 0; padding: .6rem .8rem .8rem; background: linear-gradient(180deg, #fbfefd, var(--panel) 4rem); }
fieldset.kindfields legend { font-weight: 600; font-size: .88rem; padding: 0 .3rem; }
details.advanced { border-top: 1px solid var(--line-soft); padding-top: .5rem; }
details.advanced > summary { font-size: .88rem; color: var(--muted); }
details.advanced[open] > summary { margin-bottom: .6rem; }
.danger-zone { border-color: #e7b9b2; }
.danger-zone > h2:first-child { background: linear-gradient(var(--bad), var(--bad)) left bottom / 2.75rem 3px no-repeat, linear-gradient(#e7b9b2, #e7b9b2) left bottom / 100% 1px no-repeat; }
.small-form { margin-top: .75rem; }
.small-form label { font-size: .85rem; }
.rowform { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.rowform input { flex: 1 1 120px; }
form.inline { display: inline; }
.actions-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
input.tiny { width: 4.2em; padding: .2rem .35rem; }

/* Filtres */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .6rem; }
.filters input[type=search] { flex: 0 1 300px; }
.filters select { flex: 0 1 auto; max-width: 210px; }
.filters input[type=text] { flex: 0 0 4.5rem; font-family: var(--mono); text-align: center; }
.filters label.check { padding: 0 .3rem; }
.exportbar { margin: 0 0 1.4rem; font-family: var(--mono); font-size: .78rem; }
.col-lieu { min-width: 9.5rem; }

/* Tableaux : fond blanc ; la ligne survolée prend une teinte menthe et un trait à gauche */
table.grid { width: 100%; border-collapse: collapse; background: var(--panel); }
table.grid th { text-align: left; font-size: .86rem; font-weight: 600; color: var(--muted); padding: .6rem .9rem; border-bottom: 2px solid var(--ink); vertical-align: bottom; }
table.grid th:first-child, table.grid td:first-child { padding-left: .25rem; }
table.grid th:last-child, table.grid td:last-child { padding-right: .25rem; }
table.grid td { padding: .8rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; transition: background .1s; }
table.grid tbody tr:hover td { background: var(--hover); }
table.grid tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--accent-hover); }
table.grid.compact td, table.grid.compact th { padding: .4rem .55rem; }
table.grid tfoot td { font-weight: 600; border-top: 2px solid var(--ink); border-bottom: 0; }
table.grid tr.disabled td { color: var(--faint); }
/* Tableau posé directement sur la page (liste des opportunités, sources…) : carte blanche à coins arrondis */
main > table.grid { border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
main > table.grid th:first-child, main > table.grid td:first-child { padding-left: .9rem; }
main > table.grid th:last-child, main > table.grid td:last-child { padding-right: .9rem; }
main > table.grid thead th { background: linear-gradient(180deg, #fcfcfc, #f2f6f5); }
main > table.grid thead th:first-child { border-top-left-radius: var(--radius); }
main > table.grid thead th:last-child { border-top-right-radius: var(--radius); }
main > table.grid tbody tr:last-child td { border-bottom: 0; }
main > table.grid tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius); }
main > table.grid tbody tr:last-child td:last-child { border-bottom-right-radius: var(--radius); }
.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
/* Un nombre ne se coupe pas (overflow-wrap: anywhere des cellules) */
td.num { white-space: nowrap; overflow-wrap: normal; }
th.num { text-align: right; }
a.title { font-weight: 600; color: var(--ink); line-height: 1.4; text-decoration: none; }
a.title:hover { text-decoration: underline; text-decoration-color: var(--accent-hover); }
.sub { font-size: .8rem; color: var(--muted); margin-top: .3rem; }
.tag { font-family: var(--mono); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink); margin-right: .2rem; }
.actions form { margin-left: .25rem; }
.barcell { width: 50%; }
/* Barre de proportion : vert foncé vers menthe, au moins 3:1 sur blanc */
.bar { display: block; height: 10px; width: var(--w); min-width: 3px; border-radius: 999px; background: linear-gradient(90deg, #00664f, #00a383); }
.pager { display: flex; gap: 1rem; justify-content: flex-end; margin: 1.25rem 0; font-family: var(--mono); font-size: .86rem; }
.pager a { color: var(--muted); text-decoration: none; }
.pager a:hover { color: var(--ink); }
.pager strong { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent-hover); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.pager .gap { color: var(--muted); }

/* Score et statuts : pastille teintée de la couleur du niveau, point plein, texte foncé */
.score { display: inline-flex; align-items: center; gap: .4rem; padding: .08rem .5rem .08rem .4rem; border: 1px solid #dedede; border-radius: 999px; background: var(--grey-tint); font-family: var(--mono); font-weight: 700; font-size: 1rem; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); }
.score::before { content: ""; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--low); }
.score.high { background: var(--mint-tint); border-color: var(--mint-edge); color: var(--mint-deep); }
.score.high::before { background: var(--accent-hover); box-shadow: 0 0 0 3px rgba(0, 204, 153, .22); }
.score.mid { background: var(--amber-tint); border-color: var(--amber-edge); color: var(--amber-deep); }
.score.mid::before { background: var(--mid); }
.score.big { font-size: 2rem; gap: .55rem; padding: .15rem .85rem .15rem .7rem; }
.score.big::before { width: 13px; height: 13px; }
.status { display: inline-flex; align-items: center; gap: .45rem; padding: .05rem .55rem .05rem .45rem; border: 1px solid var(--amber-edge); border-radius: 999px; background: var(--amber-tint); font-size: .84rem; color: var(--amber-deep); white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--mid); }
.status.s-DETECTE { background: var(--grey-tint); border-color: #dedede; color: var(--ink); }
.status.s-DETECTE::before { background: var(--low); }
.status.s-ACHETE { background: var(--mint-tint); border-color: var(--mint-edge); color: var(--mint-deep); }
.status.s-ACHETE::before { background: var(--accent-hover); }
.status.s-PERDU, .status.s-SANS_SUITE { background: transparent; border-color: var(--line); color: var(--muted); }
.status.s-PERDU::before, .status.s-SANS_SUITE::before { background: var(--line-strong); }
/* État d'une source : mêmes pastilles (active menthe, erreur ambre, désactivée sans fond) */
.pill { display: inline-flex; align-items: center; gap: .4rem; padding: .02rem .55rem .02rem .45rem; border: 1px solid #dedede; border-radius: 999px; background: var(--grey-tint); font-size: .84rem; color: var(--ink); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--low); }
.pill.ok { background: var(--mint-tint); border-color: var(--mint-edge); color: var(--mint-deep); }
.pill.ok::before { background: var(--accent-hover); box-shadow: 0 0 0 3px rgba(0, 204, 153, .22); }
.pill.warn { background: var(--amber-tint); border-color: var(--amber-edge); color: var(--amber-deep); }
.pill.warn::before { background: var(--mid); }
.pill.off { background: transparent; border-color: var(--line); color: var(--muted); }
.pill.off::before { background: var(--line-strong); }

/* Fiche */
.dethead { position: relative; display: flex; gap: 1.25rem; align-items: flex-start; padding-bottom: 1rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.dethead h1 { margin-bottom: .3rem; font-size: 1.5rem; line-height: 1.25; }
.dethead > div { flex: 1; }
.dethead .sub { font-size: .88rem; }
.statusform label { font-family: var(--mono); font-size: .72rem; color: var(--muted); display: flex; flex-direction: column; gap: .3rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.next { padding: .6rem .85rem; border-left: 3px solid var(--accent-hover); border-radius: 0 var(--radius) var(--radius) 0; background: linear-gradient(90deg, var(--hover), var(--field) 70%); }
dl.facts { display: grid; grid-template-columns: 9rem 1fr; gap: .45rem .9rem; margin: 0 0 .75rem; font-size: .92rem; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
.files { padding-left: 1.1rem; margin: 0; }
.files li { margin-bottom: .4rem; }
pre.raw { white-space: pre-wrap; background: var(--field); border: 1px solid var(--line); padding: .75rem; border-radius: var(--radius); max-height: 320px; overflow: auto; }
.comment { border-left: 2px solid var(--mint-edge); padding-left: .8rem; margin-bottom: .9rem; }
.comment p { margin: .2rem 0 0; white-space: pre-wrap; }
.timeline { padding-left: 1.1rem; margin: 0; }
.timeline li { margin-bottom: .55rem; }
.timeline li::marker { color: var(--accent-hover); }
.choice { display: flex; gap: .4rem; }
.choice button.selected { background: var(--ink); border-color: var(--ink); color: #fff; box-shadow: inset 0 -2px 0 var(--accent); }
details summary { cursor: pointer; font-weight: 500; }

/* Pipeline : colonnes translucides sur le fond texturé, cartes qui se soulèvent au survol */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 1rem; overflow-x: auto; padding-bottom: 1rem; align-items: start; scrollbar-color: var(--accent-hover) transparent; }
.lane { position: relative; padding: .85rem .6rem .35rem; min-height: 220px; background: rgba(255, 255, 255, .6); border: 1px solid var(--line-soft); border-radius: 8px; }
.lane::before { content: ""; position: absolute; top: -1px; left: -1px; right: -1px; height: 3px; border-radius: 8px 8px 0 0; background: var(--mid); }
.lane[data-status="DETECTE"]::before { background: var(--low); }
.lane[data-status="ACHETE"]::before { background: var(--grad-accent); }
.lane[data-status="PERDU"]::before, .lane[data-status="SANS_SUITE"]::before { background: var(--line-strong); }
.lane h2 { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; font-family: var(--mono); font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; margin: 0 .15rem .7rem; }
.card { display: flex; flex-direction: column; gap: .3rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .65rem .75rem; margin-bottom: .5rem; color: var(--ink); text-decoration: none; cursor: grab; box-shadow: 0 1px 2px rgba(48, 48, 48, .06); transition: transform .12s, box-shadow .12s, border-color .12s; }
.card:hover { border-color: var(--accent-hover); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.card .score { align-self: flex-start; font-size: .86rem; }
.cardtitle { font-size: .9rem; font-weight: 600; line-height: 1.35; }

/* Indicateurs : cartes blanches à liseré menthe et lueur d'angle ; l'indicateur phare en aplat anthracite */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .8rem; margin-bottom: 1.6rem; }
.tile { position: relative; display: flex; flex-direction: column; gap: .2rem; padding: 1.05rem 1.1rem 1rem; overflow: hidden; background: radial-gradient(170px 90px at 100% 0, rgba(0, 255, 204, .16), transparent 70%), var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.tile::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--grad-accent); }
.tile-v { font-family: var(--mono); font-size: 1.9rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile-l { color: var(--muted); font-size: .84rem; }
.tile.accent { background: radial-gradient(220px 120px at 100% 0, rgba(0, 255, 204, .24), transparent 70%), var(--hatch-dark), var(--ink); border-color: var(--ink); color: #fff; }
.tile.accent .tile-v { color: var(--accent); text-shadow: 0 0 18px rgba(0, 255, 204, .45); }
.tile.accent .tile-l { color: var(--on-dark); }

/* Onglets */
.tabs { display: flex; gap: 1.5rem; border-bottom: 1px solid var(--line); margin-bottom: 1.2rem; }
.tabs a { padding: .5rem 0; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 500; text-decoration: none; }
.tabs a.active { color: var(--ink); border-image: var(--grad-accent) 1; border-bottom-width: 3px; border-bottom-style: solid; font-weight: 600; }
.tabs a:hover { color: var(--ink); }

/* Connexion : carte blanche à liseré menthe sur un halo menthe */
body.guest {
  background-image:
    radial-gradient(760px 440px at 50% -60px, rgba(0, 255, 204, .32), transparent 70%),
    radial-gradient(circle, rgba(48, 48, 48, .17) 1.1px, transparent 1.7px),
    var(--grain-dark);
  background-size: auto, 22px 22px, 180px 180px;
  background-repeat: no-repeat, repeat, repeat;
}
.login { position: relative; overflow: hidden; width: calc(100% - 2rem); max-width: 380px; margin: 14vh auto 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 2.1rem 1.9rem 2rem; box-shadow: 0 28px 60px -28px rgba(0, 81, 63, .5), var(--shadow-1); }
.login::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--grad-accent); }
.login h1 { margin: 0; font-size: 1.5rem; letter-spacing: .02em; }
.login h1 span { color: var(--accent-ink); }
.login p.muted { margin: .3rem 0 1.5rem; }
.login button { width: 100%; padding: .55rem; }

/* Ancres (#lots, #commentaires) */
.panel[id], [id].panel { scroll-margin-top: 64px; }
/* Une référence ou une URL sans espace ne doit pas élargir la page */
table.grid td, .panel p, .comment p, .files li { overflow-wrap: anywhere; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.topbar :focus-visible { outline-color: var(--accent); }
.adminlinks :focus-visible { outline-color: var(--accent-ink); }

@media (max-width: 1100px) {
  .topbar { gap: 1.25rem; padding: 0 1rem; }
  .mainnav { gap: .5rem; }
  main { padding: 1.3rem 1.2rem 1rem; }
}
@media (max-width: 900px) {
  .cols, .cols.even, .cols.three { grid-template-columns: minmax(0, 1fr); }
  /* Menu repliable : visible au clic sur « Menu » (sans JavaScript) */
  .topbar { position: static; flex-wrap: wrap; height: auto; min-height: 48px; align-items: center; }
  .navtoggle-btn { display: block; margin-left: auto; color: #fff; font-family: var(--mono); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; padding: .4rem .2rem; cursor: pointer; }
  .navtoggle:focus-visible + .navtoggle-btn { outline: 2px solid var(--accent); outline-offset: 2px; }
  .topnav { display: none; flex-basis: 100%; flex-direction: column; gap: .75rem; padding: .25rem 0 1rem; }
  .navtoggle:checked ~ .topnav { display: flex; }
  .mainnav { flex-direction: column; gap: 0; }
  .mainnav > a, .adminmenu > summary { height: auto; padding: .5rem 0; border-bottom: 0; border-left: 2px solid transparent; padding-left: .6rem; }
  .mainnav > a.active, .adminmenu.active > summary { border-left-color: var(--accent); background: linear-gradient(90deg, rgba(0, 255, 204, .14), transparent 70%); }
  .adminmenu { flex-direction: column; }
  .adminlinks { position: static; background: none; border: 0; border-radius: 0; box-shadow: none; padding: 0 0 0 1rem; }
  .adminlinks a { color: var(--on-dark); }
  .adminlinks a:hover { background: none; color: #fff; }
  .adminlinks a.active { border-left-color: var(--accent); }
  .adminlinks :focus-visible { outline-color: var(--accent); }
  .userbox { flex-wrap: wrap; }
  .panel[id], [id].panel { scroll-margin-top: 0; }
  table.grid { display: block; overflow-x: auto; }
  .dethead { flex-wrap: wrap; }
  main { padding: 1.1rem 1rem .5rem; }
  .foot { padding: 1rem; }
}

/* Confirmation d'enregistrement : reste visible même après défilement */
main > .alert:first-child { position: sticky; top: 56px; z-index: 20; box-shadow: var(--shadow-1); }
@media (max-width: 900px) { main > .alert:first-child { top: .5rem; } }
/* Pipeline : glisser-déposer */
.board .card.dragging { opacity: .45; }
.board .lane.over { outline: 2px dashed var(--accent-ink); outline-offset: 4px; background: rgba(230, 251, 246, .8); }
.col-lieu .sub { font-family: var(--mono); font-size: .76rem; }
.sub .warn { color: var(--mid); font-weight: 500; }
/* Points d'attention du §12 : même rouge que l'encadré de la fiche */
.sub .attention { color: var(--bad); font-weight: 500; }
/* Opportunité similaire : lien vers la fiche racine (§18) */
.sub a.similar { color: var(--mid); text-decoration-color: currentColor; }
/* Suivi (§21) : échéance du jour en orange, échéance dépassée ou fiche qui n'avance plus en rouge */
.due.today { color: var(--mid); font-weight: 600; }
.due.late { color: var(--bad); font-weight: 600; }
.col-due { min-width: 9rem; font-size: .84rem; }
.col-due .due + .due { margin-top: .2rem; }
#suivi form.inline { display: block; margin-bottom: .25rem; }

/* Alertes des plateformes : étapes de la boîte de veille, liste dépliable des plateformes, recherches à copier */
ol.steps { list-style: none; counter-reset: step; margin: 0 0 .9rem; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
ol.steps > li { counter-increment: step; position: relative; padding: .6rem .8rem .7rem 2.6rem; border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; gap: .25rem; background: var(--panel); }
ol.steps > li::before { content: counter(step); position: absolute; left: .75rem; top: .6rem; width: 1.35rem; height: 1.35rem; border-radius: 50%; border: 1px solid var(--line-strong); font-size: .8rem; font-weight: 600; display: flex; align-items: center; justify-content: center; color: var(--muted); }
ol.steps > li.done { border-color: #a8e0d2; background: linear-gradient(135deg, #f2fbf8, var(--panel)); }
ol.steps > li.done::before { content: "✓"; background: var(--ok); border-color: var(--ok); color: #fff; box-shadow: 0 0 0 3px rgba(0, 204, 153, .2); }
ol.steps form { margin-top: .2rem; }
details.howto { border-top: 1px solid var(--line-soft); padding-top: .6rem; }
details.howto > summary, details.addbox > summary { font-weight: 600; }
.plist { border-top: 1px solid var(--line); margin: .4rem 0 .9rem; }
.prow { display: grid; grid-template-columns: minmax(0, 1fr) 8rem; gap: .5rem 1rem; align-items: baseline; padding: .55rem .25rem; border-bottom: 1px solid var(--line); }
.plist.with-stats .prow { grid-template-columns: minmax(0, 1fr) 9rem 6.5rem 6.5rem 6.5rem 8rem; }
.prow.phead { font-size: .86rem; font-weight: 600; color: var(--muted); border-bottom: 2px solid var(--ink); }
.prow.unknown { color: var(--muted); }
details.platform > summary { cursor: pointer; list-style: none; font-weight: 400; }
details.platform > summary::-webkit-details-marker { display: none; }
details.platform > summary .pname::before { content: "▸"; display: inline-block; width: 1rem; color: var(--accent-ink); }
details.platform[open] > summary .pname::before { content: "▾"; }
details.platform > summary:hover { background: var(--hover); }
details.platform.disabled > summary { color: var(--faint); }
details.platform[open] > summary { border-bottom-color: var(--line-soft); }
.pbody { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 1.5rem; padding: .4rem .25rem 1.2rem 1.25rem; border-bottom: 1px solid var(--line); }
.pbody h3 { margin-top: .4rem; }
form.quiet { align-items: center; margin-top: 0; }
form.quiet input.tiny { margin: 0 .25rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .8rem; }
button.chip { border-radius: 999px; padding: .25rem .75rem; font-size: .88rem; background: var(--bg); border-color: var(--line); }
button.chip:hover { border-color: var(--accent-ink); background: var(--hover); }
button.chip.copied { border-color: var(--ok); background: #e6f7f2; }
button.chip.copied::after { content: " ✓ copié"; color: var(--ok); font-weight: 600; }
details.addbox > summary { padding: .1rem 0; }
details.addbox[open] > summary { margin-bottom: .9rem; }
@media (max-width: 900px) {
  ol.steps, .pbody { grid-template-columns: minmax(0, 1fr); }
  .plist.with-stats .prow { grid-template-columns: minmax(0, 1fr) 7rem; }
  .plist.with-stats .prow > :nth-child(n+2):not(:last-child) { display: none; }
}

/* Réglages : sommaire collant, une colonne ; un bloc modifié garde son bouton à l'écran avec un rappel */
nav.toc { position: sticky; top: 48px; z-index: 15; display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; padding: .55rem 0 .6rem; margin: -.8rem 0 1.2rem; background: rgba(247, 247, 247, .9); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); font-size: .93rem; }
nav.toc a { color: var(--muted); text-decoration: none; }
nav.toc a:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent-hover); }
.settings { max-width: 980px; }
.settings .panel[id], .settings form[id] { scroll-margin-top: 110px; }
.savebar { display: flex; align-items: center; gap: .8rem; }
.savebar .unsaved { display: none; color: var(--mid); font-weight: 600; font-size: .86rem; }
form.dirty .savebar { position: sticky; bottom: 0; z-index: 5; background: var(--panel); padding: .6rem 0; border-top: 1px solid var(--line); }
form.dirty .savebar .unsaved { display: inline; }
@media (max-width: 900px) { nav.toc { position: static; margin-top: 0; } }

/* Mots-clés : ajout libellé, interrupteur actif/inactif, suppression en lien (cibles de 24 px au moins) */
form.kwadd { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) 7rem auto; gap: .75rem; align-items: end; }
form.kwadd label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .88rem; }
form.kwadd label small { font-weight: 400; color: var(--muted); }
.kwfilters input[type=search] { flex: 0 1 320px; }
table.kwlist td { vertical-align: middle; }
table.kwlist button.link { min-height: 24px; padding: .15rem .3rem; }
/* 250 liens rouges alourdiraient la page : gris, rouges au survol de la ligne ou au clavier */
table.kwlist button.link.danger { color: var(--muted); text-decoration-color: var(--line-strong); }
table.kwlist tr:hover button.link.danger, table.kwlist button.link.danger:focus-visible { color: var(--bad); text-decoration-color: currentColor; }
label.switch { position: relative; display: inline-block; width: 34px; height: 20px; cursor: pointer; vertical-align: middle; }
label.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
label.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background .1s; }
label.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .1s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
label.switch input:checked + span { background: linear-gradient(135deg, #00a383, var(--ok)); }
label.switch input:checked + span::after { transform: translateX(14px); }
label.switch input:focus-visible + span { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
@media (max-width: 900px) { form.kwadd { grid-template-columns: minmax(0, 1fr); } }

/* Mise en route : une étape par ligne, état à gauche (fait, à faire, en attente, sans contrôle) */
.setuppanel { max-width: 860px; }
ol.setup { list-style: none; margin: 0; padding: 0; }
ol.setup > li { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) auto; gap: .4rem 1rem; align-items: start; padding: .8rem 0; border-top: 1px solid var(--line-soft); }
ol.setup > li:first-child { border-top: 0; padding-top: .2rem; }
ol.setup h3 { margin: 0 0 .15rem; font-size: .98rem; font-weight: 600; }
ol.setup p { margin: 0; }
ol.setup p + p { margin-top: .3rem; }
ol.setup li.done h3 { color: var(--muted); }
.setupstate { font-family: var(--mono); font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: .15rem .45rem; border-radius: var(--radius); border: 1px solid var(--line); justify-self: start; white-space: nowrap; }
.setupstate.done { color: var(--ok); border-color: #a8e0d2; background: #e6f7f2; }
.setupstate.todo { color: var(--ink); border-color: var(--ink); }
.setupstate.waiting { color: #7a3e00; border-color: #e3cfa5; background: #f6ead2; }
.setupstate.manual { color: var(--muted); }
.setupbar { height: 8px; background: var(--line-soft); border-radius: 999px; overflow: hidden; margin: .2rem 0 1rem; }
.setupbar span { display: block; height: 100%; border-radius: 999px; background: var(--grad-accent); box-shadow: 0 0 12px rgba(0, 255, 204, .5); }
@media (max-width: 700px) { ol.setup > li { grid-template-columns: minmax(0, 1fr); } }

/* Animations de survol coupées si l'utilisateur réduit les animations */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .card:hover, button.primary:hover, .button.primary:hover { transform: none; }
}
