/* ==========================================================================
   CraftBelt Shared Design System — tokens + core components.
   Fixed CraftBelt product chrome (orange / leather). Tenant accents never
   override --pc-primary for field phone surfaces.
   ========================================================================== */

:root {
  /* Surfaces — saddle / charcoal leather */
  --pc-bg: #0c0a08;
  --pc-surface: #1a1512;
  --pc-surface-2: #120f0d;
  --pc-border: rgba(232, 196, 160, 0.12);

  /* Text */
  --pc-text: #f7f1e8;
  --pc-text-muted: #cbb8a4;
  --pc-slate: #9a8776;

  /* Brand — locked CraftBelt amber (not tenant primary) */
  --pc-primary: #e86f24;
  --pc-primary-ink: #1a1008;
  --pc-primary-soft: rgba(232, 111, 36, 0.14);
  --pc-leather: #6b3e24;
  --pc-leather-soft: rgba(107, 62, 36, 0.35);
  --pc-saddle: #c4a574;

  /* Production / status semantics */
  --pc-ok: #2fbb7a;
  --pc-warn: #e3a008;
  --pc-alert: #e85a4f;
  --pc-onpace: var(--pc-ok);
  --pc-behind: var(--pc-alert);
  --pc-overhours: var(--pc-alert);
  --pc-idle: var(--pc-slate);

  --pc-ok-soft: rgba(47, 187, 122, 0.16);
  --pc-warn-soft: rgba(227, 160, 8, 0.16);
  --pc-alert-soft: rgba(232, 90, 79, 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;

  --pc-tap: 44px;

  /* Expressive CraftBelt type — not Inter/Roboto/system default */
  --pc-font: 'Outfit', 'Segoe UI', sans-serif;
  --pc-font-display: 'Fraunces', 'Georgia', serif;

  --pc-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  --pc-shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
  --pc-focus-ring: 0 0 0 2px rgba(232, 111, 36, 0.55);

  --pc-overlay: rgba(8, 5, 3, 0.78);
  --pc-z-modal: 1000;
  --pc-z-toast: 1100;

  --pc-transition: 0.18s ease;
}

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

.pc-card {
  background:
    linear-gradient(145deg, rgba(232, 111, 36, 0.06), transparent 50%),
    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.04);
  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, transform 0.12s ease;
}
.pc-btn:hover { filter: brightness(1.08); }
.pc-btn:active { transform: scale(0.98); }
.pc-btn:focus-visible { outline: none; box-shadow: var(--pc-focus-ring); }

.pc-btn--primary {
  background: linear-gradient(180deg, #f08a3a 0%, var(--pc-primary) 100%);
  border-color: #d4621a;
  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(47, 187, 122, 0.18); color: var(--pc-ok); border-color: rgba(47, 187, 122, 0.5); }
.pc-pace--behind,
.pc-pace--overhours { background: rgba(232, 90, 79, 0.18); color: var(--pc-alert); border-color: rgba(232, 90, 79, 0.5); }
.pc-pace--idle { background: rgba(154, 135, 118, 0.15); color: var(--pc-slate); border-color: rgba(154, 135, 118, 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
   ========================================================================== */

.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);
}

.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.05);
  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(47, 187, 122, 0.5);
}
.pc-badge--warn {
  background: var(--pc-warn-soft);
  color: var(--pc-warn);
  border-color: rgba(227, 160, 8, 0.5);
}
.pc-badge--alert {
  background: var(--pc-alert-soft);
  color: var(--pc-alert);
  border-color: rgba(232, 90, 79, 0.5);
}

.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); }

.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); }

.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);
}

.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);
}

.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); }

.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;
}
.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); }

.pc-countdown {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--pc-radius-sm);
  border: 1px solid rgba(227, 160, 8, 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;
}
.pc-countdown--urgent {
  border-color: rgba(232, 90, 79, 0.5);
  background: var(--pc-alert-soft);
  color: var(--pc-alert);
}

.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.
   ========================================================================== */

.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(26, 21, 18, 0.98) 0%, rgba(12, 10, 8, 0.99) 100%);
  border-top: 1px solid rgba(232, 111, 36, 0.28);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45);
  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);
}
.pc-bottom-bar-btn.active i {
  transform: scale(1.08);
}

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

.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(26, 21, 18, 0.99) 0%, rgba(12, 10, 8, 0.99) 100%);
  border-top: 1px solid rgba(232, 111, 36, 0.32);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.55);
  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(232, 111, 36, 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);
}

.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(227, 160, 8, 0.4);
  background: rgba(227, 160, 8, 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(227, 160, 8, 0.5);
  background: rgba(227, 160, 8, 0.18);
  color: #f0c14a;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

/* ---- Phone review / approve (daily sheets) ----------------------------- */

.pc-ds-day {
  margin-bottom: 16px;
  animation: pcDayIn 0.4s ease both;
}
.pc-ds-day__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding: 0 2px;
}
.pc-ds-day__title {
  font-family: var(--pc-font);
  font-weight: 800;
  font-size: 12px;
  color: var(--pc-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.pc-ds-day__count {
  font-size: 10px;
  font-weight: 700;
  color: var(--pc-slate);
}
.pc-ds-ticket-summary {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: var(--pc-radius-sm);
  border: 1px solid rgba(196, 165, 116, 0.18);
  background: rgba(12, 10, 8, 0.55);
}
.pc-ds-ticket-summary__title {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pc-saddle);
  margin: 0 0 6px;
}
.pc-ds-ticket-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
  font-size: 11px;
  color: var(--pc-text-muted);
}
.pc-ds-ticket-row strong {
  color: var(--pc-text);
  font-weight: 700;
}
.pc-ds-ticket-empty {
  font-size: 11px;
  color: var(--pc-slate);
  font-style: italic;
}

.pc-ds-sticky-approve {
  position: sticky;
  bottom: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  margin: 12px -4px 0;
  background: linear-gradient(180deg, rgba(26, 21, 18, 0.92) 0%, rgba(12, 10, 8, 0.98) 40%);
  border-top: 1px solid rgba(232, 111, 36, 0.35);
  box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  animation: pcStickyIn 0.35s ease both;
}
.pc-ds-sticky-approve .pc-btn {
  flex: 1;
  min-height: 48px;
  font-size: 13px;
}
.pc-ds-sticky-approve__meta {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  color: var(--pc-slate);
  max-width: 7ch;
  text-align: center;
  line-height: 1.25;
}

@keyframes pcDayIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pcStickyIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@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,
  .pc-ds-day,
  .pc-ds-sticky-approve {
    transition: none;
    animation: none;
  }
}
