/*
 * Carmenta color tokens
 *
 * Theme resolution:
 *   - No data-theme attribute  -> follows prefers-color-scheme
 *   - <html data-theme="light"> -> forces light
 *   - <html data-theme="dark">  -> forces dark
 *
 * All text/surface and control-border pairings are >= 4.5:1.
 * Decorative --border is exempt and must never be the only boundary of a control.
 */

/* ---------- Light (default) ---------- */
:root {
  color-scheme: light;

  /* Surfaces */
  --canvas: #ffffff;
  --surface-subtle: #f6f6f8;   /* client rollup rows */
  --surface-muted: #ececf0;    /* table header, totals */
  --surface-closed: #f0f0f3;   /* closed-quarter columns */

  /* Borders */
  --border: #d4d4da;           /* decorative only */
  --border-strong: #6b6b78;    /* inputs, selects, toggles */

  /* Text */
  --text: #1a1a1f;
  --text-2: #454550;
  --text-3: #595965;           /* floor for any text, incl. placeholders */

  /* Accent */
  --accent: #7a1f57;
  --accent-hover: #661748;
  --on-accent: #ffffff;

  /* Semantic */
  --positive: #0b6b3a;
  --negative: #b3261e;
  --focus: #0b57d0;

  /* Status chips */
  --status-committed-bg: #dceafb;
  --status-committed-fg: #0f3d75;
  --status-pending-bg: #fde2d3;
  --status-pending-fg: #7a2d08;
  --status-opportunity-bg: #d8efe0;
  --status-opportunity-fg: #0d5030;
  --status-lost-bg: #e6e6eb;
  --status-lost-fg: #454550;
}

/* ---------- Dark: system preference (unless forced light) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --canvas: #121216;
    --surface-subtle: #1a1a20;
    --surface-muted: #24242c;
    --surface-closed: #1e1e25;

    --border: #3a3a44;
    --border-strong: #858592;

    --text: #f2f2f5;
    --text-2: #c8c8d2;
    --text-3: #a9a9b6;

    --accent: #eda9d0;
    --accent-hover: #f3bedc;
    --on-accent: #121216;    /* flips: dark text on light accent */

    --positive: #5fd18f;
    --negative: #ff9a92;
    --focus: #8ab4ff;

    --status-committed-bg: #1b3558;
    --status-committed-fg: #a9ccff;
    --status-pending-bg: #4a2412;
    --status-pending-fg: #ffc3a3;
    --status-opportunity-bg: #143d28;
    --status-opportunity-fg: #9be3b9;
    --status-lost-bg: #2e2e37;
    --status-lost-fg: #c8c8d2;
  }
}

/* ---------- Dark: manual override ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;

  --canvas: #121216;
  --surface-subtle: #1a1a20;
  --surface-muted: #24242c;
  --surface-closed: #1e1e25;

  --border: #3a3a44;
  --border-strong: #858592;

  --text: #f2f2f5;
  --text-2: #c8c8d2;
  --text-3: #a9a9b6;

  --accent: #eda9d0;
  --accent-hover: #f3bedc;
  --on-accent: #121216;

  --positive: #5fd18f;
  --negative: #ff9a92;
  --focus: #8ab4ff;

  --status-committed-bg: #1b3558;
  --status-committed-fg: #a9ccff;
  --status-pending-bg: #4a2412;
  --status-pending-fg: #ffc3a3;
  --status-opportunity-bg: #143d28;
  --status-opportunity-fg: #9be3b9;
  --status-lost-bg: #2e2e37;
  --status-lost-fg: #c8c8d2;
}
