@layer tokens {
  :root {
    /* Thème : Automatique (suit le Mac), Clair ou Sombre, choisi dans Réglages → Apparence.
       Chaque couleur donne sa valeur claire puis sombre (light-dark). */
    color-scheme: light dark;

    /* Papier et encre */
    --paper: light-dark(#F5F3EE, #121110);          /* fond de l'application, autour du plan de travail */
    --paper-raised: light-dark(#FFFFFF, #1A1918);   /* plan de travail, panneaux, cartes */
    --paper-sunken: light-dark(#EEEBE4, #232220);
    --ink: light-dark(#1F1E1C, #ECEAE5);
    --ink-soft: light-dark(#6B6862, #A29E97);
    --ink-faint: light-dark(#A19D95, #6B6862);
    --line: light-dark(#E8E5DE, #2A2927);
    --line-strong: light-dark(#D6D1C7, #3A3835);

    /* Survol et sélection : de l'encre très diluée, jamais une couleur */
    --hover: light-dark(rgb(31 30 28 / 0.045), rgb(236 234 229 / 0.05));
    --selected: light-dark(rgb(31 30 28 / 0.075), rgb(236 234 229 / 0.085));
    --focus-ring: light-dark(rgb(31 30 28 / 0.2), rgb(236 234 229 / 0.28));

    /* Action principale : l'encre elle-même (interface monochrome, comme Linear) */
    --primary: var(--ink);
    --on-primary: light-dark(#FFFFFF, #121110);

    /* Le rouge brique est un signal : échec, à publier, erreur, suppression. Rien d'autre. */
    --accent: light-dark(#B5483A, #E07A6A);
    --accent-soft: light-dark(#F5E6E2, rgb(224 122 106 / 0.14));
    --ok: light-dark(#4F7A5A, #7FAE89);

    /* Pastilles de marque : 8 teintes désaturées (de l'information, comme les étiquettes) */
    --brand-sauge: #A3B5A0;
    --brand-ciel: #9DB4C7;
    --brand-lavande: #B2A8C6;
    --brand-rose: #D4A9A8;
    --brand-sable: #D3BF9A;
    --brand-argile: #C4A08A;
    --brand-mousse: #A6A784;
    --brand-ardoise: #9A9FA6;

    /* Aperçus des réseaux : leurs couleurs en clair ; en sombre, les fonds suivent la palette de Kom
       (le noir pur d'Instagram faisait un trou dans l'écran), les couleurs d'accent restent celles des réseaux. */
    --ig-bg: light-dark(#FFFFFF, #201F1D);
    --ig-ink: light-dark(#000000, #F5F5F5);
    --ig-muted: light-dark(#737373, #A8A8A8);
    --ig-line: light-dark(#DBDBDB, #33312E);
    --ig-button: light-dark(#EFEFEF, #302E2B);
    --ig-link: light-dark(#00376B, #E0F1FF);
    --ig-blue: #0095F6;
    --li-bg: light-dark(#FFFFFF, #222220);
    --li-page: light-dark(#F4F2EE, #161514);
    --li-ink: light-dark(rgb(0 0 0 / 0.9), rgb(255 255 255 / 0.9));
    --li-muted: light-dark(rgb(0 0 0 / 0.6), rgb(255 255 255 / 0.6));
    --li-line: light-dark(#E8E5DF, #34322F);
    --li-blue: light-dark(#0A66C2, #71B7FB);
    --li-on-blue: light-dark(#FFFFFF, #000000);
    --li-green: light-dark(#01754F, #7FC15E);

    /* Typographie : pile système (SF Pro sur Mac). Interface en 13 px, comme macOS. */
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", system-ui, sans-serif;
    --font-mono: ui-monospace, "SF Mono", Menlo, monospace;
    --text-2xs: 0.6875rem;  /* 11 */
    --text-xs: 0.75rem;     /* 12 */
    --text-sm: 0.8125rem;   /* 13 : texte d'interface */
    --text-md: 0.875rem;    /* 14 : texte à lire (légendes, champs longs) */
    --text-lg: 1.0625rem;   /* 17 */
    --text-xl: 1.375rem;    /* 22 */
    --leading: 1.5;
    --tracking-tight: -0.011em;

    /* Espace : grille de 4 px */
    --space-0: 0.125rem;
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-12: 3rem;

    /* Hauteurs de contrôle */
    --control-sm: 1.5rem;   /* 24 */
    --control: 1.75rem;     /* 28 */
    --control-lg: 2rem;     /* 32 */

    --radius-sm: 4px;
    --radius: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --hairline: 1px solid var(--line);

    /* Ombres : à peine visibles, elles détachent sans assombrir */
    --shadow-xs: 0 1px 1px light-dark(rgb(31 30 28 / 0.04), rgb(0 0 0 / 0.3));
    --shadow-sm: 0 1px 2px light-dark(rgb(31 30 28 / 0.05), rgb(0 0 0 / 0.4)), 0 0 0 1px light-dark(rgb(31 30 28 / 0.04), rgb(255 255 255 / 0.06));
    --shadow-pop: 0 0 0 1px light-dark(rgb(31 30 28 / 0.06), rgb(255 255 255 / 0.08)), 0 4px 12px light-dark(rgb(31 30 28 / 0.06), rgb(0 0 0 / 0.4)), 0 16px 32px -8px light-dark(rgb(31 30 28 / 0.1), rgb(0 0 0 / 0.5));
    --shadow-panel: 0 0 0 1px light-dark(rgb(31 30 28 / 0.06), rgb(255 255 255 / 0.08)), 0 24px 48px -12px light-dark(rgb(31 30 28 / 0.14), rgb(0 0 0 / 0.6));
    --scrim: light-dark(rgb(31 30 28 / 0.06), rgb(0 0 0 / 0.4));

    /* Mouvement : rapide, décéléré, jamais rebondissant */
    --duration-fast: 100ms;
    --duration: 160ms;
    --duration-slow: 260ms;
    --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in: cubic-bezier(0.7, 0, 0.84, 0);

    --sidebar-width: 15rem;
  }

  :root[data-theme="light"] { color-scheme: light; }
  :root[data-theme="dark"] { color-scheme: dark; }

  @media (prefers-reduced-motion: reduce) {
    :root { --duration-fast: 0ms; --duration: 0ms; --duration-slow: 0ms; }
  }
}
