/* ============================================================================
   TASKS PAGE — Domain-specific styles
   External stylesheet for tasks.html
   Design system classes (rf-btn, rf-input, rf-modal, rf-kpi, rf-badge, etc.)
   are provided by rustica-design-system.css — only task-specific overrides here.
   ============================================================================ */

/* ── Layout ─────────────────────────────────────────────────────────────── */

.main-content {
  flex: 1;
  padding: 24px;
}

.page-container {
  max-width: 100%;
  margin: 0 auto;
}

/* ── Counter Cards (KPI overrides) ──────────────────────────────────────── */

.counters-row {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.counter-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  flex: 1;
  min-width: 180px;
  cursor: pointer;
  transition: all 0.2s;
}

.counter-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.counter-card.active {
  background: var(--rf-primary-gradient);
  color: white;
}

.counter-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.counter-card:not(.active) .counter-icon { background: rgba(var(--rf-primary-rgb), 0.1); }
.counter-card.active .counter-icon { background: rgba(255, 255, 255, 0.2); }

.counter-content { flex: 1; }
.counter-value { font-size: 28px; font-weight: 700; }
.counter-label { font-size: 13px; opacity: 0.8; }

/* ── Department Counter Pills ───────────────────────────────────────────── */

.dept-counters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 8px;
}

.dept-counter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--rf-radius-xl);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
  font-weight: 600;
  color: white;
}

.dept-counter:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  filter: brightness(1.1);
}

.dept-counter.active {
  box-shadow: 0 0 0 3px rgba(0,0,0,0.3);
}

.dept-counter-icon { display: none; }
.dept-counter-content { display: flex; align-items: center; gap: 6px; }
.dept-counter-value {
  background: rgba(255,255,255,0.3);
  padding: 2px 8px;
  border-radius: var(--rf-radius-sm);
  font-size: 12px;
}
.dept-counter-label { font-size: 13px; }

/* Department colors */
.dept-counter.dept-self { background: #6366f1; }
.dept-counter.dept-employee { background: #8b5cf6; }
.dept-counter.dept-sales-service { background: #ec4899; }
.dept-counter.dept-shipping { background: #f59e0b; }
.dept-counter.dept-engineering { background: var(--rf-success); }
.dept-counter.dept-website { background: #3b82f6; }
.dept-counter.dept-soft-goods { background: #ef4444; }
.dept-counter.dept-marketing { background: #14b8a6; }
.dept-counter.dept-production { background: #f97316; }

/* ── Day / Reminder Checkboxes ──────────────────────────────────────────── */

.day-checkbox, .reminder-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: white;
  border: 1px solid var(--rf-border-light);
  border-radius: var(--rf-radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}
.day-checkbox:hover, .reminder-checkbox:hover {
  border-color: #a855f7;
  background: #faf5ff;
}
.day-checkbox:has(input:checked), .reminder-checkbox:has(input:checked) {
  background: #a855f7;
  color: white;
  border-color: #a855f7;
}
.day-checkbox input, .reminder-checkbox input {
  display: none;
}

/* ── Calendar Styles ────────────────────────────────────────────────────── */

.calendar-container {
  flex: 1;
  padding: 20px;
  background: white;
}
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.calendar-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--rf-text-secondary);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.calendar-day-header {
  text-align: center;
  font-weight: 600;
  font-size: 12px;
  color: var(--rf-text-secondary);
  padding: 8px;
}
.calendar-day {
  min-height: 80px;
  border: 1px solid var(--rf-border-light);
  border-radius: var(--rf-radius-sm);
  padding: 4px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
}
.calendar-day:hover {
  border-color: #a855f7;
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.1);
}
.calendar-day.today {
  border-color: #a855f7;
  background: #faf5ff;
}
.calendar-day.other-month {
  background: #f8fafc;
  opacity: 0.6;
}
.calendar-day-number {
  font-size: 12px;
  font-weight: 600;
  color: var(--rf-text-primary);
  margin-bottom: 4px;
}
.calendar-day.today .calendar-day-number {
  background: #a855f7;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.calendar-task {
  font-size: 10px;
  padding: 2px 4px;
  border-radius: 4px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.calendar-task.one-time {
  background: #f3e8ff;
  color: #7c3aed;
}
.calendar-task.recurring {
  background: #dbeafe;
  color: #1d4ed8;
}
.calendar-task.overdue {
  background: #fee2e2;
  color: var(--rf-danger);
}
.calendar-sidebar {
  width: 300px;
  background: #f8fafc;
  border-left: 1px solid var(--rf-border-light);
  padding: 20px;
  overflow-y: auto;
  max-height: calc(70vh / var(--rf-app-zoom, 1));
}
.upcoming-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.upcoming-task-item {
  background: white;
  border-radius: var(--rf-radius-sm);
  padding: 12px;
  border: 1px solid var(--rf-border-light);
  cursor: pointer;
  transition: all 0.2s;
}
.upcoming-task-item:hover {
  border-color: #a855f7;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.upcoming-task-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
}
.upcoming-task-meta {
  font-size: 11px;
  color: var(--rf-text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.upcoming-task-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}
.upcoming-task-badge.recurring {
  background: #dbeafe;
  color: #1d4ed8;
}
.upcoming-task-badge.one-time {
  background: #f3e8ff;
  color: #7c3aed;
}

#taskCalendarModal .modal-body {
  display: flex;
  flex-direction: row;
}

/* Calendar Tabs */
.calendar-tabs {
  display: flex;
  gap: 0;
  padding: 0 20px;
  border-bottom: 1px solid var(--rf-border-light);
  background: #f8fafc;
}
.calendar-tab {
  padding: 12px 20px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--rf-text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
}
.calendar-tab:hover {
  color: var(--rf-text-primary);
}
.calendar-tab.active {
  color: #7c3aed;
  border-bottom-color: #7c3aed;
  background: white;
}
.calendar-tab-content {
  display: none;
}
.calendar-tab-content.active, .calendar-tab-content[style*="flex"] {
  display: flex;
}

/* Recurring Tasks List */
.recurring-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.recurring-task-card {
  background: white;
  border: 1px solid var(--rf-border-light);
  border-radius: var(--rf-radius-md);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  transition: all 0.2s;
}
.recurring-task-card:hover {
  border-color: #a855f7;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.recurring-task-info { flex: 1; }
.recurring-task-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 6px;
  color: var(--rf-text-primary);
}
.recurring-task-schedule {
  font-size: 13px;
  color: var(--rf-text-secondary);
  margin-bottom: 8px;
}
.recurring-task-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.recurring-task-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--rf-radius-md);
  font-weight: 500;
}
.recurring-task-badge.pattern {
  background: #dbeafe;
  color: #1d4ed8;
}
.recurring-task-badge.active {
  background: #dcfce7;
  color: var(--rf-success);
}
.recurring-task-badge.inactive {
  background: #fee2e2;
  color: var(--rf-danger);
}
.recurring-task-badge.dept {
  background: #f3e8ff;
  color: #7c3aed;
}
.recurring-task-actions {
  display: flex;
  gap: 8px;
}

/* ── Mini Status Counters ───────────────────────────────────────────────── */

.mini-counters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 16px;
}

.mini-counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--rf-radius-xl);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.mini-counter:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.mini-counter.active {
  border-color: #1a1a1a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.mini-counter-count {
  background: rgba(0, 0, 0, 0.15);
  padding: 2px 6px;
  border-radius: var(--rf-radius-sm);
  font-size: 11px;
  min-width: 18px;
  text-align: center;
}

/* Mini counter status colors */
.mini-counter.sent_to_sales { background: #f6c445; color: #1a1a1a; }
.mini-counter.action_needed { background: #e8697d; color: #fff; }
.mini-counter.in_programming { background: #e861ab; color: #fff; }
.mini-counter.resolution { background: #6dd4a0; color: #1a1a1a; }
.mini-counter.waiting_on_web { background: #9776d1; color: #fff; }
.mini-counter.waiting_on_accounting { background: #e861ab; color: #fff; }
.mini-counter.waiting_on_customer { background: #54c4d4; color: #1a1a1a; }
.mini-counter.shop_working_on_it { background: #a89984; color: #fff; }
.mini-counter.on_hold { background: #54a6d4; color: #fff; }
.mini-counter.under_evaluation { background: #d4c854; color: #1a1a1a; }
.mini-counter.cs_working_on_it { background: #707070; color: #fff; }
.mini-counter.processing { background: #e8697d; color: #fff; }
.mini-counter.custom { background: #4a5568; color: #fff; }

/* ── NEW Badge for tasks ────────────────────────────────────────────────── */

.task-new-badge {
  background: linear-gradient(135deg, #ef4444, var(--rf-danger));
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 8px;
  animation: pulse-new 2s infinite;
}

@keyframes pulse-new {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ── Main Tasks Layout ──────────────────────────────────────────────────── */

.tasks-layout {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 24px;
  /* One viewport tall (divided by the app zoom — a raw 100vh paints at
     ×zoom and overflows). selectTask() scrolls the layout into view, so an
     open task gets the whole screen; the 64px keeps a sliver of breathing
     room for the page padding. */
  height: calc(100vh / var(--rf-app-zoom, 1) - 64px); /* fallback for no-dvh browsers */
  height: calc(100dvh / var(--rf-app-zoom, 1) - 64px); /* dvh tracks Android/iOS URL-bar */
  min-height: 500px;
}

/* Task List Panel */
.task-list-panel {
  background: var(--rf-bg-card-alpha);
  backdrop-filter: blur(20px);
  border-radius: var(--rf-radius-2xl);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 10px 40px var(--rf-border-light);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

.list-header {
  padding: 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.list-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 16px;
  border-radius: var(--rf-radius-xl);
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: white;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

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

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 14px;
  margin-top: 12px;
}

.search-box input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  outline: none;
}

.task-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  min-height: 0;
}

/* ── Notification Bell & Dropdown ───────────────────────────────────────── */

.notification-bell-container {
  position: relative;
}

.notification-bell {
  background: rgba(0, 0, 0, 0.05);
  border: none;
  border-radius: var(--rf-radius-md);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

.notification-bell:hover {
  background: rgba(0, 0, 0, 0.1);
}

.bell-icon {
  font-size: 20px;
}

.notification-count {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--rf-danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 420px;
  max-height: 600px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--rf-radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  display: none;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
}

.notification-dropdown.open {
  display: flex;
}

.notification-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--rf-border-light);
  background: var(--rf-primary-gradient);
}

.notification-dropdown-header h3 {
  color: white;
  font-size: 18px;
  font-weight: 600;
}

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

.mark-all-read {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 13px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--rf-radius-sm);
  font-weight: 500;
  transition: all 0.2s;
}

.mark-all-read:hover {
  background: rgba(255, 255, 255, 0.3);
}

.notification-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.notification-close:hover {
  color: white;
}

.notification-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rf-border-light);
  background: rgba(0, 0, 0, 0.02);
  flex-wrap: wrap;
}

.notification-tab {
  background: none;
  border: none;
  color: var(--rf-text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--rf-radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.notification-tab:hover {
  background: rgba(var(--rf-primary-rgb), 0.08);
  color: var(--rf-primary);
}

.notification-tab.active {
  background: var(--rf-primary-gradient);
  color: white;
}

.notification-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--rf-border-light);
}

.notification-search input {
  width: 100%;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--rf-radius-sm);
  padding: 10px 14px;
  color: var(--rf-text-primary);
  font-size: 13px;
  outline: none;
  transition: all 0.2s;
}

.notification-search input::placeholder {
  color: var(--rf-text-tertiary);
}

.notification-search input:focus {
  border-color: var(--rf-primary);
  box-shadow: 0 0 0 3px rgba(var(--rf-primary-rgb), 0.1);
}

.notification-dropdown-content {
  flex: 1;
  overflow-y: auto;
  max-height: 400px;
}

.notification-group {
  padding: 12px 16px 8px;
}

.notification-group-title {
  color: var(--rf-text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.notification-item:hover {
  background: rgba(var(--rf-primary-rgb), 0.04);
}

.notification-item.unread {
  background: rgba(var(--rf-primary-rgb), 0.06);
  border-left-color: var(--rf-primary);
}

.notification-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--rf-radius-md);
  background: var(--rf-primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.notification-body {
  flex: 1;
  min-width: 0;
}

.notification-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.notification-sender {
  color: var(--rf-text-primary);
  font-size: 13px;
  font-weight: 600;
}

.notification-action {
  color: var(--rf-primary);
  font-size: 13px;
  font-weight: 500;
}

.notification-context {
  color: var(--rf-text-secondary);
  font-size: 13px;
}

.notification-preview {
  color: var(--rf-text-secondary);
  font-size: 13px;
  line-height: 1.4;
  margin: 6px 0;
}

.notification-task-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--rf-text-tertiary);
  font-size: 12px;
  margin-top: 6px;
}

.notification-task-link span {
  color: var(--rf-text-secondary);
}

.notification-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.notification-time {
  color: var(--rf-text-tertiary);
  font-size: 12px;
}

.notification-unread-dot {
  width: 8px;
  height: 8px;
  background: var(--rf-primary);
  border-radius: 50%;
}

.notification-loading, .notification-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--rf-text-tertiary);
  font-size: 14px;
}

/* ── Task Sections ──────────────────────────────────────────────────────── */

.task-section {
  margin-bottom: 16px;
}

.task-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: var(--rf-radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  user-select: none;
}

.task-section-header h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--rf-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-section-header .count {
  background: var(--rf-border-light);
  padding: 2px 8px;
  border-radius: var(--rf-radius-sm);
  font-size: 11px;
}

.task-section-header .toggle-icon {
  color: var(--rf-text-tertiary);
  font-size: 12px;
  transition: transform 0.2s;
}

.task-section-header.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

.task-section-items {
  transition: all 0.2s;
}

.task-section-items.collapsed {
  display: none;
}

.completed-task .task-item-title {
  text-decoration: line-through;
  color: var(--rf-text-tertiary);
}

.completed-task .task-item-meta {
  opacity: 0.6;
}

/* Empty notifications state */
.no-notifications {
  padding: 16px;
  text-align: center;
  color: var(--rf-text-tertiary);
  font-size: 12px;
}

/* ── Task Items ─────────────────────────────────────────────────────────── */

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: var(--rf-radius-lg);
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 8px;
  border: 2px solid transparent;
}

.task-item:hover { background: rgba(0, 0, 0, 0.03); }
.task-item.selected { background: rgba(var(--rf-primary-rgb), 0.08); border-color: var(--rf-primary); }

.task-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--rf-border-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  margin-top: 2px;
}

.task-checkbox:hover { border-color: var(--rf-primary); }
.task-checkbox.checked { background: var(--rf-success); border-color: var(--rf-success); color: white; }

.task-item-content { flex: 1; min-width: 0; }

.task-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--rf-text-primary);
  margin-bottom: 4px;
}

.task-item-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--rf-text-secondary);
  flex-wrap: wrap;
  align-items: center;
}

.task-assignees {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.task-assignee-name {
  background: rgba(var(--rf-primary-rgb), 0.1);
  color: var(--rf-primary);
  padding: 2px 8px;
  border-radius: var(--rf-radius-md);
  font-size: 11px;
  font-weight: 500;
}

/* Card layout: title → order chips → status+date → badges, with the assignees
   pinned to the bottom under a subtle divider. Even vertical rhythm between rows. */
.task-item-title { margin-bottom: 0; }
.task-item-orders { margin-top: 8px; }
.task-item-meta { margin-top: 8px; }
.task-item-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--rf-border-light, rgba(33, 30, 52, 0.08));
}
.task-item-assigned-ico { font-size: 12px; opacity: .55; line-height: 1; }

.task-assignee-more {
  background: var(--rf-border-light);
  color: var(--rf-text-secondary);
  padding: 2px 8px;
  border-radius: var(--rf-radius-md);
  font-size: 11px;
  font-weight: 500;
}

.task-item-due { display: flex; align-items: center; gap: 4px; }
.task-item-due.overdue { color: var(--rf-danger); font-weight: 500; }

/* Promised-ship-date countdown pill (Est Ship Date Updates group cards).
   Traffic-light fill set per-card via the --ship custom property. */
.task-item-ship {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: var(--ship, #16a34a);
  white-space: nowrap;
}

/* Sort toggles in the Est Ship Date Updates group header. */
.ship-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--rf-border-light, #e2e8f0);
  background: var(--rf-surface, #fff);
  color: var(--rf-text-secondary, #475569);
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.ship-sort-btn:hover { background: var(--rf-surface-2, #f1f5f9); }
.ship-sort-btn.active {
  background: var(--rf-primary, #6e1530);
  border-color: var(--rf-primary, #6e1530);
  color: #fff;
}

/* Red clear-sort button — appears beside the toggles when a sort is active. */
.ship-sort-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid #dc2626;
  background: var(--rf-surface, #fff);
  color: #dc2626;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.ship-sort-clear:hover { background: #dc2626; color: #fff; }

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

.priority-dot.urgent { background: var(--rf-danger); }
.priority-dot.high { background: #f97316; }
.priority-dot.normal { background: #3b82f6; }
.priority-dot.low { background: var(--rf-text-tertiary); }

.task-item-badges { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* Per-user private note on a task card (only the current user sees its content).
   Sits below the product-type badges, above the assignees. */
.task-note-wrap { margin-top: 8px; }
.task-note-input {
  width: 100%;
  box-sizing: border-box;
  resize: none;
  border: 1px dashed var(--rf-border, #d8d2cc);
  border-radius: 8px;
  background: var(--rf-surface-2, #faf7f4);
  color: var(--rf-text-primary);
  padding: 6px 9px;
  font: inherit;
  font-size: 12.5px;
  line-height: 1.4;
  min-height: 30px;
  overflow-y: hidden;   /* the box grows to fit the whole note instead of scrolling */
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.task-note-input::placeholder { color: var(--rf-text-tertiary, #9a9088); }
.task-note-input:hover { border-color: var(--rf-text-tertiary, #b8aea4); }
.task-note-input:focus {
  outline: none;
  border-style: solid;
  border-color: var(--rf-primary, #8b1a3a);
  background: var(--rf-surface, #fff);
  box-shadow: 0 0 0 3px rgba(var(--rf-primary-rgb, 139,26,58), 0.10);
}
[data-rf-dark="true"] .task-note-input { background: rgba(255,255,255,0.04); }

.task-item-badges { align-items: center; }

/* Note input + red round "+" button share a row. All card notes are public;
   posting drops the note into the feed below. */
.task-note-row { display: flex; align-items: flex-end; gap: 8px; }
.task-note-row .task-note-input { flex: 1 1 auto; min-width: 0; }
.task-note-add {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--rf-danger, #d6293e);
  color: #fff;
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(214, 41, 62, 0.3);
  transition: filter .15s, transform .1s, box-shadow .15s;
}
.task-note-add:hover { filter: brightness(1.08); box-shadow: 0 3px 12px rgba(214, 41, 62, 0.4); }
.task-note-add:active { transform: scale(0.92); }

/* The append-only notes feed: every posted note stacks below the last. */
.task-note-public { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.task-note-pub {
  font-size: 12px;
  line-height: 1.4;
  color: var(--rf-text-secondary);
  background: var(--rf-surface-2, #f6f2ee);
  border-left: 3px solid var(--rf-primary, #8b1a3a);
  border-radius: 0 6px 6px 0;
  padding: 5px 9px;
  white-space: pre-wrap;
  word-break: break-word;
}
/* Your own notes get the brand accent so you can spot them in the feed. */
.task-note-pub.mine { border-left-color: var(--rf-danger, #d6293e); }
.task-note-pub-text { display: block; }
.task-note-pub-text.editable { cursor: text; border-radius: 4px; }
.task-note-pub-text.editable:hover { background: rgba(214, 41, 62, 0.08); box-shadow: 0 0 0 4px rgba(214, 41, 62, 0.08); }
/* Inline editor shown when you click your own note. */
.task-note-pub.editing { padding: 6px; }
.task-note-edit {
  width: 100%; box-sizing: border-box; resize: none; overflow: hidden;
  font: inherit; font-size: 12px; line-height: 1.4;
  color: var(--rf-text-primary, #2b2722);
  background: var(--rf-surface, #fff);
  border: 1px solid var(--rf-primary, #8b1a3a);
  border-radius: 5px; padding: 5px 7px;
}
[data-rf-dark="true"] .task-note-edit { background: rgba(255,255,255,0.06); color: #f1ece6; }
.task-note-edit-actions { display: flex; gap: 6px; margin-top: 5px; }
.task-note-edit-actions button {
  font-size: 11px; padding: 3px 10px; border-radius: 5px; cursor: pointer; border: none;
}
.task-note-esave { background: var(--rf-primary, #8b1a3a); color: #fff; }
.task-note-esave:hover { filter: brightness(1.08); }
.task-note-ecancel { background: var(--rf-surface-2, #ece6df); color: var(--rf-text-secondary, #5b544c); }
.task-note-ecancel:hover { filter: brightness(0.96); }
.task-note-pub-meta {
  display: flex; align-items: center; gap: 6px; margin-top: 2px;
  font-size: 10.5px; color: var(--rf-text-tertiary, #9a9088);
}
.task-note-pub-by { font-style: italic; }
.task-note-pub-when { opacity: 0.85; }
.task-note-del {
  margin-left: auto; flex: 0 0 auto;
  width: 18px; height: 18px; padding: 0; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%; cursor: pointer;
  background: transparent; color: var(--rf-text-tertiary, #9a9088);
  font-size: 15px; transition: background .15s, color .15s;
}
.task-note-del:hover { background: var(--rf-danger, #d6293e); color: #fff; }
[data-rf-dark="true"] .task-note-pub { background: rgba(255,255,255,0.04); }

.task-badge {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
}

.badge-approval { background: #fef3c7; color: #d97706; }
.badge-comments { background: #dbeafe; color: #2563eb; }
.badge-subtasks { background: #f3e8ff; color: #7c3aed; }

/* ── Task Detail Panel ──────────────────────────────────────────────────── */

.task-detail-panel {
  background: var(--rf-bg-card-alpha);
  backdrop-filter: blur(20px);
  border-radius: var(--rf-radius-2xl);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 10px 40px var(--rf-border-light);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.detail-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--rf-text-tertiary);
  padding: 40px;
}

.detail-empty-icon { font-size: 64px; margin-bottom: 16px; }

.detail-header {
  padding: 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  flex: 0 0 auto; /* never collapse the task identity on a short panel */
}

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

.detail-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--rf-text-primary);
  flex: 1;
}

.detail-actions {
  display: flex;
  gap: 8px;
}

/* Detail meta is a responsive grid of label-above-value cells, so the fields stay
   aligned in tidy columns instead of wrapping unevenly. auto-fit collapses to fewer
   columns on a narrow panel; hidden cells (display:none) drop out cleanly. */
.detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px 22px;
  align-items: start;
}

.meta-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  font-size: 13px;
  color: var(--rf-text-secondary);
}

/* Label sits on its own row above the control (uppercase muted, matching the
   PRODUCT TYPE label) so every field reads the same way. */
.meta-item > span:first-child {
  flex-basis: 100%;
  flex-shrink: 0;
  padding-top: 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--rf-text-tertiary, #888);
}

.meta-item strong { color: var(--rf-text-primary); font-weight: 600; }

#detailAssigned {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 4px;
  width: 100%;
  /* A long assignee list used to grow the header without bound and squash the
     message thread below it. Cap it to ~3 rows with a scroll, and let the user
     drag the bottom edge to make it taller/shorter to taste. */
  min-height: 34px;
  /* fitDetailAssignedHeight() sizes this to the chips, capped at ~3 rows;
     beyond that it scrolls. max-height only bounds a manual drag. */
  max-height: 60vh;
  overflow-y: auto;
  resize: vertical;       /* drag the bottom edge to size it yourself */
  padding-bottom: 2px;
}

#detailAssigned .user-chip {
  padding: 4px 10px;
  font-size: 12px;
}

/* Status / Priority selects */
.status-select, .priority-select {
  padding: 6px 12px;
  border-radius: var(--rf-radius-sm);
  border: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
}

/* Status colors - colorful label system */
.status-select { background: #f3f4f6; color: var(--rf-text-primary); }
.status-select.sent_to_sales { background: #f6c445; color: #1a1a1a; }
.status-select.action_needed { background: #e8697d; color: #fff; }
.status-select.in_programming { background: #e861ab; color: #fff; }
.status-select.resolution { background: #6dd4a0; color: #1a1a1a; }
.status-select.waiting_on_web { background: #9776d1; color: #fff; }
.status-select.waiting_on_accounting { background: #e861ab; color: #fff; }
.status-select.waiting_on_customer { background: #54c4d4; color: #1a1a1a; }
.status-select.shop_working_on_it { background: #a89984; color: #fff; }
.status-select.on_hold { background: #54a6d4; color: #fff; }
.status-select.under_evaluation { background: #d4c854; color: #1a1a1a; }
.status-select.done { background: #6dd4a0; color: #1a1a1a; }
.status-select.cs_working_on_it { background: #707070; color: #fff; }
.status-select.processing { background: #e8697d; color: #fff; }
.status-select.custom { background: #4a5568; color: #fff; }

/* Status badge colors for task list */
.task-status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.task-status-badge.sent_to_sales { background: #f6c445; color: #1a1a1a; }
.task-status-badge.action_needed { background: #e8697d; color: #fff; }
.task-status-badge.in_programming { background: #e861ab; color: #fff; }
.task-status-badge.resolution { background: #6dd4a0; color: #1a1a1a; }
.task-status-badge.waiting_on_web { background: #9776d1; color: #fff; }
.task-status-badge.waiting_on_accounting { background: #e861ab; color: #fff; }
.task-status-badge.waiting_on_customer { background: #54c4d4; color: #1a1a1a; }
.task-status-badge.shop_working_on_it { background: #a89984; color: #fff; }
.task-status-badge.on_hold { background: #54a6d4; color: #fff; }
.task-status-badge.under_evaluation { background: #d4c854; color: #1a1a1a; }
.task-status-badge.done { background: #6dd4a0; color: #1a1a1a; }
.task-status-badge.cs_working_on_it { background: #707070; color: #fff; }
.task-status-badge.processing { background: #e8697d; color: #fff; }
.task-status-badge.custom { background: #4a5568; color: #fff; }

/* Custom status input */
.custom-status-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.custom-status-input {
  flex: 1;
  padding: 6px 12px;
  border-radius: var(--rf-radius-sm);
  border: 1px solid rgba(0, 0, 0, 0.15);
  font-size: 13px;
  outline: none;
}
.custom-status-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* ── Detail Tabs ────────────────────────────────────────────────────────── */

.detail-tabs {
  display: flex;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding: 0 24px;
  overflow-x: auto;
  /* overflow-x:auto makes this flex item's auto-min-size 0, so on a short
     panel the column would crush the tabs row to nothing (just a scrollbar) —
     the bug where teammates on small laptops "lost" the tabs. Pin it so only
     the message body shrinks/scrolls. */
  flex: 0 0 auto;
}

.detail-tab {
  padding: 16px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--rf-text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.detail-tab:hover { color: var(--rf-primary); }
.detail-tab.active { color: var(--rf-primary); border-bottom-color: var(--rf-primary); }

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: var(--rf-radius-sm);
  background: rgba(var(--rf-primary-rgb), 0.1);
  color: var(--rf-primary);
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
}

.detail-body {
  /* Claim all remaining panel height so the message thread is as large as the
     window allows (it was content-sized, so a tall assignee header used to
     squash it to a sliver). min-height:0 keeps it scrollable. */
  flex: 1 1 0;
  min-height: 120px;
  overflow-y: auto;
  padding: 24px;
}

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

/* ── Conversation Tab ───────────────────────────────────────────────────── */

.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.conversation-item {
  display: flex;
  gap: 12px;
}

.conversation-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rf-primary), #dc2f5a);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

.conversation-bubble {
  flex: 1;
  background: rgba(0, 0, 0, 0.03);
  border-radius: var(--rf-radius-lg);
  padding: 14px 18px;
}

.conversation-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.conversation-author {
  font-size: 13px;
  font-weight: 600;
  color: var(--rf-text-primary);
}

.conversation-time {
  font-size: 11px;
  color: var(--rf-text-tertiary);
}

.conversation-text {
  font-size: 14px;
  color: var(--rf-text-secondary);
  line-height: 1.5;
}

/* ── Email Preview Card ─────────────────────────────────────────────────── */

.email-preview-card {
  background: linear-gradient(135deg, #f0f4ff, #e8f0fe);
  border: 1px solid #c8d6e5;
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 16px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  position: relative;
  transition: box-shadow 0.15s;
}

.email-preview-card:hover {
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.12);
}

.email-preview-card.loading {
  padding: 14px 18px;
  justify-content: center;
  align-items: center;
}

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

.email-preview-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--rf-radius-sm);
  background: linear-gradient(135deg, #1a73e8, #4285f4);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.email-preview-icon .material-icons-outlined { font-size: 20px; }

.email-preview-body {
  flex: 1;
  min-width: 0;
}

.email-preview-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #1a73e8;
  margin-bottom: 4px;
}

.email-preview-subject {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--rf-text-primary);
  margin-bottom: 6px;
  line-height: 1.3;
}

.email-preview-from {
  font-size: 0.82rem;
  color: var(--rf-text-primary);
  margin-bottom: 2px;
}

.email-preview-addr {
  color: var(--rf-text-secondary);
  font-weight: 400;
}

.email-preview-to {
  font-size: 0.78rem;
  color: var(--rf-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-preview-date {
  font-size: 0.75rem;
  color: var(--rf-text-tertiary);
  margin-top: 4px;
}

.email-preview-snippet {
  font-size: 0.82rem;
  color: var(--rf-text-secondary);
  margin-top: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.email-preview-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.email-preview-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #1a73e8, #4285f4);
  color: white;
  border-radius: var(--rf-radius-xl);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.15s;
}

.email-preview-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(26, 115, 232, 0.3);
}

.email-preview-link .material-icons-outlined { font-size: 16px; }

.email-preview-note {
  font-size: 0.82rem;
  color: var(--rf-text-tertiary);
  font-style: italic;
}

/* ── Full Email Viewer Card ─────────────────────────────────────────────── */

.email-full-card {
  background: linear-gradient(135deg, #f0f4ff, #e8f0fe);
  border: 1px solid #c8d6e5;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 16px;
}

.email-full-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.email-full-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.email-full-header-right {
  flex-shrink: 0;
  margin-left: 12px;
}

.email-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  color: var(--rf-text-secondary);
}

.email-toggle-btn:hover {
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  color: #1a73e8;
}

.email-full-meta {
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.5);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.email-full-body {
  background: white;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.email-full-body iframe {
  display: block;
}

/* Attachments */
.email-attach-list {
  padding: 10px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  background: rgba(255, 255, 255, 0.4);
}

.email-attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  background: var(--rf-bg-card-alpha);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--rf-radius-xl);
  font-size: 0.82rem;
  color: var(--rf-text-primary);
}

/* Reply Section */
.email-reply-section {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.35);
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.email-reply-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #1a73e8, #4285f4);
  color: white;
  border: none;
  border-radius: var(--rf-radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.email-reply-btn:hover {
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.35);
  transform: translateY(-1px);
}

.email-reply-btn .material-icons-outlined { font-size: 18px; }

.email-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--rf-radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--rf-text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
}

.email-open-btn:hover {
  background: white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  color: #1a73e8;
}

.email-open-btn .material-icons-outlined { font-size: 16px; }

/* Reply Form */
.email-reply-form {
  border-top: 1px solid var(--rf-border-light);
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.6);
}

.reply-form-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--rf-text-primary);
  margin-bottom: 12px;
}

.reply-form-header .material-icons-outlined { font-size: 20px; }

.reply-form-textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px 14px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--rf-radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.6;
  resize: vertical;
  color: var(--rf-text-primary);
  background: white;
  transition: border-color 0.2s;
}

.reply-form-textarea:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

.reply-form-textarea::placeholder { color: var(--rf-text-tertiary); }

.reply-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.reply-form-cancel {
  padding: 8px 18px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--rf-radius-sm);
  background: white;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--rf-text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.reply-form-cancel:hover {
  background: #f3f4f6;
  color: var(--rf-text-primary);
}

.reply-form-send {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  background: linear-gradient(135deg, #1a73e8, #4285f4);
  color: white;
  border: none;
  border-radius: var(--rf-radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.reply-form-send:hover {
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.35);
  transform: translateY(-1px);
}

.reply-form-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.reply-form-send .material-icons-outlined { font-size: 16px; }

.conversation-activity {
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: var(--rf-radius-md);
  font-size: 13px;
  color: var(--rf-text-secondary);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* "Seen by" — viewers of the task, shown atop the Activity tab */
.task-seenby {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.task-seenby-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rf-text-tertiary);
  margin-bottom: 8px;
}
.task-seenby-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.task-seen-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--rf-border-light);
  font-size: 12px;
  color: var(--rf-text-secondary);
  white-space: nowrap;
}
.task-seen-chip .t {
  font-size: 11px;
  color: var(--rf-text-tertiary);
  font-variant-numeric: tabular-nums;
}

.activity-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--rf-radius-sm);
  background: rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

/* ── Comment Input ──────────────────────────────────────────────────────── */

.comment-input-area {
  padding: 20px 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(0, 0, 0, 0.02);
  flex: 0 0 auto; /* composer always visible — only the message body scrolls */
}

.comment-input-box {
  display: flex;
  gap: 12px;
  background: white;
  border-radius: var(--rf-radius-lg);
  padding: 12px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.comment-input-box textarea {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  resize: none;
  min-height: 40px;
  font-family: inherit;
}

.comment-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

/* ── Subtasks Tab ───────────────────────────────────────────────────────── */

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

.subtask-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: var(--rf-radius-md);
  transition: all 0.2s;
}

.subtask-item:hover { background: rgba(0, 0, 0, 0.04); }

.subtask-title {
  flex: 1;
  font-size: 14px;
}

.subtask-item.completed .subtask-title {
  text-decoration: line-through;
  color: var(--rf-text-tertiary);
}

.add-subtask-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border: 2px dashed rgba(0, 0, 0, 0.1);
  border-radius: var(--rf-radius-md);
  cursor: pointer;
  font-size: 14px;
  color: var(--rf-text-secondary);
  transition: all 0.2s;
}

.add-subtask-btn:hover { border-color: var(--rf-primary); color: var(--rf-primary); }

/* ── Approvals Tab ──────────────────────────────────────────────────────── */

.approval-item {
  background: rgba(0, 0, 0, 0.02);
  border-radius: var(--rf-radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

/* ── Order Info Cards ───────────────────────────────────────────────────── */

.order-card {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid var(--rf-border-light);
  border-radius: var(--rf-radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

.order-card.work-order {
  border-left: 4px solid #3b82f6;
}

.order-card.sales-order {
  border-left: 4px solid var(--rf-success);
}

.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.order-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.order-card-title h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--rf-text-primary);
}

.order-type-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--rf-radius-xl);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.order-type-badge.wo {
  background: #dbeafe;
  color: #1d4ed8;
}

.order-type-badge.so {
  background: #d1fae5;
  color: #059669;
}

.order-card-body {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.order-field {
  display: flex;
  flex-direction: column;
}

.order-field.full-width {
  grid-column: 1 / -1;
}

.order-field-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--rf-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.order-field-value {
  font-size: 14px;
  color: var(--rf-text-primary);
  font-weight: 500;
}

.order-field-value.notes {
  font-weight: 400;
  white-space: pre-wrap;
  background: rgba(255, 255, 255, 0.7);
  padding: 10px;
  border-radius: var(--rf-radius-sm);
  font-size: 13px;
  line-height: 1.5;
}

.order-shipping-address {
  background: rgba(255, 255, 255, 0.8);
  border-radius: var(--rf-radius-md);
  padding: 16px;
  margin-top: 12px;
}

.order-shipping-address h5 {
  margin: 0 0 12px 0;
  font-size: 13px;
  color: var(--rf-text-secondary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.order-shipping-address p {
  margin: 0;
  font-size: 14px;
  color: var(--rf-text-primary);
  line-height: 1.6;
}

.order-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--rf-text-secondary);
}

.order-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--rf-radius-md);
  padding: 16px;
  color: var(--rf-danger);
  font-size: 14px;
}

.no-orders {
  text-align: center;
  padding: 40px;
  color: var(--rf-text-tertiary);
}

.link-order-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #f1f5f9;
  border: 1px dashed #cbd5e1;
  border-radius: var(--rf-radius-sm);
  color: var(--rf-text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 12px;
}

.link-order-btn:hover {
  background: var(--rf-border-light);
  border-color: #94a3b8;
  color: #475569;
}

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

.approval-status {
  padding: 4px 12px;
  border-radius: var(--rf-radius-sm);
  font-size: 12px;
  font-weight: 600;
}

.approval-status.pending { background: #fef3c7; color: #d97706; }
.approval-status.approved { background: #dcfce7; color: var(--rf-success); }
.approval-status.denied { background: #fee2e2; color: var(--rf-danger); }

.approval-text {
  font-size: 14px;
  color: var(--rf-text-primary);
  margin-bottom: 12px;
}

.approval-meta {
  font-size: 12px;
  color: var(--rf-text-secondary);
}

.approval-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

/* ── Attachments Tab ────────────────────────────────────────────────────── */

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

.attachment-card {
  background: rgba(0, 0, 0, 0.02);
  border-radius: var(--rf-radius-md);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.attachment-card:hover { background: rgba(0, 0, 0, 0.04); }

.attachment-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.attachment-name {
  font-size: 12px;
  color: var(--rf-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-size {
  font-size: 11px;
  color: var(--rf-text-tertiary);
}

/* ── Legacy Button Compat (dual-class: .btn maps to design system) ────── */
/* Keep .btn-icon sizing for icon-only buttons in task detail */
.btn-icon { width: 36px; height: 36px; padding: 0; }

/* ── User Picker ────────────────────────────────────────────────────────── */

.user-picker {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--rf-radius-md);
  overflow: hidden;
}

.user-picker-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  min-height: 48px;
  background: white;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(var(--rf-primary-rgb), 0.1);
  border-radius: var(--rf-radius-xl);
  font-size: 13px;
  color: var(--rf-primary);
}

.user-chip-remove {
  cursor: pointer;
  opacity: 0.6;
  font-weight: bold;
}

.user-chip-remove:hover { opacity: 1; }

.user-picker-dropdown {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  max-height: 300px;
  overflow-y: auto;
  background: #fafafa;
}

.user-picker-search {
  padding: 12px;
  background: white;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 1;
}

.user-picker-search input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--rf-radius-sm);
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

.user-picker-search input:focus {
  border-color: var(--rf-primary);
}

.user-picker-list {
  max-height: 240px;
  overflow-y: auto;
}

.user-picker-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.15s;
}

.user-picker-item:hover { background: rgba(var(--rf-primary-rgb), 0.08); }

/* Clear, unmistakable selected state: tinted bg + inset accent bar + ring + bold name. */
.user-picker-item.selected {
  background: rgba(var(--rf-primary-rgb), 0.16);
  box-shadow: inset 3px 0 0 var(--rf-primary), inset 0 0 0 1px rgba(var(--rf-primary-rgb), 0.45);
}
.user-picker-item.selected .user-picker-name { color: var(--rf-primary); font-weight: 700; }
.user-picker-item.selected .user-picker-avatar { box-shadow: 0 0 0 2px var(--rf-primary); }

.user-picker-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rf-primary), #dc2f5a);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: 600;
}

.user-picker-name { font-size: 14px; }
.user-picker-dept { font-size: 12px; color: var(--rf-text-tertiary); margin-left: auto; }

.no-users { padding: 20px; text-align: center; color: var(--rf-text-tertiary); font-size: 14px; }

/* ── Form Row Layout ────────────────────────────────────────────────────── */

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 1200px) {
  .tasks-layout { grid-template-columns: 1fr; }
  .task-detail-panel { display: none; }
  .task-detail-panel.mobile-show { display: flex; position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 200; border-radius: 0; }
}

@media (max-width: 768px) {
  .counters-row { flex-direction: column; }
  .counter-card { min-width: 100%; }

  /* Calendar sidebar: hide inside modal on mobile */
  .calendar-sidebar { display: none; }

  /* Filter/search area: ensure wrapping */
  .list-filters { flex-wrap: wrap; gap: 8px; }
  .search-box { margin-top: 8px; }

  /* Notification dropdown: fit on small screens */
  .notification-dropdown {
    width: calc(100vw - 20px);
    max-width: 420px;
    right: -10px;
  }

  /* Calendar modal: full width on mobile */
  #taskCalendarModal .modal { max-width: 100%; margin: 10px; }
  #calendarViewTab { flex-direction: column; }
}

@media (max-width: 480px) {
  /* Reduce counter card padding */
  .counter-card { padding: 14px 16px; gap: 12px; }
  .counter-card .counter-value { font-size: 22px; }
  .counter-card .counter-label { font-size: 12px; }

  /* Task items: tighter layout */
  .task-item { padding: 12px; gap: 10px; }
  .task-item-title { font-size: 13px; }
  .task-item-meta { gap: 8px; font-size: 11px; }
  .task-item-badges { gap: 4px; }
  .task-badge { font-size: 9px; padding: 2px 6px; }

  /* Hide assignee names on very small screens */
  .task-assignees { display: none; }

  /* List header: tighter padding */
  .list-header { padding: 14px; }
  .filter-btn { padding: 6px 12px; font-size: 12px; }

  /* Tasks layout: account for shell mobile toggle */
  .tasks-layout { height: calc(100vh / var(--rf-app-zoom, 1) - 84px); min-height: 400px; }
  .tasks-layout { height: calc(100dvh / var(--rf-app-zoom, 1) - 84px); } /* dvh tracks URL-bar */

  /* Notification dropdown: full width minus small margin */
  .notification-dropdown {
    width: calc(100vw - 16px);
    right: -8px;
    max-height: 70vh;
  }
  .notification-dropdown-header { padding: 14px; }
  .notification-dropdown-header h3 { font-size: 16px; }

  /* Task detail panel mobile overlay: tighter padding */
  .task-detail-panel.mobile-show { padding: 0; }
}

/* ============================================================================
   2026 PREMIUM SWEEP OVERRIDES
   ============================================================================ */

.tasks-layout {
  gap: 16px;
}

.task-list-panel,
.task-detail-panel,
.calendar-sidebar,
.notification-dropdown {
  background: linear-gradient(180deg, rgba(255,255,255,0.86), rgba(255,255,255,0.72));
  border: 1px solid rgba(33, 30, 52, 0.10);
  border-radius: 20px;
  box-shadow: 0 10px 24px rgba(31, 29, 48, 0.08);
}

.list-header,
.task-detail-header,
.task-detail-footer {
  border-color: rgba(33, 30, 52, 0.10);
  background: rgba(255,255,255,0.65);
}

.counter-card {
  border: 1px solid rgba(33, 30, 52, 0.10);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.88), rgba(255,255,255,0.72));
  box-shadow: 0 8px 20px rgba(31, 29, 48, 0.07);
}

.counter-card.active {
  background: linear-gradient(135deg, rgba(111, 87, 232, 0.94), rgba(145, 123, 246, 0.92));
  box-shadow: 0 12px 26px rgba(111, 87, 232, 0.24);
}

.dept-counter {
  border-radius: 999px;
  box-shadow: 0 6px 14px rgba(31, 29, 48, 0.12);
}

.task-item {
  border: 1px solid rgba(33, 30, 52, 0.08);
  border-radius: 14px;
  margin: 8px 10px;
  background: rgba(255,255,255,0.68);
}

.task-item:hover {
  background: rgba(111, 87, 232, 0.06);
  border-color: rgba(111, 87, 232, 0.22);
}

.task-item.selected {
  background: rgba(111, 87, 232, 0.10);
}

.search-box input,
.list-filters select,
.list-filters .rf-input {
  border-radius: 12px;
  border-color: rgba(33, 30, 52, 0.14);
  background: rgba(255,255,255,0.84);
}

.task-badge {
  border-radius: 999px;
  font-weight: 650;
}

/* Executive Luxury reset */
.task-list-panel,
.task-detail-panel,
.calendar-sidebar,
.notification-dropdown,
.counter-card {
  border-radius: 14px !important;
}

.counter-card.active {
  background: linear-gradient(135deg, rgba(95, 36, 53, 0.95), rgba(123, 51, 73, 0.92)) !important;
  box-shadow: 0 10px 22px rgba(95, 36, 53, 0.22) !important;
}

.task-item {
  border-radius: 10px !important;
}

.task-item:hover,
.task-item.selected {
  background: rgba(95, 36, 53, 0.08) !important;
  border-color: rgba(95, 36, 53, 0.22) !important;
}

.dept-counter,
.task-badge {
  border-radius: 10px !important;
}

/* remove purple accents */
.dept-counter.dept-employee,
.dept-counter.dept-self {
  background: #5f2435 !important;
}

.calendar-task.one-time,
.upcoming-task-badge.one-time,
.badge-subtasks,
.calendar-tab.active {
  background: rgba(95, 36, 53, 0.10) !important;
  color: #5f2435 !important;
  border-bottom-color: #5f2435 !important;
}

.upcoming-task-item:hover {
  border-color: rgba(95, 36, 53, 0.28) !important;
}

.day-checkbox:hover,
.reminder-checkbox:hover {
  border-color: rgba(95, 36, 53, 0.45) !important;
  background: rgba(95, 36, 53, 0.06) !important;
}

.day-checkbox:has(input:checked),
.reminder-checkbox:has(input:checked) {
  background: #5f2435 !important;
  border-color: #5f2435 !important;
}

.calendar-day:hover,
.calendar-day.today {
  border-color: rgba(95, 36, 53, 0.45) !important;
  background: rgba(95, 36, 53, 0.06) !important;
  box-shadow: 0 2px 8px rgba(95, 36, 53, 0.10) !important;
}

.calendar-day.today .calendar-day-number {
  background: #5f2435 !important;
}

/* ── Mobile polish (≤480px) — page-scoped, added 2026-06-06 ── */
@media (max-width: 480px) {
  .rf-page-actions { flex-wrap: wrap; gap: 8px; width: 100%; }
  .rf-page-actions .rf-btn[onclick*="openRecurringTaskModal"],
  .rf-page-actions .rf-btn[onclick*="openTaskCalendar"] { margin-left: 0 !important; }
  .rf-page-actions > .rf-btn { flex: 1 1 auto; min-height: 44px; justify-content: center; }
  .notification-bell-container { flex: 0 0 auto; }

  .form-row { grid-template-columns: 1fr; gap: 12px; }

  #newTaskModal .rf-modal, #editTaskModal .rf-modal, #addSubtaskModal .rf-modal,
  #requestApprovalModal .rf-modal, #editApprovalModal .rf-modal,
  #recurringTaskModal .rf-modal, #editRecurringTaskModal .rf-modal,
  #taskCalendarModal .rf-modal { max-width: 100% !important; width: calc(100vw - 16px); margin: 8px; }

  .detail-actions .rf-btn-icon, .detail-actions .btn-icon,
  .comment-actions .rf-btn-icon, .comment-actions .btn-icon { width: 44px; height: 44px; }

  .detail-title { font-size: 18px; }
  .detail-header { padding: 16px; }
  .detail-body { padding: 16px; }
  .comment-input-area { padding: 14px 16px; }

  .order-card-body { grid-template-columns: 1fr; }
  .order-card { padding: 16px; }

  .notification-tabs { gap: 4px; padding: 10px 12px; }
  .notification-tab { padding: 8px 10px; font-size: 12px; }
}

/* ── Message edit support ────────────────────────────────────────────────── */

.conversation-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.msg-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s;
  line-height: 1;
}

.conversation-item:hover .msg-edit-btn {
  opacity: 1;
}

.msg-edited-badge {
  font-size: 10px;
  color: var(--rf-text-tertiary);
  font-style: italic;
}

.msg-edit-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--rf-border);
  border-radius: var(--rf-radius);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  background: var(--rf-surface);
  color: var(--rf-text-primary);
  box-sizing: border-box;
}

.msg-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

/* ── Groups & Self views ─────────────────────────────────────────────────── */

#groupsView, #ungroupedView {
  display: none;
}

/* Both alternate views hide the standard task UI and reveal their own panel. */
.page-container.groups-mode .rf-page-header,
.page-container.ungrouped-mode .rf-page-header,
.page-container.groups-mode .counters-row,
.page-container.ungrouped-mode .counters-row,
.page-container.groups-mode .dept-counters-row,
.page-container.ungrouped-mode .dept-counters-row,
.page-container.groups-mode .mini-counters-row,
.page-container.ungrouped-mode .mini-counters-row,
.page-container.groups-mode .tasks-layout,
.page-container.ungrouped-mode .tasks-layout { display: none; }

.page-container.groups-mode #groupsView { display: block; }
.page-container.ungrouped-mode #ungroupedView { display: block; }

.groups-view-header {
  margin-bottom: 24px;
}

/* Groups tab: sticky live filter bar above the group list */
.groups-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--rf-surface, #fff);
  padding: 8px 0 12px;
  margin-bottom: 4px;
}
.groups-filter-icon {
  font-size: 14px;
  opacity: 0.6;
  flex: 0 0 auto;
}
.groups-filter-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 9px 12px;
  font-size: 14px;
  border: 1px solid var(--rf-border);
  border-radius: var(--rf-radius-md, 8px);
  background: var(--rf-surface);
  color: var(--rf-text-primary);
}
.groups-filter-input:focus {
  outline: none;
  border-color: var(--rf-primary, #6e1530);
  box-shadow: 0 0 0 3px rgba(110, 21, 48, 0.12);
}
.groups-filter-count {
  font-size: 12px;
  color: var(--rf-text-tertiary);
  white-space: nowrap;
  flex: 0 0 auto;
}

/* Manage Groups modal: archived ("backup") groups */
.manage-archived-divider {
  margin: 14px 2px 6px;
  padding-top: 10px;
  border-top: 1px dashed var(--rf-border, #e2e8f0);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--rf-text-tertiary);
}
.group-row-archived {
  opacity: 0.7;
  background: rgba(0, 0, 0, 0.02);
}
.group-backup-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--rf-text-tertiary);
  background: var(--rf-surface-2, rgba(0, 0, 0, 0.06));
  border: 1px solid var(--rf-border, #e2e8f0);
  vertical-align: middle;
}

.group-section {
  background: var(--rf-surface);
  border: 1px solid var(--rf-border);
  border-radius: var(--rf-radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
}

.group-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(0,0,0,0.02);
  border-bottom: 1px solid var(--rf-border);
  padding-left: 16px;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}
.group-section-header:hover {
  background: rgba(0,0,0,0.05);
}
/* Collapsed sections drop the header's bottom divider (no body below it) */
.group-section:not(.is-open) .group-section-header {
  border-bottom: none;
}

.group-section-name {
  display: flex;
  align-items: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--rf-text-primary);
}

.group-section-caret {
  display: inline-block;
  width: 1em;
  margin-right: 6px;
  font-size: 11px;
  color: var(--rf-text-tertiary);
}

.group-section-count {
  font-size: 12px;
  color: var(--rf-text-tertiary);
}

.group-tasks-list {
  padding: 4px 0;
}

.group-task-row {
  display: grid;
  grid-template-columns: 160px 1fr 160px 100px;
  gap: 12px;
  align-items: center;
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.1s;
  font-size: 13px;
  border-bottom: 1px solid var(--rf-border-subtle, rgba(0,0,0,0.05));
}

.group-task-row:last-child {
  border-bottom: none;
}

.group-task-row:hover {
  background: var(--rf-hover, rgba(0,0,0,0.03));
}

.group-task-done {
  opacity: 0.6;
}

.group-task-done .group-task-title {
  text-decoration: line-through;
  color: var(--rf-text-tertiary);
}

.group-task-status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 100px;
  background: rgba(110,21,48,0.1);
  color: var(--rf-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-task-status-pill[data-status="done"] {
  background: rgba(34,197,94,0.1);
  color: #16a34a;
}

.group-task-status-pill[data-status="action_needed"] {
  background: rgba(239,68,68,0.12);
  color: #dc2626;
}

.group-task-status-pill[data-status="on_hold"] {
  background: rgba(156,163,175,0.2);
  color: var(--rf-text-secondary);
}

.group-task-title {
  font-size: 13px;
  color: var(--rf-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-task-meta {
  font-size: 12px;
  color: var(--rf-text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-task-due {
  font-size: 12px;
  color: var(--rf-text-tertiary);
  text-align: right;
}

.group-done-divider {
  font-size: 11px;
  font-weight: 600;
  color: var(--rf-text-tertiary);
  padding: 8px 18px 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.group-no-tasks {
  padding: 16px 18px;
  color: var(--rf-text-tertiary);
  font-size: 13px;
}

@media (max-width: 768px) {
  .group-task-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .group-task-status-pill { display: inline-block; }
  .group-task-due { text-align: left; }
}

/* ── Work Order / Sales Order / Link chips (task list row + detail header) ──
   WO (green) + SO (blue) are click-to-copy buttons; Link (red) opens the URL in a
   new tab. Each chip is a real <button>. */
.wo-so-chips { display: inline-flex; flex-wrap: wrap; gap: 6px; vertical-align: middle; }
.wo-so-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: var(--rf-radius-md);
  font-size: 11px; font-weight: 600; line-height: 1.5;
  border: 1px solid transparent; max-width: 100%;
  cursor: pointer; font-family: inherit; background: none; text-decoration: none;
  transition: filter .12s, transform .06s;
}
.wo-so-chip:hover { filter: brightness(0.96); }
.wo-so-chip:active { transform: scale(.97); }
.wo-so-chip.wo   { background: var(--rf-success-bg, #e7f4ec); color: var(--rf-success-text, #1c6b3f); border-color: var(--rf-success-light, #bfe3cd); }
.wo-so-chip.so   { background: var(--rf-info-bg, #e8f1fc);    color: var(--rf-info-text, #1e5fb0);    border-color: var(--rf-info-light, #bcd9f5); }
.wo-so-chip.link { background: var(--rf-danger-bg, #fdeaea);  color: var(--rf-danger-text, #b42424);  border-color: var(--rf-danger-light, #f3b9b9); }
.wo-so-chip .wo-so-label { font-weight: 800; letter-spacing: .04em; opacity: .85; }
.wo-so-chip .wo-so-val { font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.wo-so-chip .wo-so-ico { opacity: .65; font-size: 12px; line-height: 1; }
.wo-so-chip:hover .wo-so-ico { opacity: 1; }

/* Detail-header variant — sits inline next to the title, at the title's text size. */
.detail-wo-so:empty { display: none; }
.wo-so-chips.detail { gap: 8px; }
.wo-so-chips.detail .wo-so-chip { padding: 2px 12px; border-radius: var(--rf-radius-lg, 12px); }
.wo-so-chips.detail .wo-so-label { font-size: 12px; }
.wo-so-chips.detail .wo-so-val { font-size: 22px; max-width: 360px; }
.wo-so-chips.detail .wo-so-ico { font-size: 17px; }

/* Title row: title + inline WO/SO/Link chips on the left, actions on the right. */
.detail-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; flex: 1; min-width: 0; }
.detail-title-row .detail-title { flex: 0 1 auto; }
.detail-header-top .detail-actions { flex: 0 0 auto; }

/* List row: chips sit inline after the task number on the title line. */
.task-item-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.task-item-title .task-item-title-text { min-width: 0; }

/* ── Est Ship Date Updates: group info page (countdown buckets) ── */
.gi-wrap { padding: 32px 28px; max-width: 720px; margin: 0 auto; width: 100%; }
.gi-eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--rf-text-tertiary); }
.gi-title { font-size: 26px; font-weight: 800; margin: 4px 0 6px; color: var(--rf-text-primary, #1c1c1e); }
.gi-sub { font-size: 13px; color: var(--rf-text-secondary); }
.gi-section-title { margin: 26px 0 12px; font-size: 13px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--rf-text-secondary); }
.gi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.gi-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 14px 16px; border-radius: 14px; cursor: pointer; text-align: left;
  background: var(--rf-surface-2, #f7f7f8);
  border: 1px solid var(--rf-border-light, #ececf0);
  border-left: 4px solid var(--gi, #94a3b8);
  transition: transform .12s, box-shadow .12s, background .12s;
}
.gi-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px -14px rgba(0,0,0,.4); }
.gi-card .gi-card-count { font-size: 28px; font-weight: 800; line-height: 1; color: var(--gi, #1c1c1e); font-variant-numeric: tabular-nums; }
.gi-card .gi-card-label { font-size: 12px; font-weight: 700; color: var(--rf-text-secondary); }
.gi-card.active { background: var(--gi, #6e1530); border-color: var(--gi, #6e1530); }
.gi-card.active .gi-card-count, .gi-card.active .gi-card-label { color: #fff; }
.gi-filter-note { margin-top: 18px; font-size: 13px; color: var(--rf-text-secondary); }
.gi-hint { margin-top: 18px; font-size: 12px; color: var(--rf-text-tertiary); }
.gi-clear { border: none; background: none; color: var(--rf-primary, #6e1530); font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline; font-size: 13px; }
@media (max-width: 900px) { .gi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .gi-wrap { padding: 22px 16px; } }

/* Promised ship-date calendar (group info page) */
.gi-cal { border: 1px solid var(--rf-border-light, #ececf0); border-radius: 14px; padding: 12px; background: var(--rf-surface, #fff); }
.gi-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.gi-cal-month { font-weight: 800; font-size: 15px; color: var(--rf-text-primary, #1c1c1e); }
.gi-cal-nav { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--rf-border-light, #ececf0); background: var(--rf-surface-2, #f7f7f8); cursor: pointer; font-size: 16px; line-height: 1; color: var(--rf-text-secondary); }
.gi-cal-nav:hover { background: var(--rf-border-light, #ececf0); color: var(--rf-text-primary, #1c1c1e); }
.gi-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.gi-cal-dow { text-align: center; font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--rf-text-tertiary); padding-bottom: 4px; }
.gi-cal-cell { min-height: 46px; border-radius: 9px; }
.gi-cal-empty { background: transparent; }
.gi-cal-day {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 5px 7px; border: 1px solid var(--rf-border-light, #ececf0);
  background: var(--rf-surface-2, #f7f7f8); color: var(--rf-text-secondary); cursor: default; text-align: left;
}
.gi-cal-day[disabled] { opacity: .55; }
.gi-cal-day.has-tasks { cursor: pointer; background: rgba(var(--rf-primary-rgb), 0.08); border-color: rgba(var(--rf-primary-rgb), 0.22); color: var(--rf-text-primary, #1c1c1e); }
.gi-cal-day.has-tasks:hover { background: rgba(var(--rf-primary-rgb), 0.16); }
.gi-cal-day.past.has-tasks { background: var(--rf-danger-bg, #fdeaea); border-color: var(--rf-danger-light, #f3b9b9); }
.gi-cal-day.today { outline: 2px solid var(--rf-primary, #6e1530); outline-offset: -2px; }
.gi-cal-day.selected { background: var(--rf-primary, #6e1530) !important; border-color: var(--rf-primary, #6e1530); color: #fff; }
.gi-cal-num { font-size: 12px; font-weight: 700; }
.gi-cal-count {
  align-self: flex-end; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--rf-primary, #6e1530); color: #fff; font-size: 11px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.gi-cal-day.past.has-tasks .gi-cal-count { background: var(--rf-danger, #dc2626); }
.gi-cal-day.selected .gi-cal-count { background: #fff; color: var(--rf-primary, #6e1530); }

/* ── Product-type tags (Wood/Metal door, Hardware, Awning) ───────────────── */
/* Display chip on the task card + detail. Colored by data-type. */
.pt-chip {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 8px; font-size: 11px; font-weight: 600; line-height: 1.6;
  white-space: nowrap; vertical-align: middle;
}
.pt-chip[data-type="wood"]     { background: #f3e8d2; color: #7a5512; }
.pt-chip[data-type="metal"]    { background: #e3eefb; color: #1e5fb0; }
.pt-chip[data-type="hardware"] { background: #ebeae4; color: #4b4b46; }
.pt-chip[data-type="awning"]   { background: #ddf0e8; color: #0f6e56; }

/* Shared colored dot used by the detail toggles + modal checkboxes. */
.pt-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* Third toolbar row: product-type filter pills. */
.type-filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 10px; }
.type-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px;
  border-radius: 999px; font-size: 12px; font-weight: 500; cursor: pointer;
  background: var(--rf-surface-2, #f1f0ec); border: 1px solid var(--rf-border, #e4e4e7);
  color: var(--rf-text-secondary, #555); user-select: none; transition: filter .1s;
}
.type-pill:hover { filter: brightness(0.97); }
.type-pill.active { background: var(--rf-primary, #6e1530); border-color: var(--rf-primary, #6e1530); color: #fff; }
.type-pill-count { font-size: 11px; opacity: .7; font-variant-numeric: tabular-nums; }
.type-pill.active .type-pill-count { opacity: .9; }

/* Inline picker in the open task. */
.detail-product-types-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 2px; }
.detail-pt-label { font-size: 12px; font-weight: 600; color: var(--rf-text-tertiary, #888); text-transform: uppercase; letter-spacing: .04em; }
.detail-product-types { display: flex; flex-wrap: wrap; gap: 6px; }
.pt-toggle {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px;
  border-radius: 999px; font-size: 12.5px; cursor: pointer;
  background: var(--rf-surface, #fff); border: 1px solid var(--rf-border, #e4e4e7);
  color: var(--rf-text-primary, #222); transition: filter .1s, background .1s;
}
.pt-toggle:hover { background: var(--rf-surface-2, #f1f0ec); }
.pt-toggle.on { background: var(--rf-primary-soft, #f5e7ec); border-color: var(--rf-primary, #6e1530); color: var(--rf-primary, #6e1530); font-weight: 600; }
.pt-toggle .pt-check { color: var(--rf-primary, #6e1530); font-weight: 700; }

/* Checkbox picker in the New/Edit Task modals. */
.pt-check-row { display: flex; flex-wrap: wrap; gap: 10px 18px; padding-top: 2px; }
.pt-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; color: var(--rf-text-primary, #222); }
.pt-check input { margin: 0; cursor: pointer; }

/* ── Mobile task detail overlay (≤768px) — added 2026-07-09 ──
   The theme's translucent glass panel reads as depth on desktop (side-by-side),
   but .mobile-show turns the panel into a fixed full-screen overlay, where
   translucency lets the task list bleed through. Overlays must be opaque.
   At the end of the file so it wins the cascade over every theme block. */
@media (max-width: 768px) {
  .task-detail-panel.mobile-show {
    background: var(--rf-bg-card, #fffdf9) !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  /* The overlay owns the whole viewport — hide the floating hamburger + global
     search bar underneath it (the panel's ✕ is the way out). */
  body:has(.task-detail-panel.mobile-show) .rf-sidebar-toggle,
  body:has(.task-detail-panel.mobile-show) .rf-sbar { display: none !important; }
}

/* Mobile detail header: the action cluster (~323px, nowrap) crushed the title
   to ~30px and painted over it. Stack instead — actions row first (✕ stays
   top-right), title on its own full-width line below. */
@media (max-width: 768px) {
  .detail-header-top { flex-wrap: wrap; gap: 10px; }
  .detail-header-top .detail-actions { order: -1; width: 100%; justify-content: flex-end; }
  .detail-title-row { flex: 1 1 100%; }
}
