/* =============================================================
   TradeRail — PR241: Time & Attendance
   Namespace : tr241-*
   Brand     : #FF6B00 primary, #1A1A2E dark
   ============================================================= */

/* ── Module shell ───────────────────────────────────────────── */
.tr241-module {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1A1A2E;
  background: #f5f6f8;
  min-height: 100%;
  padding-bottom: 40px;
}

/* ── Header ─────────────────────────────────────────────────── */
.tr241-module-header {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 20px 28px 0;
}
.tr241-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.tr241-module-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: #1A1A2E;
  margin: 0 0 2px;
}
.tr241-module-sub {
  font-size: 13px;
  color: #9ca3af;
  margin: 0 0 14px;
}
.tr241-header-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding-top: 3px;
}
.tr241-role-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  text-transform: capitalize;
}
.tr241-exempt-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #1d4ed8;
}

/* ── Tab bar ────────────────────────────────────────────────── */
.tr241-tab-bar {
  display: flex;
  gap: 0;
  border-top: 1px solid #f3f4f6;
  margin: 0 -28px;
  padding: 0 28px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tr241-tab-bar::-webkit-scrollbar { display: none; }

.tr241-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.14s, border-color 0.14s;
  white-space: nowrap;
  outline: none;
  font-family: inherit;
}
.tr241-tab:hover { color: #FF6B00; }
.tr241-tab.tr241-tab-active {
  color: #FF6B00;
  border-bottom-color: #FF6B00;
  font-weight: 600;
}
.tr241-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  background: #e5e7eb;
  color: #374151;
}
.tr241-tab.tr241-tab-active .tr241-tab-badge {
  background: #fff3e8;
  color: #FF6B00;
}
.tr241-tab-badge-alert {
  background: #fee2e2 !important;
  color: #dc2626 !important;
}

/* ── Tab content ────────────────────────────────────────────── */
.tr241-tab-content {
  padding: 20px 28px;
}

/* ── Summary stat cards row ─────────────────────────────────── */
.tr241-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 900px) {
  .tr241-stats-row { grid-template-columns: repeat(2, 1fr); }
}
.tr241-stat-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tr241-stat-label {
  font-size: 12px;
  font-weight: 500;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tr241-stat-value {
  font-size: 26px;
  font-weight: 700;
  color: #1A1A2E;
  line-height: 1;
}
.tr241-stat-value-orange { color: #FF6B00; }
.tr241-stat-value-red    { color: #dc2626; }
.tr241-stat-value-amber  { color: #d97706; }
.tr241-stat-sub {
  font-size: 12px;
  color: #9ca3af;
}

/* ── Section headers ────────────────────────────────────────── */
.tr241-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 10px;
}

/* ── Worker crew cards (Office View) ────────────────────────── */
.tr241-crew-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.tr241-crew-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 16px;
  transition: box-shadow 0.15s;
  cursor: default;
}
.tr241-crew-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.07); }
.tr241-crew-card--mismatch {
  border-left: 4px solid #f59e0b;
}
.tr241-crew-card--clocked-out {
  opacity: 0.72;
}
.tr241-crew-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.tr241-crew-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.tr241-crew-name-block {
  flex: 1;
  padding: 0 10px;
}
.tr241-crew-name {
  font-size: 14px;
  font-weight: 600;
  color: #1A1A2E;
  margin: 0;
}
.tr241-crew-role {
  font-size: 12px;
  color: #9ca3af;
  text-transform: capitalize;
}
.tr241-crew-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tr241-dot-in  { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,0.2); }
.tr241-dot-out { background: #d1d5db; }

.tr241-crew-job {
  font-size: 13px;
  color: #374151;
  font-weight: 500;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tr241-crew-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tr241-crew-time {
  font-size: 12px;
  color: #6b7280;
}
.tr241-crew-elapsed {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  background: #f3f4f6;
  border-radius: 5px;
  padding: 1px 6px;
}
.tr241-crew-elapsed-ot {
  background: #fff3e8;
  color: #FF6B00;
}

/* GPS badge */
.tr241-gps-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
}
.tr241-gps-ok       { background: #dcfce7; color: #15803d; }
.tr241-gps-mismatch { background: #fef3c7; color: #92400e; }
.tr241-gps-none     { background: #f3f4f6; color: #6b7280; }

/* OT / corrected badges */
.tr241-ot-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  background: #fff3e8;
  color: #FF6B00;
  border: 1px solid #ffb366;
}
.tr241-corrected-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  background: #eff6ff;
  color: #1d4ed8;
}
.tr241-active-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  background: #dcfce7;
  color: #15803d;
}
.tr241-active-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
}

/* ── Records table ──────────────────────────────────────────── */
.tr241-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}
.tr241-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid #f3f4f6;
  flex-wrap: wrap;
}
.tr241-filter-input {
  flex: 1;
  min-width: 160px;
  padding: 7px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  color: #374151;
  outline: none;
  font-family: inherit;
  transition: border-color 0.14s, box-shadow 0.14s;
}
.tr241-filter-input:focus {
  border-color: #FF6B00;
  box-shadow: 0 0 0 3px rgba(255,107,0,0.1);
}
.tr241-filter-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 7px 30px 7px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239ca3af' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.14s;
}
.tr241-filter-select:focus { border-color: #FF6B00; }
.tr241-table-wrap { overflow-x: auto; }
.tr241-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tr241-table thead th {
  padding: 9px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f9fafb;
  border-bottom: 1px solid #f3f4f6;
  white-space: nowrap;
}
.tr241-table tbody tr {
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.1s;
}
.tr241-table tbody tr:last-child { border-bottom: none; }
.tr241-table tbody tr:hover { background: #fafafa; }
.tr241-table tbody td {
  padding: 11px 14px;
  color: #374151;
  vertical-align: middle;
}
.tr241-table .tr241-row-corrected td:first-child {
  border-left: 3px solid #3b82f6;
}
.tr241-btn-link {
  background: none;
  border: none;
  color: #FF6B00;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 3px 0;
  font-family: inherit;
  transition: opacity 0.12s;
  white-space: nowrap;
}
.tr241-btn-link:hover { opacity: 0.75; }

/* ── Buttons ────────────────────────────────────────────────── */
.tr241-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: background 0.14s, box-shadow 0.14s;
  white-space: nowrap;
  outline: none;
  line-height: 1.4;
}
.tr241-btn-primary {
  background: #FF6B00;
  color: #fff;
}
.tr241-btn-primary:hover {
  background: #e55f00;
  box-shadow: 0 2px 8px rgba(255,107,0,0.25);
}
.tr241-btn-secondary {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
}
.tr241-btn-secondary:hover { background: #e5e7eb; }
.tr241-btn-danger {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
}
.tr241-btn-danger:hover { background: #fecaca; }
.tr241-btn-ghost {
  background: transparent;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}
.tr241-btn-ghost:hover { background: #f9fafb; color: #374151; }
.tr241-btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 6px; }
.tr241-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Worker clock-in panel ──────────────────────────────────── */
.tr241-worker-wrap {
  max-width: 540px;
  margin: 0 auto;
}
.tr241-clock-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
}
.tr241-clock-card--in {
  border-color: #86efac;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.08);
}
.tr241-clock-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.tr241-clock-status-label {
  font-size: 15px;
  font-weight: 700;
  color: #1A1A2E;
}
.tr241-clock-detail {
  margin-bottom: 16px;
}
.tr241-clock-job {
  font-size: 15px;
  font-weight: 600;
  color: #1A1A2E;
  margin-bottom: 4px;
}
.tr241-clock-meta {
  font-size: 13px;
  color: #6b7280;
}
.tr241-clock-elapsed {
  font-size: 28px;
  font-weight: 700;
  color: #FF6B00;
  margin-bottom: 16px;
}
.tr241-clock-prompt {
  font-size: 14px;
  color: #9ca3af;
  margin: 0 0 16px;
}
.tr241-clock-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.tr241-gps-hint-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12px;
  color: #9ca3af;
  background: #f9fafb;
  border-radius: 6px;
  padding: 8px 10px;
}
.tr241-gps-hint-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── My Day ack queue ───────────────────────────────────────── */
.tr241-myday-section {
  margin-top: 0;
}
.tr241-ack-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-left: 4px solid #FF6B00;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.tr241-ack-date {
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 6px;
}
.tr241-ack-msg {
  font-size: 13px;
  color: #374151;
  margin-bottom: 12px;
  line-height: 1.5;
}
.tr241-ack-done {
  font-size: 13px;
  font-weight: 600;
  color: #15803d;
}

/* ── Live Map panel ─────────────────────────────────────────── */
.tr241-map-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 800px) {
  .tr241-map-layout { grid-template-columns: 1fr; }
}
.tr241-map-canvas {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  min-height: 320px;
}
.tr241-map-svg-wrap {
  width: 100%;
  aspect-ratio: 16/9;
  background: #e8f0fe;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tr241-map-svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tr241-map-overlay-note {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(26,26,46,0.75);
  color: #fff;
  font-size: 12px;
  border-radius: 6px;
  padding: 6px 10px;
  backdrop-filter: blur(4px);
}
.tr241-map-refresh {
  position: absolute;
  top: 10px;
  right: 10px;
}
.tr241-map-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tr241-map-worker-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 14px;
  transition: box-shadow 0.14s;
}
.tr241-map-worker-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.07); }
.tr241-map-worker-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.tr241-map-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tr241-map-worker-name {
  font-size: 13px;
  font-weight: 600;
  color: #1A1A2E;
}
.tr241-map-worker-job {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tr241-map-worker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.tr241-map-updated {
  font-size: 11px;
  color: #9ca3af;
}
.tr241-map-threshold-row {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 8px;
  padding: 8px 12px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #f3f4f6;
}

/* ── Corrections panel ──────────────────────────────────────── */
.tr241-corrections-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 800px) {
  .tr241-corrections-layout { grid-template-columns: 1fr; }
}
.tr241-form-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 20px;
}
.tr241-form-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #1A1A2E;
  margin: 0 0 16px;
}
.tr241-form-row {
  margin-bottom: 14px;
}
.tr241-form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tr241-form-label-small {
  font-size: 11px;
  font-weight: 500;
  color: #9ca3af;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 6px;
}
.tr241-form-select,
.tr241-form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  color: #374151;
  outline: none;
  font-family: inherit;
  transition: border-color 0.14s, box-shadow 0.14s;
  box-sizing: border-box;
  background: #fff;
}
.tr241-form-select {
  appearance: none;
  -webkit-appearance: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239ca3af' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  padding-right: 30px;
}
.tr241-form-select:focus,
.tr241-form-input:focus {
  border-color: #FF6B00;
  box-shadow: 0 0 0 3px rgba(255,107,0,0.1);
}
.tr241-form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.tr241-form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  color: #374151;
  outline: none;
  font-family: inherit;
  transition: border-color 0.14s, box-shadow 0.14s;
  resize: vertical;
  box-sizing: border-box;
  min-height: 72px;
}
.tr241-form-textarea:focus {
  border-color: #FF6B00;
  box-shadow: 0 0 0 3px rgba(255,107,0,0.1);
}
.tr241-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.tr241-corr-info {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 8px;
  line-height: 1.5;
}
.tr241-required { color: #dc2626; font-size: 11px; font-weight: 500; text-transform: none; letter-spacing: 0; }

/* Correction history list */
.tr241-history-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
}
.tr241-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #f3f4f6;
}
.tr241-history-title {
  font-size: 14px;
  font-weight: 700;
  color: #1A1A2E;
  margin: 0;
}
.tr241-history-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid #f9fafb;
  transition: background 0.1s;
}
.tr241-history-row:last-child { border-bottom: none; }
.tr241-history-row:hover { background: #fafafa; }
.tr241-history-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  margin-top: 1px;
}
.tr241-history-body {
  flex: 1;
  min-width: 0;
}
.tr241-history-worker {
  font-size: 13px;
  font-weight: 600;
  color: #1A1A2E;
  margin-bottom: 1px;
}
.tr241-history-detail {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}
.tr241-history-note {
  font-size: 12px;
  color: #374151;
  font-style: italic;
}
.tr241-history-meta {
  text-align: right;
  flex-shrink: 0;
}
.tr241-history-date {
  font-size: 11px;
  color: #9ca3af;
}
.tr241-history-by {
  font-size: 11px;
  color: #6b7280;
  margin-top: 2px;
}

/* ── Exempt / no-access notices ─────────────────────────────── */
.tr241-exempt-notice,
.tr241-no-access {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 40px 24px;
  text-align: center;
  max-width: 420px;
  margin: 0 auto;
}
.tr241-exempt-icon,
.tr241-no-access-icon {
  font-size: 32px;
  margin-bottom: 10px;
}
.tr241-exempt-title,
.tr241-no-access-title {
  font-size: 16px;
  font-weight: 700;
  color: #1A1A2E;
  margin: 0 0 8px;
}
.tr241-exempt-body,
.tr241-no-access p {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
  line-height: 1.6;
}

/* ── Muted text ─────────────────────────────────────────────── */
.tr241-muted { color: #9ca3af; }
.tr241-muted-sm { font-size: 11px; color: #9ca3af; }
