/* Charte go://create Solutions — voir _projet/CHARTE_GRAPHIQUE.md */
:root {
  --brand: #CB001A;
  --brand-hover: #A90016;
  --brand-soft: #FFF0F2;
  --ink: #242426;
  --muted: #68686E;
  --bg: #F7F7F8;
  --surface: #FFFFFF;
  --border: #DEDEE2;
  --success: #23724E;
  --error: #A51B2C;
  --warning: #86620C;
  --radius: 4px;
  --sidebar: 220px;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
.mono, code { font-family: var(--mono); }
code { font-size: 11px; color: var(--muted); word-break: break-all; }
.muted { color: var(--muted); }
svg.lucide { width: 18px; height: 18px; stroke-width: 1.7; flex: none; }

/* Structure */
.layout { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border);
}
.brand { padding: 20px 16px 16px; border-bottom: 1px solid var(--border); }
.logo { display: block; width: 100%; max-width: 180px; height: auto; object-fit: contain; }
.product { margin-top: 10px; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: normal; color: var(--muted); }
.main-nav { display: flex; flex-direction: column; padding: 12px 8px; gap: 2px; flex: 1; }
.main-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius);
  color: var(--ink); text-decoration: none; font-weight: 500;
}
.main-nav a:hover { background: var(--bg); }
.main-nav a.active { background: var(--brand-soft); color: var(--brand); }
.sidebar-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }

.workspace { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  height: 48px; padding: 0 28px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.breadcrumb { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.breadcrumb span:last-child { color: var(--ink); font-weight: 500; }
.breadcrumb svg.lucide { width: 14px; height: 14px; }
.tech { font-size: 11px; color: var(--muted); }
main { padding: 24px 28px 48px; }

/* Typographie */
.overline { font-size: 11px; color: var(--brand); text-transform: uppercase; }
h1 { margin: 2px 0 8px; font-size: 30px; font-weight: 600; line-height: 1.2; }
h2 { margin: 0 0 12px; font-size: 19px; font-weight: 600; color: var(--brand); }
h3 { margin: 20px 0 8px; font-size: 14px; font-weight: 600; }
h4 { margin: 0 0 4px; font-size: 14px; font-weight: 600; }

/* Regroupements */
.group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; margin-top: 16px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; align-items: end; margin-bottom: 12px; }
.grid-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; }
.checks { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.checks label { display: flex; align-items: center; gap: 6px; font-weight: 400; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 12px; padding: 8px 12px 0; }
legend { padding: 0 4px; font-weight: 500; }
.actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--border); }
.actions .muted { margin-right: auto; }

/* Commandes */
input, select, textarea {
  height: 32px; padding: 0 8px;
  font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
textarea.json-editor { display: block; width: 100%; min-height: 112px; height: auto; padding: 12px; line-height: 1.5; resize: vertical; }
select[multiple] { height: auto; padding: 4px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
input[type="checkbox"] { height: auto; accent-color: var(--brand); }
button, .button {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  font: inherit; font-weight: 500; text-decoration: none; cursor: pointer;
  color: #fff; background: var(--brand); border: 1px solid var(--brand); border-radius: var(--radius);
}
button:hover, .button:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
button.secondary, .button.secondary { color: var(--ink); background: var(--surface); border-color: var(--border); }
button.secondary:hover, .button.secondary:hover { background: var(--bg); }
button.danger { color: var(--error); background: var(--surface); border-color: var(--error); }
button.danger:hover { color: #fff; background: var(--error); }
button.small { height: 26px; padding: 0 8px; font-size: 12px; }
button.small svg.lucide { width: 15px; height: 15px; }
button:disabled { opacity: .5; cursor: not-allowed; }
.wide { grid-column: 1 / -1; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.source-actions { margin: 12px 0; }
.status-error { min-height: 1.4em; color: var(--error); }
.auth-view {
  display: grid; place-items: center; min-height: 100vh; padding: 28px;
  background-color: var(--bg);
  background-image: repeating-linear-gradient(90deg, transparent 0, transparent 119px, #DEDEE24D 120px);
}
.auth-shell { width: min(100%, 440px); }
.auth-brand { padding: 0 20px 24px; }
.auth-brand .logo { max-width: 180px; }
.auth-brand .product { margin-top: 8px; }
.auth-form { display: grid; gap: 10px; }
.auth-form h1 { font-size: 24px; }
.auth-form input { width: 100%; }
.auth-form .actions { margin-top: 6px; }

/* Tableaux */
.scroll { max-height: 480px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); margin: 8px 0 16px; }
table { border-collapse: collapse; width: 100%; background: var(--surface); }
.scroll table { margin: 0; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { position: sticky; top: 0; z-index: 1; background: var(--bg); color: var(--muted); font-weight: 500; font-size: 12px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Badges / états */
.badge { display: inline-block; padding: 1px 6px; border-radius: var(--radius); font-size: 11px; font-weight: 500; font-family: var(--mono); background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.badge.ok, .status-done { color: var(--success); }
.badge.ko, .status-error, .status-interrupted { color: var(--error); }
.status-running, .status-partial, .status-pending { color: var(--warning); }
.badge[class*="status-"] { border-color: currentColor; background: var(--surface); }

/* Onglets du rapport */
#tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin: -4px 0 16px; }
#tabs button {
  height: 36px; color: var(--muted); background: transparent; border: 0;
  border-bottom: 2px solid transparent; border-radius: 0;
}
#tabs button:hover { color: var(--ink); background: transparent; }
#tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }

/* Métriques */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; }
.card { padding: 10px 14px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 0 -1px -1px 0; }
.card .v { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.card .l { color: var(--muted); font-size: 11px; }
.cols2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 0 24px; }

/* Graphiques */
.bars { display: grid; gap: 4px; margin: 8px 0 16px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 2fr) 3fr 80px; gap: 8px; align-items: center; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--bg); border-radius: 2px; height: 12px; }
.bar-fill { background: var(--brand); height: 100%; border-radius: 2px; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; }
.columns { display: flex; align-items: flex-end; gap: 1px; height: 180px; border-bottom: 1px solid var(--border); margin: 8px 0 4px; }
.columns .col { flex: 1; min-width: 1px; background: var(--brand); }
.columns .col.alt { background: var(--muted); }
.axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; font-family: var(--mono); }
.heatmap { display: grid; grid-template-columns: 40px repeat(24, 1fr); gap: 2px; font-size: 10px; margin: 8px 0 16px; }
.heatmap .cell { height: 18px; border-radius: 2px; background: var(--brand); }
.heatmap .lbl { color: var(--muted); text-align: center; font-family: var(--mono); }

/* Suggestions */
.suggestion { border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 12px; }
.suggestion.moyenne { border-left-color: var(--warning); }
.suggestion.basse { border-left-color: var(--border); }
.suggestion ul { margin: 6px 0; padding-left: 18px; }
.tag { display: inline-block; padding: 1px 6px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--border); font-size: 11px; margin-right: 4px; }
.tag.haute { color: var(--brand); background: var(--brand-soft); border-color: var(--brand-soft); }
.tag.moyenne { color: var(--warning); }

pre { background: var(--bg); color: var(--ink); border: 1px solid var(--border); padding: 12px; border-radius: var(--radius); overflow: auto; max-height: 400px; font-family: var(--mono); font-size: 11px; }
details { margin-bottom: 6px; }
summary { cursor: pointer; }

/* Responsive */
@media (max-width: 1120px) {
  :root { --sidebar: 180px; }
  main { padding: 20px; }
  .topbar { padding: 0 20px; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { border-bottom: 0; padding: 10px 16px; }
  .logo { max-width: 120px; }
  .main-nav { flex-direction: row; flex: 1 1 100%; padding: 4px 8px; overflow-x: auto; }
  .sidebar-foot { margin-left: auto; padding: 0; border-top: 0; }
  .topbar { height: auto; padding: 8px 16px; flex-wrap: wrap; }
  main { padding: 16px; }
  h1 { font-size: 24px; }
  .grid-form, .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols2 { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: minmax(80px, 1fr) 1fr 60px; }
}
