.table-wrap { overflow-x: auto; }

#timesheetTable {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

#timesheetTable th,
#timesheetTable td {
  border: 1px solid rgba(148,163,184,.35);
  padding: 6px;
  text-align: center;
  vertical-align: middle;
}

#timesheetTable input {
  width: 100%;
  box-sizing: border-box;
}

/* Time range layout */
.timeRange {
  display: grid;
  grid-template-columns: 1fr auto 1fr 92px;
  gap: 6px;
  align-items: center;
}

.timeRange .to { opacity: .7; font-size: 12px; }

/* Make time pickers look “clickable” */
.timeRange input[type="time"]{
  padding: 8px 10px;
  border: 1px solid rgba(148,163,184,.55);
  border-radius: 10px;
  background: rgba(15,23,42,.35);
  color: inherit;
  cursor: pointer;
}

/* Improve the visibility of the clock icon button in WebKit browsers */
.timeRange input[type="time"]::-webkit-calendar-picker-indicator {
  opacity: 1;
  filter: invert(1);
  cursor: pointer;
}

/* Break minutes box */
.breakMin{
  padding: 8px 10px;
  border: 1px solid rgba(148,163,184,.55);
  border-radius: 10px;
  background: rgba(15,23,42,.35);
  color: inherit;
}

.inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.totals {
  font-size: 1.1em;
}

.saved-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.saved-list li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(148,163,184,.25);
  font-size: 0.95em;
}

.remove {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 16px;
}

/* Day state colors */
td[data-day].complete {
  background: rgba(34,197,94,.15); /* green */
}

td[data-day].missing {
  background: rgba(239,68,68,.15); /* red */
}

td[data-day].current {
  background: rgba(234,179,8,.18); /* yellow */
}

td[data-day].future {
  background: rgba(148,163,184,.15); /* gray */
}

/* Top nav */
.timesheet-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.back-btn {
  border: none;
  background: none;
  font-size: 16px;
  cursor: pointer;
}

/* Mobile tightening */
@media (max-width: 640px) {
  .timeRange {
    grid-template-columns: 1fr;
  }
}

/* ---------- Mobile Day Slider ---------- */

.day-slider {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid rgba(148,163,184,.35);
  border-radius: 12px;
  background: rgba(15,23,42,.35);
  font-weight: 600;
}

.day-slider button {
  border: none;
  background: rgba(59,130,246,.2);
  color: inherit;
  padding: 6px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.hidden {
  display: none;
}

/* Mobile-only behavior */
@media (max-width: 768px) {

  /* Hide all day columns by default in mobile time mode */
  .mobile-time-mode td[data-day] {
    display: none;
  }

  /* Show only the active day */
  .mobile-time-mode td[data-day].active-day {
    display: table-cell;
  }

  /* Tighten table for mobile */
  #timesheetTable {
    min-width: unset;
  }
}

@media (max-width: 768px) {
  #timesheetTable thead th[data-day] {
    display: none;
  }

  #timesheetTable thead th[data-day].active-day {
    display: table-cell;
  }
}
td.complete { background: #ecfdf5; }
td.current  { background: #fff7ed; }
td.missing  { background: #fef2f2; }
td.future   { background: #f8fafc; }

thead th.active-day,
td.active-day {
  outline: 2px solid #2563eb;
  background: transparent;
}

.date {
  font-size: 12px;
  color: #64748b;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button.warning {
  background: #f59e0b;
  color: #111827;
  font-weight: 600;
}

button.warning:hover {
  background: #d97706;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge.draft {
  background: #374151;
  color: #e5e7eb;
}

.badge.submitted {
  background: #2563eb;
  color: white;
}

.saved-list li.submitted {
  font-weight: 600;
  color: #2563eb;
}

.table-wrap {
  overflow-x: hidden;
}

#timesheetTable {
  table-layout: fixed;
  width: 100%;
}

#timesheetTable th,
#timesheetTable td {
  padding: 6px;
  text-align: center;
}

#timesheetTable td[data-day] .timeRange {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

@media (min-width: 1024px) {
  #timesheetTable th[data-day],
  #timesheetTable td[data-day] {
    width: 11%;
  }
}

.table-wrap {
  overflow-x: auto;   /* NOT hidden */
  overflow-y: visible;
}

#timesheetTable {
  width: 100%;
  table-layout: fixed;
}

#timesheetTable th,
#timesheetTable td {
  text-align: center;
  vertical-align: top;
  padding: 6px;
  font-size: 13px;
}

#timesheetTable th[data-day],
#timesheetTable td[data-day] {
  width: 110px;
}

.timeRange {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.timeRange input {
  width: 100%;
  font-size: 12px;
  padding: 4px;
}

.timeRange .to {
  display: none;
}
th .day-name {
  font-weight: 700;
  font-size: 14px;
}

th .day-date {
  font-size: 12px;
  opacity: 0.7;
}

th.active-day {
  background: transparent;
}

@media (max-width: 768px) {
  #timesheetTable thead th:not(.active-day) {
    display: none;
  }
}

.date-open {
  border: none;
  background: transparent;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
}

.date-open:hover {
  background: #40d406;
}

th.active-day {
  background: transparent; /* dark slate */
  color: #ffffff;
}

th.active-day .day-date {
  color: #ffffff; /* light gray */
}

td.active-day {
  background: transparent;
}

/* ===== MODAL OVERLAY ===== */
.modal {
  position: fixed;
  inset: 0; /* top:0 right:0 bottom:0 left:0 */
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999; /* above everything */
}

/* Hide when not active */
.modal.hidden {
  display: none;
}

/* ===== MODAL CONTENT ===== */
.modal-content {
  background: #fff;
  color: #111;
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  overflow-y: auto;

  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

/* Employee blocks */
.missing-employee {
  margin-bottom: 14px;
}

.missing-employee strong {
  display: block;
  margin-bottom: 6px;
}

.missing-employee ul {
  margin: 0;
  padding-left: 18px;
}

/* Action buttons */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* ===== MODAL CONTENT POLISH ===== */
.modal-content {
  background: linear-gradient(#ffffff, #f7f9fb);
  border: 1px solid #e3e7ed;
}

/* Modal header */
.modal-content h3 {
  margin: 0 0 12px;
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 8px;
}

/* Employee issue blocks */
.missing-employee {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.missing-employee strong {
  color: #111827;
  font-weight: 600;
}

.missing-employee ul {
  margin-top: 6px;
  color: #e69e04;
  font-size: 0.95rem;
}

/* Footer actions */
.modal-actions {
  border-top: 1px solid #e5e7eb;
  padding-top: 12px;
}

.modal-actions button {
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 600;
  border: none;
  cursor: pointer;
}

/* Buttons */
.modal-actions .cancel {
  background: #e5e7eb;
  color: #111827;
}

.modal-actions .proceed {
  background: #2563eb;
  color: #fff;
}

.modal-actions .proceed:hover {
  background: #1d4ed8;
}

#timesheetTable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.95rem;
}

#timesheetTable thead th {
  background: #f3f4f6;
  color: #111827;
  font-weight: 600;
  text-align: center;
  border-bottom: 2px solid #e5e7eb;
  padding: 10px 6px;
}

#timesheetTable tbody tr {
  background: transparent;
  transition: background 0.15s ease;
  color: #d1d5db;
}

#timesheetTable tbody tr:hover {
  background: #01182e;
  color: #111;
}

#timesheetTable td {
  border-bottom: 1px solid #e5e7eb;
  padding: 10px 6px;
  vertical-align: top;
}

.empName {
  font-weight: 600;
  color: #111827;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 6px 8px;
}

td.complete {
  background: #ecfdf5;
}

td.missing {
  background: #fff7ed;
}

td.current {
  outline: 2px solid #2563eb;
  color: #111;
  outline-offset: -2px;
}

td.future {
  background: #f9fafb;
}

.timeRange {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.time-field label {
  font-size: 0.75rem;
  color: #f8f8f8;
}

.time-field input {
  width: 100%;
  padding: 6px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
}

.totals {
  display: flex;
  justify-content: space-between;
  font-size: 1.1rem;
}

.badge {
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.8rem;
}

.badge.draft {
  background: #e5e7eb;
  color: #111827;
}

.badge.submitted {
  background: #2563eb;
  color: #ffffff;
}

.actions button {
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 600;
}

.actions .primary {
  background: #2563eb;
  color: white;
}

.actions .warning {
  background: #f59e0b;
  color: white;
}

.approved-view input,
.approved-view button {
  opacity: 0.6;
  cursor: not-allowed;
}



.badge.approved {
  background: #0f766e;
  color: white;
}

.approved-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #81adee;
  border: 2px solid #05f705;
  border-left: 56px solid #2c7be5;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;

  font-weight: 600;
  color: #1f2937;
}

/* 🔴 CLOSE BUTTON */
.approved-banner .close-btn {
  background: #dc2626; /* red */
  color: #fff;
  border: none;
  border-radius: 6px;

  padding: 6px 12px;
  font-size: 14px;
  font-weight: 600;

  cursor: pointer;
}

.approved-banner .close-btn:hover {
  background: #b91c1c;
}

.approved-banner .close-btn:active {
  transform: scale(0.97);
}

/* Export button styling */
.approved-banner .export-btn {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.approved-banner .export-btn:hover { background: #1d4ed8; }

.approved-banner .approved-sub {
  font-weight: 500;
  opacity: 0.75;
  margin-left: 10px;
  font-size: 13px;
}

/* -------------------------------------------------------------------------------------Print / PDF formatting */
@media print {
  /* Hide UI that shouldn't appear in PDF */
  nav, .timesheet-nav, .saved-list, #savedList, .actions, #daySlider,
  #addRow, #saveDraft, #submitForApproval {
    display: none !important;
  }

  /* Remove cards/shadows for clean PDF */
  .card {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 0 10px 0 !important;
  }

  body {
    background: #fff !important;
  }

  /* Force table readable */
  table {
    width: 100% !important;
    border-collapse: collapse !important;
  }

  th, td {
    border: 1px solid #7c7a7a !important;
    padding: 6px !important;
    font-size: 12px !important;
    color: #000 !important;
  }

  /* Show full headers and dates cleanly */
  thead th {
    background: #f3f4f6 !important;
  }

  @media print {

  /* Hide controls only */
  button,
  input[type="time"],
  input[type="number"],
  input[type="text"] {
    display: none !important;
  }

  /* Render time text inside table cells */
  td[data-day]::after {
    content: attr(data-print);
    display: block;
    font-size: 12px;
    color: #000;
    white-space: nowrap;
  }

  /* Ensure table cells stay aligned */
  td, th {
    vertical-align: middle !important;
  }

  /* Fix totals alignment */
  .rowTotal {
    display: table-cell !important;
    font-weight: bold !important;
    text-align: right !important;
  }
}


  /* But keep computed totals visible */
  .rowTotal, #grandTotal {
    display: inline !important;
    font-weight: 700 !important;
  }

  /* Approved banner becomes a simple header line */
  .approved-banner {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin-bottom: 12px !important;
    font-size: 14px !important;
    color: #000 !important;
  }

  .approved-banner-actions {
    display: none !important;
  }
}

.approved-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1f2933;
  color: #fff;
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.approved-banner-left {
  font-size: 15px;
}

.approved-sub {
  display: block;
  font-size: 12px;
  opacity: 0.8;
}

.approved-banner-actions {
  display: flex;
  gap: 10px;
}

.export-btn {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
}

.close-btn.danger {
  background: #dc2626;
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}

.signature-block {
  margin-top: 30px;
  font-size: 13px;
}

.sig-line {
  margin-top: 14px;
}

/* -------------------------------- PRINT-ONLY VALUES */
@media print {
  .print-value {
    display: block !important;
    margin-top: 4px;
    text-align: center;
    font-weight: 600;
    font-size: 11px;
    white-space: nowrap;
    color: #000;
  }
}

/* Screen view: never show print values */
.print-value {
  display: none;
}

/* -------------------- FIX TOTALS ALIGNMENT (PDF ONLY) */
@media print {
  /* Force totals to behave like table content */
  .rowTotal,
  .regTotal,
  .otTotal {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    font-weight: 700 !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  /* Remove any pill / box styling */
  .rowTotal::before,
  .regTotal::before,
  .otTotal::before {
    content: none !important;
  }

  /* Grand total row stays inside flow */
  .totals {
    display: block !important;
    margin-top: 8px !important;
  }
}
@media print {
  /* Force each day cell to stack content vertically */
  td[data-day] {
    vertical-align: top !important;
  }

  td[data-day] .print-value {
    display: block !important;
    margin-bottom: 4px !important;
    white-space: nowrap !important;
    font-size: 11px !important;
  }
}
@media print {
  td[data-day] {
    padding: 6px !important;
  }

  /* Prevent browser from floating content */
  td[data-day] * {
    float: none !important;
    position: static !important;
  }
}
@media print {
  /* Hide totals columns completely in PDF */
  th:nth-last-child(3),
  th:nth-last-child(2),
  th:nth-last-child(1),
  td:nth-last-child(3),
  td:nth-last-child(2),
  td:nth-last-child(1) {
    display: none !important;
  }
}
.emp-name-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.emp-name-cell input {
  width: 100%;
  box-sizing: border-box;
}
@media print {
  thead th[data-day] .day-name {
    display: block !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    margin-bottom: 2px;
  }

  thead th[data-day] .day-date {
    display: block !important;
    font-size: 11px;
    opacity: 0.85;
  }
}

@media print {
  #timesheetTable {
    display: none !important;
  }

  #printSummary {
    display: block !important;
    font-size: 13px;
  }
}
/* ===================== PDF HEADER CLARITY FIX ===================== */
@media print {
  /* Week label + date picker value */
  .week-picker,
  .week-picker label,
  #weekStart {
    color: #000 !important;
    font-weight: 700 !important;
    background: transparent !important;
  }

  /* Week range text */
  #weekRange {
    color: #000 !important;
    font-weight: 700 !important;
  }

  /* Client / Job label + value */
  label,
  #jobName {
    color: #000 !important;
    font-weight: 700 !important;
    background: transparent !important;
  }

  /* Remove any accidental shading */
  input {
    background: transparent !important;
  }
}
/* ===================== PDF: SHOW JOB NAME VALUE (NOT LABEL) ===================== */
@media print {
  /* Hide the "Client / Job" label text */
  label:has(#jobName) {
    display: none !important;
  }

  /* Show job name value as bold text */
  #jobName {
    display: block !important;
    border: none !important;
    padding: 0 !important;
    font-weight: 800 !important;
    font-size: 14px !important;
    color: #000 !important;
    background: transparent !important;
  }
}


/* =========================
   Saved Timesheets List
   ========================= */

.saved-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
}

/* Each saved timesheet card */
.saved-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.1s ease;
}

/* Left content layout */
.saved-item > div {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Job / file name */
.saved-item strong {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

/* Metadata row (secondary info) */
.saved-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  padding-top: 2px;
}
/* Nudge saved timesheet content away from left edge */
.saved-item > div {
  padding-left: 8px;
}

/* Hover / focus affordance */
.saved-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

/* Make entire left area feel clickable */
.saved-item > div {
  cursor: pointer;
}

/* DEV delete button alignment */
.saved-item button {
  align-self: flex-start;
  margin-top: 2px;
}
.saved-item[data-status="submitted"] {
  border-left: 4px solid #3b82f6;
}

.saved-item[data-status="draft"] {
  border-left: 4px solid #f59e0b;
}

/* ================================
   TIMESHEET HEADER INPUT REFINEMENT
   ================================ */

/* Wrap container alignment */
.week-picker .date-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Date input */
#weekStart {
  max-width: 180px;
}

/* Job / Project input */
#jobName {
  max-width: 320px;
}

/* Project dropdown (Select existing project) */
#projectSelect {
  max-width: 260px;
}

/* Normalize inputs + selects */
#jobName,
#projectSelect,
#weekStart {
  width: 100%;
  padding: 6px 10px;
  font-size: 14px;
}

/* Prevent full-width stretch on large screens */
@media (min-width: 900px) {
  #jobName,
  #projectSelect {
    width: auto;
  }
}

/* Mobile: still full width for usability */
@media (max-width: 768px) {
  #jobName,
  #projectSelect,
  #weekStart {
    max-width: 100%;
  }
}
/* Add Employee (table) button styling */
#addRow {
  border-radius: 15px;
  background: linear-gradient(180deg, #a8fca1, #7fe874);
  border: 1px solid #555855;
  padding: 2px 14px;

  font-weight: 600;
  cursor: pointer;

  /* 3D effect */
  box-shadow:
    0 2px 0 #2f7d2f,
    0 2px 3px rgba(0, 0, 0, 0.25);

  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    background-color 0.12s ease;
}

/* Hover = lift + brighter */
#addRow:hover {
  background: linear-gradient(180deg, #b8ffb0, #62acf1);
}

/* Active / click = pressed down */
#addRow:active {
  transform: translateY(1px);
  box-shadow:
    0 1px 0 #2f7d2f,
    0 3px 2px rgba(0, 0, 0, 0.2);
}
/* ===============================
   Saved Timesheets – Uniform Rows
   =============================== */

.saved-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.saved-list li {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 10px;

  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
}

.saved-list li:last-child {
  border-bottom: none;
}

/* Left label (date + job) */
.saved-list li span {
  font-size: 14px;
  cursor: pointer;
}

/* Copy link button */
.saved-list button {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
}

/* Signed badge */
.saved-list .signed-badge {
  font-size: 12px;
  color: #16a34a;
  font-weight: 600;
  white-space: nowrap;
}

/* DEV delete button */
.saved-list .delete-btn {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 16px;
  cursor: pointer;
}

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
  .saved-list li {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .saved-list li > * {
    justify-self: flex-start;
  }
}
