/**
 * Punch Lists Module - Themed Styles
 *
 * Uses theme tokens for all colors - NO hard-coded values
 * Supports org-specific branding via CSS custom properties
 * WCAG AA compliant (minimum 4.5:1 contrast)
 */

/* ============================================================================
   LAYOUT & CONTAINERS
   Redesigned to match other project detail tabs (full width, no redundant header)
   ============================================================================ */

/* Tab content container */
.punch-lists-tab-content {
  width: 100%;
}

/* ===========================================
   Summary Pills Bar - Compact Stats Overview
   =========================================== */

.punch-summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--mts-gray-50, #f9fafb);
  border-radius: 8px;
  border: 1px solid var(--mts-gray-100, #f3f4f6);
}

.punch-summary-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  background: white;
  border-radius: 100px;
  border: 1px solid var(--mts-gray-200, #e5e7eb);
  font-size: 0.75rem;
}

.summary-pill .pill-value {
  font-weight: 600;
  color: var(--mts-gray-900, #111827);
}

.summary-pill .pill-label {
  color: var(--mts-gray-500, #6b7280);
  font-weight: 400;
}

/* Status-specific pill colors */
.summary-pill.summary-total {
  border-color: var(--mts-gray-300, #d1d5db);
}

.summary-pill.summary-open .pill-value {
  color: #dc2626;
}

.summary-pill.summary-in-progress .pill-value {
  color: #f59e0b;
}

.summary-pill.summary-corrected .pill-value {
  color: #3b82f6;
}

.summary-pill.summary-verified .pill-value {
  color: #10b981;
}

.summary-pill.summary-completion {
  background: var(--theme-primary, #3b82f6);
  border-color: var(--theme-primary, #3b82f6);
}

.summary-pill.summary-completion .pill-value,
.summary-pill.summary-completion .pill-label {
  color: white;
}

.punch-summary-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Mobile responsiveness for summary bar */
@media (max-width: 640px) {
  .punch-summary-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .punch-summary-pills {
    justify-content: center;
  }

  .punch-summary-actions {
    justify-content: center;
  }
}

/* Legacy toolbar - kept for backwards compatibility */
.punch-lists-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.punch-lists-toolbar .toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.punch-lists-toolbar .toolbar-right {
  display: flex;
  gap: 0.5rem;
}

/* Count badge - subtle, matches rest of site */
.punch-count-badge {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--mts-gray-500, #6b7280);
}

/* Legacy container - kept for backwards compatibility */
.punch-lists-container {
  width: 100%;
}

/* Legacy header - hidden, no longer used */
.punch-lists-header {
  display: none;
}

/* ============================================================================
   PUNCH LISTS GRID
   ============================================================================ */

.punch-lists-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  width: 100%;
}

/* When grid only contains empty state, center it */
.punch-lists-grid:has(.empty-state-centered) {
  display: flex;
  justify-content: center;
}

@media (max-width: 768px) {
  .punch-lists-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

/* ===========================================
   Compact Punch List Card - Dense Layout
   =========================================== */

.punch-list-card-compact {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--mts-gray-200, #e5e7eb);
  border-radius: 8px;
  padding: 0.875rem 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.punch-list-card-compact:hover {
  border-color: var(--theme-primary, #3b82f6);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.pcard-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
}

.pcard-name {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--mts-gray-900, #111827);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pcard-status {
  font-size: 0.625rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.pcard-status-active { background: rgba(16, 185, 129, 0.1); color: #059669; }
.pcard-status-closed { background: var(--mts-gray-100, #f3f4f6); color: var(--mts-gray-500, #6b7280); }
.pcard-status-on-hold { background: rgba(245, 158, 11, 0.1); color: #d97706; }

.pcard-desc {
  margin: 0 0 0.5rem 0;
  font-size: 0.75rem;
  color: var(--mts-gray-500, #6b7280);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Inline Stats */
.pcard-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.625rem;
}

.pcard-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--mts-gray-600, #4b5563);
}

.stat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.stat-dot.stat-open { background: #dc2626; }
.stat-dot.stat-in-progress { background: #f59e0b; }
.stat-dot.stat-corrected { background: #3b82f6; }
.stat-dot.stat-verified { background: #10b981; }

/* Mini Progress Bar */
.pcard-progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.625rem;
}

.pcard-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--mts-gray-100, #f3f4f6);
  border-radius: 100px;
  overflow: hidden;
}

.pcard-progress-fill {
  height: 100%;
  background: var(--theme-primary, #3b82f6);
  border-radius: 100px;
  transition: width 0.3s ease;
}

.pcard-progress-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--mts-gray-500, #6b7280);
  min-width: 32px;
  text-align: right;
}

/* Footer Meta */
.pcard-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
}

.meta-tag {
  font-size: 0.6875rem;
  padding: 0.125rem 0.375rem;
  background: var(--mts-gray-100, #f3f4f6);
  border-radius: 4px;
  color: var(--mts-gray-600, #4b5563);
}

.meta-tag.overdue {
  background: rgba(220, 38, 38, 0.08);
  color: #dc2626;
}

.meta-updated {
  font-size: 0.6875rem;
  color: var(--mts-gray-400, #9ca3af);
  margin-left: auto;
}

/* Legacy Punch list cards - kept for compatibility */
.punch-list-card {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--mts-gray-200, #e5e7eb);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.punch-list-card:hover {
  border-color: var(--theme-primary, var(--btn-primary-bg, #3b82f6));
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.punch-list-card:focus {
  outline: 1.5px solid var(--theme-primary, var(--focus-ring));
  outline-offset: 1px;
}

.card-header {
  margin-bottom: 0.875rem;
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.375rem;
}

.card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--mts-gray-900, #111827);
  flex: 1;
  line-height: 1.3;
}

.card-description {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--mts-gray-500, #6b7280);
  line-height: 1.4;
}

.card-body {
  margin-bottom: 0.875rem;
}

.stats-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.875rem;
}

.stat {
  flex: 1;
  text-align: center;
  padding: 0.5rem 0;
  background: var(--mts-gray-50, #f9fafb);
  border-radius: 6px;
}

.stat-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--mts-gray-900, #111827);
  line-height: 1.2;
}

.stat-label {
  display: block;
  font-size: 0.625rem;
  color: var(--mts-gray-500, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.125rem;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  font-size: 0.75rem;
  color: var(--mts-gray-500, #6b7280);
  margin-top: 0.75rem;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.meta-item .icon {
  font-size: 0.875rem;
}

.meta-item.overdue {
  color: var(--mts-error, #ef4444);
  font-weight: 600;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px solid var(--mts-gray-100, #f3f4f6);
}

.footer-text {
  font-size: 0.6875rem;
  color: var(--mts-gray-400, #9ca3af);
}

/* ============================================================================
   STATUS & PRIORITY BADGES
   ============================================================================ */

.status-chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-open {
  background: var(--overlay-brand, rgba(59, 130, 246, 0.1));
  color: var(--btn-primary-bg);
}

.status-in-progress {
  background: rgba(245, 158, 11, 0.1);
  color: var(--mts-warning, #f59e0b);
}

.status-corrected {
  background: rgba(16, 185, 129, 0.1);
  color: var(--mts-success, #10b981);
}

.status-verified {
  background: rgba(34, 197, 94, 0.1);
  color: var(--mts-success, #22c55e);
}

.status-closed {
  background: rgba(107, 114, 128, 0.1);
  color: var(--mts-gray-500, #6b7280);
}

.priority-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.priority-critical {
  background: rgba(239, 68, 68, 0.1);
  color: var(--mts-error, #ef4444);
  border: 1px solid var(--mts-error, #ef4444);
}

.priority-high {
  background: rgba(245, 158, 11, 0.1);
  color: var(--mts-warning, #f59e0b);
  border: 1px solid var(--mts-warning, #f59e0b);
}

.priority-medium {
  background: rgba(59, 130, 246, 0.1);
  color: var(--mts-info, #3b82f6);
  border: 1px solid var(--mts-info, #3b82f6);
}

.priority-low {
  background: rgba(107, 114, 128, 0.1);
  color: var(--mts-gray-500, #6b7280);
  border: 1px solid var(--mts-gray-500, #6b7280);
}

/* ============================================================================
   PROGRESS BAR
   ============================================================================ */

.progress-bar-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--card-border, #e5e7eb);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg,
    var(--btn-primary-bg),
    var(--btn-primary-hover, var(--btn-primary-bg))
  );
  transition: width 0.3s ease;
  border-radius: 4px;
}

.progress-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, #6b7280);
  white-space: nowrap;
}

/* ============================================================================
   PUNCH LIST DETAIL
   ============================================================================ */

.punch-list-detail-container {
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.detail-header-right {
  display: flex;
  gap: 12px;
}

.punch-list-info-card {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--card-border, #e5e7eb);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 32px;
}

.info-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.info-header h2 {
  margin: 0 0 8px 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary, #111827);
}

.info-header .description {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary, #6b7280);
  line-height: 1.6;
}

.info-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--card-border, #e5e7eb);
  border-bottom: 1px solid var(--card-border, #e5e7eb);
  margin-bottom: 16px;
}

.info-meta .meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-meta .label {
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-meta .value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #111827);
}

.stats-summary {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.stat-box {
  flex: 1;
  text-align: center;
  padding: 16px;
  background: var(--overlay-brand, rgba(59, 130, 246, 0.03));
  border-radius: 8px;
}

.stat-box.stat-warning {
  background: rgba(239, 68, 68, 0.05);
}

.stat-box .stat-value {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary, #111827);
}

.stat-box.stat-warning .stat-value {
  color: var(--mts-error, #ef4444);
}

.stat-box .stat-label {
  display: block;
  font-size: 11px;
  color: var(--text-secondary, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* ============================================================================
   ITEMS SECTION
   ============================================================================ */

.items-section {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--card-border, #e5e7eb);
  border-radius: 12px;
  padding: 24px;
}

.items-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 1024px) {
  .items-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

.toolbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.search-input {
  padding: 8px 12px;
  border: 1px solid var(--card-border, #e5e7eb);
  border-radius: 6px;
  font-size: 14px;
  min-width: 200px;
  transition: all 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--btn-primary-bg);
  box-shadow: 0 0 0 3px var(--overlay-brand, rgba(59, 130, 246, 0.1));
}

/* ============================================================================
   FILTER CHIPS
   ============================================================================ */

.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-group {
  display: flex;
  gap: 6px;
  align-items: center;
}

.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chip {
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--card-border, #e5e7eb);
  background: var(--card-bg, #ffffff);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--btn-primary-bg);
  background: var(--overlay-brand, rgba(59, 130, 246, 0.05));
}

.chip-active {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text, #ffffff);
  border-color: var(--btn-primary-bg);
}

.chip-active:hover {
  background: var(--btn-primary-hover);
  border-color: var(--btn-primary-hover);
}

.chip-clear {
  background: rgba(239, 68, 68, 0.1);
  color: var(--mts-error, #ef4444);
  border-color: var(--mts-error, #ef4444);
}

.chip-clear:hover {
  background: rgba(239, 68, 68, 0.2);
}

.filter-select {
  padding: 6px 12px;
  border: 1px solid var(--card-border, #e5e7eb);
  border-radius: 6px;
  font-size: 13px;
  background: var(--card-bg, #ffffff);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-select:hover {
  border-color: var(--btn-primary-bg);
}

.filter-select:focus {
  outline: none;
  border-color: var(--btn-primary-bg);
  box-shadow: 0 0 0 3px var(--overlay-brand, rgba(59, 130, 246, 0.1));
}

/* ============================================================================
   PUNCH ITEMS TABLE
   ============================================================================ */

.punch-items-container {
  min-height: 200px;
}

.punch-items-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.punch-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--card-border, #e5e7eb);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--card-bg, #ffffff);
}

.punch-item-row.inline-editing {
  cursor: default;
  border-color: var(--btn-primary-bg);
  background: var(--overlay-brand, rgba(59, 130, 246, 0.03));
  box-shadow: 0 0 0 3px var(--overlay-brand, rgba(59, 130, 246, 0.1));
}

.punch-item-row:hover {
  border-color: var(--btn-primary-bg);
  background: var(--overlay-brand, rgba(59, 130, 246, 0.02));
  transform: translateX(4px);
}

.punch-item-row:focus {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Status-based row styling */
/* Open items (not overdue) - Yellow tint */
.punch-item-row.status-row-open {
  background: rgba(251, 191, 36, 0.08);
  border-left: 4px solid #f59e0b;
}

.punch-item-row.status-row-open:hover {
  background: rgba(251, 191, 36, 0.15);
}

/* In Progress - also Yellow/Amber tint */
.punch-item-row.status-row-in-progress {
  background: rgba(251, 191, 36, 0.08);
  border-left: 4px solid #f59e0b;
}

.punch-item-row.status-row-in-progress:hover {
  background: rgba(251, 191, 36, 0.15);
}

/* Corrected - Green tint */
.punch-item-row.status-row-corrected {
  background: rgba(16, 185, 129, 0.08);
  border-left: 4px solid #10b981;
}

.punch-item-row.status-row-corrected:hover {
  background: rgba(16, 185, 129, 0.15);
}

/* Verified - White/neutral (default styling) */
.punch-item-row.status-row-verified {
  background: var(--card-bg, #ffffff);
  border-left: 4px solid var(--mts-gray-300, #d1d5db);
}

.punch-item-row.status-row-verified:hover {
  background: var(--mts-gray-50, #f9fafb);
}

/* Closed - also White/neutral */
.punch-item-row.status-row-closed {
  background: var(--card-bg, #ffffff);
  border-left: 4px solid var(--mts-gray-300, #d1d5db);
  opacity: 0.7;
}

.punch-item-row.status-row-closed:hover {
  background: var(--mts-gray-50, #f9fafb);
  opacity: 1;
}

/* Overdue - Red tint (overrides status styling) */
.punch-item-row.overdue {
  background: rgba(239, 68, 68, 0.08) !important;
  border-left: 4px solid var(--mts-error, #ef4444) !important;
}

.punch-item-row.overdue:hover {
  background: rgba(239, 68, 68, 0.15) !important;
}

.item-row-main {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex: 1;
}

.item-number {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
  font-weight: 600;
  min-width: 80px;
}

.item-content {
  flex: 1;
}

.item-description {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary, #111827);
  margin-bottom: 8px;
  line-height: 1.5;
}

.item-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
}

.meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.meta-tag .icon {
  font-size: 14px;
}

.meta-tag.overdue {
  color: var(--mts-error, #ef4444);
  font-weight: 600;
}

.item-row-badges {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.item-row-badges .photo-badge,
.item-row-badges .comment-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(107, 114, 128, 0.1);
  color: var(--mts-gray-500, #6b7280);
  position: static !important; /* Override index.html's position: absolute */
  top: auto !important;
  left: auto !important;
  vertical-align: middle;
  flex-shrink: 0;
}

.item-row-badges .photo-badge .icon,
.item-row-badges .comment-badge .icon {
  font-size: 12px;
  position: static;
  display: inline;
  line-height: 1;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.btn .icon {
  font-size: 16px;
}

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text, #ffffff);
  border: 1px solid var(--btn-primary-border, var(--btn-primary-bg));
}

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

.btn-primary:active {
  background: var(--btn-primary-active);
}

.btn-primary:focus {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--btn-primary-bg);
  border: 1px solid var(--card-border, #e5e7eb);
}

.btn-secondary:hover {
  background: var(--overlay-brand, rgba(59, 130, 246, 0.05));
  border-color: var(--btn-primary-bg);
}

.btn-secondary:focus {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.btn-text {
  background: transparent;
  color: var(--btn-primary-bg);
  border: none;
  padding: 8px 12px;
}

.btn-text:hover {
  background: var(--overlay-brand, rgba(59, 130, 246, 0.05));
}

.btn-icon {
  background: transparent;
  border: none;
  padding: 8px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-secondary, #6b7280);
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--overlay-brand, rgba(59, 130, 246, 0.1));
  color: var(--btn-primary-bg);
}

.btn-icon .icon {
  font-size: 18px;
}

/* ============================================================================
   EMPTY STATES - Refined to match site design
   ============================================================================ */

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--mts-gray-500, #6b7280);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.empty-state h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--mts-gray-700, #374151);
}

.empty-state p {
  margin: 0 0 1.5rem 0;
  font-size: 0.875rem;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

/* Centered empty state - full width, centered content */
.empty-state-centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  max-width: 400px;
  margin: 0 auto;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--mts-gray-100, #f3f4f6);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  color: var(--mts-gray-400, #9ca3af);
}

.empty-state-icon svg {
  width: 40px;
  height: 40px;
  opacity: 0.7;
}

.empty-state-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--mts-gray-800, #1f2937);
}

.empty-state-description {
  margin: 0 0 1.75rem 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--mts-gray-500, #6b7280);
}

/* Primary button in empty state - uses theme color */
.empty-state-centered .btn-primary,
.empty-state-centered .btn-lg {
  background: var(--theme-primary, var(--btn-primary-bg, #3b82f6));
  border-color: var(--theme-primary, var(--btn-primary-bg, #3b82f6));
  color: white;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.empty-state-centered .btn-primary:hover,
.empty-state-centered .btn-lg:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* ============================================================================
   MODALS & DRAWERS
   ============================================================================ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: var(--card-bg, #ffffff);
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-content.modal-large {
  max-width: 900px;
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--card-border, #e5e7eb);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary, #111827);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary, #6b7280);
  padding: 4px;
  line-height: 1;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--text-primary, #111827);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--card-border, #e5e7eb);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ============================================================================
   FORM ELEMENTS
   ============================================================================ */

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #111827);
  margin-bottom: 6px;
}

.form-label.required::after {
  content: '*';
  color: var(--mts-error, #ef4444);
  margin-left: 4px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--card-border, #e5e7eb);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s;
  background: var(--card-bg, #ffffff);
  color: var(--text-primary, #111827);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--btn-primary-bg);
  box-shadow: 0 0 0 3px var(--overlay-brand, rgba(59, 130, 246, 0.1));
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--mts-error, #ef4444);
}

.form-error {
  display: block;
  font-size: 12px;
  color: var(--mts-error, #ef4444);
  margin-top: 4px;
}

.form-hint {
  display: block;
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
  margin-top: 4px;
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

/* ============================================================================
   PHOTO WALL
   ============================================================================ */

.photo-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid var(--card-border, #e5e7eb);
  transition: all 0.2s;
}

.photo-thumb:hover {
  border-color: var(--btn-primary-bg);
  transform: scale(1.05);
}

.photo-thumb:focus {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-thumb-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.photo-thumb-delete {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.photo-thumb-delete:hover {
  background: var(--mts-error, #ef4444);
}

.photo-thumb:hover .photo-thumb-delete {
  opacity: 1;
}

.photo-upload-zone {
  border: 2px dashed var(--card-border, #e5e7eb);
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--card-bg, #ffffff);
}

.photo-upload-zone:hover {
  border-color: var(--btn-primary-bg);
  background: var(--overlay-brand, rgba(59, 130, 246, 0.02));
}

.photo-upload-zone.dragging {
  border-color: var(--btn-primary-bg);
  background: var(--overlay-brand, rgba(59, 130, 246, 0.05));
  border-style: solid;
}

.photo-upload-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.photo-upload-text {
  font-size: 14px;
  color: var(--text-primary, #111827);
  margin-bottom: 4px;
}

.photo-upload-hint {
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
}

/* ============================================================================
   PHOTO LIGHTBOX
   ============================================================================ */

.photo-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.photo-lightbox img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.photo-lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 32px;
  cursor: pointer;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.photo-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.photo-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 32px;
  cursor: pointer;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.photo-lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.2);
}

.photo-lightbox-nav.prev {
  left: 20px;
}

.photo-lightbox-nav.next {
  right: 20px;
}

/* Lightbox styles (alternate class names used in HTML) */
.lightbox-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.lightbox-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.lightbox-content img {
  max-width: 90%;
  max-height: 80%;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  cursor: pointer;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 10;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  cursor: pointer;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
  left: 20px;
}

.lightbox-next {
  right: 20px;
}

.lightbox-info {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: white;
  max-width: 80%;
}

.lightbox-meta {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 8px;
}

.lightbox-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 12px;
}

.lightbox-actions .btn {
  display: inline-flex;
  align-items: center;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
  .punch-lists-header {
    flex-direction: column;
    align-items: stretch;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-summary {
    flex-wrap: wrap;
  }

  .stat-box {
    min-width: calc(50% - 8px);
  }

  .item-row-main {
    flex-direction: column;
  }

  .item-number {
    min-width: auto;
  }

  .item-row-badges {
    flex-wrap: wrap;
  }
}

/* ============================================================================
   INLINE EDIT MODE
   ============================================================================ */

.inline-edit-input {
  padding: 6px 10px;
  border: 1px solid var(--card-border, #e5e7eb);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s;
  background: var(--card-bg, #ffffff);
  color: var(--text-primary, #111827);
  width: 100%;
  margin-bottom: 6px;
}

.inline-edit-input:focus {
  outline: none;
  border-color: var(--btn-primary-bg);
  box-shadow: 0 0 0 2px var(--overlay-brand, rgba(59, 130, 246, 0.1));
}

.inline-edit-description {
  font-weight: 500;
}

.inline-edit-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-edit-select {
  padding: 4px 10px;
  border: 1px solid var(--card-border, #e5e7eb);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: var(--card-bg, #ffffff);
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.inline-edit-select:focus {
  outline: none;
  border-color: var(--btn-primary-bg);
  box-shadow: 0 0 0 2px var(--overlay-brand, rgba(59, 130, 246, 0.1));
}

.inline-edit-save {
  color: var(--mts-success, #10b981);
}

.inline-edit-save:hover {
  background: rgba(16, 185, 129, 0.1);
}

.inline-edit-cancel {
  color: var(--mts-error, #ef4444);
}

.inline-edit-cancel:hover {
  background: rgba(239, 68, 68, 0.1);
}

.inline-editing .item-row-badges {
  gap: 4px;
}

/* ============================================================================
   UTILITIES
   ============================================================================ */

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--btn-primary-bg);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ============================================================================
   PUNCH MODAL STYLES (High z-index for proper layering)
   ============================================================================ */

.punch-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000; /* Very high to appear above navigation */
  animation: fadeIn 0.2s ease;
  padding: 20px;
}

.punch-modal {
  background: var(--card-bg, #ffffff);
  border-radius: 12px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  animation: slideUp 0.3s ease;
  position: relative;
}

.punch-modal-small {
  max-width: 400px;
}

.punch-modal-medium {
  max-width: 600px;
}

.punch-modal-large {
  max-width: 900px;
}

.punch-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  border-bottom: 1px solid var(--card-border, #e5e7eb);
}

.punch-modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary, #111827);
}

.punch-modal-close {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--text-secondary, #6b7280);
  border-radius: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.punch-modal-close:hover {
  background: var(--hover-bg, #f3f4f6);
  color: var(--text-primary, #111827);
}

.punch-modal-body {
  padding: 24px;
}

.punch-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--card-border, #e5e7eb);
  background: var(--bg-secondary, #f9fafb);
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

/* Photo Upload Section */
.form-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--card-border, #e5e7eb);
}

.form-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary, #111827);
  margin: 0 0 12px 0;
}

.inline-photo-upload {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.photo-upload-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.form-help {
  color: var(--text-secondary, #6b7280);
  font-size: 13px;
}

.quick-photo-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.quick-photo-preview img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--card-border, #e5e7eb);
}

.photo-preview-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
}

.photo-preview-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.photo-preview-badge.before {
  background: var(--btn-primary-bg, #ff7f50);
}

.photo-preview-badge.after {
  background: var(--success, #10b981);
}

.photo-preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.photo-preview-remove:hover {
  background: var(--mts-error, #dc2626);
  transform: scale(1.1);
}

/* ============================================================================
   ITEM DETAIL DRAWER
   ============================================================================ */

.punch-modal-xlarge {
  max-width: 800px;
}

.punch-drawer-right {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 90%;
  max-width: 800px;
  border-radius: 0;
  animation: slideInRight 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

.detail-tabs {
  display: flex;
  border-bottom: 1px solid var(--card-border, #e5e7eb);
  background: var(--bg-secondary, #f9fafb);
  padding: 0 24px;
  gap: 8px;
}

.detail-tab {
  background: none;
  border: none;
  padding: 12px 16px;
  cursor: pointer;
  color: var(--text-secondary, #6b7280);
  font-weight: 500;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.detail-tab:hover {
  color: var(--text-primary, #111827);
  background: rgba(0, 0, 0, 0.02);
}

.detail-tab.active {
  color: var(--btn-primary-bg, #ff7f50);
  border-bottom-color: var(--btn-primary-bg, #ff7f50);
  background: white;
}

.punch-drawer-right .punch-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.detail-tab-content {
  display: none;
  padding: 24px;
}

.detail-tab-content.active {
  display: block;
}

/* Overview Tab */
.item-detail-overview {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.overview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--bg-secondary, #f9fafb);
  border-radius: 8px;
  border: 1px solid var(--card-border, #e5e7eb);
}

.overview-status {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.overview-actions select {
  min-width: 160px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge.status-open {
  background: rgba(239, 68, 68, 0.1);
  color: var(--mts-error, #991b1b);
}

.badge.status-in-progress {
  background: rgba(59, 130, 246, 0.1);
  color: var(--mts-info, #1e40af);
}

.badge.status-corrected {
  background: rgba(245, 158, 11, 0.1);
  color: var(--mts-warning, #92400e);
}

.badge.status-verified {
  background: rgba(16, 185, 129, 0.1);
  color: var(--mts-success, #065f46);
}

.badge.status-closed {
  background: rgba(107, 114, 128, 0.1);
  color: var(--mts-gray-500, #374151);
}

.badge.priority-low {
  background: rgba(59, 130, 246, 0.1);
  color: var(--mts-info, #3730a3);
}

.badge.priority-medium {
  background: rgba(245, 158, 11, 0.1);
  color: var(--mts-warning, #92400e);
}

.badge.priority-high {
  background: rgba(245, 158, 11, 0.15);
  color: var(--mts-warning, #9a3412);
}

.badge.priority-critical {
  background: rgba(239, 68, 68, 0.1);
  color: var(--mts-error, #991b1b);
}

.badge.badge-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--mts-error, #991b1b);
}

.overview-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.overview-section h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary, #111827);
}

.overview-section p {
  margin: 0;
  color: var(--text-primary, #111827);
  line-height: 1.6;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.overview-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.overview-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.overview-field div {
  color: var(--text-primary, #111827);
  font-size: 14px;
}

/* Photos Tab */
.detail-photos {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.photo-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.photo-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.photo-section-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary, #111827);
}

.photo-grid-compact {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.photo-grid-compact img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--card-border, #e5e7eb);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.photo-grid-compact img:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.detail-photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}

.detail-photo-card {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--card-border, #e5e7eb);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.detail-photo-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.detail-photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-photo-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.detail-photo-badge.before {
  background: var(--btn-primary-bg, #ff7f50);
}

.detail-photo-badge.after {
  background: var(--success, #10b981);
}

.empty-state-small {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary, #6b7280);
}

.empty-state-small svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* Comments Tab */
.detail-comments {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comment {
  background: var(--bg-secondary, #f9fafb);
  border: 1px solid var(--card-border, #e5e7eb);
  border-radius: 8px;
  padding: 16px;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.comment-card {
  background: var(--bg-secondary, #f9fafb);
  border: 1px solid var(--card-border, #e5e7eb);
  border-radius: 8px;
  padding: 16px;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.comment-author {
  font-weight: 600;
  color: var(--text-primary, #111827);
  font-size: 14px;
}

.comment-date {
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
}

.comment-text {
  color: var(--text-primary, #111827);
  line-height: 1.6;
  margin: 0;
}

.comment-form {
  position: sticky;
  bottom: 0;
  background: white;
  border-top: 1px solid var(--card-border, #e5e7eb);
  padding: 16px;
  margin: -24px -24px 0 -24px;
}

.comment-form textarea {
  width: 100%;
  min-height: 80px;
  margin-bottom: 12px;
  resize: vertical;
}

/* Audit Trail Tab */
.detail-audit {
  display: flex;
  flex-direction: column;
}

.audit-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.audit-changes {
  margin-top: 8px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-secondary, #6b7280);
  line-height: 1.6;
}

.audit-changes div {
  margin: 4px 0;
}

.audit-changes strong {
  color: var(--text-primary, #111827);
  font-weight: 600;
  text-transform: capitalize;
}

.audit-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.audit-entry {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: var(--bg-secondary, #f9fafb);
  border: 1px solid var(--card-border, #e5e7eb);
  border-radius: 8px;
}

.audit-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--btn-primary-bg, #ff7f50);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.audit-content {
  flex: 1;
}

.audit-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.audit-action {
  font-weight: 600;
  color: var(--text-primary, #111827);
  font-size: 14px;
}

.audit-user {
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
}

.audit-details {
  font-size: 13px;
  color: var(--text-secondary, #6b7280);
  margin-top: 4px;
}

.audit-timestamp {
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
  white-space: nowrap;
}

/* Utility Classes */
.text-muted {
  color: var(--text-secondary, #6b7280) !important;
  font-size: 13px;
}

.loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary, #6b7280);
  font-size: 14px;
}

.error {
  text-align: center;
  padding: 40px 20px;
  color: var(--danger, #dc2626);
  font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
  .punch-drawer-right {
    width: 100%;
    max-width: 100%;
  }

  .overview-grid {
    grid-template-columns: 1fr;
  }

  .detail-photos-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .photo-grid-compact {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}
