/*
 * Balon colour tokens — single source of truth for status and brand colours.
 * Owned by the project lead. Pages consume these variables; request changes through the lead
 * so the workspace grid, reports and UI shell stay consistent.
 *
 * Every fill is paired with a text colour that reaches WCAG AA (>= 4.5:1).
 * Colour is never the only signal: each state also needs a label or glyph.
 */
:root {
  /* Booking cell states (owner's spec: the stall number colour in a date cell) */
  --balon-state-definitive-bg: #ffffff;   /* bianco: assegnato definitivo */
  --balon-state-definitive-fg: #0f172a;
  --balon-state-definitive-border: #334155;
  --balon-state-temporary-bg: #ffe500;    /* giallo: temporaneo / import */
  --balon-state-temporary-fg: #1a1600;
  --balon-state-booked-bg: #16c75e;       /* verde: prenotato */
  --balon-state-booked-fg: #052e16;
  --balon-state-paid-bg: #ff5ca8;         /* rosa: pagato */
  --balon-state-paid-fg: #2b0016;
  --balon-state-unpaid-bg: #e3122d;       /* rosso: partecipato ma da pagare */
  --balon-state-unpaid-fg: #ffffff;
  --balon-state-absent-bg: #ff8a00;       /* arancione: assente */
  --balon-state-absent-fg: #1f1000;
  --balon-state-holiday-bg: #ffffff;      /* ferie: scritta rossa, campo bianco */
  --balon-state-holiday-fg: #d3122b;
  --balon-state-waiting-bg: #3cc3ff;      /* ci sei? / in attesa */
  --balon-state-waiting-fg: #04263a;
  --balon-state-partial-bg: #c026d3;      /* pagamento parziale */
  --balon-state-partial-fg: #ffffff;
  --balon-state-cancelled-bg: #e2e8f0;
  --balon-state-cancelled-fg: #475569;
  --balon-state-present-bg: #334155;
  --balon-state-present-fg: #ffffff;

  /* Row states */
  --balon-row-terminated-bg: #7c3aed;     /* terminato: riga viola */
  --balon-row-terminated-fg: #ffffff;
  --balon-row-unusable-bg: #facc15;       /* nominativo non più utilizzabile */
  --balon-row-unusable-fg: #3f3f46;

  /* Identity groups (identity columns, like the office spreadsheet) */
  --balon-id-member-bg: #38bdf8;          /* socio */
  --balon-id-member-fg: #082f49;
  --balon-id-vat-bg: #fb7185;             /* partita IVA / hobbista singolo */
  --balon-id-vat-fg: #2a0710;
  --balon-id-borgo-bg: #84e12f;           /* negoziante del Borgo */
  --balon-id-borgo-fg: #132a00;
  --balon-id-family-bg: #2dd4bf;          /* famiglia hobbista */
  --balon-id-family-fg: #042f2e;
  --balon-section-stramercatino-bg: #00b0f0;
  --balon-section-stramercatino-fg: #00202e;
  --balon-total-bg: #0070c0;
  --balon-total-fg: #ffffff;

  /* Calendar headers */
  --balon-month-selected-bg: #1d4ed8;
  --balon-month-selected-fg: #ffffff;
  --balon-month-a-bg: #1d4ed8;
  --balon-month-b-bg: #0f766e;
  --balon-month-c-bg: #b45309;
  --balon-month-header-fg: #ffffff;
  --balon-extra-edition-bg: #f59e0b;      /* edizioni straordinarie */
  --balon-extra-edition-fg: #1f1300;
  --balon-month-band-0: #ffffff;
  --balon-month-band-1: #f1f5f9;
  --balon-month-band-2: #e2e8f0;

  /* Vendor category badges */
  --balon-cat-h-bg: #0369a1;
  --balon-cat-s-bg: #15803d;
  --balon-cat-a-bg: #c2410c;
  --balon-cat-fg: #ffffff;

  /* Custom situations (dots / stripes; text on them uses --balon-situation-fg) */
  --balon-situation-fg: #111827;

  /* Brand */
  --balon-primary: #2563eb;
  --balon-primary-hover: #1d4ed8;
  --balon-primary-fg: #ffffff;
  --balon-success: #15803d;
  --balon-danger: #dc2626;
  --balon-warning: #f59e0b;
  --balon-warning-fg: #1f1300;
  --balon-info: #0369a1;

  /* "Apri origine" highlight: a two-tone ring that stays visible on every state fill */
  --balon-focus-ring: #0b1220;
  --balon-focus-gap: #ffffff;
}

/* Dark theme (balon-ui.js sets <html data-theme="dark">). State fills keep the owner's
 * colours in both themes; only the surfaces and neutral states drawn from here change. */
:root[data-theme="dark"] {
  --balon-state-definitive-border: #94a3b8;
  --balon-state-cancelled-bg: #334155;
  --balon-state-cancelled-fg: #e2e8f0;
  --balon-state-present-bg: #e2e8f0;
  --balon-state-present-fg: #0f172a;
  --balon-month-band-0: #111827;
  --balon-month-band-1: #172033;
  --balon-month-band-2: #1e2a40;
  --balon-focus-ring: #ffffff;
  --balon-focus-gap: #0a0f1c;
}
