/* =====================================================================
   Font: Inter (SIL Open Font License), served by the server itself from
   the fonts folder (`FONTS_DIR`, `./fonts`, mounted under /static/fonts —
   README, "Fonts"): no call to an outside service, and the same font on an
   intranet without Internet. The PDF reports use the same Inter.
   ===================================================================== */
@font-face {
    font-family: "Inter";
    src: url("/static/fonts/Inter-Regular.woff2") format("woff2");
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Inter";
    src: url("/static/fonts/Inter-Medium.woff2") format("woff2");
    font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Inter";
    src: url("/static/fonts/Inter-SemiBold.woff2") format("woff2");
    font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Inter";
    src: url("/static/fonts/Inter-Bold.woff2") format("woff2");
    font-weight: 700; font-style: normal; font-display: swap;
}

/* =====================================================================
   Palette "Yourp" (charte graphique fournie), déclinée en mode clair ET
   sombre :

   --color-chrome-bg / --color-chrome-text
       Bandeau du haut + menu latéral : NOIR (#000000) dans les DEUX
       thèmes (élément de marque volontairement invariant, voir la
       maquette — seule la zone de contenu centrale bascule clair/sombre).
       Défini une seule fois dans :root, jamais réécrit dans les blocs
       sombres : c'est cette absence de surcharge qui le rend invariant.

   --color-accent (#7EEBC8, "Menthol")
       Couleur d'accent exacte de la charte — boutons, badges, icônes,
       état actif du menu. TOUJOURS avec du texte sombre par-dessus
       (jamais utilisée comme couleur de texte sur `--color-bg` : sur
       fond clair son contraste n'est que d'environ 1.4:1, bien en deçà
       du seuil AA).
   --color-accent-text
       Variante plus soutenue de la menthe, POUR le texte/les liens
       directement sur `--color-bg`/`--color-surface` (contraste correct
       dans les deux thèmes). C'est elle que `a { color: ... }` utilise.

   --color-heading (Noir en clair / Blanc cassé en sombre)
       Titres (H1/H2) — "Couleur principale" de la charte.
   --color-text (texte principal, #374151 en clair)
   --color-muted (texte secondaire, #6B7280 en clair)
   --color-bg / --color-surface / --color-border : fond de page, cartes,
       séparateurs — ceux-là basculent entre les deux thèmes.

   ⚠️ Règle de contribution : n'utilisez `--color-accent` QUE comme fond
   avec du texte sombre par-dessus, jamais comme couleur de texte
   directement sur `--color-bg`/`--color-surface` — utilisez
   `--color-accent-text` pour du texte/lien.
   ===================================================================== */
:root {
    /* Bandeau + menu latéral : noir invariant (voir note ci-dessus) */
    --color-chrome-bg: #000000;
    --color-chrome-text: #f8faf9;

    /* Accent de marque ("Menthol") */
    --color-accent: #7eebc8;
    --color-accent-text: #059669;
    --color-accent-tint: #e6faf3;

    /* The time view (module_api::timeline): dark in both themes. */
    --timeline-surface: #111827;
    --timeline-text: #f8faf9;
    --timeline-muted: #9ca3af;
    --timeline-line: #60a5fa;
    --timeline-series-1: #60a5fa;
    --timeline-series-2: #f59e0b;
    --timeline-series-3: #a78bfa;
    --timeline-series-4: #34d399;
    --timeline-series-5: #f472b6;

    --color-heading: #000000;
    --color-text: #374151;
    --color-muted: #6b7280;
    --color-bg: #f8faf9;
    --color-surface: #ffffff;
    --color-border: #e5e7eb;

    --color-danger: #dc2626;
    --color-danger-bg: #fee2e2;
    --color-success: #059669;
    --color-away: #d97706;
    /* A state waiting / to watch, an information (status pills…). */
    --color-warning: #b45309;
    --color-info: #2563eb;
    /* A surface set apart (a block of code, a log): over either theme. */
    --color-surface-alt: color-mix(in srgb, var(--color-muted) 8%, transparent);
    /* The background of a state (badges, flags, alerts): its colour, light. */
    --color-success-bg: color-mix(in srgb, var(--color-success) 16%, transparent);
    --color-warning-bg: color-mix(in srgb, var(--color-warning) 16%, transparent);
    --color-info-bg: color-mix(in srgb, var(--color-info) 16%, transparent);

    /* Text over a coloured background — the same in both themes. */
    --color-on-accent: #000000;      /* over the menthol accent */
    --color-on-strong: #ffffff;      /* over the red, a computed colour, an initial */
    --color-on-success: #064e3b;     /* over a completed step */
    --color-on-danger: #450a0a;      /* over a cancelled step */
    --color-on-away: #451a03;        /* over a step awaiting approval */
    /* Black for the shades: shadows, scrims, hover of a chip (mixed). */
    --color-shade: #000000;
    /* A document, a label, a mail: white paper in both themes. */
    --color-paper: #ffffff;
    /* The second colour of the login gradient. */
    --color-chrome-alt: #1f2937;
    /* A counter on the top bar (notifications): invariant, like the bar. */
    --color-count: #dc2626;
    /* A favourite, a starred item. */
    --color-star: #e0a800;
    /* The toasts of an error / a warning: dark in both themes. */
    --color-toast-error: #991b1b;
    --color-toast-error-edge: #fca5a5;
    --color-toast-warning: #92400e;
    --color-toast-warning-edge: #fcd34d;
    /* Presence of others on a record (contrast checked, WCAG AA and more):
       light theme indigo 9.9:1 (badge) / 6.3:1 (outline); dark theme
       10.7:1 / 8.9:1. */
    --presence-bg: #3730a3;
    --presence-fg: #ffffff;
    --presence-ring: #4f46e5;

    /* Sizes of the text. The titles (h1-h3) have their own, below. */
    --text-xs: 11px;    /* a tag, a counter, a technical name */
    --text-sm: 12px;    /* a hint, a label, a badge */
    --text-md: 13px;    /* a list, a menu, a secondary text */
    --text-base: 14px;  /* an input, a button, the text of a screen */
    --text-lg: 16px;    /* the body */
    --text-xl: 18px;    /* an icon, a figure */

    /* Corners. */
    --radius-sm: 4px;
    --radius: 6px;
    --radius-lg: 10px;
    --radius-pill: 999px;

    /* Shadows, by height. */
    --shadow-sm: 0 1px 3px color-mix(in srgb, var(--color-shade) 8%, transparent);     /* a card over the page */
    --shadow-md: 0 2px 8px color-mix(in srgb, var(--color-shade) 20%, transparent);      /* a button, a handle */
    --shadow-lg: 0 10px 30px color-mix(in srgb, var(--color-shade) 20%, transparent);    /* a menu, a list, a pop-over */
    --shadow-xl: 0 20px 60px color-mix(in srgb, var(--color-shade) 35%, transparent);   /* a window over the page */
    --shadow-side: -10px 0 30px color-mix(in srgb, var(--color-shade) 25%, transparent); /* a panel along the right edge */

    /* Layers (z-index) of what floats over the page, lowest first. Inside
       a component, its own small values (0 to 5) stay as numbers. */
    --z-inline-menu: 30;     /* a menu inside a block (icon picker, script menu) */
    --z-inline-popover: 40;  /* a pop-over inside a block (approval) */
    --z-dropdown: 100;       /* the menus of the top bar, the options of a list */
    --z-suggest: 200;        /* suggestions, the actions menu */
    --z-panel: 300;          /* the panels (search, dashboard views, kanban menu) */
    --z-popover: 400;        /* a preview on hover, the history over a dashboard */
    --z-float: 500;          /* the floating lists of a field (many2one, bubbles) */
    --z-float-menu: 600;     /* the menu of a record in a structure */
    --z-tooltip: 700;        /* a tooltip of a structure */
    --z-banner: 900;         /* the session banner */
    --z-modal: 1000;         /* windows, toasts, a zoomed image */
    --z-modal-float: 1100;   /* a preview over a window */
    --z-fullscreen: 2000;    /* the live webcam */

    --font: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    /* Code, identifiers, logs. */
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color-scheme: light;
}

/* Mode sombre automatique (préférence système), sauf si l'utilisateur a
   explicitement choisi un thème via le bouton 🌙/☀️ (voir
   static/js/ws-indicator.js, qui pose alors l'attribut data-theme et le
   mémorise dans localStorage). Remarque : --color-chrome-bg/-text et
   --color-accent ne sont PAS réécrits ici — ils restent identiques au
   mode clair (bandeau/menu toujours noirs, accent menthe inchangé).
   --color-accent-text passe à une teinte plus claire (#34d399) : une
   couleur de texte lisible sur fond clair ne l'est pas forcément sur
   fond sombre, et inversement. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-accent-text: #34d399;
        --color-accent-tint: #0f2a22;

        --color-heading: #f8faf9;
        --color-text: #f8faf9;
        --color-muted: #9ca3af;
        --color-bg: #0b0f0e;
        --color-surface: #12171a;
        --color-border: #262e33;

        --color-danger: #f87171;
        --color-danger-bg: #3a1513;
        --color-success: #34d399;
        --color-away: #fbbf24;
        --color-warning: #fbbf24;
        --color-info: #60a5fa;
        --color-star: #fbbf24;
        --presence-bg: #c7d2fe;
        --presence-fg: #1e1b4b;
        --presence-ring: #a5b4fc;
        color-scheme: dark;
    }
}
/* Bascule manuelle (indépendante de la préférence système) */
:root[data-theme="dark"] {
    --color-accent-text: #34d399;
    --color-accent-tint: #0f2a22;

    --color-heading: #f8faf9;
    --color-text: #f8faf9;
    --color-muted: #9ca3af;
    --color-bg: #0b0f0e;
    --color-surface: #12171a;
    --color-border: #262e33;

    --color-danger: #f87171;
    --color-danger-bg: #3a1513;
    --color-success: #34d399;
    --color-away: #fbbf24;
    --color-warning: #fbbf24;
    --color-info: #60a5fa;
    --color-star: #fbbf24;
    --presence-bg: #c7d2fe;
    --presence-fg: #1e1b4b;
    --presence-ring: #a5b4fc;
    color-scheme: dark;
}

/* Navigation between two pages of the application: the previous page stays
   shown until the next one is ready, then a short cross-fade — no blank
   frame between them (cross-document view transitions: Chrome, Vivaldi,
   Edge, Safari, recent Firefox; ignored elsewhere). See README, section
   "Theme and loading flash". */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 120ms; }
@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

* { box-sizing: border-box; }
/* The `hidden` attribute always wins, whatever the display of the element:
   the screens show or hide with it, never with an inline display. */
[hidden] { display: none !important; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: var(--text-lg);
    color: var(--color-text);
    background: var(--color-bg);
}

/* Hiérarchie typographique de la charte : Inter Bold/SemiBold/Medium
   pour les titres, Regular pour le texte courant. */
h1 { font-weight: 700; font-size: 32px; color: var(--color-heading); margin: 0 0 8px; }
h2 { font-weight: 600; font-size: 22px; color: var(--color-heading); margin: 0 0 10px; }
h3 { font-weight: 500; font-size: 17px; color: var(--color-text); margin: 0 0 8px; }

a { color: var(--color-accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
    cursor: pointer;
    font-family: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: var(--text-base);
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
}

.alert-error {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    padding: 8px 10px;
    border-radius: var(--radius);
    font-size: var(--text-md);
    margin-bottom: 8px;
}
/* A success told on a page (ex: the report of an import). */
.alert-success {
    background: var(--color-success-bg);
    color: var(--color-success);
    padding: 8px 10px;
    border-radius: var(--radius);
    font-size: var(--text-md);
    margin-bottom: 8px;
}
/* A warning told on a page (ex: a quota nearly used). */
.alert-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    padding: 8px 10px;
    border-radius: var(--radius);
    font-size: var(--text-md);
    margin-bottom: 8px;
}
