/* ==========================================
   Feature 12: Mobile Day Carousel & Navigation
   ========================================== */
.mobile-day-nav {
  display: none;
}

@media (max-width: 850px) {
  /* Full-width screen utilization on mobile */
  body {
    padding-bottom: 74px;
  }

  .container {
    padding: 0 6px !important;
    margin: 8px 0 !important;
    gap: 12px !important;
    width: 100% !important;
  }

  .card {
    padding: 12px 8px !important;
    border-radius: 8px !important;
  }

  .card-header {
    margin-bottom: 10px !important;
    padding-bottom: 8px !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .table-responsive {
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  .timesheet-table,
  .timesheet-table tbody,
  .timesheet-table tr {
    overflow: visible !important;
  }

  /* Week Ending Date Bar Responsive Alignment */
  .week-ending-bar {
    padding: 8px 10px !important;
    margin-bottom: 12px !important;
  }

  .week-ending-control {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .week-ending-picker-group {
    display: flex !important;
    width: 100% !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
    flex-wrap: nowrap !important;
  }

  .week-ending-input {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: none !important;
    text-align: center !important;
    font-size: 0.85rem !important;
    padding: 6px 8px !important;
  }

  .btn-week-nav {
    flex: 0 0 auto !important;
    padding: 6px 10px !important;
    font-size: 0.8rem !important;
    white-space: nowrap !important;
  }

  /* Mobile Day Navigation Bar */
  .mobile-day-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  }

  .mobile-day-tabs-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .mobile-day-tabs-scroll::-webkit-scrollbar {
    display: none;
  }

  .mobile-day-tabs {
    display: flex;
    gap: 6px;
    min-width: max-content;
    width: 100%;
    justify-content: space-between;
  }

  .day-tab-pill {
    background: var(--gray-bg);
    border: 1px solid var(--border);
    border-radius: 9999px;
    padding: 6px 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.775rem;
    font-weight: 700;
    color: var(--text-main);
    transition: all 0.15s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    flex: 1;
    justify-content: center;
    min-width: 44px;
    min-height: 38px;
    position: relative;
  }

  .day-tab-pill:hover {
    background: var(--primary-light);
    border-color: #93c5fd;
  }

  .day-tab-pill.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary-hover);
    box-shadow: 0 3px 6px rgba(10, 77, 125, 0.3);
  }

  .day-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 0.625rem;
    font-weight: 800;
    background: #e2e8f0;
    color: var(--text-muted-dark);
    line-height: 1;
    transition: all 0.15s ease;
  }

  .day-tab-pill.active .day-tab-badge {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
  }

  .day-tab-pill.has-hours .day-tab-badge {
    background: #10b981;
    color: #ffffff;
  }

  .day-tab-pill.is-today {
    border-color: var(--accent);
  }

  .day-tab-pill.is-today::after {
    content: "";
    position: absolute;
    top: 2px;
    right: 4px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
  }

  .mobile-nav-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
  }

  .btn-day-nav-arrow {
    background: var(--gray-bg);
    border: 1px solid var(--border);
    color: var(--primary);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.775rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 38px;
    transition: all 0.15s ease;
    user-select: none;
  }

  .btn-day-nav-arrow:hover:not(:disabled) {
    background: var(--primary-light);
    border-color: #93c5fd;
  }

  .btn-day-nav-arrow:disabled {
    opacity: 0.35;
    cursor: not-allowed;
  }

  .btn-day-view-mode {
    background: var(--primary-light);
    border: 1px solid #bfdbfe;
    color: var(--primary);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 0.775rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    transition: all 0.15s ease;
    user-select: none;
    flex: 1;
    justify-content: center;
  }

  .btn-day-view-mode:hover {
    background: #dbeafe;
  }

  /* Single Day Focus Mode: hide non-active cards on mobile */
  .timesheet-table tr.day-card-hidden-mobile {
    display: none !important;
  }

  .timesheet-table tr {
    animation: fadeInCard 0.18s ease-in-out;
  }

  @keyframes fadeInCard {
    from { opacity: 0.3; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .timesheet-table thead {
    display: none;
  }

  .timesheet-table,
  .timesheet-table tbody {
    display: block;
    width: 100%;
  }

  .timesheet-table tr {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px 8px !important;
    padding: 12px 10px !important;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  }

  .timesheet-table tr.weekend {
    background: #fafafa;
    border-left: 4px solid var(--primary);
  }

  .timesheet-table td {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    border-bottom: none !important;
    padding: 0 !important;
    gap: 3px !important;
    min-width: 0 !important;
  }

  .timesheet-table td::before {
    content: attr(data-label);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.25px;
    margin-right: 0;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Header: Day Badge & Date */
  .timesheet-table td.col-day {
    grid-column: span 2 !important;
    justify-content: center !important;
    border-bottom: 1px solid var(--border) !important;
    padding-bottom: 6px !important;
    margin-bottom: 2px !important;
  }

  .timesheet-table td.col-day::before {
    display: none !important;
  }

  .timesheet-table td.col-date {
    grid-column: span 1 !important;
    border-bottom: 1px solid var(--border) !important;
    padding-bottom: 6px !important;
    margin-bottom: 2px !important;
  }

  .timesheet-table td.col-date input {
    width: 100% !important;
    text-align: center !important;
    font-weight: 600;
    padding: 5px 6px !important;
  }

  /* Activity Code (Full Width) */
  .timesheet-table td.col-ac {
    grid-column: 1 / -1 !important;
  }

  .timesheet-table td.col-ac select {
    width: 100% !important;
    max-width: none !important;
  }

  /* Time Block: Start, Break, Finish (3 equal columns side-by-side) */
  .timesheet-table td.col-start,
  .timesheet-table td.col-break,
  .timesheet-table td.col-finish {
    grid-column: span 1 !important;
  }

  .timesheet-table td.col-start input,
  .timesheet-table td.col-finish input,
  .timesheet-table td.col-break select {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    padding: 6px 4px !important;
    font-size: 0.825rem !important;
  }

  /* Primary Hours: Normal, Total, Supervisor Initial */
  .timesheet-table td.col-normal,
  .timesheet-table td.col-total,
  .timesheet-table td.col-initial {
    grid-column: span 1 !important;
  }

  .timesheet-table td.col-normal input,
  .timesheet-table td.col-total input,
  .timesheet-table td.col-initial input {
    width: 100% !important;
    max-width: none !important;
    text-align: center !important;
    font-weight: 700;
  }

  /* Overtime Hours: OT 1.5, OT 2.0, OT 2.5 (3 columns) */
  .timesheet-table td.col-ot15,
  .timesheet-table td.col-ot20,
  .timesheet-table td.col-ot25 {
    grid-column: span 1 !important;
  }

  .timesheet-table td.col-ot15 input,
  .timesheet-table td.col-ot20 input,
  .timesheet-table td.col-ot25 input {
    width: 100% !important;
    max-width: none !important;
    text-align: center !important;
  }

  .timesheet-table td.col-normal .hours-stepper,
  .timesheet-table td.col-total .hours-stepper,
  .timesheet-table td.col-ot15 .hours-stepper,
  .timesheet-table td.col-ot20 .hours-stepper,
  .timesheet-table td.col-ot25 .hours-stepper {
    width: 100% !important;
    max-width: none !important;
  }

  /* Allowances & Comments (Full Width) */
  .timesheet-table td.col-other,
  .timesheet-table td.col-comments {
    grid-column: 1 / -1 !important;
  }

  .timesheet-table td .form-control {
    max-width: none !important;
    flex: 1;
  }

  .allowance-input-wrap {
    flex: 1 !important;
    max-width: none !important;
    width: 100% !important;
  }

  .allowance-menu {
    max-width: calc(100vw - 24px) !important;
    z-index: 100000 !important;
  }

  /* Row Actions (Full Width aligned across bottom of day card) */
  .timesheet-table td.col-actions {
    grid-column: 1 / -1 !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding-top: 8px !important;
    border-top: 1px dashed var(--border) !important;
    margin-top: 4px !important;
  }

  .timesheet-table td.col-actions::before {
    display: none !important;
  }

  .timesheet-table td.col-actions .row-actions {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
  }

  .timesheet-table td.col-actions .copy-actions-group {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
  }

  .timesheet-table td.col-actions .btn-icon {
    min-height: 34px !important;
    padding: 6px 10px !important;
    font-size: 0.85rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .timesheet-table td.col-actions .btn-clear-day {
    min-height: 34px !important;
    padding: 6px 12px !important;
    font-size: 0.825rem !important;
    margin-left: auto !important;
  }

  .timesheet-table td.col-actions .btn-clear-day .clear-text::after {
    content: " Row";
  }
}

/* ==========================================
   iOS PWA Install Banner & Modal
   ========================================== */
.ios-install-banner {
  background: linear-gradient(135deg, #0a4d7d 0%, #073a5f 100%);
  color: white;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(10, 77, 125, 0.2);
  animation: slideDownBanner 0.25s ease-out;
}

@keyframes slideDownBanner {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.ios-install-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
  line-height: 1;
}

.ios-install-content {
  font-size: 0.85rem;
  line-height: 1.4;
  flex: 1;
}

.ios-install-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-ios-dismiss {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.15rem;
  cursor: pointer;
  padding: 6px 8px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s ease;
}

.btn-ios-dismiss:hover {
  color: white;
}

.ios-modal-content {
  max-width: 440px;
  height: auto;
  max-height: 92vh;
  max-height: 92dvh;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.ios-modal-header {
  background: var(--gray-bg);
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.ios-modal-body {
  background: var(--card-bg);
  padding: 20px;
  overflow-y: auto;
}

.ios-modal-intro {
  font-size: 0.885rem;
  color: var(--text-main);
  margin-bottom: 16px;
  line-height: 1.45;
}

.ios-steps-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.ios-step-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--gray-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.ios-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ios-step-text {
  font-size: 0.865rem;
  line-height: 1.4;
  color: var(--text-main);
  flex: 1;
}

.ios-step-icon-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
}

.ios-icon {
  color: var(--primary);
  flex-shrink: 0;
}

.ios-modal-actions {
  display: flex;
  justify-content: stretch;
}

/* ==========================================
   Recommendation 12: PWA & Offline Indicators
   ========================================== */
.network-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.2s ease;
  user-select: none;
}

.network-status-pill.online {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.network-status-pill.offline {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  animation: pulseOffline 2s infinite ease-in-out;
}

@keyframes pulseOffline {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.75; }
}

.network-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.network-status-pill.online .network-dot {
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.network-status-pill.offline .network-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

/* Autosave Status Pill */
.autosave-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 82px;
  min-width: 82px;
  max-width: 82px;
  height: 26px;
  box-sizing: border-box;
  padding: 4px 6px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--bg-hover);
  color: var(--text-muted-dark);
  border: 1px solid var(--border-hover);
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
  overflow: hidden;
  line-height: 1.2;
}

.autosave-status-pill .autosave-icon {
  flex-shrink: 0;
  font-size: 0.82rem;
  line-height: 1;
  margin-right: 3px;
}

.autosave-status-pill #autosaveText {
  display: inline-block;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 58px;
}

.autosave-status-pill.saving {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.autosave-status-pill.saving .autosave-icon {
  animation: pulseSaving 0.8s infinite alternate ease-in-out;
}

.autosave-status-pill.synced {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.autosave-status-pill.offline {
  background: #fef3c7;
  color: #b45309;
  border-color: #fde68a;
}

.autosave-status-pill.error {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

@keyframes pulseSaving {
  0% { transform: scale(0.9); opacity: 0.6; }
  100% { transform: scale(1.15); opacity: 1; }
}

.btn-install {
  animation: bounceIn 0.4s ease-out;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(242, 101, 34, 0.25);
}

@keyframes bounceIn {
  0% { transform: scale(0.85); opacity: 0; }
  60% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); }
}

.offline-notice-banner {
  background: var(--card-bg);
  border: 1px solid #fde68a;
  border-left: 5px solid #f59e0b;
  border-radius: 8px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  animation: fadeInDown 0.25s ease-out;
  box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

.offline-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.offline-text {
  font-size: 0.825rem;
  color: #92400e;
  line-height: 1.4;
}

.offline-text strong {
  color: #78350f;
}

/* ==========================================
   Collapsible Section Styles (Employee Details)
   ========================================== */
.collapsible-section .card-header {
  user-select: none;
  transition: background-color 0.15s ease;
}

.collapsible-section .card-header:hover {
  background-color: var(--gray-bg);
}

.btn-toggle-collapse {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--card-bg);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-toggle-collapse:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-light);
}

.section-summary-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 12px;
  padding: 3px 10px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: fadeIn 0.2s ease-out;
}

.collapsible-body {
  transition: opacity 0.2s ease, max-height 0.25s ease;
}

.collapsible-body.collapsed {
  display: none !important;
}

/* ==========================================
   Live Multi-Device Sync Pill & Field Glow
   ========================================== */
.live-sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  animation: fadeIn 0.25s ease-out;
  cursor: default;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: livePulse 2s infinite;
}

@keyframes livePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

@keyframes liveFieldGlow {
  0% {
    background-color: #dbeafe !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35) !important;
  }
  100% {
    background-color: inherit;
    border-color: inherit;
    box-shadow: none;
  }
}

.live-updated-field {
  animation: liveFieldGlow 1.4s ease-out;
}

/* Dashboard Page Footer & Version Badge System */
.dashboard-footer {
  margin-top: 24px;
  padding: 18px 0 28px 0;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: center;
}

.dashboard-footer-content {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  justify-content: center;
  text-align: center;
}

.footer-brand {
  font-weight: 500;
}

.footer-divider {
  color: #cbd5e1;
  user-select: none;
}

.version-badge-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.version-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--bg-hover);
  border: 1px solid var(--border-hover);
  border-radius: 12px;
  font-size: 0.775rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.3px;
  transition: all 0.15s ease-in-out;
  cursor: pointer;
}

.version-badge.small {
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 10px;
}

.version-badge:hover {
  background: var(--primary-light);
  border-color: #93c5fd;
  color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.footer-doc-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-doc-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

.bottom-bar-version {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
}

@media (max-width: 600px) {
  .bottom-bar-version {
    display: none;
  }
  .week-ending-picker-group {
    gap: 4px !important;
  }
  .btn-week-nav {
    padding: 6px 8px !important;
    font-size: 0.76rem !important;
  }
}
/* Keep signature canvas and preview cards on white paper background across themes */
.sig-canvas-container {
  background: #ffffff !important;
}
.sig-style-card {
  background: #ffffff !important;
  color: #0f172a !important;
}
.sig-style-card .sig-style-sample {
  color: #0f2c59 !important;
}
.sig-style-card:hover {
  background: #f1f5f9 !important;
}
.sig-style-card.active {
  background: #e8f2f9 !important;
}

/* Dark theme overrides for history items */
:root[data-theme="dark"] .history-item:hover {
  background-color: var(--bg-hover) !important;
}
:root[data-theme="dark"] .history-item.active {
  background-color: #1e3a8a !important;
}
:root[data-theme="dark"] .history-item-hours {
  background: #082f49 !important;
  color: #7dd3fc !important;
}
