/* Studio — charte LaConteuse (mêmes couleurs, mêmes polices, deux thèmes), mise en page d'outil : une colonne,
   des filets, peu de boîtes. Les valeurs viennent de la charte de l'appli (theme.css de histoires-ia). */
:root {
  --bg: #f9f6f0; --surface: #ffffff; --surface-2: #f0ebe2; --ink: #2d2d2d; --muted: #6b645c; --line: #e6ded2;
  --accent: #d97757; --accent-text: #b4563a; --accent-soft: #f8e6dd; --danger: #b8432f; --danger-soft: #fbe8e3;
  --good: #27634a; --f-ui: 'Fredoka', ui-rounded, system-ui, sans-serif; --f-story: 'Literata', Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1a1816; --surface: #24211e; --surface-2: #2d2925; --ink: #e8e4db; --muted: #a59d91; --line: #3a3530;
    --accent-text: #eb9a7e; --accent-soft: #3b2a22; --danger: #f0a08c; --danger-soft: #3a221c; --good: #8ad1b2; color-scheme: dark; }
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { color: var(--ink); font: 400 17px/1.5 var(--f-ui); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
code { font: 500 14px/1.4 ui-monospace, Menlo, monospace; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }
.wrap { width: 100%; max-width: 1040px; margin-inline: auto; padding-inline: max(20px, env(safe-area-inset-left)) max(20px, env(safe-area-inset-right)); }
main.wrap { display: flex; flex-direction: column; gap: 20px; padding-block: 32px 72px; }

.top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 8px 24px; flex-wrap: wrap; padding-block: 8px; }
.brand { font: 600 21px/1 var(--f-ui); color: var(--ink); text-decoration: none; margin-right: auto; }
.brand span { color: var(--muted); font-weight: 400; }
.top nav { display: flex; gap: 4px 20px; flex-wrap: wrap; }
.top nav a { display: inline-flex; align-items: center; min-height: 48px; color: var(--muted); text-decoration: none; font: 500 15px/1 var(--f-ui); }
.top nav a[aria-current="page"], .top nav a:hover { color: var(--accent-text); }

h1 { font: 600 32px/1.12 var(--f-ui); letter-spacing: -.015em; text-wrap: balance; }
h2 { font: 600 24px/1.2 var(--f-ui); letter-spacing: -.01em; }
h3 { font: 600 18px/1.25 var(--f-ui); margin-top: 12px; }
h2 span, h3 span { color: var(--muted); font-weight: 400; }
h3 span { font-size: 15px; }
.lead { color: var(--muted); font-size: 18px; text-wrap: pretty; }
.small, small { font-size: 14px; color: var(--muted); }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
section { display: flex; flex-direction: column; gap: 14px; padding-top: 28px; margin-top: 12px; border-top: 2px solid var(--ink); }
.column { max-width: 420px; margin: 24px auto 0; border-top: 0; padding-top: 0; gap: 18px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; min-height: 48px; padding: 0 18px; border-radius: 9999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font: 500 15px/1 var(--f-ui); }
.chip[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 28px; }
.kpis li { display: flex; flex-direction: column; gap: 2px; padding: 14px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.kpis b { font: 600 30px/1.1 var(--f-ui); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpis.small b { font-size: 24px; }
.kpis span { color: var(--muted); font-size: 15px; }
.up { color: var(--good); } .down { color: var(--danger); }

.chart { width: 100%; height: auto; max-height: 240px; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font: 400 12px var(--f-ui); }
.chart .bar { fill: var(--accent); }
.chart .mark { fill: var(--ink); }
.chart .mark-line { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 4; opacity: .5; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }

.table { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 14px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; font-variant-numeric: tabular-nums; }
th { color: var(--muted); font-weight: 500; font-size: 14px; }
td.wrap { white-space: normal; min-width: 220px; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.narrow { max-width: 420px; }
label { display: flex; flex-direction: column; gap: 8px; font: 500 15px/1.3 var(--f-ui); }
.input { width: 100%; height: 56px; padding: 0 18px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: 400 17px/1 var(--f-ui); outline: none; }
.input:focus { border-color: var(--accent); }
.cta { height: 60px; border: 0; border-radius: 9999px; background: var(--accent); color: #fff; font: 600 19px/1 var(--f-ui); cursor: pointer; }
.btn { align-self: flex-start; min-height: 48px; padding: 0 22px; border-radius: 9999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: 500 16px/1 var(--f-ui); cursor: pointer; }
.btn-text { border: 0; background: none; color: var(--muted); font: 500 15px/1 var(--f-ui); min-height: 48px; cursor: pointer; }
.alert { padding: 12px 16px; border-radius: 16px; background: var(--danger-soft); color: var(--danger); font-weight: 500; }
.ok { padding: 12px 16px; border-radius: 16px; background: var(--accent-soft); font-weight: 500; }
.empty { padding: 18px 0; color: var(--muted); }
.qr { align-self: center; border-radius: 16px; background: #fff; }

.journal li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 4px 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.journal time { color: var(--muted); font-variant-numeric: tabular-nums; }
.journal .alerte span, .journal .erreur span { color: var(--danger); font-weight: 500; }
@media (max-width: 600px) { h1 { font-size: 28px; } h2 { font-size: 21px; } .journal li { grid-template-columns: 1fr; } .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
