/* vendored from MilieuCentralWebsite@f1a49d1; edit packages/milieu-shell/milieu-tokens.css there, then re-run vendor.ps1 */
/* ==========================================================================
   Design tokens: the SNRGY system layer, with Milieu's theme imported.

   SNRGY product UI rules (MilieuCentralWebsite docs/brand/
   SNRGY-product-ui-rules.md), section 2. Every app is two layers:

     --sx-*     the SNRGY system: neutrals, status, shape. The same in every
                app and every client deployment. Never themed.
     --brand*   the client theme: Milieu's accent and logo colours. Written
                by milieu-theme.css, which is generated from
                milieu-theme.json (`npm run theme` in Central) and imported
                below. Components read these tokens; none writes a Milieu
                colour itself.

   Keep milieu-theme.css next to this file: the @import is relative.

   The older --color-* names further down are kept as aliases onto the new
   tokens, so an app that still reads them gets the new values. New code uses
   --sx-* and --brand*.

   Light only. The .theme-dark block at the end is the older dark palette,
   used only where an app sets data-milieu-dark="on" (off everywhere since
   2026-10-18); the spec has no dark mode.
   ========================================================================== */

@import "milieu-theme.css";

:root {
  /* --- Neutrals (2.1) ---------------------------------------------------- */
  --sx-text: #0b1b34;
  --sx-muted: #4f5a72;
  --sx-subtle: #5c6780;
  --sx-page: #f7f8fa;
  --sx-surface: #ffffff;
  --sx-sunken: #f3f5f8;
  --sx-hover: #f2f4f7;
  --sx-border: #e2e5ea;
  --sx-control: #8a93a6;
  --sx-scrim: rgba(11, 27, 52, 0.4);

  /* --- Status (2.2): never themed --------------------------------------- */
  --sx-good-tint: #d2f5e0;
  --sx-good-ink: #03703a;
  --sx-good-solid: #157a47;
  --sx-warn-tint: #ffe8bf;
  --sx-warn-ink: #9a4f00;
  --sx-warn-solid: #a35400;
  --sx-alert-tint: #fddeda;
  --sx-alert-ink: #b42318;
  --sx-alert-solid: #b42318;
  --sx-neutral-tint: #eef0f3;
  --sx-neutral-ink: #4f5a72;
  --sx-neutral-solid: #8a93a6;

  /* --- Shape, space, elevation (2.4) ------------------------------------ */
  --sx-radius-control: 6px;
  --sx-radius-badge: 4px;
  --sx-radius-panel: 8px;
  --sx-radius-round: 9999px;
  --sx-shadow-float: 0 12px 32px -12px rgba(11, 27, 52, 0.35);
  --sx-motion: 150ms;

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;

  /* --- Older names, kept as aliases ------------------------------------- */
  --color-brand-blue: var(--brand);
  --color-brand-blue-dark: var(--brand-ink);
  --color-brand-blue-light: var(--brand-tint);
  /* Logo colours: decorative only, the logo and the title rule (S14.6). */
  --color-brand-salmon: var(--brand-logo-1);
  --color-brand-salmon-light: color-mix(in srgb, var(--brand-logo-1) 12%, white);
  --color-brand-gold: var(--brand-logo-2);
  --color-brand-gold-light: color-mix(in srgb, var(--brand-logo-2) 12%, white);
  --color-brand-navy: var(--sx-text);
  --color-brand-navy-muted: var(--sx-muted);

  --color-surface: var(--sx-surface);
  --color-surface-sunken: var(--sx-page);
  --color-surface-raised: var(--sx-surface);
  --color-border: var(--sx-border);
  --color-border-strong: var(--sx-control);
  --color-text: var(--sx-text);
  --color-text-muted: var(--sx-muted);
  --color-text-subtle: var(--sx-subtle);

  --color-fav-strong: var(--sx-good-ink);
  --color-fav: var(--sx-good-solid);
  --color-fav-light: var(--sx-good-tint);
  --color-neutral-mid: var(--sx-neutral-solid);
  --color-neutral-light: var(--sx-neutral-tint);
  --color-unfav: var(--sx-warn-solid);
  --color-unfav-strong: var(--sx-alert-ink);
  --color-unfav-light: var(--sx-alert-tint);
  --color-warn: var(--sx-warn-ink);
  --color-warn-bg: var(--sx-warn-tint);
  --color-warn-border: color-mix(in srgb, var(--sx-warn-ink) 25%, transparent);

  --radius-card: var(--sx-radius-panel);
}

/* The theme's defaults (2.5), for a page that has not loaded
   milieu-theme.css. :where() keeps them below the theme's own :root rule
   whatever order the two arrive in. */
:where(:root) {
  --brand: #2563eb;
  --on-brand: #ffffff;
  --brand-ink: #1d4ed8;
  --brand-tint: color-mix(in srgb, var(--brand) 12%, white);
}

/* --- Older dark palette (behind data-milieu-dark="on" only) --------------- */
.theme-dark {
  --sx-surface: #131a29;
  --sx-page: #0d131f;
  --sx-sunken: #0d131f;
  --sx-hover: #1b2436;
  --sx-border: #2a3549;
  --sx-control: #3c4a63;
  --sx-text: #eef1f6;
  --sx-muted: #a6b0c3;
  --sx-subtle: #8590a6;
  --brand-ink: #8fbce8;
  --brand-tint: #1c2b40;
  --sx-good-tint: #14301f;
  --sx-alert-tint: #33211d;
  --sx-neutral-tint: #212b3d;
  --sx-warn-tint: #2c2415;

  color: var(--sx-text);
  background-color: var(--sx-surface);
}

/* ==========================================================================
   Base
   ========================================================================== */

body {
  background-color: var(--sx-page);
  color: var(--sx-text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
}

/* Focus is never removed (12.2). */
:focus-visible {
  outline: 2px solid var(--brand-ink);
  outline-offset: 2px;
}

/* No italics anywhere in the interface (S4.2). */
em,
i,
cite,
dfn,
address {
  font-style: normal;
}
em {
  font-weight: 600;
}

/* No monospace (S4.3): codes, keys and ids are Inter with tabular figures. */
code,
kbd,
samp,
pre {
  font-family: inherit;
  font-size: inherit;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

/* ==========================================================================
   The logo-colour rule (3.6, S14.2): under a page title, in the client's
   logo colours, one segment per colour. Decorative; nothing else uses them.
   ========================================================================== */

.brand-rule {
  display: flex;
  gap: 3px;
  width: 72px;
  height: 4px;
}
.brand-rule > span {
  flex: 1;
}

/* ==========================================================================
   Hover: tone shift only, never motion (12.5).
   ========================================================================== */

.hover-solid {
  transition: filter var(--sx-motion) ease;
}
.hover-solid:hover {
  filter: brightness(0.94);
}

.hover-surface {
  transition: background-color var(--sx-motion) ease, border-color var(--sx-motion) ease;
}
.hover-surface:hover {
  background-color: var(--sx-hover);
}

@media (prefers-reduced-motion: reduce) {
  .hover-solid,
  .hover-surface {
    transition: none;
  }
}

/* ==========================================================================
   Components (section 6)
   ========================================================================== */

/* Panels and cards (6.3): flat, 1px border, no shadow. */
.milieu-card {
  border: 1px solid var(--sx-border);
  border-radius: var(--sx-radius-panel);
  background: var(--sx-surface);
  padding: 16px;
}

/* Buttons (6.1). Medium is the default: 38px, 14px/600. */
.milieu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  border-radius: var(--sx-radius-control);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--sx-motion) ease, border-color var(--sx-motion) ease;
}
.milieu-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.milieu-btn:disabled,
.milieu-btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* The single main action of a view. */
.milieu-btn--primary {
  background: var(--brand);
  color: var(--on-brand);
  border: 1px solid var(--brand);
}
.milieu-btn--primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--brand) 88%, black);
  border-color: color-mix(in srgb, var(--brand) 88%, black);
}

/* Every other action. */
.milieu-btn--secondary {
  background: var(--sx-surface);
  color: var(--sx-text);
  border: 1px solid var(--sx-control);
}
.milieu-btn--secondary:hover:not(:disabled) {
  background: var(--sx-hover);
}

/* Low emphasis, in toolbars and rows. */
.milieu-btn--quiet {
  background: transparent;
  color: var(--brand-ink);
  border: 1px solid transparent;
}
.milieu-btn--quiet:hover:not(:disabled) {
  background: var(--sx-hover);
}

/* Starts a destructive action ("danger outline"). */
.milieu-btn--destructive {
  background: var(--sx-surface);
  color: var(--sx-alert-ink);
  border: 1px solid var(--sx-alert-ink);
}
.milieu-btn--destructive:hover:not(:disabled) {
  background: var(--sx-alert-tint);
}

/* Only the final, confirming click of a destructive action. */
.milieu-btn--danger {
  background: var(--sx-alert-solid);
  color: #ffffff;
  border: 1px solid var(--sx-alert-solid);
}
.milieu-btn--danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--sx-alert-solid) 88%, black);
}

/* "New …", "Add a …" in lists. */
.milieu-btn--add {
  background: var(--sx-surface);
  color: var(--brand-ink);
  border: 1px dashed var(--sx-control);
}
.milieu-btn--add:hover:not(:disabled) {
  background: var(--sx-hover);
}

.milieu-btn--sm {
  min-height: 30px;
  padding: 0 12px;
  font-size: 13px;
}
.milieu-btn--sm svg {
  width: 14px;
  height: 14px;
}
/* Respondent-facing and touch-first screens. */
.milieu-btn--lg {
  min-height: 44px;
  font-size: 16px;
}

/* Inputs and selects (section 9). */
.milieu-input {
  min-height: 38px;
  width: 100%;
  border: 1px solid var(--sx-control);
  border-radius: var(--sx-radius-control);
  padding: 0 12px;
  font-family: inherit;
  font-size: 14px;
  background: var(--sx-surface);
  color: var(--sx-text);
}
textarea.milieu-input {
  padding: 8px 12px;
  font-size: 15px;
  line-height: 1.6;
}
.milieu-input:focus-visible {
  outline: none;
  border-color: var(--brand-ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent);
}
.milieu-input[aria-invalid="true"] {
  border-color: var(--sx-alert-ink);
}
/* A phone zooms the page into any field under 16px when it takes focus, and
   leaves it zoomed. Kept at 16px on narrow screens so that does not happen
   (the spec's 14px holds everywhere else). */
@media (max-width: 640px) {
  .milieu-input {
    font-size: 16px;
  }
}

/* Numbers that change line up (S4.4). */
.milieu-num {
  font-variant-numeric: tabular-nums;
}
