/* ==========================================================================
   PayCrew ⇄ CraftBelt Shared Design System — tokens + core components.
   Single source of truth for CraftBelt UI. Mirrors src/app/design-tokens.css.
   See docs/paycrew-craftbelt-major-update-blueprint.md §4.
   ========================================================================== */

:root {
  /* Surfaces */
  --pc-bg: #080c15;
  --pc-surface: #141b2b;
  --pc-surface-2: #0d1220;
  --pc-border: rgba(255, 255, 255, 0.08);

  /* Text */
  --pc-text: #f8fafc;
  --pc-text-muted: #cbd5e1;
  --pc-slate: #94a3b8;

  /* Brand */
  --pc-primary: #f97316;
  --pc-primary-ink: #ffffff;
  --pc-primary-soft: rgba(249, 115, 22, 0.12);

  /* Production / status semantics */
  --pc-ok: #10b981;
  --pc-warn: #f59e0b;
  --pc-alert: #ef4444;
  --pc-onpace: var(--pc-ok);
  --pc-behind: var(--pc-alert);
  --pc-overhours: var(--pc-alert);
  --pc-idle: var(--pc-slate);

  /* Geometry */
  /* Soft status fills (badges, progress, toasts) */
  --pc-ok-soft: rgba(16, 185, 129, 0.16);
  --pc-warn-soft: rgba(245, 158, 11, 0.16);
  --pc-alert-soft: rgba(239, 68, 68, 0.16);

  /* Geometry */
  --pc-radius: 10px;
  --pc-radius-sm: 6px;
  --pc-radius-lg: 16px;
  --pc-radius-pill: 999px;

  --pc-gap: 12px;
  --pc-gap-sm: 8px;
  --pc-gap-lg: 20px;

  /* Type scale (min body 11px per a11y contract) */
  --pc-text-xs: 11px;
  --pc-text-sm: 13px;
  --pc-text-md: 15px;
  --pc-text-lg: 18px;

  /* Minimum tap target */
  --pc-tap: 44px;

  /* Type */
  --pc-font: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;

  /* Elevation & focus */
  --pc-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --pc-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --pc-focus-ring: 0 0 0 2px rgba(249, 115, 22, 0.55);

  /* Overlay scrim + layering */
  --pc-overlay: rgba(3, 6, 12, 0.72);
  --pc-z-modal: 1000;
  --pc-z-toast: 1100;

  --pc-transition: 0.15s ease;
}

/* ---- Core components ---------------------------------------------------- */

.pc-card {
  background: var(--pc-surface);
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius);
  box-shadow: var(--pc-shadow);
  padding: var(--pc-gap);
}

.pc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--pc-radius-sm);
  border: 1px solid var(--pc-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--pc-text);
  font-family: var(--pc-font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s ease, background 0.15s ease;
}
.pc-btn:hover { filter: brightness(1.08); }
.pc-btn:focus-visible { outline: none; box-shadow: var(--pc-focus-ring); }

.pc-btn--primary {
  background: var(--pc-primary);
  border-color: var(--pc-primary);
  color: var(--pc-primary-ink);
}

.pc-input,
.pc-select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--pc-radius-sm);
  border: 1px solid var(--pc-border);
  background: var(--pc-surface-2);
  color: var(--pc-text);
  font-family: var(--pc-font);
  font-size: 13px;
}
.pc-input:focus,
.pc-select:focus { outline: none; box-shadow: var(--pc-focus-ring); border-color: var(--pc-primary); }

/* ---- Production pace pill (parity with VPRA green/red) ------------------ */

.pc-pace {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--pc-radius-sm);
  font-family: var(--pc-font);
  font-weight: 800;
  font-size: 11px;
  border: 1px solid transparent;
}
.pc-pace--onpace { background: rgba(16, 185, 129, 0.18); color: var(--pc-ok); border-color: rgba(16, 185, 129, 0.5); }
.pc-pace--behind,
.pc-pace--overhours { background: rgba(239, 68, 68, 0.18); color: var(--pc-alert); border-color: rgba(239, 68, 68, 0.5); }
.pc-pace--idle { background: rgba(148, 163, 184, 0.15); color: var(--pc-slate); border-color: rgba(148, 163, 184, 0.4); }

/* ---- Uniform bottom nav item ------------------------------------------- */

.pc-nav-item {
  flex: 1 1 0;
  min-width: 0;
  min-height: var(--pc-tap);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--pc-slate);
  font-family: var(--pc-font);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--pc-transition);
}
.pc-nav-item.active { color: var(--pc-primary); }
.pc-nav-item:focus-visible { outline: none; box-shadow: var(--pc-focus-ring); border-radius: var(--pc-radius-sm); }

/* ==========================================================================
   EXTENDED COMPONENT KIT — shared, premium, digestible.
   Consistent with the orange/dark theme + production-pace semantics.
   All interactive targets >=44px, visible focus rings, min 11px text.
   ========================================================================== */

/* ---- Typography: section titles + subtitles ---------------------------- */

.pc-section-title {
  margin: 0;
  font-family: var(--pc-font);
  font-size: var(--pc-text-md);
  font-weight: 800;
  line-height: 1.25;
  color: var(--pc-text);
  letter-spacing: 0.2px;
}

.pc-subtitle {
  margin: 2px 0 0;
  font-family: var(--pc-font);
  font-size: var(--pc-text-xs);
  font-weight: 500;
  line-height: 1.4;
  color: var(--pc-text-muted);
}

/* ---- Badge ------------------------------------------------------------- */

.pc-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--pc-radius-pill);
  border: 1px solid var(--pc-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--pc-text-muted);
  font-family: var(--pc-font);
  font-size: var(--pc-text-xs);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.pc-badge--ok {
  background: var(--pc-ok-soft);
  color: var(--pc-ok);
  border-color: rgba(16, 185, 129, 0.5);
}
.pc-badge--warn {
  background: var(--pc-warn-soft);
  color: var(--pc-warn);
  border-color: rgba(245, 158, 11, 0.5);
}
.pc-badge--alert {
  background: var(--pc-alert-soft);
  color: var(--pc-alert);
  border-color: rgba(239, 68, 68, 0.5);
}

/* ---- List -------------------------------------------------------------- */

.pc-list {
  display: flex;
  flex-direction: column;
  gap: var(--pc-gap-sm);
  margin: 0;
  padding: 0;
  list-style: none;
}

.pc-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pc-gap-sm);
  min-height: var(--pc-tap);
  padding: 10px 12px;
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius-sm);
  background: var(--pc-surface-2);
  color: var(--pc-text);
  font-family: var(--pc-font);
  font-size: var(--pc-text-sm);
}
a.pc-list-item,
button.pc-list-item {
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--pc-transition), background var(--pc-transition);
}
a.pc-list-item:hover,
button.pc-list-item:hover { border-color: var(--pc-primary); }
.pc-list-item:focus-visible { outline: none; box-shadow: var(--pc-focus-ring); }

/* ---- Stat (label + number) --------------------------------------------- */

.pc-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pc-stat__label {
  font-family: var(--pc-font);
  font-size: var(--pc-text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--pc-slate);
}
.pc-stat__number {
  font-family: var(--pc-font);
  font-size: 22px;
  font-weight: 900;
  line-height: 1.1;
  color: var(--pc-text);
}
.pc-stat--ok .pc-stat__number { color: var(--pc-ok); }
.pc-stat--warn .pc-stat__number { color: var(--pc-warn); }
.pc-stat--alert .pc-stat__number { color: var(--pc-alert); }

/* ---- Tab bar ----------------------------------------------------------- */

.pc-tabbar {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius);
  background: var(--pc-surface-2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.pc-tab {
  flex: 1 1 0;
  min-width: max-content;
  min-height: var(--pc-tap);
  padding: 8px 14px;
  border: none;
  border-radius: var(--pc-radius-sm);
  background: none;
  color: var(--pc-text-muted);
  font-family: var(--pc-font);
  font-size: var(--pc-text-sm);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--pc-transition), color var(--pc-transition);
}
.pc-tab:hover { color: var(--pc-text); }
.pc-tab:focus-visible { outline: none; box-shadow: var(--pc-focus-ring); }
.pc-tab[aria-selected="true"],
.pc-tab.active {
  background: var(--pc-primary);
  color: var(--pc-primary-ink);
}

/* ---- Modal ------------------------------------------------------------- */

.pc-modal {
  position: fixed;
  inset: 0;
  z-index: var(--pc-z-modal);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: var(--pc-gap);
  background: var(--pc-overlay);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
@media (min-width: 480px) {
  .pc-modal { align-items: center; }
}

.pc-modal-card {
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--pc-gap);
  padding: var(--pc-gap-lg);
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius-lg);
  background: var(--pc-surface);
  box-shadow: var(--pc-shadow);
  color: var(--pc-text);
  font-family: var(--pc-font);
}

/* ---- Toast ------------------------------------------------------------- */

.pc-toast {
  display: flex;
  align-items: center;
  gap: var(--pc-gap-sm);
  min-height: var(--pc-tap);
  padding: 10px 14px;
  border: 1px solid var(--pc-border);
  border-left: 3px solid var(--pc-primary);
  border-radius: var(--pc-radius-sm);
  background: var(--pc-surface);
  box-shadow: var(--pc-shadow-sm);
  color: var(--pc-text);
  font-family: var(--pc-font);
  font-size: var(--pc-text-sm);
  font-weight: 600;
}
.pc-toast--ok { border-left-color: var(--pc-ok); }
.pc-toast--warn { border-left-color: var(--pc-warn); }
.pc-toast--alert { border-left-color: var(--pc-alert); }

/* ---- Progress (production / skills) ------------------------------------ */

.pc-progress {
  width: 100%;
  height: 8px;
  border-radius: var(--pc-radius-pill);
  background: var(--pc-surface-2);
  border: 1px solid var(--pc-border);
  overflow: hidden;
}
.pc-progress__bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--pc-primary);
  transition: width 0.3s ease;
}
/* Production-pace mapping: on-pace green, behind/over red, idle slate */
.pc-progress--onpace .pc-progress__bar { background: var(--pc-onpace); }
.pc-progress--behind .pc-progress__bar,
.pc-progress--overhours .pc-progress__bar { background: var(--pc-behind); }
.pc-progress--idle .pc-progress__bar { background: var(--pc-idle); }

/* ---- Countdown (deadline badge) ---------------------------------------- */

.pc-countdown {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--pc-radius-sm);
  border: 1px solid rgba(245, 158, 11, 0.5);
  background: var(--pc-warn-soft);
  color: var(--pc-warn);
  font-family: var(--pc-font);
  font-size: var(--pc-text-xs);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* Urgent (past due / imminent) escalates to alert red */
.pc-countdown--urgent {
  border-color: rgba(239, 68, 68, 0.5);
  background: var(--pc-alert-soft);
  color: var(--pc-alert);
}

/* ---- Empty state ------------------------------------------------------- */

.pc-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--pc-gap-sm);
  padding: var(--pc-gap-lg);
  text-align: center;
  border: 1px dashed var(--pc-border);
  border-radius: var(--pc-radius);
  background: var(--pc-surface-2);
  color: var(--pc-text-muted);
  font-family: var(--pc-font);
}
.pc-empty__icon { font-size: 28px; line-height: 1; opacity: 0.7; }
.pc-empty__title { font-size: var(--pc-text-sm); font-weight: 800; color: var(--pc-text); }
.pc-empty__text { font-size: var(--pc-text-xs); line-height: 1.4; max-width: 32ch; }

/* ==========================================================================
   BOTTOM NAV KIT — max 5 primary slots + "More" overflow sheet.
   Replaces the old 8-11 button horizontal-scroll .bottom-navbar / .nav-item-btn.
   Driven by craftbelt-nav.js (PRIMARY vs MORE item registry, renderNav(role)).
   ========================================================================== */

.pc-bottom-bar {
  position: relative;
  display: none;
  align-items: stretch;
  gap: 2px;
  height: 68px;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 6px)) 6px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98) 0%, rgba(8, 12, 21, 0.99) 100%);
  border-top: 1px solid rgba(249, 115, 22, 0.25);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
  box-sizing: border-box;
  z-index: 100;
}

.pc-bottom-bar-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: var(--pc-tap);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--pc-slate);
  font-family: var(--pc-font);
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.1px;
  text-align: center;
  cursor: pointer;
  border-radius: var(--pc-radius-sm);
  padding: 6px 2px;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
  position: relative;
}
.pc-bottom-bar-btn span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pc-bottom-bar-btn i { width: 20px; height: 20px; transition: transform 0.2s ease; }
.pc-bottom-bar-btn:hover { color: #f3f4f6; }
.pc-bottom-bar-btn:focus-visible { outline: none; box-shadow: var(--pc-focus-ring); }
.pc-bottom-bar-btn.active {
  color: var(--pc-primary);
  background: var(--pc-primary-soft);
  transform: translateY(-1px);
}
.pc-bottom-bar-btn.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  width: 14px;
  height: 2px;
  border-radius: 2px;
  background: var(--pc-primary);
  box-shadow: 0 0 8px var(--pc-primary);
}
.pc-bottom-bar-btn.active i {
  transform: scale(1.08);
  filter: drop-shadow(0 0 6px rgba(249, 115, 22, 0.55));
}

.pc-bottom-bar-more .pc-more-dot {
  position: absolute;
  top: 6px;
  right: 16px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pc-primary);
  box-shadow: 0 0 6px var(--pc-primary);
  display: none;
}

/* ---- More sheet: bottom drawer holding overflow features ---------------- */

.pc-more-backdrop {
  position: absolute;
  inset: 0;
  background: var(--pc-overlay);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 199;
}
.pc-more-backdrop.open { opacity: 1; visibility: visible; }

.pc-more-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 72%;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(20, 27, 43, 0.99) 0%, rgba(8, 12, 21, 0.99) 100%);
  border-top: 1px solid rgba(249, 115, 22, 0.3);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.5);
  padding: 10px 14px calc(16px + env(safe-area-inset-bottom, 8px)) 14px;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 200;
  box-sizing: border-box;
}
.pc-more-sheet.open { transform: translateY(0); }

.pc-more-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.18);
  margin: 4px auto 10px;
}

.pc-more-sheet-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--pc-font);
  font-size: 12px;
  font-weight: 800;
  color: var(--pc-text);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
}

.pc-more-close {
  background: none;
  border: none;
  color: var(--pc-slate);
  cursor: pointer;
  min-height: var(--pc-tap);
  min-width: var(--pc-tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}
.pc-more-close:hover { color: var(--pc-text); }

.pc-more-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pc-more-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 72px;
  padding: 10px 6px;
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius);
  background: rgba(255, 255, 255, 0.03);
  color: var(--pc-text-muted);
  font-family: var(--pc-font);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.pc-more-item span { max-width: 100%; overflow-wrap: break-word; }
.pc-more-item i { width: 20px; height: 20px; color: var(--pc-primary); }
.pc-more-item:hover,
.pc-more-item:focus-visible {
  border-color: rgba(249, 115, 22, 0.5);
  background: var(--pc-primary-soft);
  color: var(--pc-text);
  outline: none;
}
.pc-more-item.active {
  border-color: var(--pc-primary);
  background: var(--pc-primary-soft);
  color: var(--pc-text);
}

/* ---- Top banner strip: announcements / required Q&A placeholder -------- */

.pc-hub-banner {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: var(--pc-radius);
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.1);
  color: var(--pc-text);
  font-family: var(--pc-font);
}
.pc-hub-banner__icon { color: var(--pc-warn); flex-shrink: 0; }
.pc-hub-banner__body { flex: 1; min-width: 0; }
.pc-hub-banner__title { font-size: 11px; font-weight: 800; margin: 0; }
.pc-hub-banner__text { font-size: 9.5px; color: var(--pc-text-muted); margin: 2px 0 0; line-height: 1.3; }
.pc-hub-banner__cta {
  flex-shrink: 0;
  min-height: var(--pc-tap);
  padding: 0 12px;
  border-radius: var(--pc-radius-sm);
  border: 1px solid rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

/* ---- Motion / accessibility preferences -------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .pc-btn,
  .pc-tab,
  .pc-nav-item,
  .pc-list-item,
  .pc-progress__bar,
  .pc-bottom-bar-btn,
  .pc-more-sheet,
  .pc-more-backdrop,
  .pc-more-item {
    transition: none;
  }
}
