/*
  Building on IT web design system ("Control Room") v0.5.0 — token file (B-1).
  Section 3.3 verbatim, then the section 3.4–3.6 tokens (including the Amendment 4
  component geometry) and density blocks.
  Primitive values (3.1, 3.2) appear only in this file. Application and component
  CSS reference the --bit-* semantic tokens only (T-1, T-3).
*/

/* ---- Section 3.3, verbatim ------------------------------------------------ */
:root, [data-bit-theme="light"] {
  /* surfaces */
  --bit-surface-page:    #F6F4EF;  /* paper-100 */
  --bit-surface-chrome:  #FBFAF7;  /* paper-050: header, rail, side panels */
  --bit-surface-raised:  #FFFFFF;  /* paper-000: cards, metric cards */
  --bit-surface-well:    #FFFFFF;  /* paper-000: editable inputs (P-8) */
  --bit-surface-well-inset: #F6F4EF; /* wells sitting on a raised card */

  /* borders */
  --bit-border-hairline: #E0DCD2;  /* paper-400: structural dividers */
  --bit-border-card:     #E8E4DA;  /* paper-300 */
  --bit-border-row:      #EDEAE1;  /* paper-200: compact grid rows */
  --bit-border-control:  #D8D3C6;  /* paper-500: wells, pills, buttons */
  --bit-border-affordance: #C9C3B4;/* paper-600: dashed "add" targets */

  /* text */
  --bit-text-primary:    #26241F;  /* ink-600 */
  --bit-text-secondary:  #7A7568;  /* ink-300 */
  --bit-text-faint:      #B5AF9F;  /* paper-700 */
  --bit-text-inverse:    #F6F4EF;

  /* accent (single attention family, P-1) */
  --bit-accent-signal:   #D89A2B;  /* amber-signal */
  --bit-accent-text:     #8F6410;  /* amber-text */
  --bit-accent-bg:       #F5E8CC;  /* amber-bg */
  --bit-accent-border:   #E3CD9A;  /* amber-border */

  /* status (P-2, P-3) */
  --bit-status-ok:       #4C7A2E;
  --bit-status-danger:   #A32D2D;
  --bit-status-danger-bg:#F7E4E4;
  --bit-status-neutral:  #B5AF9F;  /* discontinued/inactive */

  /* actions (P-9) */
  --bit-action-primary-bg:   #26241F;
  --bit-action-primary-text: #F6F4EF;

  /* focus */
  --bit-focus-ring: 0 0 0 2px #F6F4EF, 0 0 0 4px #D89A2B;
}

[data-bit-theme="dark"] {
  --bit-surface-page:    #211F1C;
  --bit-surface-chrome:  #26241F;
  --bit-surface-raised:  #2A2723;
  --bit-surface-well:    #2A2723;
  --bit-surface-well-inset: #211F1C;

  --bit-border-hairline: #3A372F;
  --bit-border-card:     #3A372F;
  --bit-border-row:      #33302A;
  --bit-border-control:  #4A463C;
  --bit-border-affordance: #5C574A;

  --bit-text-primary:    #E8E4DA;
  --bit-text-secondary:  #A8A294;
  --bit-text-faint:      #6E6858;
  --bit-text-inverse:    #211F1C;

  --bit-accent-signal:   #E0A93E;
  --bit-accent-text:     #E0A93E;
  --bit-accent-bg:       #2E2A22;
  --bit-accent-border:   #6B5426;

  --bit-status-ok:       #8FBF5A;
  --bit-status-danger:   #E24B4A;
  --bit-status-danger-bg:#3A2422;
  --bit-status-neutral:  #6E6858;

  --bit-action-primary-bg:   #E8E4DA;
  --bit-action-primary-text: #211F1C;

  --bit-focus-ring: 0 0 0 2px #211F1C, 0 0 0 4px #E0A93E;
}

/* ---- Section 3.4 typography ----------------------------------------------- */
:root {
  --bit-font-ui:   "Segoe UI", system-ui, -apple-system, sans-serif;
  --bit-font-mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --bit-fs-micro:   11px;
  --bit-fs-caption: 12px;
  --bit-fs-body:    13px;
  --bit-fs-title:   15px;
  --bit-fs-page:    16px;
  --bit-fs-metric:  20px;

/* ---- Section 3.5 shape and spacing ---------------------------------------- */
  --bit-radius-control:  6px;
  --bit-radius-card:     8px;
  --bit-radius-row-card: 10px;
  --bit-hairline: 1px;
  --bit-space-1: 4px;
  --bit-space-2: 8px;
  --bit-space-3: 12px;
  --bit-space-4: 16px;
  --bit-space-5: 20px;
  --bit-space-6: 24px;
}

/* ---- Section 3.5 component geometry (Amendment 4, 0.5.0) -------------------
   Fixed sizes the components need. Not remapped by density (3.6), which owns
   control height, row padding and tap size. Rule IDs name each consumer. */
:root {
  /* Regions */
  --bit-rail-w:        52px;    /* L-1, C-11 */
  --bit-rail-tool:     36px;    /* C-11 tool button */
  --bit-panel-w:       260px;   /* L-1 inspector / action panel (range 200-280) */
  --bit-scope-h:       48px;    /* C-10 minimum height, desktop */
  --bit-bar-h-mobile:  56px;    /* R-1 tab bar, R-2 back header */
  --bit-narrow-w:      420px;   /* C-16 dialog width; C-18 text measure */
  --bit-content-max:   960px;   /* C-1 metric row, L-5 form grid */
  --bit-doc-max:       760px;   /* C-19 document */
  --bit-state-min-h:   240px;   /* C-18 region */
  --bit-menu-min:      200px;   /* R-1 "More" menu */
  --bit-col-metric:    160px;   /* C-1 minimum column */
  --bit-col-pair:      180px;   /* label/value pairs minimum column */
  --bit-col-field:     220px;   /* L-5 form grid minimum column; search box basis */
  --bit-search-max:    360px;   /* C-2 grid search box */
  --bit-filter-w:      260px;   /* C-2 grid filter select */
  --bit-tip-w:         320px;   /* C-20 info tip maximum width (Amendment 5) */
  --bit-label-h:       calc(var(--bit-fs-caption) * 1.45);   /* C-3 label line; L-5 section gap (Amendment 5) */

  /* Controls and marks */
  --bit-pill-h:        26px;    /* C-4 */
  --bit-chip-h:        28px;    /* R-4 chip strip */
  --bit-badge-h:       20px;    /* C-5 line height */
  --bit-target-sm:     24px;    /* C-13 expand toggle; R-3 card title link */
  --bit-checkbox:      16px;    /* C-3 check box */
  --bit-dot:           8px;     /* C-9 */
  --bit-edge:          2px;     /* T-9 edge marker; mobile step bar */
  --bit-space-half:    2px;     /* optical nudges only; layout spacing stays on the 3.5 scale */
  --bit-radius-overlay: 12px;   /* C-16 dialog; R-4 sheet top corners */

  /* Glyphs */
  --bit-icon-xs:       14px;    /* C-13 chevron */
  --bit-icon-sm:       16px;    /* C-6, C-7, C-8 */
  --bit-icon-md:       18px;    /* C-11 rail, R-2 back, R-1 menu */
  --bit-icon-lg:       20px;    /* R-1 tab bar */
  --bit-icon-xl:       24px;    /* C-18 */

  /* Floating layers (P-4: the only shadows) */
  --bit-scrim: rgba(38, 36, 31, 0.45);                  /* C-16: ink-600 at 45% */
  --bit-shadow-dialog: 0 12px 32px var(--bit-scrim);    /* C-16 */
  --bit-shadow-float:  0 6px 20px var(--bit-scrim);     /* C-17 toast */
  --bit-shadow-sheet:  0 -8px 24px var(--bit-scrim);    /* R-4 sheet, R-1 menu (rising from the bottom) */
}
[data-bit-theme="dark"] {
  --bit-scrim: rgba(33, 31, 28, 0.45);                  /* C-16: char-900 at 45% */
}

/* ---- Section 3.6 density profiles ----------------------------------------- */
:root, [data-bit-density="comfortable"] {
  --bit-control-h:  34px;
  --bit-row-pad-y:  8px;
  --bit-cell-fs:    13px;
  --bit-tap-min:    0px;    /* n/a */
}
[data-bit-density="compact"] {
  --bit-control-h:  28px;
  --bit-row-pad-y:  6px;
  --bit-cell-fs:    12px;
  --bit-tap-min:    0px;    /* n/a */
}
[data-bit-density="touch"] {
  --bit-control-h:  44px;
  --bit-row-pad-y:  10px;
  --bit-cell-fs:    13px;
  --bit-tap-min:    44px;
}
/* T-10 / B-3: below the mobile breakpoint touch applies whatever the attribute says */
@media (max-width: 640px) {
  :root, [data-bit-density] {
    --bit-control-h:  44px;
    --bit-row-pad-y:  10px;
    --bit-cell-fs:    13px;
    --bit-tap-min:    44px;
  }
}
