/* Foreman mobile entry wizard — full-screen, touch-first flow */

#foreman-entry {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: #f1f5f9;
  flex-direction: column;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#foreman-entry.open {
  display: flex;
}

body.foreman-entry-open {
  overflow: hidden;
}

body.foreman-mobile .timesheets-page .page-header .btn-primary {
  display: none !important;
}

.fe-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  padding-top: max(0.75rem, env(safe-area-inset-top));
  background: linear-gradient(180deg, #1a4d2e, #0d2818);
  color: #fff;
  flex-shrink: 0;
}

.fe-header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0 0.75rem;
}

.fe-header-btn.text {
  font-size: 0.9375rem;
  font-weight: 600;
}

.fe-header-title {
  flex: 1;
  font-size: 1.0625rem;
  font-weight: 700;
  color: #86efac;
  text-align: center;
}

.fe-progress {
  display: flex;
  gap: 0.375rem;
  padding: 0.75rem 1rem 0;
  background: #f1f5f9;
  flex-shrink: 0;
}

.fe-progress-dot {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: #cbd5e1;
  transition: background 0.2s;
}

.fe-progress-dot.active {
  background: #22c55e;
}

.fe-progress-dot.done {
  background: #16a34a;
}

.fe-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem;
  padding-bottom: calc(5rem + env(safe-area-inset-bottom));
}

.fe-step-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.375rem;
}

.fe-step-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.25rem;
}

.fe-step-hint {
  font-size: 0.9375rem;
  color: #64748b;
  margin-bottom: 1.25rem;
  line-height: 1.45;
}

.fe-field {
  margin-bottom: 1rem;
}

.fe-field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.375rem;
}

.fe-field input,
.fe-field select,
.fe-field textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 1rem;
  font-size: 16px;
  border: 2px solid #e2e8f0;
  border-radius: 0.625rem;
  background: #fff;
  color: #1e293b;
  box-sizing: border-box;
}

.fe-field input:focus,
.fe-field select:focus,
.fe-field textarea:focus {
  outline: none;
  border-color: #22c55e;
}

.fe-date-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.fe-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.fe-chip {
  min-height: 40px;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 2px solid #e2e8f0;
  background: #fff;
  color: #334155;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}

.fe-chip.active {
  border-color: #22c55e;
  background: #dcfce7;
  color: #166534;
}

.fe-mode-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.fe-mode-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.125rem 1rem;
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 0.75rem;
  cursor: pointer;
  text-align: left;
  width: 100%;
  box-sizing: border-box;
  min-height: 72px;
}

.fe-mode-card.selected {
  border-color: #22c55e;
  background: #f0fdf4;
}

.fe-mode-card:active {
  transform: scale(0.99);
}

.fe-mode-icon {
  font-size: 1.75rem;
  width: 2.5rem;
  text-align: center;
  flex-shrink: 0;
}

.fe-mode-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.fe-mode-text strong {
  font-size: 1.0625rem;
  color: #1e293b;
}

.fe-mode-text span {
  font-size: 0.875rem;
  color: #64748b;
}

.fe-job-list,
.fe-crew-list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.fe-job-card,
.fe-crew-card {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem;
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: left;
  width: 100%;
  box-sizing: border-box;
}

.fe-crew-inputs {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-left: auto;
}

.fe-crew-input-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  cursor: default;
}

.fe-crew-input-label {
  font-size: 0.6875rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.fe-crew-ot {
  width: 3.75rem;
}

.fe-crew-perdiem {
  width: 4.25rem;
}

@media (max-width: 380px) {
  .fe-crew-card {
    flex-direction: column;
    align-items: stretch;
  }

  .fe-crew-inputs {
    margin-left: 0;
    padding-left: 2rem;
  }
}

.fe-job-card.selected,
.fe-crew-card.selected {
  border-color: #22c55e;
  background: #f0fdf4;
}

.fe-job-card:active,
.fe-crew-card:active {
  transform: scale(0.99);
}

.fe-job-name,
.fe-crew-name {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
}

.fe-job-meta,
.fe-crew-meta {
  font-size: 0.8125rem;
  color: #64748b;
  margin-top: 0.125rem;
}

.fe-job-check,
.fe-crew-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  color: transparent;
}

.fe-job-card.selected .fe-job-check,
.fe-crew-card.selected .fe-crew-check {
  border-color: #22c55e;
  background: #22c55e;
  color: #fff;
}

.fe-crew-content {
  flex: 1;
  min-width: 0;
}

.fe-crew-hours {
  width: 4.5rem;
  min-height: 44px;
  padding: 0.5rem;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  border: 2px solid #e2e8f0;
  border-radius: 0.5rem;
  flex-shrink: 0;
}

.fe-crew-card.selected .fe-crew-hours {
  border-color: #bbf7d0;
}

.fe-crew-toolbar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.fe-crew-toolbar button {
  flex: 1;
  min-height: 40px;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.fe-summary-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.fe-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.375rem 0;
  font-size: 0.9375rem;
}

.fe-summary-row strong {
  color: #1e293b;
  text-align: right;
}

.fe-summary-crew {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f5f9;
}

.fe-summary-person {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
  font-size: 0.875rem;
  color: #475569;
}

.fe-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.75rem 1rem;
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
  z-index: 2001;
}

.fe-footer-btn {
  width: 100%;
  min-height: 52px;
  border: none;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  font-size: 1.0625rem;
  font-weight: 700;
  cursor: pointer;
}

.fe-footer-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.fe-footer-btn.secondary {
  background: #f1f5f9;
  color: #334155;
  border: 2px solid #e2e8f0;
}

.fe-error {
  background: #fee2e2;
  color: #991b1b;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  margin-bottom: 1rem;
}

.fe-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  color: #64748b;
  gap: 0.75rem;
}

.fe-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e2e8f0;
  border-top-color: #22c55e;
  border-radius: 50%;
  animation: fe-spin 0.7s linear infinite;
}

@keyframes fe-spin {
  to { transform: rotate(360deg); }
}

.fe-success {
  text-align: center;
  padding: 2rem 1rem;
}

.fe-success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #dcfce7;
  color: #16a34a;
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.fe-success h2 {
  font-size: 1.375rem;
  color: #1e293b;
  margin-bottom: 0.5rem;
}

.fe-success p {
  color: #64748b;
  font-size: 0.9375rem;
  margin-bottom: 1.5rem;
}

/* Suppress React add-timesheet modals — foreman uses + New wizard; edit modal must stay available */
body.foreman-mobile .timesheets-page .modal-overlay.fe-suppress-modal {
  display: none !important;
}

body.foreman-mobile .timesheets-page .modal-overlay.fe-edit-modal {
  display: flex !important;
  z-index: 2100;
}

body.foreman-mobile .timesheets-page .data-table tbody td[data-label='Actions'] .btn-icon.btn-danger {
  display: none !important;
}

body.foreman-mobile .timesheets-page .data-table tfoot {
  display: none !important;
}

#foreman-expense-entry,
#foreman-tailgate-entry {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: #f1f5f9;
  flex-direction: column;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#foreman-expense-entry.open,
#foreman-tailgate-entry.open {
  display: flex;
}

body.foreman-mobile .expenses-page .page-header .btn-primary {
  display: none !important;
}

body.foreman-mobile .expenses-page .modal-overlay.fe-suppress-modal {
  display: none !important;
}

/* Tailgate page reuses employees-page className in the SPA */
body.foreman-mobile.pc-tailgate-page .employees-page .page-header .btn-primary {
  display: none !important;
}

body.foreman-mobile.pc-tailgate-page .employees-page .modal-overlay.fe-suppress-modal {
  display: none !important;
}

body.foreman-mobile .expenses-page .expenses-summary,
body.foreman-mobile .expenses-page .filters-section {
  display: none !important;
}

.pc-expense-pending-panel {
  margin: 0 0 1.25rem;
  padding: 1rem;
  border-radius: 0.75rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
}

.pc-expense-pending-panel h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: #92400e;
}

.pc-expense-pending-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 0;
  border-top: 1px solid #fde68a;
}

.pc-expense-pending-item:first-of-type {
  border-top: none;
}

.pc-expense-pending-meta {
  font-size: 0.8125rem;
  color: #78350f;
}

.pc-expense-pending-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.pc-expense-pending-actions button {
  border: none;
  border-radius: 0.5rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.pc-expense-approve-btn {
  background: #22c55e;
  color: #fff;
}

.pc-expense-deny-btn {
  background: #ef4444;
  color: #fff;
}

.expenses-page .action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  align-items: center;
}

.expenses-page .pc-expense-action-btn {
  border: none;
  border-radius: 0.5rem;
  padding: 0.4rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.status-badge.pending {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.approved {
  background: #dcfce7;
  color: #166534;
}

.status-badge.denied {
  background: #fee2e2;
  color: #991b1b;
}

.fe-production-section {
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: 0.75rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.fe-production-title {
  font-size: 1rem;
  font-weight: 700;
  color: #166534;
  margin-bottom: 0.25rem;
}

.fe-production-hint {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  color: #15803d;
}

.fe-success-invoice {
  color: #166534;
  font-weight: 600;
}

.fe-success-warn {
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 0.5rem;
  padding: 0.75rem;
  font-size: 0.875rem;
}

.pc-invoice-pending-panel {
  margin: 0 0 1.25rem;
  padding: 1rem;
  border-radius: 0.75rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.pc-invoice-pending-panel h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: #1e40af;
}

.pc-invoice-pending-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 0;
  border-top: 1px solid #bfdbfe;
}

.pc-invoice-pending-item:first-of-type {
  border-top: none;
}

.pc-invoice-pending-meta {
  font-size: 0.8125rem;
  color: #1e3a8a;
}

.pc-invoice-pending-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.pc-invoice-pending-actions button {
  border: none;
  border-radius: 0.5rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.pc-invoice-approve-btn {
  background: #22c55e;
  color: #fff;
}

.pc-invoice-delete-btn {
  background: #ef4444;
  color: #fff;
}

.pc-invoice-edit-btn {
  background: #2563eb;
  color: #fff;
}

.status-badge.approval-pending {
  background: #dbeafe;
  color: #1e40af;
}

.pending-invoices-page,
#pc-pending-invoices-app {
  width: 100%;
}

#pc-pending-invoices-mount[data-pc-pending-stub="1"] {
  display: none !important;
}

.pending-invoices-page .page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.pending-invoices-page .page-subtitle {
  margin: 0.25rem 0 0;
  color: #64748b;
  font-size: 0.9375rem;
}

.pending-invoices-page .action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  align-items: center;
}

.pending-invoices-page .btn-sm {
  padding: 0.4rem 0.7rem;
  font-size: 0.8125rem;
}

.pending-invoices-page .invoices-table {
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  overflow-x: auto;
}

.pc-pending-invoices-page {
  padding: 1.5rem;
  max-width: 1200px;
}

.pc-pending-invoices-page .page-header h1 {
  margin: 0 0 0.25rem;
  color: #1a4d2e;
}

.pc-pending-invoices-page .page-header p {
  margin: 0 0 1.25rem;
  color: #64748b;
}

.pc-pending-table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
}

.pc-pending-table {
  width: 100%;
  border-collapse: collapse;
}

.pc-pending-table th,
.pc-pending-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}

.pc-pending-table th {
  background: #f8fafc;
  font-size: 0.8125rem;
  color: #475569;
}

.pc-pending-sub {
  font-size: 0.75rem;
  color: #1e40af;
  font-weight: 600;
  margin-top: 0.2rem;
}

.pc-pending-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.pc-pending-empty {
  padding: 2rem;
  background: #f8fafc;
  border-radius: 0.75rem;
  color: #64748b;
  border: 1px dashed #cbd5e1;
}

.pc-invoice-edit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.pc-invoice-edit-modal {
  background: #fff;
  border-radius: 12px;
  max-width: 420px;
  width: 100%;
  padding: 1.25rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.pc-invoice-edit-modal h3 {
  margin: 0 0 0.25rem;
  color: #1a4d2e;
}

.pc-invoice-edit-meta {
  margin: 0 0 1rem;
  color: #64748b;
  font-size: 0.875rem;
}

.pc-invoice-edit-modal label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.pc-invoice-edit-modal input {
  width: 100%;
  padding: 0.65rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  box-sizing: border-box;
}

.pc-invoice-edit-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.pc-invoice-edit-actions button {
  border: none;
  background: #e2e8f0;
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.pc-invoice-edit-actions button.primary {
  background: #16a34a;
  color: #fff;
}

.pc-foreman-production-panel {
  margin: 0 0 1.25rem;
  padding: 1rem;
  border-radius: 0.75rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.pc-foreman-production-panel h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  color: #166534;
}

.pc-foreman-production-hint {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  color: #15803d;
}

.pc-foreman-production-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 0;
  border-top: 1px solid #bbf7d0;
}

.pc-foreman-production-item:first-of-type {
  border-top: none;
}

.pc-foreman-production-meta {
  font-size: 0.8125rem;
  color: #166534;
}

.pc-foreman-production-edit {
  border: none;
  border-radius: 0.5rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  background: #16a34a;
  color: #fff;
  flex-shrink: 0;
}

.pc-timesheet-production-field {
  margin: 1rem 0;
  padding: 0.85rem;
  border-radius: 0.75rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.pc-timesheet-production-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.pc-timesheet-production-field input {
  width: 100%;
  padding: 0.6rem;
  border: 2px solid #bbf7d0;
  border-radius: 0.5rem;
  box-sizing: border-box;
}

.clickable-kpi.pc-pending-invoices-kpi,
.kpi-card.pc-pending-invoices-kpi {
  cursor: pointer;
}

