/* Caly-Bornes Design System — CB-DS-1.0.0, CB-CHG-20260823-073.
   Source centrale des tokens et composants transversaux. Aucune règle métier. */
:root {
  /* Couleurs et surfaces */
  --bg-dark: #f8f9fa;
  --bg-panel: #ffffff;
  --bg-card: #f1f3f4;
  --surface-2: #f1f3f4;
  --surface: #ffffff;
  --surface2: #e8eaed;
  --surface3: #d6dae1;
  --border: #dadce0;
  --border-2: #e8eaed;
  --text: #202124;
  --text-muted: #5f6368;
  --text-faint: #6b7178;
  --text2: #5f6368;
  --text3: #80868b;
  --accent: #1a73e8;
  --accent-hover: #1967d2;
  --brand-700: #1967d2;
  --brand-500: #1a73e8;
  --brand-50: #e8f0fe;
  --brand-100: #d2e3fc;
  --success: #137333;
  --success-bg: #e6f4ea;
  --warning: #8a4b00;
  --warning-strong: #b06000;
  --warning-bg: #fef7e0;
  --danger: #c5221f;
  --danger-bg: #fce8e6;
  --info: #174ea6;
  --info-bg: #e8f0fe;

  /* Typographie */
  --font: "Google Sans", "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --font-mono: ui-monospace, "Roboto Mono", "Consolas", monospace;
  --type-xs: .72rem;
  --type-sm: .82rem;
  --type-md: .88rem;
  --type-lg: 1rem;
  --type-xl: 1.25rem;
  --type-2xl: 1.6rem;
  --line-compact: 1.25;
  --line-body: 1.5;
  --line-comfortable: 1.65;
  --weight-regular: 400;
  --weight-medium: 600;
  --weight-bold: 700;

  /* Espacements, formes et élévations */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --shadow-1: 0 1px 2px 0 rgba(60,64,67,.10), 0 1px 3px 1px rgba(60,64,67,.08);
  --shadow-2: 0 1px 3px 0 rgba(60,64,67,.14), 0 4px 8px 3px rgba(60,64,67,.08);
  --shadow-3: 0 4px 8px 0 rgba(60,64,67,.16), 0 8px 24px 8px rgba(60,64,67,.10);
  --touch-min: 44px;
  --control-min: 48px;
  color-scheme: light;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--font);
  background: var(--bg-dark);
  color: var(--text);
  height: 100vh;
  height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 14px;
  line-height: var(--line-body);
}
code { background: rgba(60,64,67,.08); padding: 1px 5px; border-radius: 4px; font-size: .85em; font-family: var(--font-mono); }
a.link { color: var(--accent); text-decoration: none; }
a.link:hover { text-decoration: underline; }
.muted { color: var(--text-muted); font-size: .85rem; }

/* Typographie et rythmes exposés par le catalogue. */
.cb-type-title { font-size: var(--type-2xl); line-height: var(--line-compact); font-weight: var(--weight-bold); }
.cb-type-heading { font-size: var(--type-xl); line-height: 1.35; font-weight: var(--weight-bold); }
.cb-type-body { font-size: var(--type-md); line-height: var(--line-body); }
.cb-type-caption { font-size: var(--type-xs); line-height: var(--line-body); color: var(--text-muted); }
.cb-stack { display: grid; gap: var(--space-4); }
.cb-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }

/* Cartes et panneaux. Les classes historiques restent des alias contractuels. */
.panel, .cb-card {
  background: var(--bg-panel); border: 1px solid var(--border-2); border-radius: var(--radius);
  padding: var(--space-5); margin-bottom: var(--space-4); box-shadow: var(--shadow-1);
}
.panel h3, .cb-card__title {
  font-size: .95rem; color: var(--text); font-weight: var(--weight-medium); margin-bottom: 10px;
  display: flex; align-items: center; gap: var(--space-2);
}
.panel h3 svg { width: 18px; height: 18px; color: var(--text-muted); }

/* Tableaux. */
table.grid, .cb-table {
  width: 100%; border-collapse: collapse; background: var(--bg-panel);
  border: 1px solid var(--border-2); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-1);
}
table.grid th, .cb-table th {
  text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); padding: 11px 15px; background: var(--surface-2); border-bottom: 1px solid var(--border-2);
}
table.grid td, .cb-table td { padding: 11px 15px; font-size: .87rem; border-bottom: 1px solid var(--border-2); color: var(--text); }
table.grid tbody tr:last-child td, .cb-table tbody tr:last-child td { border-bottom: none; }

/* Boutons. */
.btn, .cb-button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--touch-min);
  background: var(--accent); color: #fff; border: 1px solid transparent; padding: 9px 18px;
  border-radius: var(--radius-pill); cursor: pointer; font-size: .86rem; font-weight: var(--weight-medium);
  font-family: inherit; white-space: nowrap; transition: background .12s, box-shadow .12s, border-color .12s;
}
.btn svg, .cb-button svg { width: 16px; height: 16px; }
.btn:hover, .cb-button:hover { background: var(--accent-hover); box-shadow: var(--shadow-1); }
.btn:disabled, .btn[disabled], .cb-button:disabled, .btn-ghost:disabled, .btn-ghost[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; filter: grayscale(.3); }
.btn:disabled:hover, .btn[disabled]:hover, .cb-button:disabled:hover { background: var(--accent); }
.btn-block, .cb-button--block { width: 100%; padding: 11px; }
.btn-ghost, .cb-button--secondary {
  min-height: var(--touch-min); background: var(--bg-panel); color: var(--brand-700); border: 1px solid var(--border);
  padding: 8px 16px; border-radius: var(--radius-pill); cursor: pointer; font-size: .84rem;
  font-weight: var(--weight-medium); display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; font-family: inherit; white-space: nowrap;
}
.btn-ghost svg, .cb-button--secondary svg { width: 16px; height: 16px; }
.btn-ghost:hover, .cb-button--secondary:hover { color: var(--brand-700); background: var(--brand-50); border-color: #c6dafc; }
.btn-danger, .cb-button--danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn-danger:hover, .cb-button--danger:hover { background: #c5221f; }
.btn-sm, .cb-button--small { min-height: var(--touch-min); padding: 6px 13px; font-size: .78rem; }
.btn-sm svg, .cb-button--small svg { width: 15px; height: 15px; }

/* Messages et états. Le symbole et le texte doublent toujours la couleur. */
.cb-message {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-3);
  padding: var(--space-3) var(--space-4); border: 1px solid currentColor;
  border-radius: var(--radius-sm); line-height: var(--line-body);
}
.cb-message--success { color: var(--success); background: var(--success-bg); }
.cb-message--warning { color: var(--warning); background: var(--warning-bg); }
.cb-message--danger { color: var(--danger); background: var(--danger-bg); }
.cb-message--info { color: var(--info); background: var(--info-bg); }
.state-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 10px;
  border: 1px solid currentColor; border-radius: var(--radius-pill); font-size: .76rem;
  font-weight: var(--weight-bold); line-height: var(--line-compact); vertical-align: middle;
}
.state-chip__symbol {
  display: inline-grid; place-items: center; flex: 0 0 1.15em; min-width: 1.15em; height: 1.15em;
  border: 1px solid currentColor; border-radius: 50%; font-size: .82em; line-height: 1;
}
.state-chip__label { min-width: 0; overflow-wrap: anywhere; }
.state-chip--success { color: var(--success); background: var(--success-bg); }
.state-chip--warning { color: var(--warning); background: var(--warning-bg); }
.state-chip--danger { color: var(--danger); background: var(--danger-bg); }
.state-chip--info { color: var(--info); background: var(--info-bg); }
.state-chip--neutral { color: var(--text-muted); background: var(--surface-2); }

/* Catalogue humain, sans dépendance applicative. */
.cb-catalog { width: min(1120px, calc(100% - 32px)); margin: var(--space-6) auto; }
.cb-catalog__hero { margin-bottom: var(--space-6); }
.cb-catalog__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.cb-catalog .cb-card { min-width: 0; }
.cb-swatch { display: grid; grid-template-columns: 42px 1fr; align-items: center; gap: var(--space-2); }
.cb-swatch::before { content: ''; width: 42px; height: 42px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--swatch); }
.cb-swatch--accent { --swatch: var(--accent); }
.cb-swatch--success { --swatch: var(--success-bg); }
.cb-swatch--warning { --swatch: var(--warning-bg); }
.cb-swatch--danger { --swatch: var(--danger-bg); }
.cb-catalog table { box-shadow: none; }
@media (max-width: 680px) {
  .cb-catalog { width: min(100% - 20px, 1120px); margin: var(--space-3) auto; }
  .cb-catalog__grid { grid-template-columns: 1fr; }
  .panel, .cb-card { padding: var(--space-4); }
  .cb-catalog .cb-table { display: block; max-width: 100%; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
