/* Project Integration — SyNArC (charte graphique v2) */
@font-face { font-family: "Space Grotesk"; src: url("../fonts/space-grotesk.woff2") format("woff2"); font-weight: 500 700; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  --nuit: #0f1e2e;
  --turquoise: #14b8a6;
  --turquoise-clair: #2dd4bf;
  --turquoise-fonce: #0f766e;
  --ciel: #0ea5e9;
  --orange: #ff8a1f;
  --lagon: #e6f7f5;
  --surface-100: #f5f8f9;
  --surface-200: #edf2f4;
  --surface-300: #ffffff;
  --ink: #0f1e2e;
  --ink-muted: #4a5b68;
  --line: #d5e0e4;
  --line-strong: #7c8f9b;
  --error: #b3261e;
  --error-bg: #fdecea;
  --warning: #9a5b00;
  --warning-bg: #fff4e0;
  --info: #0369a1;
  --info-bg: #e8f4fb;
  --success: #2e7d4f;
  --success-bg: #e7f5ec;
  --radius-sm: 4px; --radius-md: 8px; --radius-lg: 14px;
  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-sans: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", Consolas, ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-sans); font-size: 15px; line-height: 1.55; color: var(--ink); background: var(--surface-100); -webkit-font-smoothing: antialiased; }
a { color: var(--turquoise-fonce); }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--ciel); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 28px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; font-weight: 600; letter-spacing: 0; }
p { margin: 0; }
code, .mono { font-family: var(--font-mono); font-size: 13px; }
.muted { color: var(--ink-muted); }
.small { font-size: 13px; }
.label { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--turquoise-fonce); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Structure */
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.topbar { background: var(--nuit); color: #fff; }
.topbar .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 14px; color: #fff; text-decoration: none; }
.brand img { height: 34px; width: auto; }
.brand .app { font-family: var(--font-display); font-weight: 600; font-size: 15px; padding-left: 14px; border-left: 1px solid rgba(255,255,255,.25); color: #cfe0e8; white-space: nowrap; }
.nav { display: flex; align-items: center; gap: 6px; }
.nav a { color: #dbe7ee; text-decoration: none; font-weight: 500; padding: 8px 12px; border-radius: var(--radius-md); }
.nav a:hover, .nav a.active { background: rgba(255,255,255,.08); color: #fff; }
.user-chip { display: flex; align-items: center; gap: 10px; color: #dbe7ee; font-size: 14px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--turquoise); color: var(--nuit); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.user-chip a { color: #9fb0bc; font-size: 13px; }
main { padding: 32px 0 64px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head .sub { margin-top: 6px; color: var(--ink-muted); }
.breadcrumb { font-size: 13px; color: var(--ink-muted); margin-bottom: 8px; }
.breadcrumb a { color: var(--ink-muted); }
footer.app-footer { border-top: 1px solid var(--line); padding: 20px 0; font-size: 13px; color: var(--ink-muted); }

/* Cartes */
.card { background: var(--surface-300); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; }
.card + .card, .stack > * + * { margin-top: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; align-items: start; }
.grid-2 > * + * { margin-top: 0; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius-md); border: 1.5px solid transparent; font: inherit; font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, color .15s; white-space: nowrap; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--turquoise-fonce); color: #fff; }
.btn-primary:hover { background: #0b5f59; }
.btn-accent { background: var(--orange); color: var(--nuit); }
.btn-accent:hover { background: #f07a0c; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--turquoise-fonce); color: var(--turquoise-fonce); }
.btn-danger { background: transparent; color: var(--error); border-color: #e3b1ad; }
.btn-danger:hover { background: var(--error-bg); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-ms { background: #fff; color: #1b1b1b; border-color: #8c8c8c; padding: 11px 18px; font-size: 15px; }
.btn-ms:hover { background: #f3f3f3; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
form.inline { display: inline; }

/* Formulaires */
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field small { display: block; color: var(--ink-muted); font-size: 12.5px; margin-top: 4px; }
input[type=text], input[type=email], input[type=search], input[type=number], input[type=password], textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1.5px solid var(--line-strong); border-radius: var(--radius-md); padding: 9px 12px; }
input:focus, textarea:focus, select:focus { border-color: var(--turquoise-fonce); outline: none; box-shadow: 0 0 0 3px rgba(20,184,166,.18); }
textarea { min-height: 70px; resize: vertical; }
.field.has-error input, .field.has-error textarea { border-color: var(--error); }
.field-error { color: var(--error); font-size: 13px; margin-top: 4px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 12px; }
.dropzone { position: relative; display: block; border: 2px dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--surface-100); padding: 28px 20px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--turquoise); background: var(--lagon); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .dz-icon { width: 36px; height: 36px; margin: 0 auto 10px; color: var(--turquoise-fonce); }
.dropzone strong { display: block; font-size: 15px; }
.dropzone .dz-name { margin-top: 8px; font-weight: 600; color: var(--turquoise-fonce); }

/* Messages */
.flash { border-radius: var(--radius-md); padding: 12px 16px; margin-bottom: 16px; border: 1px solid; font-size: 14px; }
.flash-success { background: var(--success-bg); border-color: #b5dcc3; color: #1e5a37; }
.flash-error { background: var(--error-bg); border-color: #f0bcb8; color: #8c1d18; }
.flash-info { background: var(--info-bg); border-color: #b8dcf0; color: #0b4a6f; }
.notes { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.notes li { font-size: 13.5px; padding: 8px 12px; border-radius: var(--radius-md); background: var(--surface-100); border-left: 3px solid var(--line-strong); }
.notes li.warning { border-left-color: var(--orange); background: var(--warning-bg); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.b-error { background: var(--error-bg); color: var(--error); }
.b-warning { background: var(--warning-bg); color: var(--warning); }
.b-info { background: var(--info-bg); color: var(--info); }
.b-success { background: var(--success-bg); color: var(--success); }
.b-neutral { background: var(--surface-200); color: var(--ink-muted); }
.b-review-to_review { background: #fff1e5; color: #b4530a; }
.b-review-validated { background: var(--success-bg); color: var(--success); }
.b-review-to_fix { background: var(--error-bg); color: var(--error); }
.b-client { background: #fff1e5; color: #b4530a; }
.b-consultant { background: var(--lagon); color: var(--turquoise-fonce); }

/* Tableaux */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--ink-muted); background: var(--surface-100); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafcfc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-link { color: var(--ink); text-decoration: none; font-weight: 600; }
.row-link:hover { color: var(--turquoise-fonce); text-decoration: underline; }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-muted); }
.empty img { width: 64px; margin: 0 auto 14px; opacity: .9; }

/* Statistiques */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 14px 16px; }
.stat .v { font-family: var(--font-display); font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat .k { font-size: 12.5px; color: var(--ink-muted); margin-top: 2px; }
.stat.s-error .v { color: var(--error); }
.stat.s-warning .v { color: var(--warning); }
.stat.s-ok .v { color: var(--success); }

/* Onglets */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 3px solid transparent; color: var(--ink-muted); text-decoration: none; font-weight: 600; font-size: 14px; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--turquoise); }
.tab.absent { opacity: .55; }
.count { font-size: 12px; font-weight: 700; min-width: 22px; padding: 1px 7px; border-radius: 999px; text-align: center; }
.count.c-error { background: var(--error); color: #fff; }
.count.c-ok { background: var(--success-bg); color: var(--success); }
.count.c-neutral { background: var(--surface-200); color: var(--ink-muted); }
.filters { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-bottom: 14px; font-size: 14px; }
.toggle { display: inline-flex; border: 1.5px solid var(--line-strong); border-radius: var(--radius-md); overflow: hidden; }
.toggle a { padding: 6px 12px; text-decoration: none; color: var(--ink); font-size: 13px; font-weight: 600; }
.toggle a.on { background: var(--nuit); color: #fff; }

/* Grille de données */
.data-grid { max-height: 70vh; }
.data-grid table { font-size: 13px; }
.data-grid th { position: sticky; top: 0; z-index: 2; vertical-align: bottom; }
.data-grid th .col { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--line-strong); }
.data-grid th .req { color: var(--turquoise-fonce); }
.data-grid td, .data-grid th { padding: 6px 10px; border-right: 1px solid #edf1f3; max-width: 260px; }
.data-grid td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.data-grid .rownum { position: sticky; left: 0; z-index: 1; background: var(--surface-100); font-family: var(--font-mono); font-size: 12px; color: var(--ink-muted); text-align: right; }
.data-grid th.rownum { z-index: 3; }
.cell-error { background: var(--error-bg) !important; box-shadow: inset 0 0 0 1.5px #e58a83; color: #7d1a15; cursor: help; }
.cell-warning { background: var(--warning-bg) !important; box-shadow: inset 0 0 0 1.5px #f2c27a; cursor: help; }
.cell-info { background: var(--info-bg) !important; cursor: help; }
.cell-empty::after { content: "vide"; color: #b8c5cc; font-style: italic; font-size: 11px; }
.issues td:first-child { font-family: var(--font-mono); font-size: 12.5px; white-space: nowrap; }
.issues .colname { font-weight: 600; }
.issues .letter { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-muted); }

/* Liens client */
.link-box { display: flex; gap: 8px; align-items: center; }
.link-box input { font-family: var(--font-mono); font-size: 12.5px; background: var(--surface-100); }
details.panel { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 0 16px; background: #fff; }
details.panel > summary { cursor: pointer; padding: 12px 0; font-weight: 600; list-style: none; display: flex; align-items: center; justify-content: space-between; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after { content: "+"; font-size: 20px; color: var(--ink-muted); }
details.panel[open] > summary::after { content: "–"; }
details.panel[open] { padding-bottom: 16px; }

/* Pages publiques (connexion, dépôt client) */
.public { min-height: 100vh; display: flex; flex-direction: column; background: var(--nuit); position: relative; overflow: hidden; }
.public::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(14,165,233,.30) 1.4px, transparent 1.5px); background-size: 32px 32px; mask-image: linear-gradient(110deg, transparent 30%, #000 85%); -webkit-mask-image: linear-gradient(110deg, transparent 30%, #000 85%); }
.public::after { content: ""; position: absolute; width: 700px; height: 700px; right: -220px; top: -260px; background: radial-gradient(circle, rgba(20,184,166,.28), transparent 65%); }
.public-main { position: relative; z-index: 1; flex: 1; display: grid; place-items: center; padding: 40px 16px; }
.public-card { width: 100%; max-width: 520px; background: #fff; border-radius: 18px; padding: 36px 36px 32px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.45); }
.public-card .logo { height: 46px; width: auto; margin-bottom: 26px; }
.public-card h1 { font-size: 24px; margin-bottom: 8px; }
.public-card .lead { color: var(--ink-muted); margin-bottom: 24px; }
.public-foot { position: relative; z-index: 1; text-align: center; color: #8ea3b1; font-size: 12.5px; padding: 18px; }
.receipt { background: var(--lagon); border-radius: var(--radius-md); padding: 16px 18px; margin: 20px 0; }
.receipt dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.receipt dt { color: var(--ink-muted); }
.receipt dd { margin: 0; font-weight: 600; word-break: break-word; }
.check-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--success-bg); color: var(--success); display: grid; place-items: center; margin-bottom: 18px; }
.check-icon svg { width: 30px; height: 30px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--ink-muted); font-size: 12px; margin: 22px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

@media (max-width: 960px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .brand .app { display: none; }
  .user-chip span { display: none; }
  .public-card { padding: 28px 22px; }
  h1 { font-size: 24px; }
}

/* Utilitaires */
.btn-block { width: 100%; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 32px; }
.mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.w-search { max-width: 320px; }
.user-chip a.user-name { color: #dbe7ee; font-size: 14px; text-decoration: none; }
.user-chip a.user-name:hover { color: #fff; text-decoration: underline; }
@media (max-width: 640px) { .user-chip a.user-name { display: none; } }
