/**
 * IamCarla design tokens — the single source of truth for the whole UI.
 *
 * Loaded first in base.html (before Bootstrap overrides and every app CSS file),
 * so every var() usage resolves against these values.
 *
 * ── Multi-brand / white-label ──────────────────────────────────────────────
 * A white-label deployment reskins the entire product by overriding ONLY the
 * BRAND block below — either by editing the `:root` values here, or (preferred,
 * no rebuild) by setting `data-theme="<name>"` on <html> and adding a matching
 * `[data-theme="…"]` block at the bottom of this file. Everything downstream
 * (buttons, pills, toggles, sidebar, social planner, site builder, mobile PWA)
 * is aliased onto these tokens, so it follows automatically.
 *
 * Default values below reproduce the current emerald look exactly — swapping
 * this file in with the same values is a no-op visually.
 *
 * NOTE: CSS custom properties cannot be used inside `@media (max-width: …)`
 * queries. The `--bp-*` values here are the canonical breakpoint reference for
 * humans/tooling; the media queries themselves must still hardcode the px.
 */
:root {
  /* ── BRAND (reskin surface — a white-label theme overrides these) ───────── */
  --brand-green: #10b981;            /* emerald-500 — primary brand color   */
  --brand-green-hover: #059669;      /* emerald-600 — hover/pressed          */
  --brand-green-strong: #047857;     /* emerald-700 — strong text on light   */
  --brand-green-ink: #065f46;        /* emerald-800 — ink on tinted surface  */
  --brand-green-ink-deep: #064e3b;   /* emerald-900                          */
  --brand-green-50: #ecfdf5;
  --brand-green-100: #d1fae5;
  --brand-green-200: #a7f3d0;
  --brand-green-300: #6ee7b7;
  --brand-green-400: #34d399;
  --brand-green-rgb: 16, 185, 129;   /* for rgba(var(--brand-green-rgb), …)  */
  /* The Horizon agency's orange (billing/agency_branding.py), for its offer on the price cards. */
  --agency-horizon: #f79423;
  --agency-horizon-rgb: 247, 148, 35;
  --agency-horizon-ink: #9a5200;
  --brand-green-surface: color-mix(in srgb, var(--brand-green) 4%, #ffffff);
  --brand-green-surface-2: color-mix(in srgb, var(--brand-green) 8%, #f8fafc);

  /* Muted brand fill for solid/outline buttons — desaturated toward a neutral
     slate so button chrome reads calmer than the full-saturation brand hue,
     while staying derived from --brand-green so a white-label reskin still
     flows through correctly. */
  --brand-green-btn: color-mix(in srgb, var(--brand-green) 78%, #64748b);
  --brand-green-btn-hover: color-mix(in srgb, var(--brand-green-hover) 78%, #64748b);
  --brand-green-btn-strong: color-mix(in srgb, var(--brand-green-strong) 78%, #475569);

  /* Brand-tinted component aliases (composed — no new hex) */
  --brand-green-pill-bg: var(--brand-green-100);
  --brand-green-pill-text: var(--brand-green-ink);
  --brand-green-pill-border: var(--brand-green-200);
  --brand-green-toggle-on-start: var(--brand-green-400);
  --brand-green-toggle-on-end: var(--brand-green);

  /* Brand-neutral name so new code needn't say "green" for a possibly-blue brand */
  --brand-primary: var(--brand-green);
  --brand-primary-hover: var(--brand-green-hover);
  --brand-primary-strong: var(--brand-green-strong);
  --brand-primary-ink: var(--brand-green-ink);
  --brand-primary-tint: var(--brand-green-100);
  --brand-primary-rgb: var(--brand-green-rgb);

  /* ── NEUTRALS (surfaces / borders / text) ──────────────────────────────── */
  --color-surface: #ffffff;          /* cards, page base                     */
  --color-surface-2: #f8fafc;        /* subtle raised/alt surface (slate-50) */
  --color-surface-3: #f1f5f9;        /* deeper alt / hover fill (slate-100)  */
  --color-surface-muted: #f8fafb;    /* sidebar / site builder neutral bg    */
  --color-border: #e2e8f0;           /* default hairline (slate-200)         */
  --color-border-subtle: #f1f5f9;    /* faint divider (slate-100)            */
  --color-text: #1e293b;             /* primary text (slate-800)             */
  --color-text-secondary: #475569;   /* secondary text (slate-600)           */
  --color-text-muted: #64748b;       /* muted / meta text (slate-500)        */
  --color-text-faint: #94a3b8;       /* placeholder / faint (slate-400)      */
  --color-heading: #2d3748;          /* headings on neutral bg               */

  /* Extended neutrals (styles.css long-tail — same hex, tokenized for lint) */
  --color-ink: #0b1320;              /* Carla brand dark / footer headings   */
  --color-ink-slate: #0f172a;        /* slate-900                            */
  --color-text-emphasis: #334155;    /* slate-700 body emphasis              */
  --color-text-mid: #444444;         /* mid gray text                        */
  --color-text-dark: #222222;        /* near-black text                      */
  --color-border-alt: #e5e7eb;       /* gray-200 hairline (legacy bootstrap) */
  --color-border-muted: #cbd5e1;     /* slate-300 borders / empty states     */
  --color-border-panel: #e0e7ef;     /* panel borders                        */
  --color-navy: #162132;
  --color-navy-mid: #2c3b52;
  --color-navy-soft: #24324a;
  --color-surface-frost: #fbfdfe;    /* near-white tinted surface            */
  --color-text-subtle: #6b7280;      /* gray-500 meta                        */
  --color-gray-300: #d1d5db;         /* gray-300 borders                     */
  --color-gray-400: #9ca3af;         /* gray-400 placeholder                 */
  --color-gray-700: #374151;         /* gray-700 emphasis                    */
  --color-gray-100: #f3f4f6;         /* gray-100 subtle fill                 */
  --color-black: #000000;
  /* Partner banner on the Rete (Horizon One brand colours, web/marketplace/_horizon_ad.html) */
  --partner-horizon-green: #1d5e4c;
  --partner-horizon-orange: #e67e08;
  --color-ink-near: #0a0a0a;         /* near-black chrome                    */
  --color-surface-cool: #eef2f7;     /* cool tinted surface (site builder)   */
  --color-border-cool: #e2e5eb;      /* cool hairline border                 */
  --color-border-google: #e8eaed;    /* Google/Meta form chrome border       */
  --color-border-form: #dee2e6;      /* Bootstrap form border                */
  --color-border-dim: #dddddd;       /* light dashed/divider border          */
  --color-surface-form: #f8f9fa;     /* Bootstrap form muted surface         */
  --color-text-form-muted: #adb5bd;  /* Bootstrap form placeholder           */
  --color-text-bootstrap: #6c757d; /* Bootstrap secondary text             */
  --color-ink-bootstrap: #212529;    /* Bootstrap body ink                   */
  --color-primary-bootstrap: #0d6efd;/* Bootstrap primary blue               */
  --color-danger-bootstrap: #dc3545; /* Bootstrap danger red                 */
  --color-green-500: #22c55e;        /* Tailwind green-500 accent            */
  --color-ink-ios: #1c1c1e;          /* iOS-style ink                        */
  --color-ios-secondary: #8e8e93;    /* iOS secondary label gray             */
  --color-ios-separator: #c7c7cc;    /* iOS hairline separator               */
  --color-ink-deep: #111827;         /* gray-900                             */
  --color-surface-ios: #eef0f4;      /* iOS grouped bg                       */
  --color-charcoal: #2c2c2e;
  --color-charcoal-mid: #2a2a2a;
  --color-danger-soft: #fca5a5;      /* red-300 soft border                  */
  --color-success-deep: #15803d;     /* green-700 on tinted surfaces         */
  --color-success-surface: #dcfce7;  /* green-100 surface                    */
  --color-orange-accent: #fb923c;    /* orange-400 accent                      */

  /* Social platform brand colors (fixed — not white-label) */
  --color-facebook: #1877f2;
  --color-messenger: #0095f6;
  --color-instagram: #e1306c;
  --color-instagram-warm: #e6683c;
  --color-instagram-mid: #dc2743;
  --color-instagram-deep: #cc2366;
  --color-instagram-ink: #bc1888;
  --color-instagram-orange: #f09433;
  --color-tiktok: #fe2c55;
  --color-tiktok-cyan: #25f4ee;
  --color-whatsapp: #25d366;
  --color-whatsapp-dark: #128c7e;
  --color-whatsapp-mid: #0fa67a;
  --color-whatsapp-light: #2ae06e;
  --color-google: #ea4335;
  --color-microsoft: #0078d4;
  --color-surface-subtle: #f9fafb;
  --color-danger-surface: #fef2f2;
  --color-danger-border: #fecaca;
  --color-danger-ink-bright: #991b1b;
  --color-warning-surface: #fffbeb;
  --color-warning-surface-alt: #fff7ed;
  --color-warning-soft: #fcd34d;
  --color-warning-soft-alt: #fde68a;
  --color-warning-deep: #92400e;
  --color-orange-600: #ea580c;
  --color-info-surface: #eff6ff;
  --color-ai-surface: #faf5ff;
  --color-ai-border: #ede9fe;
  --color-ai-ink-deep: #6b21a8;
  --color-ink-pure: #010101;

  /* Automations / info-sky palette (placeholder helper, manual trigger badges) */
  --color-border-faint: #eef2f6;
  --color-border-divider: #f1f3f7;
  --color-border-hover: #ebeef2;
  --color-border-dashed: #dce0e8;
  --color-surface-empty: #fafbfc;
  --color-info-sky-surface: #f0f9ff;
  --color-info-sky-surface-2: #e0f2fe;
  --color-info-sky-border: #bae6fd;
  --color-info-sky-border-mid: #7dd3fc;
  --color-info-sky-accent: #0284c7;
  --color-info-sky-ink: #0369a1;
  --color-info-sky-ink-deep: #0c4a6e;
  --color-success-border: #bbf7d0;
  --color-success-bright: #16a34a;
  --color-success-ink-deep: #166534;
  --color-warning-ink-mid: #a16207;
  --color-warning-ink-strong: #b45309;
  --color-warning-ink-deep: #78350f;
  --color-warning-pending-surface: #fef9c3;
  --color-danger-ink-deep: #b91c1c;
  --color-pink-surface: #fce7f3;
  --color-pink-ink: #db2777;

  /* ── SEMANTIC (status) ──────────────────────────────────────────────────── */
  --color-success: var(--brand-green);
  --color-success-tint: var(--brand-green-100);
  --color-success-ink: var(--brand-green-ink);

  --color-danger: #ef4444;
  --color-danger-strong: #b42318;
  --color-danger-tint: #fee2e2;
  --color-danger-ink: #7f1d1d;
  --color-danger-bright: #dc2626;    /* red-600 inline alerts                */

  --color-warning: #f59e0b;
  --color-warning-tint: #fef3c7;
  --color-warning-ink: #9a3412;
  --color-warning-bright: #d97706;   /* amber-600 inline alerts              */

  --color-info: #3b82f6;
  --color-info-tint: #dbeafe;
  --color-info-ink: #1e40af;
  --color-info-border-light: #93c5fd;
  --color-info-focus: #86b7fe;

  --color-ai: #7c3aed;               /* AI / generative accent (violet-600)  */
  --color-ai-tint: #f3e8ff;
  --color-ai-ink: #5b21b6;

  /* ── CANONICAL SCALE (UIrelease) ───────────────────────────────────────────
   * New and swept CSS uses ONLY the tokens in this block (plus BRAND/SEMANTIC).
   * The long-tail palette above stays for not-yet-swept files and is retired
   * as each file migrates.
   * ────────────────────────────────────────────────────────────────────── */

  /* Neutral ramp (slate) — the only greys new CSS should use */
  --neutral-0: #ffffff;
  --neutral-50: #f8fafc;
  --neutral-100: #f1f5f9;
  --neutral-200: #e2e8f0;
  --neutral-300: #cbd5e1;
  --neutral-400: #94a3b8;
  --neutral-500: #64748b;
  --neutral-600: #475569;
  --neutral-700: #334155;
  --neutral-800: #1e293b;
  --neutral-900: #0f172a;

  /* Pearl — warm off-white behind the app; white cards sit on top of it */
  --color-pearl: #f7f7f4;
  --color-pearl-deep: #efefea;
  --color-bg-app: var(--color-pearl);

  /* Brand action shades: #10b981 stays the identity colour (accents, icons,
     indicators, tints); filled controls with white text use emerald-700 so the
     label clears WCAG AA 4.5:1 (5.48:1). Focus ring uses emerald-600 (3.77:1 on
     white, clears the 3:1 non-text minimum). */
  --brand-action: var(--brand-green-strong);
  --brand-action-hover: var(--brand-green-ink);
  --brand-action-active: var(--brand-green-ink-deep);
  --brand-link: var(--brand-green-strong);
  --focus-ring-color: var(--brand-green-hover);
  --focus-ring: 0 0 0 3px rgba(var(--brand-green-rgb), 0.35);

  /* Font weights */
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Line heights */
  --line-height-tight: 1.25;
  --line-height-snug: 1.4;
  --line-height-base: 1.55;

  /* Extra steps between the existing type tokens below (px at 16px root):
     2xs 11 · xs 12 · caption 13 · sm 14 · md 15 · base 16 · lg 18 · xl 20 ·
     2xl 24 · 3xl 30 · 4xl 36 · 5xl 40 */
  --font-size-3xs: 0.625rem;   /* 10px micro labels (phone mockups, dense chips) */
  --font-size-2xs: 0.6875rem;
  --font-size-caption: 0.8125rem;
  --font-size-md: 0.9375rem;
  --font-size-5xl: 2.5rem;
  --font-size-6xl: 3rem;       /* 48px empty-state / hero icons */
  --font-size-7xl: 4rem;       /* 64px display icons */

  /* 4px spacing scale */
  --space-0: 0;
  --space-0-5: 2px;
  --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;

  /* Control dimensions — buttons, inputs, selects share these heights */
  --control-height-sm: 32px;
  --control-height: 40px;
  --control-height-lg: 48px;
  --control-padding-x-sm: 12px;
  --control-padding-x: 16px;
  --control-padding-x-lg: 20px;
  --control-radius: var(--radius-sm);
  --control-border: var(--neutral-300);

  /* Badges (status labels) and chips (small toggles/filters) */
  --badge-padding-y: 4px;
  --badge-padding-x: 10px;
  --chip-padding-x: var(--space-3);

  /* Table cells */
  --table-cell-padding-x: var(--space-4);
  --table-cell-padding-y: var(--space-3);
  --table-head-padding-y: 10px;
  --table-cell-padding-x-sm: var(--space-3);
  --table-cell-padding-y-sm: var(--space-2);

  /* Radius additions (xs 4 · sm 8 · md 12 · lg 16 · xl 20 · 2xl 24 · pill · round) */
  --radius-2xs: 2px;
  --radius-xs: 4px;
  --radius-md: 12px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-round: 50%;

  /* Categorical palette (CRM sources/stages, charts). Fixed across themes. */
  --category-rose: #e8a8c8;
  --category-sage: #9fd49a;
  --category-periwinkle: #a8b4f0;
  --category-teal: #6bb8a8;
  --category-sky: #8bb8e8;
  --category-sand: #e8b87a;
  --category-coral: #f8b4b4;

  /* Secondary hues with a fixed role */
  --color-lime-surface: #ecfccb;
  --color-lime-surface-2: #f7fee7;
  --color-lime-border: #bef264;
  --color-lime-accent: #4d7c0f;
  --color-lime-ink: #3f6212;
  --color-indigo-500: #6366f1;
  --color-indigo-600: #4f46e5;
  --color-indigo-700: #4338ca;
  --color-whatsapp-bubble-out: #dcf8c6;

  /* Dark-mode surfaces (public landing/about dark theme) */
  --color-dark-surface: #0d1522;
  --color-dark-surface-hero-1: #0d1622;
  --color-dark-surface-hero-2: #0c141f;
  --color-dark-surface-hero-3: #0b111a;
  --color-dark-surface-button-hover: #0b1220;
  --color-dark-info-surface: #0f2537;
  --color-dark-info-border: #1e3a4e;
  --color-dark-ink-indigo: #142047;


  /* Lighter violet for decorative AI accents (icons, gradients) */
  --color-ai-soft: #a78bfa;

  /* RGB triplets for translucent colour: rgba(var(--rgb-ink), 0.08) */
  --rgb-white: 255, 255, 255;
  --rgb-black: 0, 0, 0;
  --rgb-ink: 15, 23, 42;
  --rgb-neutral-400: 148, 163, 184;
  --rgb-neutral-500: 100, 116, 139;
  --rgb-info: 59, 130, 246;
  --rgb-danger: 239, 68, 68;
  --rgb-warning: 245, 158, 11;
  --rgb-ai: 124, 58, 237;
  --rgb-indigo-600: 79, 70, 229;   /* for rgba(var(--rgb-indigo-600), …), matches --color-indigo-600 */

  /* Elevation — slate-tinted so shadows sit naturally on pearl */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-popover: 0 10px 24px -6px rgba(15, 23, 42, 0.16), 0 2px 6px rgba(15, 23, 42, 0.06);
  --shadow-modal: 0 24px 48px -12px rgba(15, 23, 42, 0.25);
  --shadow-brand-lg: 0 10px 30px -6px rgba(var(--brand-green-rgb), 0.28);
  --shadow-ai: 0 4px 14px 0 rgba(var(--rgb-ai), 0.2);
  --shadow-ai-lg: 0 10px 30px -6px rgba(var(--rgb-ai), 0.3);

  /* Z-index scale (aligned with Bootstrap 5.3) */
  --z-base: 1;
  --z-raised: 10;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-sidebar: 1035;
  --z-dropdown: 1000;
  --z-modal-backdrop: 1050;
  --z-modal: 1055;
  --z-popover: 1070;
  --z-tooltip: 1080;
  --z-toast: 1090;
  --z-overlay-max: 2000;

  /* Motion */
  --duration-fast: 120ms;
  --duration: 200ms;
  --duration-slow: 300ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);

  /* ── TYPOGRAPHY ─────────────────────────────────────────────────────────── */
  --font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-family-display: Poppins, Inter, system-ui, sans-serif;
  /* Roles, so every KPI surface (admin-kpi-card, dash-stat, headline, band)
     speaks one type system. Poppins (display) is for page and section titles
     only; every number is a metric, every caption above it a label. */
  --metric-font: var(--font-family);
  --metric-weight: var(--font-weight-bold);
  --metric-color: var(--color-text);
  --metric-tracking: -0.01em;
  --metric-size-xl: var(--font-size-3xl);  /* page headline total */
  --metric-size-lg: var(--font-size-2xl);  /* KPI card */
  --metric-size-md: var(--font-size-xl);   /* compact tile, summary */
  --metric-size-sm: var(--font-size-lg);   /* band column, inline figure */
  --label-size: var(--font-size-xs);
  --label-weight: var(--font-weight-semibold);
  --label-tracking: 0.05em;
  --label-color: var(--color-text-muted);
  --hint-size: var(--font-size-xs);
  --hint-color: var(--color-text-muted);
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;

  /* ── SPACING ────────────────────────────────────────────────────────────── */
  --spacing-xs: 0.5rem;
  --spacing-sm: 0.75rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  --spacing-3xl: 4rem;

  /* ── RADIUS ─────────────────────────────────────────────────────────────── */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* ── SHADOW ─────────────────────────────────────────────────────────────── */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-brand: 0 4px 14px 0 rgba(var(--brand-green-rgb), 0.15);

  /* ── MOTION ─────────────────────────────────────────────────────────────── */
  --transition-speed: 0.25s;
  --transition-fast: 0.15s ease;
  --sidebar-expand-duration-open: 0.2s;
  --sidebar-expand-duration-close: 0.18s;
  --sidebar-copy-fade-duration: 0.16s;
  --sidebar-expand-easing: cubic-bezier(0.32, 0.72, 0, 1);

  /* ── LAYOUT (chrome dimensions) ─────────────────────────────────────────── */
  --sidebar-width: 280px;
  --sidebar-width-collapsed: 72px;
  --sidebar-layout-width: var(--sidebar-width);
  --sidebar-visual-width: var(--sidebar-width);
  --topbar-height: 70px;
  --mobile-tab-bar-height: 64px;
  --admin-tab-bar-height: 64px;
  --impersonation-banner-height: 44px;
  --billing-banner-height: 48px;
  --banner-offset: 0px;
  --ui-radius: var(--radius);

  /* ── SIDEBAR (chrome colors) ────────────────────────────────────────────── */
  --sidebar-bg: var(--color-surface-muted);
  --sidebar-text: var(--color-heading);
  --sidebar-text-light: #718096;
  --sidebar-border: var(--color-border);
  --sidebar-hover-bg: #edf2f7;
  --sidebar-active-color: var(--brand-green);
  --sidebar-active-bg: var(--brand-green-100);
  --sidebar-section-header-color: #1a202c;
  --color-sidebar-muted: #cbd5e0;
  --color-sidebar-faint: #a0aec0;
  --color-sidebar-dark-page: #0f1419;
  --color-sidebar-dark-active-bg: #2c5f4f;
  --color-sidebar-dark-active-ink: #68d391;
  --color-gray-50: #f7fafc;

  /* ── MOBILE PWA ─────────────────────────────────────────────────────────── */
  --mobile-brand-green: var(--brand-green);
  --mobile-bubble-incoming: #F2F2F7;
  --mobile-bubble-outgoing: var(--brand-green);

  /* ── SOCIAL PLANNER ─────────────────────────────────────────────────────── */
  --sp-primary: var(--brand-green);
  --sp-primary-hover: var(--brand-green-hover);
  --sp-primary-light: var(--brand-green-100);
  --sp-primary-glow: 0 4px 14px 0 rgba(var(--brand-green-rgb), 0.15);
  --sp-orange: var(--color-warning);
  --sp-orange-light: var(--color-warning-tint);
  --sp-red: var(--color-danger);
  --sp-red-light: var(--color-danger-tint);
  --sp-blue: var(--color-info);
  --sp-blue-light: var(--color-info-tint);
  --sp-gray: var(--color-text-muted);
  --sp-gray-light: #f1f5f9;
  --sp-text: var(--color-text);
  --sp-text-secondary: var(--color-text-secondary);
  --sp-text-muted: var(--color-text-faint);
  --sp-border: var(--color-border);
  --sp-border-light: #f1f5f9;
  --sp-surface: #ffffff;
  --sp-surface-alt: var(--color-surface-2);
  --sp-radius: 12px;
  --sp-radius-lg: 16px;
  --sp-radius-pill: 999px;
  --sp-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --sp-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --sp-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --sp-transition: 0.2s ease;
  --sp-post-bozza-bg: #ffedd5;
  --sp-post-bozza-ink: #9a3412;
  --sp-post-bozza-dot: #fb923c;
  --sp-post-da-approvare-bg: #ede9fe;
  --sp-post-da-approvare-ink: #5b21b6;
  --sp-post-da-approvare-dot: var(--color-ai);
  --sp-post-approvato-bg: var(--sp-primary-light);
  --sp-post-approvato-ink: var(--brand-green-ink, #166534);
  --sp-post-approvato-dot: var(--sp-primary);
  --sp-post-pubblicato-bg: var(--color-info-tint);
  --sp-post-pubblicato-ink: #1e40af;
  --sp-post-pubblicato-dot: var(--color-info);
  --sp-ai-purple: var(--color-ai);
  --sp-ai-purple-hover: #6D28D9;
  --sp-ai-purple-light: #A78BFA;
  --sp-ai-purple-glow: 0 4px 14px 0 rgba(124, 58, 237, 0.25);
  --ai-purple: var(--color-ai);
  --ai-purple-light: #9F67FF;
  --ai-purple-bg: var(--color-ai-tint);
  --media-step-violet: var(--sp-primary, #5CB574);
  --media-step-violet-hover: var(--sp-primary-hover, #44915a);
  --media-step-violet-soft: #f0fdf4;
  --media-step-violet-border: #86efac;

  /* ── SITE BUILDER (sito) ────────────────────────────────────────────────── */
  --sito-primary: var(--brand-green);
  --sito-primary-dark: var(--brand-green-hover);
  --sito-primary-light: var(--brand-green-100);
  --sito-text: var(--color-heading);
  --sito-text-light: #718096;
  --sito-border: var(--color-border);
  --sito-bg: var(--color-surface-muted);

  /* Studio manager color picker palette (hex keys must match studio-manager.js STUDIO_PALETTE) */
  --studio-palette-mint: #a8e6cf;
  --studio-palette-lavender: #d4c5f9;
  --studio-palette-peach: #fcd9bd;
  --studio-palette-sky: #bde0fe;
  --studio-palette-pink: #fbcfe8;

  /* ── LANDING (premium section — namespaced) ─────────────────────────────── */
  --premium-bg: #FAFAFA;
  --premium-surface: #FFFFFF;
  --premium-surface-2: #F5F5F5;
  --premium-text: #1A1A1A;
  --premium-text-secondary: #525252;
  --premium-text-muted: #737373;
  --premium-accent: var(--brand-green);
  --premium-accent-light: var(--brand-green-100);
  --premium-accent-dark: var(--brand-green-hover);
  --premium-border: #E5E5E5;
  --premium-border-light: #F0F0F0;
  --premium-shadow: rgba(0, 0, 0, 0.08);
  --premium-shadow-lg: rgba(0, 0, 0, 0.12);
  --premium-radius: 16px;
  --premium-radius-lg: 24px;

  /* ── BREAKPOINTS (reference only — CSS cannot use vars in media queries) ─── */
  --bp-xs: 380px;
  --bp-sm: 576px;
  --bp-md: 768px;
  --bp-lg: 992px;
  --bp-xl: 1200px;
  --bp-2xl: 1400px;

  /* ── LEGACY ALIASES ─────────────────────────────────────────────────────── */
  /* Older feature CSS references these names; keep them mapped onto the       */
  /* canonical tokens so there is exactly one source of truth. New code should */
  /* use the canonical color / brand-primary tokens above.                     */
  --emerald: var(--brand-primary);
  --emerald-hover: var(--brand-primary-hover);
  --emerald-light: var(--brand-primary-tint);
  --primary: var(--brand-primary);
  --primary-hover: var(--brand-primary-hover);
  --primary-light: var(--brand-primary-tint);
  --accent: var(--brand-primary);
  --accent-hover: var(--brand-primary-hover);
  --secondary: var(--color-text-muted);
  --bg: var(--color-surface);
  --bg-secondary: var(--color-surface-2);
  --background: var(--color-surface);
  --surface: var(--color-surface-2);
  --surface-elevated: var(--color-surface);
  --card: var(--color-surface);
  --glass: var(--color-surface);
  --glass-border: var(--color-border);
  --border: var(--color-border);
  --border-light: var(--color-border-subtle);
  --muted: var(--color-text-muted);
  --text-primary: var(--color-text);
  --text-secondary: var(--color-text-secondary);
  --text-muted: var(--color-text-faint);
  --soft-blue: var(--color-text-muted);
  --soft-blue-hover: var(--color-text-secondary);
  --radius-lg-legacy: var(--radius-lg);
  --shadow-emerald: var(--shadow-brand);
  --gradient-primary: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-hover));
  --gradient-secondary: linear-gradient(135deg, var(--color-info), #1d4ed8);
}

/* ── RESPONSIVE TOKEN OVERRIDES ──────────────────────────────────────────── */
@media (max-width: 576px) {
  :root {
    --impersonation-banner-height: 32px;
  }
}

@media (max-width: 768px) {
  :root {
    /* Touch targets: every control grows together on phones/tablets */
    --control-height-sm: 40px;
    --control-height: 44px;
    --control-height-lg: 52px;
    --table-cell-padding-x: var(--space-3);
    --sidebar-width: 0;
    --topbar-height: 65px;
  }
}

@media (max-width: 576px) {
  :root {
    --topbar-height: 60px;
  }
}

@media (prefers-contrast: more) {
  :root {
    --sidebar-text: #000000;
    --sidebar-section-header-color: #000000;
    --sidebar-active-color: #008000;
  }
}

/* Public landing palette — scoped to landing pages only (landing.css is not global). */
body.page-public-landing {
  --bg: #FAFAFA;
  --surface: #F0F0F0;
  --text: #111111;
  --text-muted: #666666;
  --text-dim: #999999;
  --accent: var(--brand-green);
  --accent-hover: var(--brand-green-hover);
  --border: #E5E5E5;
  --border-light: #EEEEEE;
  --white: #FFFFFF;
  --landing-black: #000000;
  --landing-green-bright: #22C55E;
  --landing-mint-tint: #f0f8f2;
  --landing-pipeline-1: #e8e8e8;
  --landing-pipeline-2: #e0e0e0;
  --landing-border-muted: #dddddd;
  --landing-border-faint: #cccccc;
  --landing-ink-mid: #333333;
  --section-pad: clamp(80px, 10vw, 140px);
  --container: 1200px;
  --gap: 24px;
}

/* ───────────────────────────────────────────────────────────────────────────
 * WHITE-LABEL THEMES
 * Activate by setting data-theme on <html> (see base.html). Each theme only
 * needs to override the BRAND block — neutrals/semantics/scale are inherited.
 * "ocean" below is a working proof-of-concept (indigo/blue brand).
 * ────────────────────────────────────────────────────────────────────────── */
[data-theme="ocean"] {
  --brand-green: #4f46e5;            /* indigo-600 */
  --brand-green-hover: #4338ca;      /* indigo-700 */
  --brand-green-strong: #3730a3;     /* indigo-800 */
  --brand-green-ink: #312e81;        /* indigo-900 */
  --brand-green-ink-deep: #1e1b4b;
  --brand-green-50: #eef2ff;
  --brand-green-100: #e0e7ff;
  --brand-green-200: #c7d2fe;
  --brand-green-300: #a5b4fc;
  --brand-green-400: #818cf8;
  --brand-green-rgb: 79, 70, 229;
}
