/* Forge Flow v13 — QR login/scan + manager edit + back nav + PWA */

html { scroll-behavior: smooth; }
body { -webkit-tap-highlight-color: transparent; }

.role-tab.active {
  background: white;
  color: #0d1f17;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-radius: 0.65rem;
  font-size: 0.9rem;
  color: #c5d8cc;
  transition: 0.12s ease;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-weight: 500;
}
.nav-item:hover { background: #163025; color: #f0f7f2; }
.nav-item.active {
  background: #1c3a2c;
  color: #fff;
  font-weight: 600;
}
.nav-group-label {
  margin: 1rem 0.75rem 0.4rem;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6f8a7a;
  font-weight: 700;
}

.ff-card {
  background: white;
  border: 1px solid #e8efe9;
  border-radius: 1rem;
  box-shadow: 0 1px 2px rgba(16, 40, 28, 0.04), 0 8px 24px rgba(16, 40, 28, 0.05);
}

.btn-big {
  min-height: 3.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  border-radius: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: 0.12s ease;
  user-select: none;
}
.btn-big:active { transform: scale(0.98); }
.btn-big:disabled { opacity: 0.45; pointer-events: none; }

.kpi {
  background: white;
  border: 1px solid #e8efe9;
  border-radius: 1rem;
  padding: 1rem 1.1rem;
  box-shadow: 0 1px 2px rgba(16, 40, 28, 0.04), 0 8px 24px rgba(16, 40, 28, 0.05);
}

.ff-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.ff-table th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7f72;
  font-weight: 700;
  padding: 0.75rem 1rem;
  background: #f8fbf8;
  border-bottom: 1px solid #e8efe9;
}
.ff-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #eef3ef;
  vertical-align: middle;
}
.ff-table tr:last-child td { border-bottom: 0; }
.ff-table tbody tr:hover { background: #f7fbf8; }

.live-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  animation: pulse-dot 1.6s infinite;
}
@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.timer-display {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.sidebar::-webkit-scrollbar,
#modalPanel::-webkit-scrollbar,
#notifList::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb,
#modalPanel::-webkit-scrollbar-thumb,
#notifList::-webkit-scrollbar-thumb {
  background: rgba(128, 128, 128, 0.25);
  border-radius: 99px;
}

.safe-bottom { padding-bottom: max(0.5rem, env(safe-area-inset-bottom)); }
.empty { text-align: center; padding: 2.5rem 1rem; color: #6b7f72; }

.chip {
  border: 1px solid #dce6df;
  background: white;
  color: #5b6b62;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}
.chip:hover { background: #f3faf5; color: #0d1f17; }
.chip.active {
  background: #e6f4ec;
  border-color: #96d0ae;
  color: #166534;
}

.budget-bar {
  height: 0.4rem;
  border-radius: 99px;
  background: #e8efe9;
  overflow: hidden;
}
.budget-bar > span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: #166534;
}
.budget-bar.over > span { background: #dc2626; }
.budget-bar.warn > span { background: #d97706; }

.fav-btn { color: #b7c4bb; }
.fav-btn.on { color: #eab308; }

.emp-nav-btn.active { color: #166534; }
.emp-nav-btn.active span { filter: none; }

/* Notification cards */
.notif-item {
  border: 1px solid #e8efe9;
  border-radius: 0.85rem;
  padding: 0.85rem 1rem;
  background: #fff;
  cursor: pointer;
  transition: 0.12s ease;
}
.notif-item:hover { background: #f7fbf8; }
.notif-item.unread {
  border-color: #c7e6d3;
  background: #f3faf5;
  box-shadow: inset 3px 0 0 #166534;
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 2.75rem;
  height: 1.55rem;
  border-radius: 999px;
  background: #c5d4ca;
  border: 0;
  cursor: pointer;
  transition: 0.15s ease;
  flex-shrink: 0;
}
.toggle.on { background: #166534; }
.toggle::after {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: 0.15s ease;
}
.toggle.on::after { left: 1.35rem; }

/* Employee mobile emphasis */
body.role-employee #app main {
  max-width: 32rem;
  margin-left: auto;
  margin-right: auto;
}

/* QR reader video fit */
#qrReader video {
  border-radius: 1rem;
  width: 100% !important;
}

/* PWA standalone: hide install noise */
@media all and (display-mode: standalone) {
  #installBanner { display: none !important; }
}

/* Mapping table highlight */
.map-table td:first-child { font-weight: 600; color: #14532d; }
.map-table code {
  font-size: 0.8rem;
  background: #f3faf5;
  padding: 0.15rem 0.4rem;
  border-radius: 0.35rem;
  color: #166534;
}

/* Manager edit forms */
.field-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: #5b6b62;
  margin-bottom: 0.35rem;
}
.field-input {
  width: 100%;
  border: 1px solid #dce6df;
  background: #f8fbf8;
  border-radius: 0.75rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 500;
  outline: none;
}
.field-input:focus {
  border-color: #96d0ae;
  box-shadow: 0 0 0 3px rgba(22, 101, 52, 0.12);
}
.edit-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #166534;
  background: #e6f4ec;
  border: 1px solid #c7e6d3;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}
.row-check {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: #166534;
}
.bulk-bar {
  position: sticky;
  bottom: 0;
  background: #0d1f17;
  color: white;
  border-radius: 1rem;
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  box-shadow: 0 -8px 24px rgba(0,0,0,.12);
}
.audit-line {
  border-left: 3px solid #96d0ae;
  padding-left: 0.85rem;
  margin-bottom: 0.85rem;
}
.modal-wide {
  max-width: 42rem !important;
}
.inline-edit-btn {
  font-size: 0.75rem;
  font-weight: 700;
  color: #166534;
  background: #e6f4ec;
  border: 1px solid #c7e6d3;
  border-radius: 0.5rem;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
}
.inline-edit-btn:hover { background: #d5eddf; }

/* Prominent back control (all non-home pages) */
.page-header-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  align-self: flex-start;
  border: 1px solid #dce6df;
  background: #ffffff;
  color: #166534;
  border-radius: 999px;
  padding: 0.5rem 0.95rem;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 40, 28, 0.04);
  transition: 0.12s ease;
}
.btn-back:hover {
  background: #e6f4ec;
  border-color: #96d0ae;
}
.btn-back:active {
  transform: scale(0.98);
}

/* QR generation boxes */
.qr-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 160px;
  min-height: 160px;
}
.qr-box img,
.qr-box canvas {
  display: block;
  max-width: 100%;
  height: auto !important;
}
.qr-print-card {
  break-inside: avoid;
  page-break-inside: avoid;
  border: 2px solid #0d1f17;
  border-radius: 1rem;
  padding: 1rem;
  background: white;
  text-align: center;
}
.qr-print-card h3 {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 0.5rem 0 0.15rem;
}
.qr-print-card .code {
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  color: #5b6b62;
  word-break: break-all;
}
.qr-scan-hero {
  background: linear-gradient(145deg, #14532d, #0d1f17);
  color: white;
  border-radius: 1.25rem;
  padding: 1.25rem;
  box-shadow: 0 12px 28px rgba(13, 31, 23, 0.25);
}
.hours-actual {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.hours-costed {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #166534;
}

@media print {
  header,
  #sidebar,
  #empBottomNav,
  #pushBanner,
  #installBanner,
  #toast,
  #notifDrawer,
  #menuBtn,
  .btn-back,
  .no-print {
    display: none !important;
  }
  .shell,
  .flex {
    display: block !important;
  }
  main {
    max-width: none !important;
    padding: 0 !important;
  }
  .qr-print-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .qr-print-card {
    box-shadow: none;
  }
  body {
    background: white !important;
  }
}
