/* Pulse design tokens: the approved redesign of 9 Nov 2026 (the "spatial" mockups, docs/specs/design-system.md).
 *
 * The same palette as apps/web/src/styles/tokens.css, plus the demo brands at the foot. Two surfaces, one set of
 * names. The SHELL is the room: graphite by default (#0E0E10), and the console's rail sits on it. The WINDOW
 * (.window) is the bright viewer floating in the room, and every page is drawn inside it: off-white by default
 * (#F2F2F4). Every component uses the same semantic tokens (--color-bg, --color-surface, --color-text, ...); the
 * shell and the window each declare their own values, so a card, a table or a button looks right in either without
 * knowing where it is.
 *
 * The person picks the shell's theme (the theme button in ui/client.ts sets it on <html>):
 *   data-shell="dark" (default) | "light"
 *
 * A client's brand (D21, data-brand) replaces the accent only. Status and effect-class colours never change with the
 * brand. The template core carries no client's name or colours. */

/* ---------- Constants: type, space, radii, motion ---------- */
:root {
  /* Type: Inter and Geist Mono, self-hosted (@font-face below, served by server.ts). */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, "DejaVu Sans Mono", monospace;
  --text-2xs: 11px;    /* group headings (uppercase) */
  --text-xs: 12px;     /* fine print, pill text, row meta */
  --text-sm: 13px;     /* secondary text, buttons */
  --text-base: 14px;   /* body, tables */
  --text-md: 15px;     /* dialogs, the largest controls */
  --text-lg: 17px;     /* card titles */
  --text-xl: 28px;     /* page titles */
  --text-2xl: 30px;    /* figures */
  --text-3xl: 36px;
  --text-hero: 34px;
  --leading-tight: 1.2;
  --leading: 1.5;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --tracking-tight: -0.01em;
  --tracking-display: -0.02em;

  /* Spacing (4px grid). Proximity: label-value 4, row-row 12, card-card 12-16, card padding 18-24, section 32. */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  --space-12: 48px; --space-16: 64px;

  /* Layout: the rail and the window float in the room, 16px from the edges and each other. */
  --rail-width: 64px;
  --shell-gap: 16px;
  --topbar-height: 56px;
  --content-max: 1120px;
  --reading-max: 720px;

  --radius-sm: 10px;
  --radius: 14px;                   /* inputs, small controls */
  --radius-lg: 20px;                /* cards and figure tiles */
  --radius-xl: 28px;                /* dialogs, big cards */
  --radius-window: 32px;            /* the window */
  --radius-ask: 999px;
  --radius-pill: 999px;

  /* Motion: CSS first (ADR-33). Transform and opacity only, 150-300 ms; never blur. --ease-spring-soft is a spring
   * as a linear() curve, a little overshoot then settle. Under prefers-reduced-motion it all becomes a fade
   * (components.css). */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.45, 0.64, 1);
  --ease-spring-soft: linear(0, 0.06 2.4%, 0.24 5.3%, 0.55 10.3%, 0.78 15%, 0.92 19.6%, 1.01 24.6%, 1.04 29.5%, 1.04 34.6%, 1.02 42.5%, 1 55%, 0.998 70%, 1);
  --duration-fast: 150ms;
  --duration: 220ms;
  --duration-slow: 280ms;

  /* "Pulse is live": listening, the showing-now dot, links in the shell. Never a status colour, never branded. */
  --color-live: #64d2ff;

  /* The Pulse mark used in "Powered by Pulse": never re-branded. */
  --pulse-logo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12h4l2.5-6 5 12 2.5-6h4'/%3E%3C/svg%3E");
  --brand-name: "Pulse";
  --brand-full-name: "Pulse";
  --brand-logo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12h4l2.5-6 5 12 2.5-6h4'/%3E%3C/svg%3E");
  --brand-mark-radius: 12px;
}

/* ---------- Dark: the shell's default ---------- */
:root,
.pal-dark {
  color-scheme: dark;
  --color-bg: #0e0e10;               /* the room */
  --color-surface: #1c1c1e;          /* cards on the dark */
  --color-surface-2: #2c2c2e;        /* wells */
  --color-surface-hover: rgba(255, 255, 255, 0.06);
  --color-border: rgba(255, 255, 255, 0.08);
  --color-border-strong: rgba(255, 255, 255, 0.16);
  --color-track: #3a3a3c;            /* chart tracks, meters */
  --color-text: #f5f5f7;
  --color-text-2: #aeaeb2;
  --color-text-3: #8e8e93;           /* 5.8:1 on the room */
  --color-overlay: rgba(0, 0, 0, 0.55);
  --shadow-sm: none;
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.62), 0 6px 18px rgba(0, 0, 0, 0.4);

  /* The accent in the dark is white: the current entry, primary. */
  --color-accent: #f5f5f7;
  --color-accent-hover: #ffffff;
  --color-accent-press: #e5e5ea;
  --color-accent-soft: rgba(255, 255, 255, 0.1);
  --color-accent-text: #0e0e10;
  --color-accent-ink: #f5f5f7;
  --brand-mark-bg: rgba(255, 255, 255, 0.08);
  --brand-mark-fg: var(--color-text);
  --focus-ring: 0 0 0 2px var(--color-bg), 0 0 0 4px rgba(100, 210, 255, 0.8);

  /* Glass: ONLY floating controls (the rail). Never content. */
  --glass-bg: rgba(40, 40, 44, 0.62);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 12px 40px rgba(0, 0, 0, 0.5);
  --glass-blur: blur(24px) saturate(160%);

  --color-ok: #5cc98a;        --color-ok-soft: rgba(48, 209, 88, 0.16);
  --color-warn: #ffb340;      --color-warn-soft: rgba(255, 159, 10, 0.16);
  --color-danger: #ff6961;    --color-danger-soft: rgba(255, 69, 58, 0.14);
  --color-info: #86a8f0;      --color-info-soft: rgba(100, 140, 240, 0.16);
  --color-unknown: #f39a55;   --color-unknown-soft: rgba(243, 154, 85, 0.16);
  --color-neutral: #aeb6c2;   --color-neutral-soft: #2c2c2e;
  --color-attention: #ff9f0a;

  --effect-read: #d1d1d6;           --effect-read-soft: #3a3a3c;
  --effect-internal: #8ed8f0;       --effect-internal-soft: rgba(100, 210, 255, 0.14);
  --effect-external: #da8fff;       --effect-external-soft: rgba(191, 90, 242, 0.18);
  --effect-financial: #ffb340;      --effect-financial-soft: rgba(255, 159, 10, 0.18);
  --effect-destructive: #ff6961;    --effect-destructive-soft: rgba(255, 69, 58, 0.14);

  --color-outside: #e2c766;
  --color-outside-soft: #1f1c10;
  --color-outside-border: #4a4220;

  --chart-series: #f5f5f7;
  --chart-series-2: #8e8e93;
  --chart-track: #3a3a3c;
}

/* ---------- Light: the window's default, and the shell when the person picks light ---------- */
:root[data-shell="light"],
.window,
.pal-light {
  color-scheme: light;
  --color-bg: #f2f2f4;               /* the window */
  --color-surface: #ffffff;          /* cards */
  --color-surface-2: #ececf0;        /* wells, table heads, hover */
  --color-surface-hover: #f2f2f5;
  --color-border: rgba(0, 0, 0, 0.07);
  --color-border-strong: rgba(0, 0, 0, 0.14);
  --color-track: #e8e8ed;
  --color-text: #1d1d1f;
  --color-text-2: #515154;           /* 7.4:1 on the window */
  --color-text-3: #6e6e73;           /* 4.7:1 on the window, 5.1:1 on white: the lightest text */
  --color-overlay: rgba(14, 14, 16, 0.32);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.18), 0 6px 16px rgba(0, 0, 0, 0.08);

  /* Inside the light window the primary is ink. */
  --color-accent: #1d1d1f;
  --color-accent-hover: #2c2c2e;
  --color-accent-press: #000000;
  --color-accent-soft: #ececf0;
  --color-accent-text: #ffffff;
  --color-accent-ink: #1d1d1f;
  --brand-mark-bg: #1d1d1f;
  --brand-mark-fg: #ffffff;
  --focus-ring: 0 0 0 2px var(--color-surface), 0 0 0 4px rgba(10, 132, 255, 0.55);

  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 12px 40px rgba(0, 0, 0, 0.1);

  --color-ok: #137a43;        --color-ok-soft: #e7f5ec;
  --color-warn: #b25000;      --color-warn-soft: #fdf1df;
  --color-danger: #c4161c;    --color-danger-soft: #fdecec;
  --color-info: #2b5cc4;      --color-info-soft: #eaf0fc;
  --color-unknown: #a34a00;   --color-unknown-soft: #fff1e6;
  --color-neutral: #4f5866;   --color-neutral-soft: #eef0f3;
  --color-attention: #ee8a2a;

  --effect-read: #4f5866;           --effect-read-soft: #eef0f3;
  --effect-internal: #2f5f73;       --effect-internal-soft: #e8f1f4;
  --effect-external: #5a3fc0;       --effect-external-soft: #f1ecfd;
  --effect-financial: #8f5300;      --effect-financial-soft: #fdf1df;
  --effect-destructive: #b42318;    --effect-destructive-soft: #fdecea;

  --color-outside: #7a5a00;
  --color-outside-soft: #fbf7ea;
  --color-outside-border: #e6d9a8;

  --chart-series: #1d1d1f;
  --chart-series-2: #aeaeb2;
  --chart-track: #e8e8ed;
}

/* The light shell's room is a pale grey, and its window is white with soft-grey cards. */
:root[data-shell="light"] {
  --color-bg: #e9e9ee;
  --color-surface: #ffffff;
}
:root[data-shell="light"] .window {
  --color-bg: #ffffff;
  --color-surface: #f5f5f7;
  --color-surface-2: #ececf0;
}

/* The window's own frame: off-white, radius 32, a light rim and a deep shadow into the room. */
.window {
  background: var(--color-bg);
  color: var(--color-text);
  border-radius: var(--radius-window);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.65), 0 40px 100px rgba(0, 0, 0, 0.55), 0 8px 24px rgba(0, 0, 0, 0.35);
}
:root[data-shell="light"] .window { box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 30px 80px rgba(0, 0, 0, 0.12), 0 6px 18px rgba(0, 0, 0, 0.06); }

/* ---------- Brand: the demo companies. A brand replaces the accent only: never the radii, the neutrals or a
 * status colour (D21). ---------- */

/* Glenmorran Mechanical Services: petrol blue, a trade firm's livery. */
[data-brand="glenmorran"] {
  --brand-name: "Glenmorran";
  --brand-full-name: "Glenmorran Mechanical Services";
  --brand-logo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5c3.6 4.3 6.5 8 6.5 11.6A6.5 6.5 0 0 1 5.5 14.1C5.5 10.5 8.4 6.8 12 2.5Z' fill='black'/%3E%3Cpath d='M12 9.5c1.7 2 3 3.7 3 5.2a3 3 0 0 1-6 0c0-1.5 1.3-3.2 3-5.2Z' fill='white'/%3E%3C/svg%3E");
  --color-accent: #0f5c8c;
  --color-accent-hover: #0b4a72;
  --color-accent-press: #093d5f;
  --color-accent-soft: #e6f0f7;
  --color-accent-text: #ffffff;
  --color-accent-ink: #0c5180;
  --brand-mark-bg: #0f5c8c;
  --brand-mark-fg: #ffffff;
}

/* Carrowkeel Dental Group: plum, rounder letterforms. */
[data-brand="carrowkeel"] {
  --brand-name: "Carrowkeel Dental";
  --brand-full-name: "Carrowkeel Dental Group";
  --brand-logo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M5 9.5C5 6 7.5 4 10 4.6c1 .25 1.4.6 2 .6s1-.35 2-.6C16.5 4 19 6 19 9.5c0 2.8-1.2 4.1-1.8 6.6-.5 2-1 3.9-2.2 3.9-1.5 0-1.4-4.5-3-4.5s-1.5 4.5-3 4.5c-1.2 0-1.7-1.9-2.2-3.9C6.2 13.6 5 12.3 5 9.5Z'/%3E%3C/svg%3E");
  --color-accent: #7a3a86;
  --color-accent-hover: #64306e;
  --color-accent-press: #54275c;
  --color-accent-soft: #f5ebf6;
  --color-accent-text: #ffffff;
  --color-accent-ink: #6d3378;
  --brand-mark-bg: #f5ebf6;
  --brand-mark-fg: #7a3a86;
}

/* In the dark shell a brand's accent lifts to stay legible on the room. */
:root[data-shell="dark"] [data-brand="glenmorran"] {
  --color-accent: #2a72a6;
  --color-accent-hover: #3482b9;
  --color-accent-press: #256592;
  --color-accent-soft: #11283a;
  --color-accent-ink: #7dbbe4;
  --brand-mark-bg: #2f84bd;
  --brand-mark-fg: #ffffff;
}
:root[data-shell="dark"] [data-brand="carrowkeel"] {
  --color-accent: #8e4a9a;
  --color-accent-hover: #9e57aa;
  --color-accent-press: #7a3f85;
  --color-accent-soft: #2c1a30;
  --color-accent-ink: #d7a4df;
  --brand-mark-bg: #2c1a30;
  --brand-mark-fg: #d7a4df;
}

@font-face {
  font-family: "Inter";
  src: url("/ui/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  src: url("/ui/inter-ext.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face { font-family: "Geist Mono"; src: url("/ui/geist-mono.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
