/* Cauta — design tokens v1.0
   Thème clair par défaut ; thème sombre via [data-theme="dark"] ou préférence système.
   Chemins des polices relatifs au kit (05_Typographie) : adaptez-les dans votre projet. */

@font-face { font-family: "Manrope"; src: url("fonts/Manrope-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("fonts/Manrope-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("fonts/Manrope-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Sans 3"; src: url("fonts/SourceSans3-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Sans 3"; src: url("fonts/SourceSans3-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Source Sans 3"; src: url("fonts/SourceSans3-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Sans 3"; src: url("fonts/SourceSans3-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/IBMPlexMono-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/IBMPlexMono-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }

:root {
  --paper: #f7f3eb;
  --surface: #ffffff;
  --chalk: #e7e0d5;
  --line: #dcd3c5;
  --border-control: #8c8276;
  --ink: #27252d;
  --ink-muted: #655d55;
  --accent: #c0472c;
  --accent-hover: #a23a22;
  --on-accent: #ffffff;
  --success: #28704e;
  --success-bg: #e2eee6;
  --warning: #8a5a00;
  --warning-bg: #f6ead0;
  --danger: #b42318;
  --danger-bg: #f9e3df;
  --focus: #27252d;
  --brand-ink: #27252d;
  --brand-paper: #f7f3eb;
  --brand-terracotta: #c0472c;
  --shadow-overlay: 0 8px 24px rgba(39, 37, 45, 0.14);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --radius-0: 0px;
  --radius-sm: 2px;
  --radius-md: 4px;
  --control-sm: 32px;
  --control-md: 40px;
  --control-lg: 48px;
  --frame-mark: 12px;
  --frame-stroke: 2px;
  --content-max: 1200px;
  --measure: 68ch;
  --font-display: "Manrope", "Segoe UI", system-ui, sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --paper: #1c1b20;
  --surface: #25242a;
  --chalk: #2f2d35;
  --line: #3d3a43;
  --border-control: #7d7681;
  --ink: #f2eee6;
  --ink-muted: #b5ada2;
  --accent: #e8775a;
  --accent-hover: #f08e74;
  --on-accent: #1c1b20;
  --success: #7bc9a0;
  --success-bg: #1e3328;
  --warning: #e3b356;
  --warning-bg: #3a2e14;
  --danger: #f28b7d;
  --danger-bg: #3f201d;
  --focus: #f2eee6;
  --brand-ink: #27252d;
  --brand-paper: #f7f3eb;
  --brand-terracotta: #c0472c;
  --shadow-overlay: 0 8px 24px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #1c1b20;
  --surface: #25242a;
  --chalk: #2f2d35;
  --line: #3d3a43;
  --border-control: #7d7681;
  --ink: #f2eee6;
  --ink-muted: #b5ada2;
  --accent: #e8775a;
  --accent-hover: #f08e74;
  --on-accent: #1c1b20;
  --success: #7bc9a0;
  --success-bg: #1e3328;
  --warning: #e3b356;
  --warning-bg: #3a2e14;
  --danger: #f28b7d;
  --danger-bg: #3f201d;
  --focus: #f2eee6;
  --brand-ink: #27252d;
  --brand-paper: #f7f3eb;
  --brand-terracotta: #c0472c;
  --shadow-overlay: 0 8px 24px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

/* Styles typographiques */
.display { font-family: var(--font-display); font-size: 44px; line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; }
.page-title { font-family: var(--font-display); font-size: 32px; line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; }
.section-title { font-family: var(--font-display); font-size: 22px; line-height: 1.25; font-weight: 600; }
.subtitle { font-family: var(--font-display); font-size: 17px; line-height: 1.35; font-weight: 600; }
.body { font-family: var(--font-body); font-size: 15px; line-height: 1.6; font-weight: 400; }
.body-strong { font-family: var(--font-body); font-size: 15px; line-height: 1.6; font-weight: 600; }
.body-small { font-family: var(--font-body); font-size: 13px; line-height: 1.5; font-weight: 400; }
.label { font-family: var(--font-body); font-size: 12px; line-height: 1.4; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.caption { font-family: var(--font-body); font-size: 12px; line-height: 1.45; font-weight: 400; }
.data { font-family: var(--font-mono); font-size: 13px; line-height: 1.4; font-weight: 500; }
.data-small { font-family: var(--font-mono); font-size: 12px; line-height: 1.4; font-weight: 400; }

/* =====================================================================
   Cauta UI — feuille de style des composants v1.0
   Prérequis : cauta-tokens.css (variables, polices, styles typographiques).
   Toutes les valeurs viennent des tokens. Préfixe des classes : .ca-
   ===================================================================== */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--ink); margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--border-control); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ca-muted { color: var(--ink-muted); }
.ca-mono { font-family: var(--font-mono); }
.ca-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.ca-stack { display: flex; flex-direction: column; gap: var(--space-3); }

/* ---------- Logo (SVG inline qui suit le thème) ---------- */
.ca-logo { display: block; height: auto; }
.ca-logo .ca-logo-ink { stroke: var(--ink); }
.ca-logo .ca-logo-bar { stroke: var(--accent); }
.ca-logo .ca-logo-name { fill: var(--ink); }
.ca-logo .ca-logo-endorse { fill: var(--ink-muted); }
.ca-logo.is-mono .ca-logo-bar { stroke: var(--ink); }

/* ---------- Boutons ---------- */
.ca-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: var(--control-md); padding: 0 var(--space-4); border: 1.5px solid transparent; border-radius: var(--radius-sm); font: 600 15px/1 var(--font-body); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color .12s ease, border-color .12s ease; }
.ca-btn:disabled, .ca-btn[aria-disabled="true"] { cursor: not-allowed; background: var(--chalk); border-color: var(--chalk); color: var(--ink-muted); }
.ca-btn-sm { height: var(--control-sm); padding: 0 var(--space-3); font-size: 13px; }
.ca-btn-lg { height: var(--control-lg); padding: 0 var(--space-6); font-size: 16px; }
.ca-btn-primary { background: var(--accent); color: var(--on-accent); }
.ca-btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.ca-btn-secondary { background: transparent; color: var(--ink); border-color: var(--border-control); }
.ca-btn-secondary:hover:not(:disabled) { border-color: var(--ink); background: var(--surface); }
.ca-btn-quiet { background: transparent; color: var(--ink); padding: 0 var(--space-2); }
.ca-btn-quiet:hover:not(:disabled) { background: var(--chalk); }
.ca-btn svg { width: 16px; height: 16px; flex: none; }

/* ---------- Icônes ---------- */
.ca-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: square; stroke-linejoin: miter; }

/* ---------- Statuts ---------- */
.ca-status { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 var(--space-2); border-radius: var(--radius-sm); font: 600 13px/1 var(--font-body); white-space: nowrap; }
.ca-status .ca-icon { width: 14px; height: 14px; stroke-width: 2; }
.ca-status-ok { background: var(--success-bg); color: var(--success); }
.ca-status-review { background: var(--warning-bg); color: var(--warning); }
.ca-status-action { background: var(--danger-bg); color: var(--danger); }
.ca-status-unknown { background: var(--chalk); color: var(--ink-muted); }

/* ---------- Référence ---------- */
.ca-ref { display: inline-flex; align-items: center; gap: var(--space-1); padding: 2px 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: 500 12px/1.4 var(--font-mono); white-space: nowrap; }

/* ---------- Cadre de contrôle (motif de marque) ---------- */
.ca-frame { position: relative; padding: var(--space-4); }
.ca-frame::before, .ca-frame::after, .ca-frame > .ca-frame-b::before, .ca-frame > .ca-frame-b::after { content: ""; position: absolute; width: var(--frame-mark); height: var(--frame-mark); border: 0 solid var(--border-control); pointer-events: none; }
.ca-frame::before { top: 0; left: 0; border-top-width: var(--frame-stroke); border-left-width: var(--frame-stroke); }
.ca-frame::after { top: 0; right: 0; border-top-width: var(--frame-stroke); border-right-width: var(--frame-stroke); }
.ca-frame > .ca-frame-b::before { bottom: 0; left: 0; border-bottom-width: var(--frame-stroke); border-left-width: var(--frame-stroke); }
.ca-frame > .ca-frame-b::after { bottom: 0; right: 0; border-bottom-width: var(--frame-stroke); border-right-width: var(--frame-stroke); }
.ca-frame.is-active::before, .ca-frame.is-active::after, .ca-frame.is-active > .ca-frame-b::before, .ca-frame.is-active > .ca-frame-b::after { border-color: var(--accent); }
.ca-frame-label { display: block; margin-bottom: var(--space-2); font: 600 12px/1.4 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }
.ca-frame.is-active .ca-frame-label { color: var(--accent); }

/* ---------- Carte ---------- */
.ca-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-0); padding: var(--space-6); }
.ca-card-title { font: 600 17px/1.35 var(--font-display); margin-bottom: var(--space-1); }

/* ---------- Ligne de document ---------- */
.ca-doclist { border-top: 1px solid var(--line); }
.ca-doc { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: var(--space-3); align-items: start; padding: var(--space-3) var(--space-4); background: var(--surface); border-bottom: 1px solid var(--line); }
.ca-doc > .ca-icon { margin-top: 2px; color: var(--ink-muted); }
.ca-doc-title { font: 600 15px/1.35 var(--font-body); color: var(--ink); }
.ca-doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-1); color: var(--ink-muted); font: 400 13px/1.5 var(--font-body); }
.ca-doc-meta .ca-mono { font-size: 12px; }

/* ---------- Avis ---------- */
.ca-notice { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--line); background: var(--surface); }
.ca-notice > .ca-icon { color: var(--ink-muted); }
.ca-notice-warning { background: var(--warning-bg); border-color: transparent; }
.ca-notice-warning > .ca-icon { color: var(--warning); }
.ca-notice-title { font: 600 15px/1.4 var(--font-body); margin-bottom: 2px; }
.ca-notice-body { font: 400 14px/1.55 var(--font-body); }

/* ---------- Formulaires ---------- */
.ca-field { display: flex; flex-direction: column; gap: 6px; }
.ca-field-label { font: 600 14px/1.3 var(--font-body); color: var(--ink); }
.ca-field-help { font: 400 13px/1.45 var(--font-body); color: var(--ink-muted); }
.ca-field-error { font: 600 13px/1.45 var(--font-body); color: var(--danger); }
.ca-input, .ca-select, .ca-textarea { width: 100%; height: var(--control-md); padding: 0 var(--space-3); border: 1.5px solid var(--border-control); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: 400 15px/1.4 var(--font-body); }
.ca-textarea { height: auto; min-height: 96px; padding: var(--space-2) var(--space-3); resize: vertical; }
.ca-input::placeholder, .ca-textarea::placeholder { color: var(--ink-muted); }
.ca-input:hover, .ca-select:hover, .ca-textarea:hover { border-color: var(--ink); }
.ca-input:focus-visible, .ca-select:focus-visible, .ca-textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.ca-input[aria-invalid="true"] { border-color: var(--danger); }
.ca-input:disabled { background: var(--chalk); border-color: var(--chalk); color: var(--ink-muted); }
.ca-check { display: inline-flex; align-items: center; gap: var(--space-2); font: 400 15px/1.4 var(--font-body); cursor: pointer; }
.ca-check input { appearance: none; width: 18px; height: 18px; margin: 0; border: 1.5px solid var(--border-control); border-radius: var(--radius-sm); background: var(--surface); display: grid; place-content: center; cursor: pointer; }
.ca-check input:checked { background: var(--ink); border-color: var(--ink); }
.ca-check input:checked::after { content: ""; width: 9px; height: 5px; border: 2px solid var(--paper); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }

/* ---------- Tableau ---------- */
.ca-table-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--surface); }
.ca-table { width: 100%; border-collapse: collapse; font: 400 14px/1.45 var(--font-body); }
.ca-table th { text-align: left; padding: var(--space-2) var(--space-4); background: var(--chalk); font: 600 12px/1.4 var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); white-space: nowrap; }
.ca-table td { padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); vertical-align: middle; }
.ca-table td.num, .ca-table td.ca-mono { font: 400 13px/1.4 var(--font-mono); font-variant-numeric: tabular-nums; }
.ca-table tr:hover td { background: var(--paper); }

/* ---------- Onglets ---------- */
.ca-tabs { display: flex; gap: var(--space-6); border-bottom: 1px solid var(--line); }
.ca-tab { padding: var(--space-2) 0; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; font: 600 14px/1.4 var(--font-body); color: var(--ink-muted); cursor: pointer; }
.ca-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- Mise en page d'application ---------- */
.ca-app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.ca-sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: var(--space-6) var(--space-4); display: flex; flex-direction: column; gap: var(--space-8); }
.ca-nav { display: flex; flex-direction: column; gap: 2px; }
.ca-nav a { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); color: var(--ink-muted); font: 600 14px/1.3 var(--font-body); text-decoration: none; }
.ca-nav a:hover { background: var(--paper); color: var(--ink); }
.ca-nav a[aria-current="page"] { background: var(--chalk); color: var(--ink); box-shadow: inset 2px 0 0 var(--accent); }
.ca-main { padding: var(--space-8) var(--space-12); max-width: var(--content-max); width: 100%; }
.ca-page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-8); }
.ca-eyebrow { font: 600 12px/1.4 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }
@media (max-width: 820px) { .ca-app { grid-template-columns: 1fr; } .ca-sidebar { border-right: 0; border-bottom: 1px solid var(--line); } .ca-main { padding: var(--space-6) var(--space-4); } }

/* ---------- État vide ---------- */
.ca-empty { padding: var(--space-12) var(--space-6); text-align: center; border: 1px dashed var(--border-control); color: var(--ink-muted); }
.ca-empty-title { font: 600 17px/1.35 var(--font-display); color: var(--ink); margin-bottom: var(--space-1); }

/* ---------- Message éphémère ---------- */
.ca-toast { display: inline-flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--ink); color: var(--paper); border-radius: var(--radius-md); box-shadow: var(--shadow-overlay); font: 600 14px/1.4 var(--font-body); }

/* ---------- Copilote (réponse sourcée) ---------- */
.ca-answer { border-left: 0; padding: var(--space-4); background: var(--surface); border: 1px solid var(--line); }
.ca-answer-source { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--line); font: 400 13px/1.4 var(--font-body); color: var(--ink-muted); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
