/* ===== ProAgri Sheet Component ===== */

/* === Base Structure === */

.proagri-sheet-wrap {
  width: 100%;
  position: relative;
}

/* Search toolbar */
.proagri-sheet-toolbar {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  gap: 8px;
}

.proagri-sheet-search {
  flex: 1;
  max-width: 280px;
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid rgba(128, 128, 128, 0.2);
  border-radius: 8px;
  background: rgba(128, 128, 128, 0.06);
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.proagri-sheet-search:focus {
  border-color: var(--color-accent-light);
}

.proagri-sheet-search::placeholder {
  color: var(--text-muted);
}

/* Header row */
.proagri-sheet-header {
  display: flex;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(128, 128, 128, 0.15);
  transition: opacity 0.2s ease;
}

.proagri-sheet-header-cell {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  flex: 1;
  min-width: 0;
  cursor: default;
  display: flex;
  align-items: center;
  gap: 4px;
  user-select: none;
}

/* Typography floor on touch-class viewports — 10px is unreadable at 375px. */
@media (max-width: 768px) {
  .proagri-sheet-header-cell { font-size: 11px; }
}
@media (max-width: 480px) {
  .proagri-sheet-header-cell { font-size: 12px; }
}

.proagri-sheet-header-cell.sortable {
  cursor: pointer;
}

.proagri-sheet-header-cell.sortable:hover {
  color: var(--text-secondary);
}

.proagri-sheet-sort-arrows {
  display: inline-flex;
  flex-direction: column;
  margin-left: 4px;
  line-height: 1;
  vertical-align: middle;
}

.sort-arrow {
  font-size: 8px;
  line-height: 8px;
  opacity: 0.3;
  transition: opacity 0.15s, color 0.15s;
}

.sort-arrow.active {
  opacity: 1;
  color: var(--color-accent-light);
}

.proagri-sheet-header-cell.sortable:hover .sort-arrow {
  opacity: 0.6;
}

.proagri-sheet-header-cell.sortable:hover .sort-arrow.active {
  opacity: 1;
}

/* Column width classes */
.proagri-sheet-header-cell.cell-sm,
.proagri-sheet-cell.cell-sm {
  flex: 0 0 60px;
}

.proagri-sheet-header-cell.cell-md,
.proagri-sheet-cell.cell-md {
  flex: 0 0 140px;
}

.proagri-sheet-header-cell.cell-lg,
.proagri-sheet-cell.cell-lg {
  flex: 0 0 180px;
}

.proagri-sheet-header-cell.radial-col,
.proagri-sheet-cell.radial-col {
  flex: 0 0 40px;
}

/* === Data Rows === */

.proagri-sheet-row {
  display: flex;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(128, 128, 128, 0.08);
  align-items: center;
  transition: opacity 0.2s ease, background 0.15s ease;
  animation: sheetRowIn 0.25s ease both;
}

.proagri-sheet-row:hover {
  background: rgba(128, 128, 128, 0.04);
}

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

/* === Cells === */

.proagri-sheet-cell {
  font-size: 12px;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.proagri-sheet-cell.cell-wrap {
  white-space: normal;
  word-break: break-word;
  overflow: visible;
  text-overflow: unset;
}

.proagri-sheet-cell.cell-name {
  color: var(--text-primary);
  font-weight: 500;
}

.proagri-sheet-cell.cell-editable {
  cursor: pointer;
}

.proagri-sheet-cell.cell-editable:hover {
  background: rgba(128, 128, 128, 0.08);
}

.proagri-sheet-cell.cell-editing {
  background: rgba(128, 128, 128, 0.1);
  outline: 2px solid var(--color-accent-light);
  outline-offset: -1px;
}


.proagri-sheet-cell.radial-col {
  flex: 0 0 40px;
  text-align: right;
  overflow: visible;
}

/* === Status Badges === */

.proagri-sheet-link {
  color: var(--color-accent-light, #f5a623);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(245, 166, 35, 0.3);
  transition: background 0.15s;
}

.proagri-sheet-link:hover {
  background: rgba(245, 166, 35, 0.1);
  text-decoration: none;
}

.proagri-sheet-upload-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(100, 100, 100, 0.25);
  background: transparent;
  color: var(--color-text-secondary, #64748b);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.proagri-sheet-upload-btn:hover {
  background: var(--color-accent-light, #f5a623);
  color: #fff;
  border-color: var(--color-accent-light, #f5a623);
}

.proagri-sheet-status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 500;
  text-transform: capitalize;
  white-space: nowrap;
}

.proagri-sheet-status-pending {
  background: rgba(245, 166, 35, 0.15);
  color: #f5a623;
}

.proagri-sheet-status-in_progress {
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
}

.proagri-sheet-status-completed,
.proagri-sheet-status-done {
  background: rgba(39, 174, 96, 0.15);
  color: #27ae60;
}

.proagri-sheet-status-overdue {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
}

.proagri-sheet-status-active {
  background: rgba(39, 174, 96, 0.15);
  color: #27ae60;
}

.proagri-sheet-status-inactive {
  background: rgba(128, 128, 128, 0.15);
  color: #888;
}

.proagri-sheet-status-request_client_materials,
.proagri-sheet-status-materials_requested {
  background: rgba(245, 166, 35, 0.15);
  color: #f5a623;
}

.proagri-sheet-status-materials_received {
  background: rgba(39, 174, 96, 0.15);
  color: #27ae60;
}

.proagri-sheet-status-lead {
  background: rgba(245, 166, 35, 0.15);
  color: #f5a623;
}

.proagri-sheet-status-low {
  background: rgba(39, 174, 96, 0.15);
  color: #27ae60;
}

.proagri-sheet-status-medium {
  background: rgba(245, 166, 35, 0.15);
  color: #f5a623;
}

.proagri-sheet-status-high {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
}

.proagri-sheet-status-urgent {
  background: rgba(192, 57, 43, 0.2);
  color: #c0392b;
}

.proagri-sheet-status-draft {
  background: rgba(128, 128, 128, 0.15);
  color: #888;
}

.proagri-sheet-status-outline_proposal {
  background: rgba(155, 89, 182, 0.15);
  color: #9b59b6;
}

.proagri-sheet-status-design {
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
}

.proagri-sheet-status-design_proposal {
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
}

.proagri-sheet-status-design_review {
  background: rgba(41, 128, 185, 0.15);
  color: #2980b9;
}

.proagri-sheet-status-proposal_ready {
  background: rgba(39, 174, 96, 0.15);
  color: #27ae60;
}

.proagri-sheet-status-sent_to_client {
  background: rgba(243, 156, 18, 0.15);
  color: #f39c12;
}

.proagri-sheet-status-client_approved {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
}

.proagri-sheet-status-booking_form_ready {
  background: rgba(22, 160, 133, 0.15);
  color: #16a085;
}

.proagri-sheet-status-client_changes {
  background: rgba(230, 126, 34, 0.15);
  color: #e67e22;
}

.proagri-sheet-status-booking_form_sent {
  background: rgba(0, 172, 193, 0.15);
  color: #00acc1;
}

.proagri-sheet-status-onboarding {
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
}

.proagri-sheet-status-onboarded {
  background: rgba(39, 174, 96, 0.15);
  color: #27ae60;
}

.proagri-sheet-status-declined {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
}

.proagri-sheet-status-approved {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
}

/* Web-design pipeline statuses */
.proagri-sheet-status-request_client_materials {
  background: rgba(245, 166, 35, 0.15);
  color: #f5a623;
}

.proagri-sheet-status-materials_requested {
  background: rgba(243, 156, 18, 0.15);
  color: #f39c12;
}

.proagri-sheet-status-materials_received {
  background: rgba(22, 160, 133, 0.15);
  color: #16a085;
}

.proagri-sheet-status-sitemap {
  background: rgba(155, 89, 182, 0.15);
  color: #9b59b6;
}

.proagri-sheet-status-wireframe {
  background: rgba(142, 68, 173, 0.15);
  color: #8e44ad;
}

.proagri-sheet-status-prototype {
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
}

.proagri-sheet-status-ready_for_approval {
  background: rgba(243, 156, 18, 0.15);
  color: #f39c12;
}

.proagri-sheet-status-sent_for_approval {
  background: rgba(230, 126, 34, 0.15);
  color: #e67e22;
}

.proagri-sheet-status-design_changes {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
}

.proagri-sheet-status-development {
  background: rgba(41, 128, 185, 0.15);
  color: #2980b9;
}

.proagri-sheet-status-site_developed {
  background: rgba(39, 174, 96, 0.15);
  color: #27ae60;
}

.proagri-sheet-status-hosting_seo {
  background: rgba(22, 160, 133, 0.15);
  color: #16a085;
}

.proagri-sheet-status-complete {
  background: rgba(39, 174, 96, 0.15);
  color: #27ae60;
}

/* Content calendar legacy statuses (pre-2026-04-08 rename: focus_points → materials).
   These selectors are retained for any rows in flight that haven't migrated yet.
   New rows use `request_materials` / `materials_requested` / `materials_received`
   which inherit the standard "materials" palette defined above. */
.proagri-sheet-status-request_focus_points {
  background: rgba(142, 68, 173, 0.15);
  color: #8e44ad;
}

.proagri-sheet-status-focus_points_requested {
  background: rgba(155, 89, 182, 0.15);
  color: #9b59b6;
}

.proagri-sheet-status-focus_points_received {
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
}

/* Content calendar — request_materials gets its own purple accent so the
   pipeline reads visually like a kickoff (the other two materials_* classes
   inherit the orange/teal palette from earlier in this file). */
.proagri-sheet-status-request_materials {
  background: rgba(142, 68, 173, 0.15);
  color: #8e44ad;
}

.proagri-sheet-status-editorial {
  background: rgba(230, 126, 34, 0.15);
  color: #e67e22;
}

.proagri-sheet-status-editorial_review {
  background: rgba(211, 84, 0, 0.15);
  color: #d35400;
}

.proagri-sheet-status-ready_for_scheduling {
  background: rgba(22, 160, 133, 0.15);
  color: #16a085;
}

/* Social Media pipeline statuses */
.proagri-sheet-status-upload_materials {
  background: rgba(245, 166, 35, 0.15);
  color: #f5a623;
}

.proagri-sheet-status-waiting_for_materials {
  background: rgba(245, 166, 35, 0.15);
  color: #f5a623;
}

.proagri-sheet-status-artwork_design {
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
}

.proagri-sheet-status-create_captions {
  background: rgba(155, 89, 182, 0.15);
  color: #9b59b6;
}

.proagri-sheet-status-create_links {
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
}

.proagri-sheet-status-create_stat_sheet {
  background: rgba(22, 160, 133, 0.15);
  color: #16a085;
}

.proagri-sheet-status-scheduled {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
}

/* Agri4All product-uploads pipeline statuses */
.proagri-sheet-status-agri4all-links {
  background: rgba(22, 163, 74, 0.15);
  color: #16a34a;
}

.proagri-sheet-status-posted {
  background: rgba(39, 174, 96, 0.15);
  color: #27ae60;
}

/* Agri4All pipeline statuses */
.proagri-sheet-status-agri4all-links {
  background: rgba(22, 163, 74, 0.15);
  color: #16a34a;
}

/* Editorial/Online Articles statuses */
.proagri-sheet-status-editing {
  background: rgba(230, 126, 34, 0.15);
  color: #e67e22;
}

.proagri-sheet-status-editorial_changes {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
}

.proagri-sheet-status-translating {
  background: rgba(155, 89, 182, 0.15);
  color: #9b59b6;
}

.proagri-sheet-status-ready_to_upload {
  background: rgba(22, 160, 133, 0.15);
  color: #16a085;
}

/* Video pipeline statuses */
.proagri-sheet-status-send_request_form {
  background: rgba(142, 68, 173, 0.15);
  color: #8e44ad;
}

.proagri-sheet-status-request_form_sent {
  background: rgba(155, 89, 182, 0.15);
  color: #9b59b6;
}

.proagri-sheet-status-request_form_received {
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
}

.proagri-sheet-status-populating_video_dept {
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
}

.proagri-sheet-status-brief_received {
  background: rgba(41, 128, 185, 0.15);
  color: #2980b9;
}

.proagri-sheet-status-assign_and_schedule {
  background: rgba(245, 166, 35, 0.15);
  color: #f5a623;
}

.proagri-sheet-status-review {
  background: rgba(230, 126, 34, 0.15);
  color: #e67e22;
}

.proagri-sheet-status-changes_requested {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
}

.proagri-sheet-status-final_delivery {
  background: rgba(39, 174, 96, 0.15);
  color: #27ae60;
}

/* === Multi-Select Tags (in cell) === */

.proagri-sheet-tags {
  display: flex;
  gap: 4px;
  overflow: hidden;
  flex-wrap: nowrap;
}

.proagri-sheet-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 500;
  background: rgba(128, 128, 128, 0.12);
  color: var(--text-secondary);
  white-space: nowrap;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.proagri-sheet-tag-overflow {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(128, 128, 128, 0.1);
  color: var(--text-muted);
  white-space: nowrap;
}

/* === Person Avatars (in cell) === */

.proagri-sheet-persons {
  display: flex;
  align-items: center;
}

.proagri-sheet-person-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--color-secondary, #fff);
  object-fit: cover;
  margin-left: -6px;
  background: rgba(128, 128, 128, 0.15);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: box-shadow 0.15s;
}

@media (hover: hover) {
  .proagri-sheet-person-avatar:hover {
    box-shadow: 0 0 0 2px var(--color-primary, #4f46e5);
  }
}

.proagri-sheet-person-avatar:first-child {
  margin-left: 0;
}

.proagri-sheet-person-avatar-placeholder {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--color-secondary, #fff);
  margin-left: -6px;
  background: rgba(128, 128, 128, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: box-shadow 0.15s;
}

.proagri-sheet-person-avatar-placeholder:hover {
  box-shadow: 0 0 0 2px var(--color-primary, #4f46e5);
}

.proagri-sheet-person-avatar-placeholder:first-child {
  margin-left: 0;
}

.proagri-sheet-person-avatar-placeholder svg {
  width: 14px;
  height: 14px;
  fill: rgba(128, 128, 128, 0.5);
}

.proagri-sheet-person-avatar-empty {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px dashed rgba(128, 128, 128, 0.35);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
}

.proagri-sheet-person-avatar-empty:hover {
  border-color: var(--color-primary, #4f46e5);
  background: rgba(79, 70, 229, 0.06);
}

.proagri-sheet-person-avatar-empty svg {
  width: 16px;
  height: 16px;
  fill: rgba(128, 128, 128, 0.4);
  transition: fill 0.15s;
}

.proagri-sheet-person-avatar-empty:hover svg {
  fill: var(--color-primary, #4f46e5);
}

.proagri-sheet-person-overflow {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--color-secondary, #fff);
  margin-left: -6px;
  background: rgba(128, 128, 128, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Person tooltip */
.proagri-sheet-person-tooltip {
  position: fixed;
  z-index: 600;
  background: var(--color-secondary, #fff);
  border: 1px solid rgba(128, 128, 128, 0.15);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  padding: 10px 14px;
  pointer-events: none;
  animation: editorFadeIn 0.15s ease;
  white-space: nowrap;
}

.proagri-sheet-person-tooltip-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.proagri-sheet-person-tooltip-role {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* === Checkbox (in cell) === */

.proagri-sheet-checkbox {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(128, 128, 128, 0.3);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}

.proagri-sheet-checkbox.checked {
  background: var(--color-accent-light);
  border-color: var(--color-accent-light);
}

.proagri-sheet-checkbox.checked svg {
  display: block;
}

.proagri-sheet-checkbox svg {
  display: none;
  width: 12px;
  height: 12px;
  fill: #fff;
}

/* === Number Cell === */

.proagri-sheet-cell-number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* === Editor Popover Base === */

.proagri-sheet-editor {
  position: fixed;
  z-index: 500;
  background: var(--color-secondary, #fff);
  border: 1px solid rgba(128, 128, 128, 0.15);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  animation: editorFadeIn 0.15s ease;
  overflow: hidden;
}

@keyframes editorFadeIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* === Text Inline Editor === */

.proagri-sheet-text-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-primary);
  padding: 0;
}

/* === Select Dropdown (single select / status) === */

.proagri-sheet-select-dropdown {
  min-width: 180px;
  max-height: 240px;
  overflow-y: auto;
  padding: 6px;
}

.proagri-sheet-select-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-primary);
  transition: background 0.12s ease;
}

.proagri-sheet-select-option:hover {
  background: rgba(128, 128, 128, 0.08);
}

.proagri-sheet-select-option.selected {
  background: rgba(128, 128, 128, 0.1);
}

.proagri-sheet-select-check {
  width: 16px;
  text-align: center;
  color: var(--color-accent-light);
  font-size: 14px;
  flex-shrink: 0;
}

/* === Multi-Select Dropdown === */

.proagri-sheet-multiselect-dropdown {
  min-width: 220px;
  max-height: 280px;
  overflow-y: auto;
  padding: 6px;
}

.proagri-sheet-multiselect-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-primary);
  transition: background 0.12s ease;
}

.proagri-sheet-multiselect-option:hover {
  background: rgba(128, 128, 128, 0.08);
}

.proagri-sheet-multiselect-check {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(128, 128, 128, 0.3);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.proagri-sheet-multiselect-check.checked {
  background: var(--color-accent-light);
  border-color: var(--color-accent-light);
}

.proagri-sheet-multiselect-check svg {
  width: 10px;
  height: 10px;
  fill: #fff;
  display: none;
}

.proagri-sheet-multiselect-check.checked svg {
  display: block;
}

/* === Date Picker === */

.proagri-sheet-datepicker {
  width: 260px;
  padding: 12px;
}

.proagri-sheet-datepicker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.proagri-sheet-datepicker-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.proagri-sheet-datepicker-nav {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 14px;
  transition: background 0.12s;
}

.proagri-sheet-datepicker-nav:hover {
  background: rgba(128, 128, 128, 0.1);
}

.proagri-sheet-datepicker-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  margin-bottom: 4px;
}

.proagri-sheet-datepicker-weekday {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 4px 0;
}

.proagri-sheet-datepicker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.proagri-sheet-datepicker-day {
  text-align: center;
  padding: 6px 0;
  font-size: 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-primary);
  transition: background 0.12s;
  border: none;
  background: none;
  font-family: inherit;
}

.proagri-sheet-datepicker-day:hover {
  background: rgba(128, 128, 128, 0.1);
}

.proagri-sheet-datepicker-day.today {
  font-weight: 700;
  color: var(--color-accent-light);
}

.proagri-sheet-datepicker-day.selected {
  background: var(--color-accent-light);
  color: #fff;
  font-weight: 600;
}

.proagri-sheet-datepicker-day.other-month {
  color: var(--text-muted);
  opacity: 0.4;
}

.proagri-sheet-datepicker-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(128, 128, 128, 0.1);
}

.proagri-sheet-datepicker-btn {
  flex: 1;
  padding: 5px 0;
  font-size: 11px;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
  background: rgba(128, 128, 128, 0.08);
  color: var(--text-secondary);
  font-family: inherit;
}

.proagri-sheet-datepicker-btn:hover {
  background: rgba(128, 128, 128, 0.15);
}

.proagri-sheet-datepicker-btn-primary {
  background: var(--color-accent-light);
  color: #fff;
}

.proagri-sheet-datepicker-btn-primary:hover {
  opacity: 0.9;
}

/* === Person Picker Dropdown === */

.proagri-sheet-person-picker {
  width: 280px;
  max-height: 340px;
  display: flex;
  flex-direction: column;
}

.proagri-sheet-person-picker-search {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(128, 128, 128, 0.1);
}

.proagri-sheet-person-picker-search input {
  width: 100%;
  border: 1px solid rgba(128, 128, 128, 0.2);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  background: rgba(128, 128, 128, 0.06);
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
}

.proagri-sheet-person-picker-search input:focus {
  border-color: var(--color-accent-light);
}

.proagri-sheet-person-picker-search input::placeholder {
  color: var(--text-muted);
}

.proagri-sheet-person-picker-list {
  overflow-y: auto;
  padding: 6px;
  flex: 1;
}

.proagri-sheet-person-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
}

.proagri-sheet-person-picker-item:hover {
  background: rgba(128, 128, 128, 0.08);
}

.proagri-sheet-person-picker-item.selected {
  background: rgba(128, 128, 128, 0.1);
}

.proagri-sheet-person-picker-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(128, 128, 128, 0.15);
}

.proagri-sheet-person-picker-avatar-placeholder {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(128, 128, 128, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.proagri-sheet-person-picker-avatar-placeholder svg {
  width: 16px;
  height: 16px;
  fill: rgba(128, 128, 128, 0.5);
}

.proagri-sheet-person-picker-info {
  flex: 1;
  min-width: 0;
}

.proagri-sheet-person-picker-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proagri-sheet-person-picker-role {
  font-size: 10px;
  color: var(--text-muted);
}

.proagri-sheet-person-picker-check {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(128, 128, 128, 0.3);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}

.proagri-sheet-person-picker-check.checked {
  background: var(--color-accent-light);
  border-color: var(--color-accent-light);
}

.proagri-sheet-person-picker-check svg {
  width: 10px;
  height: 10px;
  fill: #fff;
  display: none;
}

.proagri-sheet-person-picker-check.checked svg {
  display: block;
}

.proagri-sheet-person-picker-unassign {
  border-bottom: 1px solid rgba(128, 128, 128, 0.15);
  opacity: 0.7;
}

.proagri-sheet-person-picker-unassign:hover {
  opacity: 1;
}

.proagri-sheet-person-picker-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* === Loading & Empty States === */

.proagri-sheet-empty,
.proagri-sheet-loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.proagri-sheet-loading::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(128, 128, 128, 0.2);
  border-top-color: var(--text-muted);
  border-radius: 50%;
  animation: sheetSpin 0.6s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}

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

/* === Cell Flash Feedback === */

.proagri-sheet-cell.cell-saved {
  animation: cellSaved 0.6s ease;
}

@keyframes cellSaved {
  0% { background: rgba(39, 174, 96, 0.15); }
  100% { background: transparent; }
}

.proagri-sheet-cell.cell-error {
  animation: cellError 0.6s ease;
}

@keyframes cellError {
  0% { background: rgba(231, 76, 60, 0.15); }
  100% { background: transparent; }
}

/* === Row Hover Actions === */

.proagri-sheet-actions-col {
  overflow: visible;
  text-align: right;
  padding: 0 8px !important;
}

.proagri-sheet-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  /* Touch devices: always show. Overridden below for hover-capable devices. */
  opacity: 1;
  transition: opacity 0.15s ease;
}

@media (hover: hover) {
  .proagri-sheet-row-actions {
    opacity: 0;
  }
  .proagri-sheet-row:hover .proagri-sheet-row-actions {
    opacity: 1;
  }
}

.proagri-sheet-row-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted, #999);
  cursor: pointer;
  padding: 4px;
  transition: background 0.15s ease, color 0.15s ease;
}

.proagri-sheet-row-action-btn:hover {
  background: rgba(128, 128, 128, 0.15);
  color: var(--text-primary, #333);
}

.proagri-sheet-row-action-btn.action-delete:hover {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
}

.proagri-sheet-row-action-btn.action-advance:hover {
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
}

.proagri-sheet-row-action-btn.action-skip:hover {
  background: rgba(245, 166, 35, 0.15);
  color: #f5a623;
}

.proagri-sheet-row-action-btn.action-approve:hover {
  background: rgba(39, 174, 96, 0.15);
  color: #27ae60;
}

.proagri-sheet-row-action-btn.action-decline:hover {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
}

.proagri-sheet-row-action-btn.action-view {
  color: #3b82f6;
}

.proagri-sheet-row-action-btn.action-view:hover {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

.proagri-sheet-row-action-btn.action-upload {
  color: #8b5cf6;
}

.proagri-sheet-row-action-btn.action-upload:hover {
  background: rgba(139, 92, 246, 0.15);
  color: #7c3aed;
}

.proagri-sheet-row-action-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* Decline Reason Modal */
.decline-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.15s ease;
}

.decline-modal {
  background: var(--card-bg, #fff);
  border-radius: 12px;
  padding: 24px;
  width: 420px;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.2s ease;
}

.decline-modal h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary, #333);
}

.decline-modal-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border-color, #ddd);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  background: var(--input-bg, #fff);
  color: var(--text-primary, #333);
  box-sizing: border-box;
  transition: border-color 0.15s ease;
}

.decline-modal-textarea:focus {
  outline: none;
  border-color: #e74c3c;
}

.decline-modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.decline-modal-btn {
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.decline-modal-btn:active {
  transform: scale(0.97);
}

.decline-modal-cancel {
  background: var(--hover-bg, #f0f0f0);
  color: var(--text-primary, #333);
}

.decline-modal-cancel:hover {
  background: var(--border-color, #ddd);
}

.decline-modal-confirm {
  background: #e74c3c;
  color: #fff;
}

.decline-modal-confirm:hover {
  background: #c0392b;
}

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

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

/* ============================================================
   Mobile responsiveness — Phase 1 foundation
   ============================================================
   Phase-1 slice of the mobile-responsiveness program. Keeps
   desktop behavior unchanged. Covered here: horizontal-scroll
   escape hatch for dense sheets, touch-target minimums on sheet
   buttons, dropdown/modal clamping so menus don't overflow a
   360px viewport. See docs/CLAUDE_PROCESSES.md §Mobile for the
   full phased plan (Phase 2 handles dept-page layouts).
   ============================================================ */

@media (max-width: 768px) {
  /* D2 — Horizontal-scroll escape hatch for dense data sheets.
     The sheet itself (.proagri-sheet-wrap) scrolls horizontally;
     the header + row rows keep their natural min-width so columns
     don't collapse. */
  .proagri-sheet-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .proagri-sheet-wrap > .proagri-sheet-header,
  .proagri-sheet-wrap > .proagri-sheet-row {
    min-width: 720px;
  }

  /* D4 — Touch-target minimums for sheet-level interactive controls. */
  .proagri-sheet-row-action-btn {
    width: 36px;
    height: 36px;
    padding: 6px;
  }
  .proagri-sheet-checkbox {
    width: 20px;
    height: 20px;
  }
}

/* D5 — Clamp cell dropdowns / pickers to viewport on narrow screens. */
@media (max-width: 480px) {
  .proagri-sheet-select-dropdown,
  .proagri-sheet-person-dropdown,
  .proagri-sheet-date-picker {
    max-width: calc(100vw - 16px);
    min-width: 0;
    left: 8px !important;
    right: 8px !important;
  }
}
