/**
 * CraftBelt — design tokens.
 * Brand: dark bench, outdoor-bright ink/icons, CraftBelt orange primary
 * (not teal/cyan), tool-depth bevel/press chrome.
 */
:root,
html[data-cbr='1'] {
  /* Bench depth surfaces — graphite under leather overlays */
  --cbr-void: #0a0c0f;
  --cbr-bench: #12151a;
  --cbr-plank: #181c22;
  --cbr-raised: #21262e;
  --cbr-raised-hi: #2a303a;
  --cbr-inset: #0d0f13;

  /* Brushed suede — heavy-duty dark tan (matte fibrous nap, not oiled cowhide) */
  --cbr-leather: #7a5c42;
  --cbr-leather-hi: #8b6a4a;
  --cbr-leather-mid: #6b4a32;
  --cbr-leather-deep: #4a3224;
  --cbr-leather-warm: #9a7858;
  /* Coarse fibrous nap grain (dual turbulence ≈ suede brush) */
  --cbr-leather-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.15 0.32' numOctaves='5' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='table' tableValues='0 0.38'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23g)'/%3E%3C/svg%3E");
  /* Fine fuzzy nap overlay */
  --cbr-leather-grain-fine: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='2.6 0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='table' tableValues='0 0.22'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23f)'/%3E%3C/svg%3E");
  /* Brushed nap streaks — soft fuzzy directional rub */
  --cbr-leather-nap: repeating-linear-gradient(
    168deg,
    transparent 0 3px,
    rgba(245, 228, 200, 0.035) 3px 4px,
    transparent 4px 11px,
    rgba(50, 32, 20, 0.04) 11px 12px,
    transparent 12px 20px
  );
  /* Irregular light/dark nap patches (bolt-bag suede blotch) */
  --cbr-leather-patch:
    radial-gradient(ellipse 90px 70px at 18% 42%, rgba(154, 120, 88, 0.16), transparent 72%),
    radial-gradient(ellipse 110px 85px at 72% 68%, rgba(55, 36, 24, 0.12), transparent 68%),
    radial-gradient(ellipse 70px 95px at 88% 22%, rgba(139, 106, 74, 0.1), transparent 62%),
    radial-gradient(ellipse 80px 60px at 42% 82%, rgba(107, 74, 50, 0.09), transparent 65%);
  /* Shared suede stack (page shell + rail capsule + service header) */
  --cbr-leather-base: linear-gradient(
    165deg,
    var(--cbr-leather-hi) 0%,
    var(--cbr-leather-warm) 22%,
    var(--cbr-leather) 48%,
    var(--cbr-leather-mid) 78%,
    var(--cbr-leather-deep) 100%
  );
  /* Legacy photo tile — trace opacity for organic blotches only */
  --cbr-leather-tex: url('../assets/cbr-brushed-leather.jpg');

  /* Outdoor-bright ink — high contrast, not neon */
  --cbr-ink: #f3f6f8;
  --cbr-ink-mute: #a9b2bd;
  --cbr-ink-faint: #6d7684;

  /* Signal — CraftBelt orange (primary) + amber warn */
  --cbr-orange: #f07a28;
  --cbr-orange-hi: #ff9a4a;
  --cbr-orange-deep: #c45a12;
  --cbr-steel: var(--cbr-orange);
  --cbr-steel-hi: var(--cbr-orange-hi);
  --cbr-amber: #f0a83a;
  --cbr-amber-hi: #ffc266;

  /* Status */
  --cbr-ok: #46c17a;
  --cbr-warn: #e0a83a;
  --cbr-bad: #e35b52;
  /* Time-ticket status — same hex as Hub --pc-te-* */
  --cbr-scheduled: #9b7ad6;
  --cbr-entered: var(--cbr-orange);
  --cbr-unapproved: #fbbf24;
  --cbr-approved: #34d399;
  /* Payroll processed / locked past Foundation floor (distinct from Approved green) */
  --cbr-processed: #5b8fd4;

  /* Type */
  --cbr-display: 'Barlow Condensed', 'Segoe UI Semibold', system-ui, sans-serif;
  --cbr-work: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --cbr-stamp: 'IBM Plex Mono', ui-monospace, monospace;

  /* Density — 44px minimum tap, compact chrome */
  --cbr-tap: 44px;
  --cbr-radius: 8px;
  --cbr-radius-lg: 14px;
  /* Panel housing wide enough to contain switches; face lifts inside bezel */
  --cbr-rail-w: 84px;
  --cbr-rail-peek: 24px;
  --cbr-rail-notch: 60px;
  --cbr-rail-notch-hi: 66px;
  --cbr-rail-lift: 8px;
  --cbr-switch-gap: 5px;

  /* Tool-depth bevel shadows (machined metal — raised / pressed) */
  --cbr-bevel-out:
    0 1px 0 rgba(255, 255, 255, 0.14) inset,
    0 3px 4px rgba(255, 255, 255, 0.05) inset,
    0 -1px 0 rgba(0, 0, 0, 0.6) inset,
    0 -4px 6px rgba(0, 0, 0, 0.4) inset,
    0 2px 0 rgba(0, 0, 0, 0.35),
    0 5px 4px rgba(0, 0, 0, 0.28),
    0 10px 18px rgba(0, 0, 0, 0.5);
  --cbr-bevel-out-hi:
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 3px 5px rgba(255, 255, 255, 0.07) inset,
    0 -1px 0 rgba(0, 0, 0, 0.55) inset,
    0 -4px 7px rgba(0, 0, 0, 0.38) inset,
    0 3px 0 rgba(0, 0, 0, 0.35),
    0 7px 6px rgba(0, 0, 0, 0.32),
    0 14px 22px rgba(0, 0, 0, 0.55);
  --cbr-bevel-in:
    0 4px 8px rgba(0, 0, 0, 0.72) inset,
    0 2px 3px rgba(0, 0, 0, 0.5) inset,
    0 -1px 0 rgba(255, 255, 255, 0.04) inset,
    0 1px 0 rgba(0, 0, 0, 0.2);
  --cbr-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
  --cbr-shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.4);
  --cbr-focus-ring: 0 0 0 2px rgba(240, 122, 40, 0.55);

  --cbr-z-nav: 40;
  --cbr-z-sheet: 70;
  --cbr-z-toast: 80;
  --cbr-z-banner: 90;

  color-scheme: dark;
}

html[data-cbr='1'] {
  overflow-x: hidden;
  overscroll-behavior-x: none;
  max-width: 100%;
}

html[data-cbr='1'] body {
  margin: 0;
  min-height: 100dvh;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  width: 100%;
  max-width: 100%;
  background-color: var(--cbr-leather-deep);
  background-image:
    /* bench ambient — CraftBelt orange warmth (matte) */
    radial-gradient(1000px 480px at 15% -10%, rgba(240, 122, 40, 0.08), transparent 55%),
    radial-gradient(720px 420px at 100% 0%, rgba(240, 168, 58, 0.05), transparent 50%),
    /* edge vignette — no oil sheen */
    radial-gradient(ellipse 130% 90% at 50% 110%, rgba(0, 0, 0, 0.38), transparent 55%),
    /* suede nap patches + trace photo blotch */
    var(--cbr-leather-patch),
    linear-gradient(rgba(107, 74, 50, 0.94), rgba(107, 74, 50, 0.96)),
    var(--cbr-leather-tex),
    var(--cbr-leather-nap),
    var(--cbr-leather-grain-fine),
    var(--cbr-leather-grain),
    var(--cbr-leather-base);
  background-size: auto, auto, auto, auto, auto, auto, 200px 200px, 120px 120px, 200px 200px, auto;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, repeat, repeat, repeat, no-repeat;
  background-blend-mode: normal, normal, multiply, normal, multiply, normal, overlay, multiply, normal;
  color: var(--cbr-ink);
  font-family: var(--cbr-work);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

html[data-cbr='1'] * {
  box-sizing: border-box;
}

html[data-cbr='1'] a {
  color: var(--cbr-orange-hi);
}

/* ---- Tool-depth buttons: bevel/press, not giant soft CTAs -------------- */
html[data-cbr='1'] .cbr-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--cbr-radius);
  background: linear-gradient(180deg, var(--cbr-raised-hi), var(--cbr-raised));
  color: var(--cbr-ink);
  font-family: var(--cbr-work);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.01em;
  padding: 0 16px;
  height: var(--cbr-tap);
  min-height: var(--cbr-tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transform: translateY(-1px);
  box-shadow: var(--cbr-bevel-out-hi);
  transition:
    transform 0.2s cubic-bezier(0.34, 1.45, 0.64, 1),
    box-shadow 0.2s cubic-bezier(0.34, 1.2, 0.64, 1),
    background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

html[data-cbr='1'] .cbr-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--cbr-bevel-out-hi);
}

html[data-cbr='1'] .cbr-btn:active,
html[data-cbr='1'] .cbr-btn.is-pressed {
  transform: translateY(2px) scale(0.98);
  box-shadow: var(--cbr-bevel-in);
  background: linear-gradient(180deg, var(--cbr-raised), var(--cbr-inset));
  transition: transform 0.07s ease-out, box-shadow 0.07s ease-out;
}

html[data-cbr='1'] .cbr-btn:focus-visible {
  outline: none;
  box-shadow: var(--cbr-bevel-out), var(--cbr-focus-ring);
}

html[data-cbr='1'] .cbr-btn[disabled] {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}

html[data-cbr='1'] .cbr-btn--primary {
  background: linear-gradient(180deg, var(--cbr-orange-hi), var(--cbr-orange));
  border-color: rgba(0, 0, 0, 0.2);
  color: #1a0c02;
}

html[data-cbr='1'] .cbr-btn--amber {
  background: linear-gradient(180deg, var(--cbr-amber-hi), var(--cbr-amber));
  border-color: rgba(0, 0, 0, 0.2);
  color: #1c1002;
}

html[data-cbr='1'] .cbr-btn--ghost {
  background: transparent;
  box-shadow: none;
  border-color: rgba(255, 255, 255, 0.12);
}

html[data-cbr='1'] .cbr-btn--ghost:active {
  box-shadow: var(--cbr-bevel-in);
}

html[data-cbr='1'] .cbr-btn--sm {
  height: 36px;
  min-height: 36px;
  padding: 0 12px;
  font-size: 12.5px;
}

html[data-cbr='1'] .cbr-btn--block {
  width: 100%;
}

html[data-cbr='1'] .cbr-btn--ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

html[data-cbr='1'] .cbr-btn--ico .cbr-ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ---- Cards / panels ------------------------------------------------------ */
html[data-cbr='1'] .cbr-card {
  background: var(--cbr-plank);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--cbr-radius-lg);
  box-shadow: var(--cbr-shadow-sm);
  padding: 10px;
}

html[data-cbr='1'] .cbr-card--inset {
  background: var(--cbr-inset);
  box-shadow: var(--cbr-bevel-in);
}

html[data-cbr='1'] .cbr-eyebrow {
  font-family: var(--cbr-stamp);
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--cbr-orange-hi);
}

html[data-cbr='1'] .cbr-h {
  font-family: var(--cbr-display);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--cbr-ink);
  margin: 0;
}

html[data-cbr='1'] .cbr-muted {
  color: var(--cbr-ink-mute);
  font-size: 13px;
}

html[data-cbr='1'] .cbr-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--cbr-raised);
  color: var(--cbr-ink-mute);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

html[data-cbr='1'] .cbr-chip--ok {
  color: var(--cbr-ok);
  border-color: rgba(70, 193, 122, 0.35);
}

html[data-cbr='1'] .cbr-chip--warn {
  color: var(--cbr-warn);
  border-color: rgba(224, 168, 58, 0.35);
}

html[data-cbr='1'] .cbr-chip--bad {
  color: var(--cbr-bad);
  border-color: rgba(227, 91, 82, 0.35);
}

html[data-cbr='1'] .cbr-empty {
  padding: 18px 10px;
  text-align: center;
  color: var(--cbr-ink-faint);
  font-size: 13px;
}

html[data-cbr='1'] input,
html[data-cbr='1'] textarea {
  appearance: none;
  background: var(--cbr-inset);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--cbr-radius);
  color: var(--cbr-ink);
  font-family: var(--cbr-work);
  font-size: 14px;
  padding: 0 12px;
  height: 42px;
  box-shadow: var(--cbr-bevel-in);
}

html[data-cbr='1'] select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--cbr-inset);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23a9b2bd' d='M1.5 1.5 6 6l4.5-4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--cbr-radius);
  color: var(--cbr-ink);
  cursor: pointer;
  font-family: var(--cbr-work);
  font-size: 14px;
  height: 42px;
  padding: 0 36px 0 12px;
  box-shadow: var(--cbr-bevel-in);
}

html[data-cbr='1'] select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

html[data-cbr='1'] textarea {
  height: auto;
  padding: 10px 12px;
  min-height: 72px;
  resize: vertical;
}

html[data-cbr='1'] label.cbr-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--cbr-ink-mute);
  font-weight: 600;
}

/* Author display:flex must not beat the HTML hidden attribute — TE hour
   buckets (OT/DBL/No-OT) rely on [hidden] from Time Policy gates. */
html[data-cbr='1'] [hidden],
html[data-cbr='1'] label.cbr-field[hidden] {
  display: none !important;
}

html[data-cbr='1'] .cbr-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ---- Icons --------------------------------------------------------------- */
html[data-cbr='1'] .cbr-ico {
  width: 1.15em;
  height: 1.15em;
  display: block;
  flex: 0 0 auto;
}
