/* Design tokens — the single source of truth for the backoffice look.
   Values seeded from the palette that shared.css already used, so
   adopting a token is never a visual change by itself.

   THE CONTRACT: component CSS (backoffice/components/*.css) may not
   invent design values — every color comes from a var() defined here.
   Need a value that doesn't exist? Add a token HERE, then use it. Never
   a second token file: one vocabulary, extended, is what keeps the
   system a system. Enforced by scripts/checkDesignTokens.js (runs with
   npm test).

   Rule of adoption: new or touched code uses tokens; untouched code keeps
   its hard-coded values until its migration slice comes up. */

:root {
    /* Brand + feedback colors */
    --color-primary: #1a73e8;
    --color-primary-hover: #1557b0;
    --color-primary-subtle: #e8f0fe;   /* selected/active backgrounds */
    --color-danger: #d93025;
    --color-danger-hover: #b3261e;
    --color-danger-subtle: #fce8e6;
    --color-success: #1e8e3e;
    --color-success-hover: #137333;
    --color-success-subtle: #e6f4ea;
    --color-warning: #f9ab00;
    --color-warning-subtle: #fef7e0;
    /* "Needs an answer" — a pending join request or invite the desk can
       settle. Deeper amber than --color-warning (money due): iOS's banner
       is a soft yellow, and reception already reads orange as an ask. */
    --color-attention: #b45309;
    --color-attention-fg: #92400e;       /* text on the subtle ground */
    --color-attention-subtle: #fefce8;
    --color-attention-border: #fde68a;
    --color-on-attention: #ffffff;
    /* A player's rating. Gold rather than a text gray because the level is a
       standing on the ladder, not a caption — the app shows it the same way. */
    --color-player-level: #b7950b;

    /* Surfaces + lines */
    --color-bg: #f5f5f5;               /* page background */
    --color-surface: #ffffff;          /* cards, rails, bars */
    --color-surface-hover: #f1f3f4;    /* hover on white surfaces */
    --color-bg-hover: #e8eaed;         /* hover on gray (bg-colored) surfaces */
    --color-border: #dadce0;
    --color-border-subtle: #eef0f2;    /* quiet structural dividers */
    --color-border-strong: #c2c6cc;   /* hover/emphasis edges */
    --color-backdrop: rgba(16, 24, 40, 0.4);  /* modal/drawer scrim */
    --color-on-primary: #ffffff;       /* text/icons on filled primary */

    /* Brand mark — exact copy of the landing page (public/homepage.css),
       used only by the sidebar brand block. */
    --color-brand: #155eef;
    --color-brand-ink: #101828;

    /* Role badge colors — app vocabulary: a role means the same colors
       wherever it appears. */
    --role-owner-bg: #fef7e0;         --role-owner-fg: #e37400;
    --role-superadmin-bg: #ede7f6;    --role-superadmin-fg: #5e35b1;
    --role-manager-bg: #e8f0fe;       --role-manager-fg: #1a73e8;
    --role-coach-bg: #e6f4ea;         --role-coach-fg: #1e8e3e;
    --role-receptionist-bg: #f1f3f4;  --role-receptionist-fg: #5f6368;

    /* Text */
    --color-text: #202124;
    --color-text-secondary: #5f6368;
    --color-text-tertiary: #80868b;   /* reference detail, reads below secondary */

    /* Typography */
    --font-sans: 'Instrument Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --text-xs: 11px;
    --text-sm: 12px;
    --text-md: 13px;
    --text-base: 14px;
    --text-lg: 16px;
    --text-xl: 18px;
    --text-2xl: 24px;
    --leading-tight: 1.2;
    --leading-body: 1.5;
    --tracking-tight: -0.02em;

    /* Spacing scale */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;

    /* Radii + elevation */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-full: 999px;
    --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
    --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.15);
    /* Under a small glyph riding an avatar (the owner's key): lifts it off
       whatever face it overlaps. */
    --shadow-glyph: 0 1px 1px rgba(0, 0, 0, 0.35);

    /* Legacy aliases (shared.css names) now resolve through the tokens,
       so old CSS and new CSS can never drift apart. */
    --primary: var(--color-primary);
    --primary-hover: var(--color-primary-hover);
    --danger: var(--color-danger);
    --danger-hover: var(--color-danger-hover);
    --bg: var(--color-bg);
    --surface: var(--color-surface);
    --text: var(--color-text);
    --text-secondary: var(--color-text-secondary);
    --border: var(--color-border);
    --shadow: var(--shadow-1);
    --shadow-lg: var(--shadow-2);
    --radius: var(--radius-md);
}

/* ============================================================
   Sidebar component tokens — the rail's own dials. Current look:
   refined minimal rail — Instrument Sans, labeled groups on an
   8px rhythm, quiet gray pill for the active item with a small
   brand-blue accent bar on the rail edge as the one signature.
   ============================================================ */

:root {
    --sb-width: 240px;

    /* Same surface as the topbar so rail and top bar read as one frame. */
    --sb-bg: var(--color-surface);
    --sb-border: rgba(0, 0, 0, 0.06);

    /* Type: Instrument Sans (variable weights) — muted at rest,
       ink when active. */
    --sb-font: var(--font-sans);
    --sb-text-size: 15px;
    --sb-sub-text-size: var(--text-base);
    --sb-text: #2f3237;
    --sb-text-weight: 460;
    --sb-parent-weight: 520;
    --sb-text-active: #17181b;
    --sb-active-weight: 580;
    --sb-tracking: -0.1px;

    /* Group labels ("Operations", "Administration") */
    --sb-label-color: #9498a1;
    --sb-label-size: var(--text-xs);
    --sb-label-tracking: 0.07em;

    /* Rows: 8px rhythm — 38px items, 34px sub-items. */
    --sb-item-height: 38px;
    --sb-sub-item-height: 34px;
    --sb-item-radius: var(--radius-sm);
    --sb-item-gap: 2px;
    --sb-item-pad-x: 10px;
    --sb-inset: 10px;              /* rail edge -> item edge */
    --sb-icon-gap: 11px;           /* icon -> label */

    /* States: active = brand-tinted pill with blue text/icon; the
       rail-edge bar stays as the secondary cue. */
    --sb-hover-bg: rgba(0, 0, 0, 0.03);
    --sb-active-bg: var(--color-primary-subtle);
    --sb-active-fg: var(--color-primary);
    --sb-active-border: transparent;
    --sb-active-shadow: none;
    --sb-accent: var(--color-primary);   /* active rail-edge bar */

    /* Icons: a touch lighter than the text. */
    --sb-icon-size: 16px;
    --sb-icon-color: #565b61;
    --sb-icon-active-color: var(--color-primary);

    /* Nested submenu guide line */
    --sb-guide-color: var(--color-border);
}
