/* ═══════════════════════════════════════════════════════════════════════
   AXOS Unified Design System — foundation and semantic tokens
   CR-BRAND-008 (9 Oct 2026, quality consolidation).

   One source of truth for every AXOS surface: the internal spaces, the
   sign-in card, the supplier portal, the exhibitions portal. Loaded first
   in both the backend and the frontend bundles, so every stylesheet can
   read these with var(). The identity stylesheet that Experience Studio
   publishes (--axos-ground, --axos-primary, --axos-success …) stays the
   kit layer; the semantic layer below bridges to it with fallbacks to the
   official palette, so a page without the identity file still paints
   right.

   Naming
     --axos-brand-*     the official palette, fixed (section 4 of the mandate)
     --axos-color-*     meaning → colour, theme-aware (Night / Formal)
     --axos-text-*      the same meanings as TEXT on the current surface
     --axos-surface-*   grounds, cards, fields
     --axos-ink-*       foreground ramps
     --axos-line-*      borders
     --axos-radius-*    one radius scale
     --axos-control-*   one control-height scale
     --axos-fs-*        one type scale
     --axos-shadow-*    elevation
     --axos-gradient-*  the approved gradients

   Themes: Night is the default. Formal is switched on by any of
     .o_axos_ws_ivory (the spaces), html[data-theme="formal"] (the expo
     portal), body.axos-sp-body / .axos-formal (light pages).
   ═══════════════════════════════════════════════════════════════════════ */

:root {
    /* ── 1. Brand palette (fixed) ─────────────────────────────────────── */
    --axos-brand-purple:   #482783;   /* AYMA Purple   — primary */
    --axos-brand-deep:     #2A0D54;   /* AYMA Deep     — deep grounds, executive */
    --axos-brand-rose:     #EF3F61;   /* Signal Rose   — attention, active, alerts */
    --axos-brand-gold:     #D4A017;   /* Premium Gold  — value, importance */
    --axos-brand-gold-soft:#E8C547;   /* Soft Gold     — highlights on dark */
    --axos-brand-teal:     #2FC3A8;   /* AXOS Teal     — success, approved */
    --axos-brand-blue:     #6C9CFF;   /* AXOS Blue     — information, supportive */
    --axos-brand-lavender: #9381BC;   /* Lavender      — secondary, purple ramps */
    --axos-brand-muted:    #6B5E80;   /* Muted Purple  — secondary text on light */

    /* derivatives for TEXT on light surfaces (≥ 4.5:1 on white and on
       the Formal ground #F6F3FA); the bright values stay for dark grounds */
    --axos-brand-teal-ink:     #1C7566;   /* 5.3 : 1 */
    --axos-brand-rose-ink:     #C2173C;   /* 6.0 : 1 */
    --axos-brand-blue-ink:     #2456C9;   /* 6.5 : 1 */
    --axos-brand-gold-ink:     #8A6300;   /* 5.4 : 1 */
    --axos-brand-lavender-ink: #5D4C85;   /* 7.4 : 1 */

    /* the night ground ramp used by the spaces, the sign-in and the portals */
    --axos-brand-night-0: #100726;
    --axos-brand-night-1: #190B36;
    --axos-brand-night-2: #1E0F3A;
    --axos-brand-silver:  #E8E3F0;    /* the lit pill / primary button on dark */

    /* ── 2. Scales (theme-independent) ────────────────────────────────── */
    --axos-radius-xs: 6px;
    --axos-radius-sm: 10px;
    --axos-radius-md: 14px;
    --axos-radius-lg: 20px;
    --axos-radius-xl: 28px;
    --axos-radius-pill: 999px;

    --axos-control-xs: 28px;
    --axos-control-sm: 34px;
    --axos-control-md: 40px;
    --axos-control-lg: 46px;

    /* type scale — nothing below 12px is used for text people must read */
    --axos-fs-caption: 12px;
    --axos-fs-label:   12.5px;
    --axos-fs-body-sm: 13px;
    --axos-fs-body:    14px;
    --axos-fs-body-lg: 15px;
    --axos-fs-card:    18px;
    --axos-fs-section: 22px;
    --axos-fs-title:   28px;
    --axos-fs-display: 40px;
    --axos-fs-kpi:     26px;

    --axos-font-ui: 'Tajawal', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --axos-font-numbers: 'Tajawal', 'Segoe UI', system-ui, sans-serif;

    --axos-ease: cubic-bezier(.2, .7, .2, 1);
    --axos-motion: 160ms;

    --axos-bp-phone: 430px;    /* for reference; media queries cannot read vars */
    --axos-bp-tablet: 768px;
    --axos-bp-desktop: 1100px;

    /* ── 3. Semantic colours — Night (default) ────────────────────────── */
    --axos-color-primary:   var(--axos-primary,  var(--axos-brand-purple));
    --axos-color-deep:      var(--axos-purple,   var(--axos-brand-deep));
    --axos-color-secondary: var(--axos-brand-lavender);
    --axos-color-success:   var(--axos-brand-teal);
    --axos-color-info:      var(--axos-brand-blue);
    --axos-color-warning:   var(--axos-brand-gold-soft);
    --axos-color-danger:    var(--axos-brand-rose);
    --axos-color-attention: var(--axos-brand-rose);
    --axos-color-value:     var(--axos-brand-gold);
    --axos-color-selected:  var(--axos-brand-silver);
    --axos-color-on-selected: var(--axos-brand-purple);
    --axos-color-focus:     var(--axos-brand-silver);

    /* the same meanings as text, on this theme's surfaces */
    --axos-text-success:   var(--axos-brand-teal);
    --axos-text-info:      var(--axos-brand-blue);
    --axos-text-warning:   var(--axos-brand-gold-soft);
    --axos-text-danger:    #FF8FA6;
    --axos-text-attention: #FF8FA6;
    --axos-text-value:     var(--axos-brand-gold-soft);
    --axos-text-secondary: var(--axos-brand-lavender);

    --axos-surface-ground:  var(--axos-brand-night-0);
    --axos-surface-ground-2:var(--axos-brand-night-1);
    --axos-surface-card:    rgba(30, 15, 58, .92);
    --axos-surface-card-solid: #21113A;
    --axos-surface-raised:  #281647;
    --axos-surface-field:   #150A2C;
    --axos-surface-lane:    rgba(255, 255, 255, .012);
    --axos-surface-hover:   rgba(255, 255, 255, .06);

    --axos-ink:        #F0ECF8;
    --axos-ink-2:      #C9BFE0;
    --axos-ink-quiet:  #A899C8;
    --axos-ink-faint:  #8F84A8;

    --axos-line:        rgba(255, 255, 255, .10);
    --axos-line-strong: rgba(255, 255, 255, .16);
    --axos-line-focus:  var(--axos-brand-silver);

    --axos-shadow-card: 0 24px 60px rgba(6, 3, 14, .5);
    --axos-shadow-pop:  0 12px 32px rgba(6, 3, 14, .45);

    --axos-gradient-ground: linear-gradient(180deg, var(--axos-brand-night-0) 0%, var(--axos-brand-night-1) 100%);
    --axos-gradient-deep:   linear-gradient(135deg, #100726 0%, #2A0D54 55%, #482783 100%);
    --axos-gradient-glow:   radial-gradient(60% 50% at 50% 0%, rgba(72, 39, 131, .55) 0%, rgba(72, 39, 131, 0) 70%);
    --axos-gradient-rose:   linear-gradient(135deg, #2A0D54 0%, #482783 60%, #EF3F61 140%);

    --axos-scheme: dark;
}

/* ── 4. Formal (light) ────────────────────────────────────────────────── */
.o_axos_ws_ivory,
.o_axos_ecc_formal,
body.o_axos_look_formal .o_action:not(.o_axos_ws_night):not(.o_axos_ecc_night),
.o_view_controller.axos_pipeline,
html[data-theme="formal"],
body.axos-sp-body,
.axos-formal {
    --axos-color-primary:   var(--axos-brand-purple);
    --axos-color-deep:      var(--axos-brand-deep);
    --axos-color-secondary: var(--axos-brand-lavender-ink);
    --axos-color-success:   var(--axos-brand-teal);
    --axos-color-info:      var(--axos-brand-blue);
    --axos-color-warning:   var(--axos-brand-gold);
    --axos-color-danger:    var(--axos-brand-rose);
    --axos-color-attention: var(--axos-brand-rose);
    --axos-color-value:     var(--axos-brand-gold);
    --axos-color-selected:  var(--axos-brand-purple);
    --axos-color-on-selected: #FFFFFF;
    --axos-color-focus:     var(--axos-brand-purple);

    --axos-text-success:   var(--axos-brand-teal-ink);
    --axos-text-info:      var(--axos-brand-blue-ink);
    --axos-text-warning:   var(--axos-brand-gold-ink);
    --axos-text-danger:    var(--axos-brand-rose-ink);
    --axos-text-attention: var(--axos-brand-rose-ink);
    --axos-text-value:     var(--axos-brand-gold-ink);
    --axos-text-secondary: var(--axos-brand-lavender-ink);

    --axos-surface-ground:  #F6F3FA;
    --axos-surface-ground-2:#FFFFFF;
    --axos-surface-card:    #FFFFFF;
    --axos-surface-card-solid: #FFFFFF;
    --axos-surface-raised:  #F3EFFA;
    --axos-surface-field:   #FFFFFF;
    --axos-surface-lane:    rgba(72, 39, 131, .03);
    --axos-surface-hover:   rgba(72, 39, 131, .06);

    --axos-ink:        #1A1226;
    --axos-ink-2:      #3C3150;
    --axos-ink-quiet:  var(--axos-brand-muted);
    --axos-ink-faint:  #776C8C;   /* 4.9 : 1 on white */

    --axos-line:        #E4E0EC;
    --axos-line-strong: #CFC2E6;
    --axos-line-focus:  var(--axos-brand-purple);

    --axos-shadow-card: 0 12px 32px rgba(42, 13, 84, .10);
    --axos-shadow-pop:  0 10px 28px rgba(42, 13, 84, .14);

    --axos-gradient-ground: linear-gradient(180deg, #F6F3FA 0%, #FFFFFF 100%);
    --axos-gradient-glow:   radial-gradient(60% 50% at 50% 0%, rgba(72, 39, 131, .10) 0%, rgba(72, 39, 131, 0) 70%);

    --axos-scheme: light;
}

/* ── 4b. Night roots (after Formal, so they win where a root is Formal by
   default — the classic CRM kanban, a page under body.o_axos_look_night) ── */
body.o_axos_look_night .o_action,
body.o_axos_look_night .o_view_controller.axos_pipeline,
.o_axos_ws.o_axos_ws_night,
.o_axos_ecc.o_axos_ecc_night {
    /* ── 3. Semantic colours — Night (default) ────────────────────────── */
    --axos-color-primary:   var(--axos-primary,  var(--axos-brand-purple));
    --axos-color-deep:      var(--axos-purple,   var(--axos-brand-deep));
    --axos-color-secondary: var(--axos-brand-lavender);
    --axos-color-success:   var(--axos-brand-teal);
    --axos-color-info:      var(--axos-brand-blue);
    --axos-color-warning:   var(--axos-brand-gold-soft);
    --axos-color-danger:    var(--axos-brand-rose);
    --axos-color-attention: var(--axos-brand-rose);
    --axos-color-value:     var(--axos-brand-gold);
    --axos-color-selected:  var(--axos-brand-silver);
    --axos-color-on-selected: var(--axos-brand-purple);
    --axos-color-focus:     var(--axos-brand-silver);

    /* the same meanings as text, on this theme's surfaces */
    --axos-text-success:   var(--axos-brand-teal);
    --axos-text-info:      var(--axos-brand-blue);
    --axos-text-warning:   var(--axos-brand-gold-soft);
    --axos-text-danger:    #FF8FA6;
    --axos-text-attention: #FF8FA6;
    --axos-text-value:     var(--axos-brand-gold-soft);
    --axos-text-secondary: var(--axos-brand-lavender);

    --axos-surface-ground:  var(--axos-brand-night-0);
    --axos-surface-ground-2:var(--axos-brand-night-1);
    --axos-surface-card:    rgba(30, 15, 58, .92);
    --axos-surface-card-solid: #21113A;
    --axos-surface-raised:  #281647;
    --axos-surface-field:   #150A2C;
    --axos-surface-lane:    rgba(255, 255, 255, .012);
    --axos-surface-hover:   rgba(255, 255, 255, .06);

    --axos-ink:        #F0ECF8;
    --axos-ink-2:      #C9BFE0;
    --axos-ink-quiet:  #A899C8;
    --axos-ink-faint:  #8F84A8;

    --axos-line:        rgba(255, 255, 255, .10);
    --axos-line-strong: rgba(255, 255, 255, .16);
    --axos-line-focus:  var(--axos-brand-silver);

    --axos-shadow-card: 0 24px 60px rgba(6, 3, 14, .5);
    --axos-shadow-pop:  0 12px 32px rgba(6, 3, 14, .45);

    --axos-gradient-ground: linear-gradient(180deg, var(--axos-brand-night-0) 0%, var(--axos-brand-night-1) 100%);
    --axos-gradient-deep:   linear-gradient(135deg, #100726 0%, #2A0D54 55%, #482783 100%);
    --axos-gradient-glow:   radial-gradient(60% 50% at 50% 0%, rgba(72, 39, 131, .55) 0%, rgba(72, 39, 131, 0) 70%);
    --axos-gradient-rose:   linear-gradient(135deg, #2A0D54 0%, #482783 60%, #EF3F61 140%);

    --axos-scheme: dark;
}

/* ── 5. Compatibility aliases ─────────────────────────────────────────
   The local token sets the four surfaces grew (--ws-*, --axl-*, --sp-*,
   --axcrm-*) keep working; their brand-bearing entries now read the
   semantic layer, so a palette change lands everywhere at once. The
   remaining local names are layout details and stay where they are. */
:root {
    --axcrm-rose:        var(--axos-color-attention);
    --axcrm-rose-bright: var(--axos-text-attention);
    --axcrm-teal:        var(--axos-color-success);
    --axcrm-gold:        var(--axos-color-value);
    --axcrm-late:        var(--axos-brand-rose-ink);
    --axos-teal:         var(--axos-color-success);     /* the expo portal's names */
    --axos-rose:         var(--axos-color-attention);
}

/* reduced motion: one switch for every surface */
@media (prefers-reduced-motion: reduce) {
    :root { --axos-motion: 0ms; }
}
