/* =============================================================================
   css/tokens.css
   Every colour, size, space and shadow the app uses, named once.

   This is the file to open when you want to change how the app looks
   (docs/05-ux-spec.md section 8, and prompt P-11 in docs/09-working-with-claude.md).
   Nothing in here draws anything. It only gives values names, so that changing
   one line here changes every button, card and screen at once.

   The rule that keeps this working: no other CSS file may write a colour or a
   size directly. They all say var(--something). If you ever find a raw #hex or
   a raw pixel number in components.css or a screen file, that is a bug.

   Two layers, on purpose:

     1. The palette    what the colours actually are      --blue-600, --grey-200
     2. The roles      what they are being used for       --color-primary, --color-border

   Screens and components only ever use layer 2. That means a redesign can
   repoint --color-primary at a different blue without hunting through files,
   and dark mode later is a matter of redefining layer 2 inside a media query.
   ============================================================================= */

:root {

  /* ---------------------------------------------------------------------------
     1. PALETTE
     The raw colours. Taken from docs/05-ux-spec.md section 8.
     --------------------------------------------------------------------------- */

  /* Brand blue */
  --blue-700: #01379a;
  --blue-600: #0149c7;   /* the brand primary */
  --blue-500: #2f6fd8;
  --blue-100: #ccdcff;   /* primary-light */
  --blue-50:  #eaf1ff;

  /* Brand navy, used for the header and deep text */
  --navy-900: #242733;

  /* Status colours. Green reads as "money came in", red as "careful". */
  --green-600:  #1e8e3e;
  --green-50:   #e6f4ea;
  --orange-600: #e37400;
  --orange-50:  #fef7e0;
  --red-600:    #c5221f;
  --red-50:     #fce8e6;

  /* Greys, light to dark */
  --grey-50:  #f8f9fa;
  --grey-100: #f1f3f4;
  --grey-200: #e8eaed;
  --grey-300: #dadce0;
  --grey-400: #bdc1c6;
  --grey-500: #9aa0a6;
  --grey-600: #80868b;
  --grey-700: #5f6368;
  --grey-800: #3c4043;
  --grey-900: #202124;

  --white: #ffffff;


  /* ---------------------------------------------------------------------------
     2. ROLES
     What each colour is for. Components use only these.
     --------------------------------------------------------------------------- */

  --color-primary:        var(--blue-600);
  --color-primary-dark:   var(--blue-700);
  --color-primary-light:  var(--blue-100);
  --color-primary-faint:  var(--blue-50);
  --color-on-primary:     var(--white);

  --color-success:        var(--green-600);
  --color-success-faint:  var(--green-50);
  --color-warning:        var(--orange-600);
  --color-warning-faint:  var(--orange-50);
  --color-danger:         var(--red-600);
  --color-danger-faint:   var(--red-50);

  /* Page and panels */
  --color-bg:             var(--grey-100);   /* behind everything */
  --color-surface:        var(--white);      /* cards, sheets, the bill panel */
  --color-surface-sunken: var(--grey-50);    /* table headers, quiet strips */
  --color-header:         var(--navy-900);   /* the app bar */
  --color-on-header:      var(--white);

  /* Text. Muted is for labels; faint is for hints that must not compete. */
  --color-text:           var(--grey-900);
  --color-text-muted:     var(--grey-700);
  --color-text-faint:     var(--grey-500);
  --color-text-inverse:   var(--white);

  /* Lines */
  --color-border:         var(--grey-300);
  --color-border-strong:  var(--grey-400);
  --color-focus:          var(--blue-500);

  /* Charts (docs/05-ux-spec.md section 6): one accent for sales, one for cost,
     one for profit, greys for everything else. */
  --chart-sales:   var(--blue-600);
  --chart-cost:    var(--orange-600);
  --chart-profit:  var(--green-600);
  --chart-neutral: var(--grey-400);
  --chart-grid:    var(--grey-200);


  /* ---------------------------------------------------------------------------
     3. TYPE
     One family, three weights, self-hosted (CLAUDE.md rule 10).
     The sizes come straight from docs/05-ux-spec.md rule 2.9, and are named
     after the job they do rather than by number, so the rule stays visible:
     nothing on a counter screen is smaller than --text-body.
     --------------------------------------------------------------------------- */

  --font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --font-regular: 400;
  --font-medium:  500;
  --font-bold:    700;

  --text-small:   14px;   /* captions and table footnotes only, never on Sell */
  --text-body:    16px;   /* the floor for anything a person reads */
  --text-line:    18px;   /* bill lines */
  --text-heading: 22px;
  --text-title:   28px;
  --text-total:   40px;   /* the bill total */
  --text-change:  48px;   /* change due, the biggest thing on any screen */

  --leading-tight: 1.2;
  --leading-normal: 1.45;


  /* ---------------------------------------------------------------------------
     4. SPACE
     A six step scale. Using anything in between is how layouts start to drift.
     --------------------------------------------------------------------------- */

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


  /* ---------------------------------------------------------------------------
     5. SHAPE AND TOUCH
     The tap sizes are function, not decoration (docs/05-ux-spec.md rule 2.2).
     They apply from phase 1 and should not be reduced during design polish.
     --------------------------------------------------------------------------- */

  --radius-sm:   8px;
  --radius-md:  12px;
  --radius-pill: 999px;

  --tap-min:      56px;   /* nothing tappable is smaller than this */
  --tap-primary:  64px;   /* Save bill, Close day, and friends */
  --tile-min-w:  150px;
  --tile-min-h:   96px;

  --border-width: 1px;
  --focus-width:  3px;


  /* ---------------------------------------------------------------------------
     6. DEPTH
     Shadows are deliberately soft. Dad's tablet is often in daylight, so
     contrast comes from borders and size, not from heavy drop shadows.
     --------------------------------------------------------------------------- */

  --shadow-card:   0 1px 2px rgba(32, 33, 36, 0.10), 0 1px 3px rgba(32, 33, 36, 0.06);
  --shadow-raised: 0 2px 6px rgba(32, 33, 36, 0.12), 0 4px 12px rgba(32, 33, 36, 0.08);
  --shadow-sheet:  0 -4px 16px rgba(32, 33, 36, 0.16);


  /* ---------------------------------------------------------------------------
     7. LAYERING
     Named so that two things can never accidentally fight over who is on top.
     --------------------------------------------------------------------------- */

  --z-base:    0;
  --z-sticky:  10;   /* the app header, sticky table headers */
  --z-sheet:  100;   /* the line editor sliding up from the bottom */
  --z-dialog: 200;   /* confirmations, Open and Close Day */
  --z-toast:  300;   /* always visible, above everything */


  /* ---------------------------------------------------------------------------
     8. MOTION
     Short and plain. Nothing on the counter should feel like it is animating.
     --------------------------------------------------------------------------- */

  --speed-fast: 120ms;
  --speed-slow: 240ms;
  --hold-duration: 2000ms;   /* the hold-to-confirm ring, docs/05-ux-spec.md 2.6 */
}


/* -----------------------------------------------------------------------------
   Breakpoints, for reference. CSS custom properties cannot be used inside a
   media query, so these numbers are written out in the few places that need
   them. They are recorded here so there is one place that states them.

     phone    up to 480px     back office and reports only; Sell refuses
     tablet   1024 to 1280px  the Tab S9 FE, designed at 1180 x 740
     desktop  1281px and up   same as tablet, wider margins

   See docs/05-ux-spec.md section 1 and PWA-03.
   ----------------------------------------------------------------------------- */


/* -----------------------------------------------------------------------------
   Dark mode is not in version 1 (docs/05-ux-spec.md section 8). When it is
   wanted, it goes here: redefine the ROLE tokens only, never the palette and
   never a component. Left as a comment so the shape of the change is obvious.

   @media (prefers-color-scheme: dark) {
     :root {
       --color-bg:      var(--grey-900);
       --color-surface: var(--grey-800);
       --color-text:    var(--grey-50);
       --color-border:  var(--grey-700);
     }
   }
   ----------------------------------------------------------------------------- */
