/*
  Meliora CRM design tokens.
  This file holds CSS variables only. Components live in app.css.
  The ten theme keys served by /api/meta (primary, accent, surface, border, text, muted, danger,
  success, warning, font_family) are applied over these variables at startup, see applyTheme in js/ui.js.
*/
:root {
  /* Brand colors */
  --color-primary: #1F3864;        /* navy: sidebar, primary buttons, table header text */
  --color-accent: #2F5597;         /* blue: links, focus, secondary accents */
  --color-accent-pale: #EAF1FC;    /* pale blue: selected rows, subtle panels */
  --color-accent-light: #DAE3F4;   /* light blue */
  --color-border: #B9CDE1;         /* border blue: controls and panels */
  --color-line: #E3E8EF;           /* neutral hairline: table rows, dividers */
  --color-surface: #FFFFFF;
  --color-page: #F5F6F8;
  --color-hover: #F4F7FC;
  --color-text: #111827;
  --color-muted: #6B7280;
  --color-danger: #C00000;         /* errors and overdue only */
  --color-danger-pale: #FBEAEA;
  --color-success: #1E6B3A;
  --color-success-pale: #E6F2EA;
  --color-warning: #475569;        /* notice accent (slate, never gold) */
  --color-on-primary: #FFFFFF;
  --color-on-primary-muted: #C9D4E8;
  --color-on-primary-hover: rgba(255, 255, 255, 0.08);
  --color-on-primary-active: rgba(255, 255, 255, 0.16);
  --color-backdrop: rgba(17, 24, 39, 0.40);
  --shadow-overlay: 0 8px 24px rgba(17, 24, 39, 0.12);

  /* Status chip tones: tinted background, dark text */
  --tone-blue-bg: #EAF1FC;
  --tone-blue-text: #1F3864;
  --tone-green-bg: #E6F2EA;
  --tone-green-text: #1B5A32;
  --tone-grey-bg: #F1F3F5;
  --tone-grey-text: #4B5563;
  --tone-red-bg: #FBEAEA;
  --tone-red-text: #9B0000;
  --tone-slate-bg: #E2E8F0;
  --tone-slate-text: #1E293B;

  /* Typography: one family, one scale */
  --font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --text-title: 22px;
  --text-section: 15px;
  --text-body: 14px;
  --text-small: 12.5px;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --line-height: 1.45;

  /* Spacing: 8px grid with a 4px half step */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  /* Radius */
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 8px;

  /* Sizes */
  --control-height: 34px;
  --row-height: 40px;
  --text-input: var(--text-body);
  --sidebar-width: 220px;
  --topbar-height: 56px;
  --tabbar-height: 0px;            /* bottom tab bar, phone only */
  --content-max: 1280px;
  --page-gutter: 24px;

  /*
    Breakpoints. CSS variables cannot be used inside media queries, so these three values document
    the numbers used in app.css and in js/ui.js (isPhone / isCompact):
      phone    below 640px          bottom tab bar, card lists, full-screen sheets
      tablet   640px to 1023px      off-canvas sidebar, tables scroll inside their container
                                    (the dashboard "All projects" table shows cards instead)
      desktop  1024px and wider     fixed sidebar, full tables (all columns from 1280px)
  */
  --bp-tablet: 640px;
  --bp-desktop: 1024px;
  --bp-wide: 1280px;
}

/* Touch devices: 44px tap targets and 16px inputs (prevents zoom on focus in iOS). */
@media (pointer: coarse) {
  :root {
    --control-height: 44px;
    --row-height: 48px;
    --text-input: 16px;
  }
}

/* Tablet: tighter gutter. */
@media (max-width: 1023.98px) {
  :root {
    --page-gutter: 20px;
  }
}

/* Phone type scale and sizes. */
@media (max-width: 639.98px) {
  :root {
    --text-title: 19px;
    --text-section: 15px;
    --text-body: 15px;
    --text-input: 16px;
    --control-height: 44px;
    --row-height: 48px;
    --topbar-height: 52px;
    --tabbar-height: 56px;
    --page-gutter: 12px;
  }
}
