/* ============================================================================
   CCL Acquisitions Dashboard — Property Detail View
   Extends: tokens.css + components.css
   Load order: tokens.css → components.css → detail.css

   Sections:
     1. Detail Layout & Header
     2. Tab System
     3. Overview Tab
     4. Deal Fields Tab
     5. Reports Tab
     6. Sub-Tasks Tab
     7. Notes Tab
     8. Communication Tab
     9. Documents Tab
    10. Activity Tab
    11. Detail Modals
    12. Responsive
   ============================================================================ */


/* ==========================================================================
   1. DETAIL LAYOUT & HEADER
   ========================================================================== */

.property-detail {
  display: none;
}

.property-detail.active {
  display: block;
  animation: fadeIn 250ms ease;
}

/* --- Header --- */

.detail-header {
  padding: var(--s-5) var(--s-8);
  border-bottom: 1px solid var(--gray-200);
  background: var(--white);
}

/* --- Breadcrumb --- */

.detail-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
  font-size: var(--text-sm);
}

.detail-breadcrumb a {
  color: var(--gray-400);
  cursor: pointer;
  text-decoration: none;
  transition: color var(--t-fast);
}

.detail-breadcrumb a:hover {
  color: var(--brand);
}

.detail-breadcrumb .sep {
  color: var(--gray-300);
  font-size: var(--text-2xs) + 1;
  user-select: none;
}

.detail-breadcrumb .current {
  color: var(--gray-700);
  font-weight: 600;
}

/* --- Title Row --- */

.detail-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
}

.detail-title-left {
  display: flex;
  align-items: flex-start;
  gap: var(--s-4);
}

.detail-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  border: 1px solid var(--gray-200);
  background: var(--white);
  cursor: pointer;
  transition: all var(--t-fast);
  color: var(--gray-500);
  flex-shrink: 0;
  margin-top: 2px;
}

.detail-back:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-wash);
}

.detail-back i {
  width: 18px;
  height: 18px;
}

.detail-address {
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.4px;
  line-height: 1.2;
}

.detail-city {
  font-size: var(--text-base);
  color: var(--gray-500);
  margin-top: 2px;
}

/* --- Badges --- */

.detail-badges {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-2);
  flex-wrap: wrap;
}

.detail-stage {
  display: inline-flex;
  padding: 4px 12px;
  border-radius: var(--r-sm);
  font-size: var(--text-xs);
  font-weight: 600;
}

.detail-sub-state {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 600;
}

.detail-sub-state .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.detail-days-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-sm);
}

/* Default: warning tier (7-13 days) */
.detail-days-badge {
  background: var(--warning-wash);
  color: #B45309;
}

/* Neutral tier (<7 days) */
.detail-days-badge.neutral {
  background: var(--gray-100);
  color: var(--gray-500);
}

/* Urgent tier (14+ days) */
.detail-days-badge.urgent {
  background: var(--error-wash);
  color: var(--error);
}

.detail-days-badge i {
  width: 12px;
  height: 12px;
}

/* --- Analysis Status Badge --- */

.detail-analysis-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-sm);
}

.detail-analysis-badge.running {
  background: rgba(59, 130, 246, 0.10);
  color: var(--blue-600, #2563EB);
}

.detail-analysis-badge.error {
  background: var(--error-wash);
  color: var(--error);
}

.spinner-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse-dot 1.2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1); }
}

/* --- Action Buttons --- */

.detail-actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-shrink: 0;
  margin-top: 4px;
}

.btn-detail {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--r-md);
  font: 600 var(--text-sm)/1.4 var(--font-sans);
  cursor: pointer;
  transition: all var(--t-fast);
  border: 1.5px solid;
}

.btn-detail i,
.btn-detail svg {
  width: 16px;
  height: 16px;
}

.btn-detail.sendback {
  background: var(--white);
  color: #B45309;
  border-color: var(--warning);
}

.btn-detail.sendback:hover {
  background: var(--accent-wash);
}

.btn-detail.decline {
  background: var(--white);
  color: var(--error);
  border-color: transparent;
}

.btn-detail.decline:hover {
  background: var(--error-wash);
  border-color: var(--error);
}

.btn-detail.advance {
  background: var(--brand);
  color: var(--white);
  border-color: var(--brand);
  box-shadow: var(--shadow-brand);
}

.btn-detail.advance:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
}

.btn-detail:active {
  transform: scale(0.97);
}

.btn-detail.advance:active {
  transform: translateY(0) scale(0.97);
}


/* ==========================================================================
   2. TAB SYSTEM
   ========================================================================== */

.detail-tab-bar {
  display: flex;
  gap: var(--s-1);
  padding: 0 var(--s-8);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.detail-tab-bar::-webkit-scrollbar {
  height: 0;
}

.detail-tab {
  display: flex;
  align-items: center;
  gap: var(--s-1-5);
  padding: 14px var(--s-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: all var(--t-fast);
  white-space: nowrap;
  position: relative;
}

.detail-tab:hover {
  color: var(--gray-700);
}

.detail-tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 600;
}

.detail-tab i,
.detail-tab svg {
  width: 18px;
  height: 18px;
}

/* Tab badge (notification count on tab) */
.detail-tab .tab-badge {
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--r-full);
  background: var(--error);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* --- Tab Content --- */

.detail-content {
  padding: var(--s-6) var(--s-8);
  max-width: 1280px;
}

.detail-pane {
  display: block;
  animation: fadeIn 200ms ease;
}


/* ==========================================================================
   3. OVERVIEW TAB
   ========================================================================== */

.ov-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-5);
}

.ov-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.ov-card:hover {
  border-color: var(--gray-300);
  box-shadow: var(--shadow-xs);
}

.ov-card.span-2 {
  grid-column: span 2;
}

.ov-card.span-3 {
  grid-column: span 3;
}

.ov-card-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-400);
  margin-bottom: var(--s-3);
}

/* --- Score Display --- */

.ov-score-display {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
}

.ov-score-num {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
}

.ov-score-max {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  color: var(--gray-400);
}

.ov-grade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  font-size: var(--text-sm);
  font-weight: 700;
  margin-left: var(--s-2);
}

/* --- Temperature --- */

.ov-temp {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 20px;
  font-weight: 700;
}

.ov-temp i {
  width: 24px;
  height: 24px;
}

/* --- Values --- */

.ov-value {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--gray-800);
}

.ov-value.mono {
  font-family: var(--font-mono);
}

/* --- Assignee --- */

.ov-assignee-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-2);
}

.ov-assignee-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--white);
  flex-shrink: 0;
}

.ov-assignee-name {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--gray-800);
}

.ov-assignee-role {
  font-size: var(--text-xs);
  color: var(--gray-400);
}

/* --- Subtask Progress --- */

.ov-subtask-bar {
  height: 6px;
  background: var(--gray-100);
  border-radius: var(--r-full);
  overflow: hidden;
  margin-top: var(--s-2);
}

.ov-subtask-fill {
  height: 100%;
  background: var(--brand);
  border-radius: var(--r-full);
  transition: width 0.4s ease;
}

/* --- External Links --- */

.ov-ext-links {
  display: flex;
  gap: var(--s-4);
  flex-wrap: wrap;
}

.ov-ext-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1-5);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--brand);
  cursor: pointer;
  text-decoration: none;
  transition: opacity var(--t-fast);
}

.ov-ext-link:hover {
  opacity: 0.7;
}

.ov-ext-link i {
  width: 14px;
  height: 14px;
}

/* --- Deal Info Grid (overview summary) --- */

.deal-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
}

.deal-info-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-400);
  margin-bottom: 2px;
}

.deal-info-value {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--gray-800);
}

.deal-info-value.mono {
  font-family: var(--font-mono);
}


/* ==========================================================================
   4. DEAL FIELDS TAB
   ========================================================================== */

.deal-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-8);
}

.deal-two-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-6);
}

.deal-two-panel.single-col {
  grid-template-columns: 1fr;
}

/* --- Current stage panel (editable emphasis) --- */
.deal-panel-current {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  transition: border-color var(--t-fast);
}

.deal-panel-current:hover {
  border-color: var(--gray-300);
}

/* --- Prior stage panel (read-only, muted) --- */
.deal-panel-completed {
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: var(--r-lg);
  padding: var(--s-5);
}

.deal-panel-completed .d-input,
.deal-panel-completed .d-textarea,
.deal-panel-completed .d-select {
  background: var(--white);
  color: var(--gray-500);
  border-color: var(--gray-100);
}

.deal-section-label {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: var(--s-4);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.section-badge {
  font-size: var(--text-2xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--r-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.d-form-group {
  margin-bottom: var(--s-4);
}

.d-form-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: var(--s-1);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.d-entered-by {
  font-size: var(--text-2xs);
  font-weight: 500;
  color: var(--gray-400);
  background: var(--gray-50);
  padding: 1px 6px;
  border-radius: var(--r-sm);
}

/* --- Form Inputs --- */

.d-input {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--r-md);
  font: 400 var(--text-base)/1.4 var(--font-sans);
  color: var(--gray-800);
  background: var(--white);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.d-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.d-input.mono {
  font-family: var(--font-mono);
}

.d-input:disabled {
  background: var(--gray-50);
  color: var(--gray-500);
  cursor: not-allowed;
  border-color: var(--gray-100);
}

.d-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--r-md);
  font: 400 var(--text-base)/1.4 var(--font-sans);
  color: var(--gray-800);
  min-height: 72px;
  resize: vertical;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.d-textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.d-select {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--r-md);
  font: 400 var(--text-base)/1.4 var(--font-sans);
  color: var(--gray-800);
  background: var(--white);
  cursor: pointer;
  transition: border-color var(--t-fast);
}

.d-select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

/* --- Currency Input --- */

.d-currency {
  position: relative;
}

.d-currency-sym {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-family: var(--font-mono);
  font-weight: 500;
}

.d-input.currency {
  padding-left: 28px;
}

/* --- Auto-save Indicator --- */

.d-autosave {
  display: flex;
  align-items: center;
  gap: var(--s-1-5);
  font-size: var(--text-xs);
  font-weight: 500;
  padding: var(--s-2) 0;
  transition: color var(--t-base);
}

.d-autosave.saved {
  color: var(--success);
}

.d-autosave.saving {
  color: var(--gray-400);
}

.d-autosave.error {
  color: var(--error);
}

.d-autosave i {
  width: 14px;
  height: 14px;
}


/* ==========================================================================
   4b. DEAL INFO TAB (intake form deal fields — admin-editable)
   ========================================================================== */

.dealinfo-wrapper {
  max-width: 720px;
}

.dealinfo-attribution {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 10px var(--s-4);
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: var(--r-md);
  margin-bottom: var(--s-4);
  font-size: var(--text-xs);
  color: var(--gray-500);
}

.dealinfo-attribution strong {
  color: var(--gray-700);
  font-weight: 600;
}

.dealinfo-attr-sep::before {
  content: '·';
  margin: 0 2px;
  color: var(--gray-300);
}

.dealinfo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 var(--s-5);
}

.dealinfo-textarea-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 var(--s-5);
  margin-top: var(--s-2);
}

.dealinfo-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.dealinfo-checkbox-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--r-full);
  font-size: var(--text-sm);
  color: var(--gray-600);
  cursor: pointer;
  transition: all var(--t-fast);
  user-select: none;
}

.dealinfo-checkbox-item:hover {
  border-color: var(--gray-300);
  background: var(--gray-50);
}

.dealinfo-checkbox-item.checked {
  border-color: var(--brand);
  background: var(--brand-wash);
  color: var(--brand-dark);
}

.dealinfo-checkbox-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--brand);
  margin: 0;
  cursor: pointer;
}

@media (max-width: 640px) {
  .dealinfo-grid,
  .dealinfo-textarea-row {
    grid-template-columns: 1fr;
  }
}


/* ==========================================================================
   5. REPORTS TAB
   ========================================================================== */

.reports-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-5);
}

.rpt-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.rpt-card:hover {
  border-color: var(--gray-300);
  box-shadow: var(--shadow-xs);
}

.rpt-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--s-3);
}

.rpt-title {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--gray-800);
}

.rpt-title i {
  width: 18px;
  height: 18px;
}

.rpt-score {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--gray-900);
}

.rpt-score .out-of {
  font-size: var(--text-sm);
  color: var(--gray-400);
  font-weight: 400;
}

.rpt-grade-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}

.rpt-grade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  font-size: var(--text-xs);
  font-weight: 700;
}

.rpt-summary {
  font-size: var(--text-sm);
  color: var(--gray-600);
  line-height: 1.5;
}

/* --- Findings List --- */

.rpt-findings {
  list-style: none;
  padding: 0;
  margin-top: var(--s-3);
}

.rpt-findings li {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  padding: var(--s-1-5) 0;
  font-size: var(--text-sm);
  color: var(--gray-600);
  line-height: 1.5;
}

.rpt-findings li i {
  width: 16px;
  height: 16px;
  color: var(--success);
  flex-shrink: 0;
  margin-top: 2px;
}

.rpt-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1-5);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
  margin-top: var(--s-3);
  transition: opacity var(--t-fast);
  text-decoration: none;
}

.rpt-link:hover {
  opacity: 0.7;
}

.rpt-link i {
  width: 14px;
  height: 14px;
}

/* --- Tab Wrappers --- */

.ov-wrapper,
.reports-wrapper {
  display: block;
}

/* --- Glance Hero Section --- */

.glance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-5);
  margin-bottom: var(--s-8);
}
.glance-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  text-align: center;
  box-shadow: var(--shadow-xs);
}
.glance-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-400);
  margin-bottom: var(--s-3);
}
.glance-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 32px;
  letter-spacing: -0.02em;
}
.glance-sub {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: var(--s-1);
}
.grade-value-a { color: #059669; }
.grade-value-b { color: var(--teal); }
.grade-value-c { color: #D97706; }
.grade-value-d { color: #EA580C; }
.grade-value-f { color: #DC2626; }
.temp-value-hot  { color: var(--temp-hot); }
.temp-value-warm { color: var(--temp-warm); }
.temp-value-cool { color: var(--temp-cool); }
.temp-value-cold { color: var(--temp-cold); }

/* --- Report Cards Grid --- */

.report-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-5);
}
/* Scoped to .reports-wrapper to beat submitter.css's .report-card (display:flex row) */
.reports-wrapper .report-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  box-shadow: var(--shadow-sm);
  transition: all var(--base);
  display: block;
  cursor: default;
}
.reports-wrapper .report-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  border-color: var(--gray-200);
}
.reports-wrapper .report-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--s-4);
}
.reports-wrapper .report-card-icon.market {
  background: var(--teal-wash);
  color: var(--teal);
}
.reports-wrapper .report-card-icon.zoning {
  background: var(--teal-wash);
  color: var(--teal);
}
.reports-wrapper .report-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: var(--s-2);
}
.reports-wrapper .report-card-desc {
  font-size: 13px;
  color: var(--gray-500);
  line-height: 1.5;
  margin-bottom: var(--s-5);
}
.reports-wrapper .report-card-stats {
  display: flex;
  gap: var(--s-6);
  margin-bottom: var(--s-5);
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--gray-100);
}
.reports-wrapper .report-stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-400);
  margin-bottom: 4px;
}
.reports-wrapper .report-stat-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  color: var(--gray-900);
}
.reports-wrapper .report-card-action {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--teal);
  text-decoration: none;
  transition: gap var(--fast);
}
.reports-wrapper .report-card-action:hover {
  gap: 10px;
}

/* Zoning unavailable card */
.reports-wrapper .zoning-unavailable {
  border-style: dashed;
  border-color: var(--gray-300);
}
.reports-wrapper .zoning-unavailable:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}

/* --- Report Pending State --- */

.rpt-pending {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s-8) var(--s-4);
  text-align: center;
}

.rpt-pending i {
  width: 32px;
  height: 32px;
  color: var(--gray-300);
  margin-bottom: var(--s-3);
  animation: pulse 2s ease-in-out infinite;
}

.rpt-pending-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: var(--s-1);
}

.rpt-pending-desc {
  font-size: var(--text-sm);
  color: var(--gray-400);
}


/* ==========================================================================
   6. SUB-TASKS TAB
   ========================================================================== */

.ck-list {
  list-style: none;
  padding: 0;
}

.ck-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3);
  border: 1px solid var(--gray-100);
  border-radius: var(--r-md);
  margin-bottom: var(--s-2);
  background: var(--white);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.ck-item:hover {
  border-color: var(--gray-200);
  box-shadow: var(--shadow-xs);
}

/* --- Checkbox --- */

.ck-check {
  width: 22px;
  height: 22px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--t-fast);
}

.ck-check.done {
  background: var(--success);
  color: var(--white);
}

.ck-check.done i {
  width: 14px;
  height: 14px;
}

.ck-check.pending {
  border: 2px solid var(--gray-300);
}

.ck-check.pending:hover {
  border-color: var(--brand);
  background: var(--brand-wash);
}

/* --- Task Info --- */

.ck-info {
  flex: 1;
  min-width: 0;
}

.ck-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-800);
}

.ck-name.done {
  text-decoration: line-through;
  color: var(--gray-400);
}

.ck-who {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 1px;
}

/* --- Status Badge --- */

.ck-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--r-full);
  flex-shrink: 0;
}

.ck-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

/* --- Complete on Behalf --- */

.ck-behalf {
  font-size: 11px;
  font-weight: 500;
  color: var(--brand);
  background: none;
  border: 1px solid var(--brand-subtle);
  border-radius: var(--r-sm);
  padding: 3px 8px;
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
}

.ck-behalf:hover {
  background: var(--brand-wash);
  border-color: var(--brand-light);
}

/* Previous-stage muted items */
.ck-item.ck-muted {
  opacity: 0.65;
}
.ck-item.ck-muted .ck-name.done {
  text-decoration: line-through;
}

/* --- Section Headers --- */

.ck-section {
  margin-bottom: var(--s-6);
}

.ck-section-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: var(--s-1);
}

.ck-section-meta {
  font-size: var(--text-xs);
  color: var(--gray-500);
  margin-bottom: var(--s-4);
}

.ck-prev-section {
  margin-top: var(--s-5);
  padding-top: var(--s-4);
  border-top: 1px solid var(--gray-150);
}

.ck-prev-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--gray-400);
  margin-bottom: var(--s-3);
}

.ck-prev-done {
  color: var(--success);
}

/* --- Add Task Card --- */

.ck-add-card {
  background: var(--white);
  border: 1.5px solid var(--gray-150);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  margin-top: var(--s-4);
}

.ck-add-header {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: var(--s-4);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--gray-100);
}

.ck-add-header i { width: 16px; height: 16px; color: var(--brand); }

.ck-add-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
}

.ck-add-full { grid-column: 1 / -1; }

.ck-add-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: var(--s-2);
  padding-top: var(--s-3);
  border-top: 1px solid var(--gray-100);
  margin-top: var(--s-1);
}

.ck-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 640px) {
  .ck-add-grid { grid-template-columns: 1fr; }
}

/* --- Row Actions (Edit/Delete) --- */

.ck-row-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.ck-icon-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--gray-400);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--t-fast);
}

.ck-icon-btn:hover {
  background: var(--gray-100);
  color: var(--gray-600);
}

.ck-icon-btn.danger:hover {
  background: rgba(239,68,68,0.08);
  color: var(--error);
}

/* --- Inline Edit Form --- */

.ck-edit-inline {
  display: flex;
  gap: var(--s-2);
  align-items: center;
  flex: 1;
  min-width: 0;
}

.ck-edit-input {
  flex: 1;
  padding: 4px 8px;
  font-size: 13px;
  font-family: var(--font-sans);
  border: 1px solid var(--gray-300);
  border-radius: var(--r-sm);
  outline: none;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.ck-edit-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(72,122,123,0.15);
}

.ck-edit-save {
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-sans);
  padding: 4px 10px;
  background: var(--brand);
  color: var(--white);
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t-fast);
  white-space: nowrap;
}

.ck-edit-save:hover {
  background: var(--brand-dark);
}

.ck-edit-cancel {
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-sans);
  padding: 4px 10px;
  background: var(--gray-100);
  color: var(--gray-600);
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
}

.ck-edit-cancel:hover {
  background: var(--gray-200);
  color: var(--gray-700);
}


/* ==========================================================================
   7. NOTES TAB
   ========================================================================== */

.notes-layout {
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}

/* --- Note Form --- */

.note-form-box {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--t-fast);
}

.note-form-box:hover {
  border-color: var(--gray-300);
}

.note-form-head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--gray-100);
}

.note-form-head i {
  width: 16px;
  height: 16px;
  color: var(--brand);
}

.note-form-title {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--gray-800);
}

.note-form-body {
  padding: var(--s-5);
}

.note-ta {
  width: 100%;
  min-height: 100px;
  padding: var(--s-3);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--r-md);
  font: 400 var(--text-base)/1.5 var(--font-sans);
  color: var(--gray-800);
  resize: vertical;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.note-ta:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.note-ta::placeholder {
  color: var(--gray-400);
}

.note-form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--s-3);
}

.note-vis-label {
  display: flex;
  align-items: center;
  gap: var(--s-1-5);
  font-size: var(--text-xs);
  color: var(--gray-500);
  cursor: pointer;
  user-select: none;
}

.note-vis-label input[type="checkbox"] {
  accent-color: var(--brand);
}

.btn-note {
  padding: 8px 16px;
  background: var(--brand);
  color: var(--white);
  border: none;
  border-radius: var(--r-md);
  font: 600 var(--text-sm)/1 var(--font-sans);
  cursor: pointer;
  transition: all var(--t-fast);
}

.btn-note:hover {
  background: var(--brand-dark);
}

.btn-note:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- Note Entries --- */

.note-entries {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.note-item {
  padding: var(--s-4);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  background: var(--white);
  transition: border-color var(--t-fast);
}

.note-item:hover {
  border-color: var(--gray-300);
}

.note-meta {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
  flex-wrap: wrap;
}

.note-author {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gray-800);
}

.note-time {
  font-size: var(--text-xs);
  color: var(--gray-400);
}

.note-vis-tag {
  font-size: var(--text-2xs);
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-wash);
  padding: 2px 8px;
  border-radius: var(--r-full);
}

.note-body {
  font-size: var(--text-sm);
  color: var(--gray-600);
  line-height: 1.6;
  white-space: pre-wrap;
}


/* ==========================================================================
   8. COMMUNICATION TAB
   ========================================================================== */

.comm-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-5);
}

/* --- Card container (shared for compose + history panels) --- */
.comm-box {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--t-fast);
}

.comm-box:hover {
  border-color: var(--gray-300);
}

/* --- Card Header (replaces old .comm-compose-title / .msg-history-title) --- */
.comm-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--gray-100);
}

.comm-card-title {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.comm-card-title i {
  width: 16px;
  height: 16px;
  color: var(--brand);
}

.comm-card-badge {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--r-full);
}

/* --- Card Body --- */
.comm-card-body {
  padding: var(--s-5);
}

/* --- Compose Rows --- */
.comm-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}

.comm-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--gray-500);
  min-width: 72px;
  flex-shrink: 0;
}

/* --- Channel Radio --- */

.ch-radio {
  display: flex;
  gap: var(--s-1);
}

.ch-opt {
  display: flex;
  align-items: center;
  gap: var(--s-1-5);
  padding: 6px 14px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  font: 500 var(--text-sm)/1 var(--font-sans);
  color: var(--gray-500);
  cursor: pointer;
  transition: all var(--t-fast);
}

.ch-opt:hover {
  border-color: var(--gray-300);
}

.ch-opt.active {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-wash);
}

.ch-opt i {
  width: 14px;
  height: 14px;
}

/* --- Send Button --- */

.btn-send {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  background: var(--brand);
  color: var(--white);
  border: none;
  border-radius: var(--r-md);
  font: 600 var(--text-sm)/1 var(--font-sans);
  cursor: pointer;
  transition: all var(--t-fast);
}

.btn-send:hover {
  background: var(--brand-dark);
}

.btn-send i {
  width: 15px;
  height: 15px;
}

/* --- Message History --- */

.msg-history-title {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: var(--s-3);
}

.msg-history-title i {
  color: var(--gray-400);
}

/* --- Message List Container --- */
.msg-list {
  max-height: 420px;
  overflow-y: auto;
  display: grid;
  gap: var(--s-2);
  padding-right: 4px;
}

/* --- Message Row (directional, with left-border indicator) --- */
.msg-item {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3);
  border: 1px solid var(--gray-100);
  border-radius: var(--r-md);
  background: var(--white);
  transition: all var(--t-fast);
  position: relative;
}

.msg-item:hover {
  border-color: var(--gray-200);
  box-shadow: var(--shadow-xs);
}

.msg-item.outgoing {
  border-left: 3px solid var(--brand-light);
}

.msg-item.incoming {
  border-left: 3px solid var(--gray-300);
}

/* Direction indicator circle */
.msg-dir {
  width: 22px;
  height: 22px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.msg-dir.out {
  background: var(--brand-wash);
  color: var(--brand);
}

.msg-dir.in {
  background: var(--gray-100);
  color: var(--gray-500);
}

.msg-dir i {
  width: 12px;
  height: 12px;
}

/* Message body (flex child) */
.msg-body {
  flex: 1;
  min-width: 0;
}

.msg-item-header {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: 3px;
}

.msg-ch-badge {
  font-size: var(--text-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: var(--r-sm);
}

.msg-ch-badge.email {
  background: var(--info-wash);
  color: var(--info);
}

.msg-ch-badge.text {
  background: var(--success-wash);
  color: var(--success);
}

.msg-ts {
  font-size: 11px;
  color: var(--gray-400);
  margin-left: auto;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.msg-preview {
  font-size: var(--text-sm);
  color: var(--gray-600);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


/* --- Contact Status Bar --- */

.comm-status-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 10px 16px;
  background: var(--white);
  border-radius: var(--r-lg);
  border: 1px solid var(--gray-200);
  transition: border-color var(--t-fast);
}

.comm-status-bar:hover {
  border-color: var(--gray-300);
}

.comm-status-bar i {
  width: 16px;
  height: 16px;
}

.comm-status-bar .status-label {
  font-size: 13px;
  color: var(--gray-600);
}

.comm-status-bar .status-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
}

.comm-status-bar .status-badge.active {
  color: var(--success);
  background: rgba(16, 185, 129, 0.1);
}

.comm-status-bar .status-badge.opted-out {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

.comm-status-bar .status-badge.unknown {
  color: var(--gray-500);
  background: rgba(148, 163, 184, 0.1);
}

.comm-status-bar .status-email {
  font-size: 11px;
  color: var(--gray-400);
  margin-left: auto;
}

/* --- Recipients List --- */

.comm-recipients-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.comm-recipient-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--t-fast);
  background: var(--white);
}

.comm-recipient-item:hover {
  border-color: var(--gray-300);
  background: var(--gray-50);
}

.comm-recipient-item input[type="checkbox"] {
  margin: 0;
  accent-color: var(--brand);
}

.comm-recipient-item.opted-out {
  opacity: 0.55;
  border-color: var(--gray-100);
  background: var(--gray-50);
}

.recipient-name {
  font-weight: 600;
  color: var(--gray-800);
}

.recipient-role {
  font-size: 11px;
  color: var(--gray-400);
}

.recipient-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 99px;
}

.recipient-tag.primary {
  background: var(--brand-wash);
  color: var(--brand);
}

.recipient-tag.cc {
  background: rgba(148, 163, 184, 0.12);
  color: var(--gray-500);
}

.recipient-dnd {
  font-size: 10px;
  font-weight: 600;
  color: var(--error);
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(239, 68, 68, 0.08);
}

/* --- Body Actions (Drive Link) --- */

.comm-body-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.btn-drive-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500);
  background: none;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--t-fast);
}

.btn-drive-link:hover {
  color: var(--brand);
  border-color: var(--brand);
  background: var(--brand-wash);
}

.btn-drive-link i {
  width: 13px;
  height: 13px;
}

/* --- Compose Title (legacy — kept for compat, superseded by .comm-card-head) --- */

.comm-compose-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: var(--s-3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.comm-compose-title i {
  width: 16px;
  height: 16px;
  color: var(--brand);
}

/* --- UI-201: Stage Context Selector --- */

.comm-stage-row {
  margin-bottom: var(--s-3);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--gray-100);
}

.comm-stage-select {
  flex: 1;
  padding: 7px 10px;
  font-size: var(--text-sm);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--r-md);
  background: var(--white);
  color: var(--gray-800);
  font-family: var(--font-sans);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  cursor: pointer;
}

.comm-stage-select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.comm-stage-hint {
  font-size: 11px;
  color: var(--warning);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

/* --- UI-202: Source Reason Pills --- */

.recipient-source {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: 99px;
}

.source-submitter-global {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.source-stage-lead {
  background: rgba(59, 130, 246, 0.1);
  color: var(--info);
}

.source-delegation {
  background: var(--brand-wash);
  color: var(--brand);
}

.source-task-assignee {
  background: rgba(139, 92, 246, 0.1);
  color: #8B5CF6;
}

.source-explicit-association {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.source-admin-override {
  background: rgba(239, 68, 68, 0.08);
  color: var(--gray-600);
}

/* --- UI-204: Message History Filter Pills + Stage Badges --- */

.msg-filter-row {
  display: flex;
  gap: var(--s-1);
  margin-bottom: var(--s-3);
}

.msg-filter-pill {
  padding: 5px 12px;
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: 600;
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-600);
  cursor: pointer;
  transition: all var(--t-fast);
}

.msg-filter-pill:hover {
  border-color: var(--gray-300);
  background: var(--gray-50);
}

.msg-filter-pill.active {
  background: var(--brand-wash);
  color: var(--brand);
  border-color: var(--brand);
}

.msg-stage-badge {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--brand-wash);
  color: var(--brand);
  text-transform: capitalize;
}

/* --- UI-205: Sender Eligibility Banner --- */

.comm-eligibility-banner {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-4);
  background: rgba(239, 68, 68, 0.04);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: var(--r-md);
  margin-bottom: var(--s-4);
}

.eligibility-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.eligibility-icon-wrap.error {
  background: rgba(239, 68, 68, 0.12);
  color: var(--error);
}

.eligibility-icon-wrap i {
  width: 18px;
  height: 18px;
}

.eligibility-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 2px;
}

.eligibility-message {
  font-size: var(--text-xs);
  color: var(--gray-600);
  line-height: 1.5;
}

.eligibility-action {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--brand);
  margin-top: var(--s-2);
}

.comm-sender-identity {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.15);
  border-radius: var(--r-md);
  font-size: 12px;
  color: var(--gray-600);
  margin-bottom: var(--s-3);
}

.comm-sender-identity strong {
  color: var(--gray-800);
  font-weight: 600;
}

.comm-eligibility-loading {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-4);
  font-size: var(--text-sm);
  color: var(--gray-400);
}

/* --- UI-206: Delivery Confidence Panel --- */

.comm-delivery-section {
  margin-top: var(--s-4);
  padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
}

.comm-delivery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-2);
}

.comm-delivery-title {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
}

.comm-delivery-title i { color: var(--gray-400); }

.delivery-filter-pills {
  display: flex;
  gap: 4px;
}

.delivery-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-500);
  cursor: pointer;
  transition: all var(--t-fast);
}

.delivery-pill:hover {
  border-color: var(--gray-300);
  color: var(--gray-700);
}

.delivery-pill.active {
  background: var(--brand-wash);
  color: var(--brand);
  border-color: var(--brand);
}

.delivery-event-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 5px 0;
  font-size: 12px;
  flex-wrap: wrap;
}

.delivery-status-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: var(--r-sm);
}

.delivery-status-badge.queued { background: var(--gray-100); color: var(--gray-500); }
.delivery-status-badge.sent { background: rgba(59, 130, 246, 0.08); color: var(--info); }
.delivery-status-badge.delivered { background: rgba(16, 185, 129, 0.08); color: var(--success); }
.delivery-status-badge.failed { background: rgba(239, 68, 68, 0.08); color: var(--error); }
.delivery-status-badge.bounced { background: rgba(245, 158, 11, 0.08); color: #B45309; }
.delivery-status-badge.cancelled { background: var(--gray-100); color: var(--gray-500); }

.delivery-channel-badge {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: var(--r-sm);
  text-transform: uppercase;
}

.delivery-channel-badge.email { background: rgba(59, 130, 246, 0.08); color: var(--info); }
.delivery-channel-badge.sms { background: rgba(139, 92, 246, 0.08); color: #8B5CF6; }

.delivery-type-badge {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: var(--r-sm);
  background: rgba(139, 92, 246, 0.08);
  color: #8B5CF6;
  text-transform: capitalize;
}

.delivery-attempt {
  font-size: 10px;
  font-weight: 600;
  color: var(--warning);
  font-family: var(--font-mono);
}

.delivery-error-detail {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 3px 0 2px 8px;
  font-size: 11px;
}

.delivery-error-code {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: var(--r-sm);
  background: rgba(239, 68, 68, 0.08);
  color: var(--error);
}

.delivery-error-msg { color: var(--gray-500); }

.delivery-empty {
  font-size: 12px;
  color: var(--gray-400);
  padding: var(--s-2) 0;
}

/* --- Stage Lens Controls (shared across SubTasks + Notes) --- */

.stage-lens-bar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: var(--r-lg);
  margin-bottom: var(--s-4);
  flex-wrap: wrap;
}

.stage-lens-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-400);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin-right: var(--s-1);
}

.stage-lens-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-full);
  cursor: pointer;
  transition: all var(--t-fast);
}

.stage-lens-pill:hover {
  background: var(--gray-100);
  color: var(--gray-700);
  border-color: var(--gray-300);
}

.stage-lens-pill.active {
  background: var(--brand-wash);
  color: var(--brand);
  border-color: var(--brand);
}

.stage-lens-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 0 5px;
  min-width: 18px;
  text-align: center;
  border-radius: var(--r-full);
  background: rgba(0,0,0,0.06);
}

.stage-lens-pill.active .stage-lens-badge {
  background: rgba(72,122,123,0.15);
}

.stage-lens-select {
  font-size: 12px;
  padding: 5px 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
  color: var(--gray-500);
  background: var(--white);
  cursor: pointer;
  margin-left: auto;
  transition: border-color var(--t-fast);
}

.stage-lens-select:focus {
  outline: none;
  border-color: var(--brand);
}

.stage-lens-empty {
  padding: var(--s-6);
  text-align: center;
  color: var(--gray-400);
  font-size: var(--text-sm);
}

.note-stage-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: var(--brand-wash);
  color: var(--brand);
}

/* ALN-009: Prior stage group headers */
.deal-prior-stage-group {
  margin-bottom: var(--s-4);
}

.deal-prior-stage-group:last-child {
  margin-bottom: 0;
}

.deal-prior-stage-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding-bottom: var(--s-1);
  margin-bottom: var(--s-3);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: var(--s-1-5);
}

.deal-future-note {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  font-size: 12px;
  color: var(--gray-400);
  background: var(--gray-50);
  border: 1px dashed var(--gray-200);
  border-radius: var(--r-md);
  margin-top: var(--s-3);
}

/* --- Template Select --- */

.comm-template-select {
  flex: 1;
  padding: 7px 10px;
  font-size: var(--text-sm);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--r-md);
  background: var(--white);
  color: var(--gray-800);
  font-family: var(--font-sans);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  cursor: pointer;
}

.comm-template-select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

/* --- Subject Input --- */

.comm-subject-input {
  flex: 1;
  padding: 7px 10px;
  font-size: var(--text-sm);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--r-md);
  background: var(--white);
  color: var(--gray-800);
  font-family: var(--font-sans);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.comm-subject-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

/* --- Body Textarea --- */

.comm-body-wrap {
  margin-bottom: var(--s-3);
}

.comm-body-textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: var(--text-sm);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--r-md);
  min-height: 110px;
  resize: vertical;
  font-family: var(--font-sans);
  line-height: 1.5;
  color: var(--gray-800);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.comm-body-textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

/* --- Send Row --- */

.comm-send-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.comm-followup-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--gray-500);
  cursor: pointer;
}

.comm-send-group {
  display: inline-flex;
  align-items: stretch;
  position: relative;
}

.comm-send-group .btn-send:first-child {
  border-radius: var(--r-md) 0 0 var(--r-md);
}

.comm-send-group .btn-send-chevron {
  display: inline-flex;
  align-items: center;
  padding: 8px 6px;
  background: var(--brand);
  color: var(--white);
  border: none;
  border-left: 1px solid rgba(255,255,255,0.2);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  cursor: pointer;
  transition: all var(--t-fast);
}

.comm-send-group .btn-send-chevron:hover {
  background: var(--brand-dark);
}

.comm-send-group .btn-send-chevron:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.comm-send-group .btn-send-chevron i {
  width: 14px;
  height: 14px;
}

/* --- Send Dropdown Menu --- */

.send-menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  min-width: 200px;
  z-index: 50;
  overflow: hidden;
}

.send-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  font-size: 13px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--gray-700);
  transition: background var(--t-fast);
}

.send-menu-item:hover {
  background: var(--gray-50);
}

.send-menu-item i {
  width: 14px;
  height: 14px;
}

/* --- Date/Time Picker in Send Menu --- */

.send-menu-dt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--gray-100);
}

.send-menu-dt input[type="datetime-local"] {
  flex: 1;
  font-size: 12px;
  padding: 4px 6px;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-sm);
  color: var(--gray-700);
}

.send-menu-dt button {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  background: var(--brand);
  color: var(--white);
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t-fast);
}

.send-menu-dt button:hover {
  background: var(--brand-dark);
}

/* --- Pending Follow-ups Section --- */

.comm-pending-section {
  margin-top: var(--s-4);
  padding-top: var(--s-3);
  border-top: 1px solid var(--gray-100);
}

.comm-pending-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: var(--s-2);
  display: flex;
  align-items: center;
  gap: 4px;
}

.comm-pending-title i {
  width: 13px;
  height: 13px;
}

.comm-pending-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 12px;
}

.comm-pending-row .pending-label {
  color: var(--gray-600);
}

.comm-pending-row .btn-cancel-job {
  font-size: 11px;
  color: var(--error);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
}

/* --- Email Jobs Section --- */

.comm-jobs-section {
  margin-top: var(--s-4);
  padding-top: var(--s-3);
  border-top: 1px solid var(--gray-100);
}

.comm-jobs-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: var(--s-2);
}

.comm-job-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 4px 0;
  font-size: 12px;
}

.comm-job-row .job-label {
  color: var(--gray-600);
  flex: 1;
}

.comm-job-row .btn-retry {
  font-size: 11px;
  color: var(--brand);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
}

/* --- v1.1: Threaded Inbox Layout (Phase II mockup → production) --- */

/* 3-panel grid: thread list | conversation | operations
   Mirrors mockup .p2-layout with production naming.
   Height: calc avoids fixed px — adapts to detail content area. */
.comm-threaded-layout {
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  gap: 0;
  height: calc(100vh - 310px);
  min-height: 580px;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--white);
}

/* ---- Thread List (left panel) ---- */

.comm-thread-list {
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  background: var(--gray-50);
  min-height: 0;
}

.comm-thread-list-head {
  padding: var(--s-4);
  border-bottom: 1px solid var(--gray-200);
  background: var(--white);
}

.comm-thread-list-title {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.comm-thread-list-title i {
  width: 16px;
  height: 16px;
  color: var(--brand);
}

/* Search input — padded to match compose button wrapper, no icon */
.comm-thread-search {
  padding: 0 var(--s-4) var(--s-3);
}

.comm-thread-search input {
  width: 100%;
  padding: 7px var(--s-3);
  font-size: var(--text-sm);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--r-md);
  background: var(--white);
  font-family: var(--font-sans);
  color: var(--gray-700);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.comm-thread-search input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

/* "Compose New" button at top of thread list */
.comm-compose-new-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  width: 100%;
  padding: 7px var(--s-3);
  font: 600 var(--text-sm)/1 var(--font-sans);
  color: var(--brand);
  background: var(--white);
  border: 1.5px solid rgba(72,122,123,0.25);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--t-fast);
}

.comm-compose-new-btn:hover {
  background: var(--brand-wash);
  border-color: var(--brand);
}

.comm-compose-new-btn i {
  width: 14px;
  height: 14px;
}

.comm-compose-new-btn.active {
  background: var(--brand);
  color: var(--white);
  border-color: var(--brand);
}

.comm-compose-new-btn.active:hover {
  background: var(--brand-dark);
}

/* Scrollable thread items container */
.comm-thread-items {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-2);
}

/* Thread group headings (Group Conversations / Direct / Private Forks) */
.comm-thread-group {
  padding: var(--s-1) var(--s-2);
}

.comm-thread-group:not(:first-child) {
  margin-top: var(--s-2);
}

.comm-thread-group-label {
  font-size: var(--text-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-400);
  padding: var(--s-1) var(--s-1);
  margin-bottom: var(--s-1);
}

/* Individual thread row */
.comm-thread-item {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--t-fast);
  margin-bottom: 2px;
  border-left: 3px solid transparent;
  position: relative;
}

.comm-thread-item:hover {
  background: var(--gray-100);
}

.comm-thread-item.active {
  background: var(--brand-wash);
  border-left-color: var(--brand);
}

/* Thread avatar circle */
.comm-thread-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.comm-thread-avatar.group {
  background: var(--gray-200);
  color: var(--gray-600);
}

.comm-thread-avatar.person {
  background: var(--brand-subtle);
  color: var(--brand-dark);
}

/* Thread info (name + preview) */
.comm-thread-info {
  flex: 1;
  min-width: 0;
}

.comm-thread-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: var(--s-1-5);
  margin-bottom: 2px;
}

/* Bold state for recent activity (deferred: no unread dots in v1.1) */
.comm-thread-name.recent {
  font-weight: 700;
  color: var(--gray-900);
}

.comm-thread-preview {
  font-size: var(--text-xs);
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Right column: time + type badge */
.comm-thread-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.comm-thread-time {
  font-size: 10px;
  color: var(--gray-400);
  font-family: var(--font-mono);
}

/* Thread type badges — frozen enum: direct | group_main | fork_private */
.comm-thread-type-badge {
  font-size: var(--text-2xs);
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--r-full);
  line-height: 1.4;
  white-space: nowrap;
}

.comm-thread-type-badge.group {
  background: rgba(59,130,246,0.10);
  color: #3b82f6;
}

.comm-thread-type-badge.direct {
  background: rgba(16,185,129,0.10);
  color: #10b981;
}

.comm-thread-type-badge.fork {
  background: rgba(245,158,11,0.10);
  color: #b45309;
}

/* ---- Conversation Panel (center) ---- */

.comm-conversation {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  min-width: 0;
}

/* Conversation header bar */
.comm-conv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-3) var(--s-5);
  border-bottom: 1px solid var(--gray-200);
  background: var(--white);
  gap: var(--s-3);
}

.comm-conv-title {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--gray-800);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comm-conv-meta {
  font-size: var(--text-xs);
  color: var(--gray-500);
  margin-top: 2px;
}

.comm-conv-tags {
  display: flex;
  gap: var(--s-2);
  align-items: center;
}

.comm-conv-link {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: opacity var(--t-fast);
  text-decoration: none;
}

.comm-conv-link:hover {
  opacity: 0.7;
}

.comm-conv-link i {
  width: 12px;
  height: 12px;
}

/* Scrollable message area */
.comm-conv-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-4) var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

/* Divider between local outbound messages and GHL history section */
.comm-conv-divider {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) 0;
  color: var(--gray-400);
  font-size: var(--text-xs);
  font-weight: 600;
}

.comm-conv-divider::before,
.comm-conv-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

/* Message bubbles */
.comm-bubble {
  max-width: 75%;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-lg);
  font-size: var(--text-sm);
  line-height: 1.5;
  position: relative;
}

.comm-bubble.outbound {
  align-self: flex-end;
  background: rgba(72,122,123,0.08);
  border: 1px solid rgba(72,122,123,0.18);
  border-bottom-right-radius: var(--r-sm);
}

.comm-bubble.inbound {
  align-self: flex-start;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-bottom-left-radius: var(--r-sm);
}

/* System messages (stage transitions, thread events) */
.comm-bubble.system {
  align-self: center;
  max-width: 90%;
  background: var(--gray-50);
  border: 1px dashed var(--gray-200);
  color: var(--gray-500);
  font-style: italic;
  text-align: center;
  font-size: var(--text-xs);
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-full);
}

/* Bubble sender name */
.comm-bubble-sender {
  font-size: var(--text-xs);
  font-weight: 600;
  margin-bottom: 3px;
}

.comm-bubble.outbound .comm-bubble-sender {
  color: var(--brand-dark);
}

.comm-bubble.inbound .comm-bubble-sender {
  color: var(--gray-600);
}

/* Bubble text content */
.comm-bubble-text {
  color: var(--gray-700);
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

/* Bubble footer: timestamp + delivery status */
.comm-bubble-meta {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-1);
  font-size: 10px;
  color: var(--gray-400);
}

.comm-bubble-meta i {
  width: 10px;
  height: 10px;
}

/* Delivery status indicator on bubble */
.comm-bubble-status {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
}

.comm-bubble-status.sent { color: var(--info); }
.comm-bubble-status.delivered { color: var(--success); }
.comm-bubble-status.failed { color: var(--error); }

/* ---- Reply Bar (bottom of conversation panel) ---- */

.comm-reply-bar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-5);
  border-top: 1px solid var(--gray-200);
  background: var(--white);
  flex-wrap: wrap;
}

/* Reply context indicator ("Replying to [Name]", "Continuing private thread") */
.comm-reply-context {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  margin-bottom: var(--s-1);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--gray-600);
  background: var(--gray-50);
  border-radius: var(--r-md);
  border-left: 3px solid var(--brand);
}

.comm-reply-context i {
  width: 12px;
  height: 12px;
  color: var(--brand);
  flex-shrink: 0;
}

.comm-reply-context .reply-dismiss {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  padding: 2px;
  display: flex;
  transition: color var(--t-fast);
}

.comm-reply-context .reply-dismiss:hover {
  color: var(--gray-700);
}

.comm-reply-context .reply-dismiss i {
  width: 12px;
  height: 12px;
}

/* Reply action buttons */
.comm-reply-btn {
  font: 600 var(--text-xs)/1 var(--font-sans);
  padding: 6px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-600);
  cursor: pointer;
  transition: all var(--t-fast);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.comm-reply-btn:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
  color: var(--gray-700);
}

.comm-reply-btn.primary {
  background: var(--brand);
  color: var(--white);
  border-color: var(--brand);
}

.comm-reply-btn.primary:hover {
  background: var(--brand-dark);
}

.comm-reply-btn i {
  width: 12px;
  height: 12px;
}

/* Fork reuse indicator — appears near reply buttons when context is relevant */
.comm-fork-indicator {
  display: flex;
  align-items: center;
  gap: var(--s-1-5);
  font-size: var(--text-xs);
  color: var(--gray-500);
  font-style: italic;
  padding: 4px var(--s-2);
}

.comm-fork-indicator i {
  width: 12px;
  height: 12px;
  color: var(--warning);
  flex-shrink: 0;
}

/* ---- Operations Panel (right) ---- */

.comm-ops-panel {
  border-left: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--gray-50);
  min-height: 0;
}

.comm-ops-head {
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--gray-200);
  background: var(--white);
}

.comm-ops-head-title {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.comm-ops-head-title i {
  width: 16px;
  height: 16px;
  color: var(--brand);
}

.comm-ops-body {
  flex: 1;
  padding: var(--s-4) var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  overflow-y: auto;
}

/* Ops panel sections */
.comm-ops-section h4 {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-500);
  margin-bottom: var(--s-3);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.comm-ops-section h4 i {
  width: 13px;
  height: 13px;
}

/* Info grid rows (Type: Direct, Channel: Email, etc.) */
.comm-ops-info-grid {
  display: grid;
  gap: var(--s-2);
}

.comm-ops-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-sm);
}

.comm-ops-info-label {
  color: var(--gray-500);
  font-weight: 500;
}

.comm-ops-info-value {
  color: var(--gray-800);
  font-weight: 600;
  text-align: right;
}

/* Compose scope indicator */
.comm-ops-scope {
  padding: var(--s-3);
  background: var(--brand-wash);
  border: 1px solid rgba(72,122,123,0.12);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  color: var(--brand-dark);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.comm-ops-scope i {
  width: 14px;
  height: 14px;
  color: var(--brand);
  flex-shrink: 0;
}

/* Quick action links in ops panel */
.comm-ops-link {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
  border-radius: var(--r-md);
  transition: all var(--t-fast);
  text-decoration: none;
}

.comm-ops-link:hover {
  background: var(--brand-wash);
}

.comm-ops-link i {
  width: 14px;
  height: 14px;
}

/* Empty state for conversation panel when no thread selected */
.comm-conv-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--s-8);
  color: var(--gray-400);
}

/* Icon wrapper: fixed dimensions so layout is stable before Lucide converts <i> → <svg> */
.comm-conv-empty-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--s-3);
  color: var(--gray-300);
}

.comm-conv-empty-icon i,
.comm-conv-empty-icon svg {
  width: 40px;
  height: 40px;
}

.comm-conv-empty h4 {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: var(--s-1);
}

.comm-conv-empty p {
  font-size: var(--text-sm);
  color: var(--gray-400);
}

.comm-conv-empty-cta {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-5);
  padding: 9px var(--s-5);
  font: 600 var(--text-sm)/1 var(--font-sans);
  color: var(--white);
  background: var(--brand);
  border: 1.5px solid var(--brand);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--t-fast);
}

.comm-conv-empty-cta:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  box-shadow: var(--shadow-brand);
  transform: translateY(-1px);
}

.comm-conv-empty-cta i {
  width: 15px;
  height: 15px;
}

/* Back button for thread conversation header */
.comm-conv-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: var(--s-2);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  color: var(--gray-500);
  cursor: pointer;
  transition: all var(--t-fast);
  flex-shrink: 0;
}

.comm-conv-back:hover {
  background: var(--gray-100);
  border-color: var(--gray-200);
  color: var(--gray-700);
}

.comm-conv-back i {
  width: 16px;
  height: 16px;
}

/* ---- Sub-Task Reassignment Inline (UI-303) ---- */

.ck-reassign-inline {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex: 1;
}

.ck-reassign-label {
  font-size: var(--text-xs);
  color: var(--gray-500);
  white-space: nowrap;
}

.ck-reassign-select {
  flex: 1;
  max-width: 200px;
}

/* --- Activity Filter --- */

.act-filter-select {
  padding: 5px 10px;
  font-size: 13px;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
  background: var(--white);
  color: var(--gray-700);
  cursor: pointer;
}

.act-filter-select:focus {
  outline: none;
  border-color: var(--brand);
}


/* ==========================================================================
   DOCUMENTS TAB — NEW STYLES
   Replaces old Section 9 (.docs-layout, .d-folder, .d-file, .dz, .btn-doc)
   Source: 6 mockup files (docs-smart-view, docs-drive-explorer,
           docs-management-actions, docs-task-integration,
           docs-upload-flow, docs-edge-cases)
   ========================================================================== */


/* ─── Documents Tab: Smart View ─── */

/* Tab Content Container */
.doc-content {
  padding: var(--s-6) var(--s-8) var(--s-10);
  max-width: 960px;
  margin: 0 auto;
}

/* Documents skeleton loading */
.doc-skeleton { padding: var(--s-4) 0; display: flex; flex-direction: column; gap: var(--s-3); }
.doc-skeleton-bar {
  height: 12px; width: 50%; border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%; animation: skeletonShimmer 1.5s ease-in-out infinite;
}
.doc-skeleton-row {
  height: 44px; width: 100%; border-radius: var(--r-md);
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%; animation: skeletonShimmer 1.5s ease-in-out infinite;
}
.doc-skeleton-row.short { width: 70%; }

/* Mode Toggle (Smart View / Explorer) */
.doc-mode-toggle {
  display: flex; gap: var(--s-1); margin-bottom: var(--s-6);
}
.doc-mode-btn {
  display: inline-flex; align-items: center; gap: var(--s-1-5);
  padding: var(--s-2) var(--s-4); border-radius: var(--r-md);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--gray-200); background: var(--white);
  color: var(--gray-500); transition: all var(--t-fast);
}
.doc-mode-btn i, .doc-mode-btn svg { width: 16px; height: 16px; }
.doc-mode-btn:hover { color: var(--gray-700); border-color: var(--gray-300); background: var(--gray-50); }
.doc-mode-btn.active {
  color: var(--brand); background: var(--brand-wash);
  border-color: var(--brand); font-weight: 600;
}
.doc-mode-btn.disabled {
  opacity: 0.4; cursor: not-allowed; pointer-events: none;
}

/* Section Shell */
.doc-section { margin-bottom: var(--s-6); }
.doc-section-header {
  display: flex; align-items: center; gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.doc-section-title {
  font-size: 15px; font-weight: 700; color: var(--gray-800);
  display: flex; align-items: center; gap: var(--s-2);
  letter-spacing: -0.1px;
}
.doc-section-title i, .doc-section-title svg { width: 18px; height: 18px; color: var(--gray-400); }
.doc-section-badge {
  font-size: 11px; font-weight: 700; min-width: 20px; height: 20px;
  padding: 0 6px; border-radius: var(--r-full);
  background: var(--gray-100); color: var(--gray-500);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
}

/* Property Files Card */
.doc-files-card {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-xs);
}

/* File Row */
.doc-file-row {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--gray-100);
  transition: background var(--t-fast);
  animation: docSlideUp 0.3s ease both;
}
.doc-file-row:last-of-type { border-bottom: none; }
.doc-file-row:hover { background: var(--gray-50); }

/* File Info */
.doc-file-info {
  display: flex; align-items: center; gap: var(--s-3);
  min-width: 0;
}
.doc-file-icon {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.doc-file-icon i, .doc-file-icon svg { width: 18px; height: 18px; }
/* Explorer tree uses smaller icons */
.exp-tree-row .doc-file-icon { width: 28px; height: 28px; }
.exp-tree-row .doc-file-icon i, .exp-tree-row .doc-file-icon svg { width: 16px; height: 16px; }
.doc-file-icon.folder { background: rgba(251,188,4,0.12); color: #C79500; }
.doc-file-icon.sheets { background: rgba(15,157,88,0.12); color: var(--sheets-green); }
.doc-file-icon.docs { background: rgba(66,133,244,0.12); color: var(--docs-blue); }
.doc-file-icon.pdf { background: rgba(234,67,53,0.10); color: #EA4335; }
.doc-file-icon.docx { background: rgba(59,130,246,0.10); color: #3B82F6; }
.doc-file-icon.generic { background: var(--gray-100); color: var(--gray-400); }

.doc-file-name {
  font-size: 14px; font-weight: 500; color: var(--gray-800);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Stage Origin Badge on File Rows */
.doc-file-stage {
  font-size: 11px; font-weight: 600; padding: 3px 8px;
  border-radius: var(--r-full); white-space: nowrap; flex-shrink: 0;
}

/* Open Link */
.doc-file-open {
  display: inline-flex; align-items: center; gap: var(--s-1);
  margin-left: auto;
  font-size: 13px; font-weight: 500; color: var(--brand);
  cursor: pointer; transition: all var(--t-fast);
  text-decoration: none; padding: var(--s-1) var(--s-2);
  border-radius: var(--r-sm); white-space: nowrap;
  margin-left: auto; flex-shrink: 0;
}
.doc-file-open i, .doc-file-open svg { width: 14px; height: 14px; }
.doc-file-open:hover { color: var(--brand-dark); background: var(--brand-wash); }
.doc-file-open.disabled {
  color: var(--gray-300); cursor: not-allowed; pointer-events: none;
}

/* Section Note Footer */
.doc-section-note {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  font-size: 11.5px; color: var(--gray-400);
  border-top: 1px solid var(--gray-100);
  font-style: italic;
  background: var(--gray-50);
}

/* Task Workspace Card */
.doc-workspace-card {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-xs);
}

/* Filter Row */
.doc-filters {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--gray-50); border-bottom: 1px solid var(--gray-200);
}
.doc-filter-toggle {
  display: flex; border: 1px solid var(--gray-200); border-radius: var(--r-md);
  overflow: hidden;
}
.doc-filter-btn {
  padding: var(--s-1-5) var(--s-3); font-size: 12px; font-weight: 500;
  color: var(--gray-500); background: var(--white); border: none;
  cursor: pointer; transition: all var(--t-fast); white-space: nowrap;
}
.doc-filter-btn:hover { color: var(--gray-700); background: var(--gray-50); }
.doc-filter-btn.active { color: var(--brand); background: var(--brand-wash); font-weight: 600; }

/* Stage Group */
.doc-stage-group { margin-bottom: 0; }
.doc-stage-group + .doc-stage-group {
  border-top: 2px solid var(--gray-200);
}
.doc-stage-group.dimmed { opacity: 0.55; }
.doc-stage-group.dimmed:hover { opacity: 0.85; }

.doc-stage-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-3) var(--s-4);
  background: var(--gray-50); border-bottom: 1px solid var(--gray-200);
}
.doc-stage-header-left { display: flex; align-items: center; gap: var(--s-3); }
.doc-stage-badge-sm {
  display: inline-flex; align-items: center; gap: var(--s-1);
  font-size: 11px; font-weight: 600; padding: 3px 8px;
  border-radius: var(--r-full); text-transform: uppercase; letter-spacing: 0.03em;
}
.doc-stage-current-tag {
  font-size: 11px; font-weight: 500; color: var(--gray-400);
  padding: 2px 6px; border-radius: var(--r-sm);
  background: var(--gray-100);
}
.doc-stage-complete {
  display: inline-flex; align-items: center; gap: var(--s-1);
  font-size: 12px; font-weight: 600; color: var(--success);
}
.doc-stage-complete i, .doc-stage-complete svg { width: 14px; height: 14px; }
.doc-stage-count {
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  color: var(--gray-500);
}

/* Task Table */
.doc-task-head {
  display: grid;
  grid-template-columns: 1fr 80px 148px 96px;
  gap: 0; padding: 0 var(--s-4);
  background: var(--white); border-bottom: 1px solid var(--gray-200);
}
.doc-th {
  padding: var(--s-2) var(--s-3);
  font-size: 11px; font-weight: 600; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.doc-task-row {
  display: grid;
  grid-template-columns: 1fr 80px 148px 96px;
  gap: 0; padding: 0 var(--s-4); align-items: center;
  border-bottom: 1px solid var(--gray-100);
  transition: background var(--t-fast);
  animation: docSlideUp 0.3s ease both;
}
.doc-task-row:last-child { border-bottom: none; }
.doc-task-row:hover { background: var(--gray-50); }
.doc-td { padding: var(--s-3) var(--s-3); }
.doc-td-task { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.doc-td-assigned { display: flex; align-items: center; justify-content: center; }
.doc-task-title {
  font-size: 13px; font-weight: 600; color: var(--gray-800);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Task Workspace Avatar */
.doc-task-avatar {
  width: 26px; height: 26px; border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: var(--white);
  flex-shrink: 0; letter-spacing: 0.02em;
}

/* Task Workspace Status Pill — matches tv2-status-pill */
.doc-status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 3px 10px;
  border-radius: var(--r-full); white-space: nowrap;
  user-select: none; line-height: 1.3;
}
.doc-status-pill .pill-dot {
  width: 6px; height: 6px; border-radius: var(--r-full); flex-shrink: 0;
}

/* Folder Link */
.doc-folder-link {
  display: inline-flex; align-items: center; gap: var(--s-1);
  font-size: 12px; font-weight: 500; color: var(--brand);
  cursor: pointer; transition: all var(--t-fast); text-decoration: none;
  padding: 3px 8px; border-radius: var(--r-sm);
}
.doc-folder-link i, .doc-folder-link svg { width: 14px; height: 14px; }
.doc-folder-link:hover { background: var(--brand-wash); color: var(--brand-dark); }
.doc-folder-count {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  background: var(--brand-subtle); color: var(--brand);
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: var(--r-full); display: inline-flex;
  align-items: center; justify-content: center;
  margin-left: 2px;
}
.doc-no-folder { color: var(--gray-300); font-size: 13px; padding: 0 var(--s-3); }

/* Empty State */
.doc-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px var(--s-8); text-align: center;
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
}
.doc-empty i, .doc-empty > svg { width: 48px; height: 48px; color: var(--gray-300); margin-bottom: var(--s-4); }
.doc-empty h3 {
  font-size: 15px; font-weight: 700; color: var(--gray-700);
  margin-bottom: var(--s-1-5);
}
.doc-empty p {
  font-size: 13px; color: var(--gray-500); max-width: 320px; line-height: 1.6;
}

/* Declined Banner */
.doc-declined-banner {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-4); border-radius: var(--r-md);
  font-size: 13px; font-weight: 500; color: #92400E;
  background: var(--warning-wash); border: 1px solid rgba(245,158,11,0.25);
  margin-bottom: var(--s-5);
}
.doc-declined-banner i, .doc-declined-banner svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--warning); }

/* File Size Column */
.doc-file-size {
  font-family: var(--font-mono); font-size: 12px; font-weight: 500;
  color: var(--gray-400); white-space: nowrap; flex-shrink: 0;
  min-width: 60px; text-align: right;
}


/* ─── Documents Tab: Explorer ─── */

/* Action Bar */
.exp-action-bar {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--r-lg); margin-bottom: var(--s-4);
  box-shadow: var(--shadow-xs);
}
.exp-action-btn {
  display: inline-flex; align-items: center; gap: var(--s-1-5);
  padding: var(--s-2) var(--s-3); border-radius: var(--r-md);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--gray-200); background: var(--white);
  color: var(--gray-600); transition: all var(--t-fast);
}
.exp-action-btn i, .exp-action-btn svg { width: 15px; height: 15px; }
.exp-action-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-wash); }
.exp-action-btn.primary {
  background: var(--brand); color: var(--white); border-color: var(--brand);
}
.exp-action-btn.primary:hover { background: var(--brand-dark); }
.exp-action-bar.disabled { opacity: 0.45; pointer-events: none; }
.exp-search {
  margin-left: auto;
  padding: var(--s-2) var(--s-3); border-radius: var(--r-md);
  border: 1px solid var(--gray-200); background: var(--gray-50);
  font-size: 13px; color: var(--gray-700); min-width: 180px;
  transition: all var(--t-fast); font-family: var(--font-sans);
  outline: none;
}
.exp-search::placeholder { color: var(--gray-400); }
.exp-search:hover { border-color: var(--gray-300); }
.exp-search:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); background: var(--white); }

/* Drive Breadcrumb */
.exp-breadcrumb {
  display: flex; align-items: center; gap: var(--s-1-5);
  padding: 0 var(--s-1); margin-bottom: var(--s-3);
  font-size: 13px;
}
.exp-breadcrumb-seg {
  color: var(--gray-500); cursor: pointer; font-weight: 500;
  transition: color var(--t-fast); text-decoration: none;
  padding: 2px 4px; border-radius: var(--r-sm);
}
.exp-breadcrumb-seg:hover { color: var(--brand); background: var(--brand-wash); }
.exp-breadcrumb-seg.current { color: var(--gray-800); font-weight: 600; cursor: default; }
.exp-breadcrumb-seg.current:hover { background: none; color: var(--gray-800); }
.exp-breadcrumb-sep { color: var(--gray-300); font-size: 11px; user-select: none; }

/* Tree Card */
.exp-tree-card {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-xs);
  position: relative;
}
.exp-tree-card.dimmed > .exp-tree-body { opacity: 0.4; pointer-events: none; }

/* Tree Header */
.exp-tree-head {
  display: grid; grid-template-columns: 1fr 110px 70px;
  gap: 0; padding: 0 var(--s-4);
  background: var(--gray-50); border-bottom: 1px solid var(--gray-200);
}
.exp-th {
  padding: var(--s-2) var(--s-3);
  font-size: 11px; font-weight: 600; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: 0.06em;
}

/* Tree Row */
.exp-tree-row {
  display: grid; grid-template-columns: 1fr 110px 70px;
  gap: 0; padding: 0 var(--s-4); align-items: center;
  border-bottom: 1px solid var(--gray-100);
  transition: background var(--t-fast);
  animation: docSlideUp 0.25s ease both;
  cursor: default;
}
.exp-tree-row:last-child { border-bottom: none; }
.exp-tree-row:hover { background: var(--gray-50); }
.exp-tree-row.selected {
  background: var(--brand-wash);
  border-left: 3px solid var(--brand);
  padding-left: calc(var(--s-4) - 3px);
}
.exp-tree-row.ctx-active { background: var(--gray-50); }

/* Tree Cells */
.exp-tc { padding: 10px var(--s-3); }
.exp-tc-name {
  display: flex; align-items: center; gap: var(--s-2);
  min-width: 0;
}
.exp-tc-meta {
  font-size: 12px; color: var(--gray-500); font-family: var(--font-mono);
}

/* Chevron */
.exp-chevron {
  width: 16px; height: 16px; flex-shrink: 0;
  color: var(--gray-400); transition: transform var(--t-fast);
  cursor: pointer;
}
.exp-chevron.expanded { transform: rotate(90deg); }
.exp-chevron.hidden { visibility: hidden; }

/* File Name */
.exp-name {
  font-size: 14px; font-weight: 500; color: var(--gray-800);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.exp-name.folder-name { font-weight: 600; }

/* Context Menu — fixed position to escape overflow:hidden containers */
.exp-ctx-menu {
  position: fixed; z-index: 9999;
  min-width: 200px; padding: 6px;
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  animation: docCtxFadeIn 0.12s ease;
}
.exp-ctx-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  font-size: 13px; font-weight: 500; color: var(--gray-700);
  cursor: pointer; transition: all var(--t-fast);
  border-radius: var(--r-md); border: none; background: none;
  width: 100%; text-align: left;
}
.exp-ctx-item svg { color: var(--gray-400); flex-shrink: 0; }
.exp-ctx-item:hover { background: var(--gray-50); color: var(--gray-900); }
.exp-ctx-item:hover svg { color: var(--gray-600); }
.exp-ctx-item.danger { color: var(--error); }
.exp-ctx-item.danger svg { color: var(--error); }
.exp-ctx-item.danger:hover { background: rgba(239,68,68,0.06); }
.exp-ctx-divider {
  height: 1px; background: var(--gray-100);
  margin: 4px 8px;
}

/* Info Panel */
.exp-info-panel {
  margin-top: var(--s-4);
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-xs);
  animation: docSlideUp 0.25s ease both;
}
.exp-info-header {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4); border-bottom: 1px solid var(--gray-100);
}
.exp-info-icon {
  width: 44px; height: 44px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.exp-info-icon i, .exp-info-icon svg { width: 22px; height: 22px; }
.exp-info-icon.pdf { background: rgba(234,67,53,0.10); color: #EA4335; }
.exp-info-title {
  font-size: 15px; font-weight: 700; color: var(--gray-800);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.exp-info-body {
  padding: var(--s-4);
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3) var(--s-6);
}
.exp-info-field-label {
  font-size: 11px; font-weight: 600; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 2px;
}
.exp-info-field-value {
  font-size: 13px; font-weight: 500; color: var(--gray-800);
}
.exp-info-actions {
  display: flex; gap: var(--s-2); padding: 0 var(--s-4) var(--s-4);
}
.exp-info-btn {
  display: inline-flex; align-items: center; gap: var(--s-1-5);
  padding: var(--s-2) var(--s-4); border-radius: var(--r-md);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all var(--t-fast); border: 1px solid transparent;
}
.exp-info-btn i, .exp-info-btn svg { width: 15px; height: 15px; }
.exp-info-btn.primary {
  background: var(--brand); color: var(--white); border-color: var(--brand);
}
.exp-info-btn.primary:hover { background: var(--brand-dark); }
.exp-info-btn.secondary {
  background: var(--white); color: var(--gray-600); border-color: var(--gray-200);
}
.exp-info-btn.secondary:hover { border-color: var(--brand); color: var(--brand); }

/* New Folder Inline Input */
.exp-new-folder-row {
  display: grid; grid-template-columns: 1fr 110px 70px;
  gap: 0; padding: 0 var(--s-4); align-items: center;
  border-bottom: 1px solid var(--gray-200);
  background: var(--brand-wash);
  animation: docSlideUp 0.2s ease both;
}
.exp-new-folder-cell {
  display: flex; align-items: center; gap: var(--s-2);
  padding: 8px var(--s-3);
}
.exp-new-input {
  flex: 1; padding: var(--s-2) var(--s-3); border-radius: var(--r-md);
  border: 1.5px solid var(--brand); background: var(--white);
  font-size: 13px; font-weight: 500; color: var(--gray-800);
  font-family: var(--font-sans); outline: none;
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.exp-new-input::placeholder { color: var(--gray-400); }
.exp-inline-btn {
  width: 28px; height: 28px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--gray-200); background: var(--white);
  cursor: pointer; transition: all var(--t-fast);
  flex-shrink: 0;
}
.exp-inline-btn i, .exp-inline-btn svg { width: 15px; height: 15px; }
.exp-inline-btn.save { color: var(--success); }
.exp-inline-btn.save:hover { background: var(--success-wash); border-color: var(--success); }
.exp-inline-btn.cancel { color: var(--gray-400); }
.exp-inline-btn.cancel:hover { background: var(--gray-100); color: var(--gray-600); }

/* Tree Footer */
.exp-tree-footer {
  display: flex; align-items: center; gap: var(--s-1-5);
  padding: var(--s-3) var(--s-4);
  font-size: 12px; color: var(--gray-400);
  border-top: 1px solid var(--gray-100);
}
.exp-tree-footer i { width: 14px; height: 14px; flex-shrink: 0; }


/* ─── Documents Tab: Upload Flow ─── */

/* Upload Section */
.upload-section {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--r-lg); box-shadow: var(--shadow-xs);
}
.upload-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.upload-title {
  font-size: 13px; font-weight: 700; color: var(--gray-700);
  display: flex; align-items: center; gap: var(--s-2);
}
.upload-title i { width: 16px; height: 16px; color: var(--gray-400); }
.upload-header-count {
  font-size: 12px; color: var(--gray-400);
}
.upload-header-success {
  font-size: 12px; font-weight: 600; color: var(--success);
  display: flex; align-items: center; gap: 4px;
}
.upload-header-success i { width: 14px; height: 14px; }

/* Folder Selector */
.folder-select-wrap {
  position: relative;
  padding: var(--s-3) var(--s-4);
  display: flex; align-items: center; gap: var(--s-3);
  border-bottom: 1px solid var(--gray-200);
}
.folder-select-label {
  font-size: 12px; font-weight: 600; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap;
  flex-shrink: 0;
}
.folder-select {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border: 1.5px solid var(--gray-200);
  border-radius: var(--r-md); cursor: pointer; background: var(--white);
  transition: all var(--t-fast); flex: 1; min-width: 0;
}
.folder-select:hover { border-color: var(--gray-300); }
.folder-select.active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.folder-select i { width: 16px; height: 16px; color: #C79500; flex-shrink: 0; }
.folder-select .fs-name { font-size: 13px; font-weight: 500; color: var(--gray-700); flex: 1; }
.folder-select .fs-chevron { width: 16px; height: 16px; color: var(--gray-400); }
.folder-select.drag-highlight {
  border-color: var(--brand); background: var(--brand-wash);
}
.folder-select.drag-highlight .fs-name { color: var(--brand); font-weight: 600; }
.folder-select.uploading { pointer-events: none; opacity: 0.7; }
.folder-select.success {
  border-color: var(--success); background: var(--success-wash);
}
.folder-select.success i { color: var(--success); }
.folder-select.success .fs-name { color: var(--success); font-weight: 600; }

/* Folder Dropdown */
.folder-dropdown {
  position: absolute; top: 100%; left: var(--s-4); right: var(--s-4);
  z-index: 50; margin-top: 4px;
  border: 1px solid var(--gray-200); background: var(--white);
  border-radius: var(--r-lg); box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  max-height: 260px; overflow-y: auto; padding: 4px;
  animation: docCtxFadeIn 0.12s ease;
}
.folder-option {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; cursor: pointer;
  transition: all var(--t-fast); font-size: 13px;
  border-radius: var(--r-md); border: none; background: none;
  width: 100%; text-align: left;
}
.folder-option:hover { background: var(--gray-50); }
.folder-option.selected { background: var(--brand-wash); }
.folder-option svg { flex-shrink: 0; }
.folder-option .fo-name { color: var(--gray-700); font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-option.selected .fo-name { color: var(--brand); font-weight: 600; }
.folder-option .fo-check { margin-left: auto; flex-shrink: 0; }
.folder-option .fo-indent { flex-shrink: 0; }
.folder-option .fo-tag {
  font-size: 10px; font-weight: 600; color: var(--gray-400);
  background: var(--gray-100); padding: 2px 6px; border-radius: var(--r-sm);
  flex-shrink: 0;
}

/* Dropzone */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px var(--s-8); text-align: center;
  border: 2px dashed var(--gray-300); border-radius: var(--r-lg);
  margin: var(--s-4); transition: all var(--t-base); cursor: pointer;
}
.dropzone:hover { border-color: var(--brand); background: var(--brand-wash); }
.dropzone.drag-active {
  border-color: var(--brand); background: var(--brand-wash);
  box-shadow: inset 0 0 0 2px var(--brand-glow), 0 0 24px var(--brand-glow);
}
.dropzone.compact { margin-top: 0; padding: 32px var(--s-8); }
.dropzone-icon {
  width: 48px; height: 48px; border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--s-4);
}
.dropzone-icon i { width: 24px; height: 24px; }
.dropzone-icon.default { background: var(--gray-100); color: var(--gray-400); }
.dropzone-icon.active { background: var(--brand-wash); color: var(--brand); }
.dropzone-title { font-size: 15px; font-weight: 700; color: var(--gray-700); margin-bottom: var(--s-1); }
.dropzone-title.brand-active { color: var(--brand); }
.dropzone-desc { font-size: 13px; color: var(--gray-400); }
.dropzone-desc .brand-link { color: var(--brand); font-weight: 600; cursor: pointer; }
.dropzone-hint { font-size: 11px; color: var(--gray-400); margin-top: var(--s-3); }

/* Upload Queue */
.upload-queue { padding: var(--s-2) var(--s-4) var(--s-4); }
.upload-file {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3); border: 1px solid var(--gray-200);
  border-radius: var(--r-md); margin-bottom: var(--s-2);
  animation: docSlideUp 0.3s ease both;
}
.upload-file:last-child { margin-bottom: 0; }
.upload-file.queued { opacity: 0.5; }
.upload-file.error-state {
  border-color: rgba(239,68,68,0.3); background: var(--error-wash);
}
.upload-file.success-state {
  border-color: rgba(16,185,129,0.2); background: var(--success-wash);
}
.upload-error-wrap {
  margin: 0 var(--s-4) var(--s-2);
}
.uf-icon {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.uf-icon i, .uf-icon svg { width: 16px; height: 16px; }
.uf-icon.pdf { background: rgba(234,67,53,0.10); color: #EA4335; }
.uf-icon.img { background: rgba(59,130,246,0.10); color: #3B82F6; }
.uf-icon.doc { background: rgba(66,133,244,0.10); color: var(--docs-blue); }
.uf-icon.error { background: rgba(239,68,68,0.10); color: var(--error); }
.uf-info { flex: 1; min-width: 0; }
.uf-name {
  font-size: 13px; font-weight: 500; color: var(--gray-700);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.uf-name.error { color: var(--error); }
.uf-meta { font-size: 11px; color: var(--gray-400); display: flex; align-items: center; gap: var(--s-2); }
.uf-progress {
  width: 100%; height: 4px; border-radius: 2px;
  background: var(--gray-100); margin-top: var(--s-1-5); overflow: hidden;
}
.uf-progress-bar {
  height: 100%; border-radius: 2px; background: var(--brand);
  transition: width 0.5s ease;
}
.uf-progress-bar.done { background: var(--success); }
.uf-progress-bar.error { background: var(--error); }
.uf-status {
  font-size: 12px; font-weight: 600; flex-shrink: 0;
  display: flex; align-items: center; gap: var(--s-1);
}
.uf-status i { width: 16px; height: 16px; }
.uf-status.uploading { color: var(--brand); }
.uf-status.done { color: var(--success); }
.uf-status.error { color: var(--error); }
.uf-status.queued { color: var(--gray-400); }

/* Validation Error */
.validation-error {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-3) var(--s-4); background: var(--error-wash);
  border: 1px solid rgba(239,68,68,0.2); border-radius: var(--r-md);
  margin: var(--s-4);
}
.ve-icon {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  background: rgba(239,68,68,0.15); color: var(--error); flex-shrink: 0;
}
.ve-icon i { width: 16px; height: 16px; }
.ve-info { flex: 1; }
.ve-title { font-size: 13px; font-weight: 700; color: #991B1B; }
.ve-desc { font-size: 12px; color: #B91C1C; margin-top: 2px; }
.ve-dismiss {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: var(--r-sm);
  border: none; background: none; color: #B91C1C; cursor: pointer;
}
.ve-dismiss i { width: 14px; height: 14px; }


/* ─── Documents Tab: Management Modals ─── */

/* Modal Backdrop */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  animation: docFadeIn 0.2s ease;
}

/* Modal Shell */
.modal-card {
  background: var(--white); border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl); width: 480px; max-width: 92vw;
  overflow: hidden; animation: docSlideIn 0.25s ease;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-5) var(--s-6); border-bottom: 1px solid var(--gray-200);
}
.modal-header-left {
  display: flex; align-items: center; gap: var(--s-3);
}
.modal-header-icon {
  width: 36px; height: 36px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.modal-header-icon i, .modal-header-icon svg { width: 18px; height: 18px; }
.modal-header-icon.brand { background: var(--brand-wash); color: var(--brand); }
.modal-header-icon.error { background: var(--error-wash); color: var(--error); }
.modal-header-icon.info { background: var(--info-wash); color: var(--info); }
.modal-header-icon.success { background: var(--success-wash); color: var(--success); }
.modal-title {
  font-size: 16px; font-weight: 700; color: var(--gray-900);
  letter-spacing: -0.2px;
}
.modal-subtitle {
  font-size: 12px; color: var(--gray-500); margin-top: 1px;
}
.modal-close {
  width: 32px; height: 32px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  border: none; background: none; color: var(--gray-400);
  cursor: pointer; transition: all var(--t-fast);
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-600); }
.modal-close i, .modal-close svg { width: 18px; height: 18px; }
.modal-body { padding: var(--s-5) var(--s-6); }
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: var(--s-3);
  padding: var(--s-4) var(--s-6); border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}

/* Form Fields */
.form-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--gray-600); margin-bottom: var(--s-1-5);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.form-input {
  width: 100%; padding: 10px var(--s-3);
  border: 1px solid var(--gray-200); border-radius: var(--r-md);
  font-size: 14px; font-family: var(--font-sans); color: var(--gray-800);
  background: var(--white); transition: all var(--t-fast);
  outline: none;
}
.form-input:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow);
}
.form-input::placeholder { color: var(--gray-400); }
.form-hint {
  font-size: 12px; color: var(--gray-400); margin-top: var(--s-1-5);
}
.form-group { margin-bottom: var(--s-5); }
.form-group:last-child { margin-bottom: 0; }
.form-select {
  width: 100%; padding: 10px var(--s-3);
  border: 1px solid var(--gray-200); border-radius: var(--r-md);
  font-size: 14px; font-family: var(--font-sans); color: var(--gray-700);
  background: var(--white); cursor: pointer; outline: none;
}

/* Location Breadcrumb Inside Modal */
.form-location {
  display: flex; align-items: center; gap: var(--s-2);
  padding: 10px var(--s-3);
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: var(--r-md); font-size: 13px; color: var(--gray-600);
}
.form-location i { width: 16px; height: 16px; color: var(--gray-400); flex-shrink: 0; }
.form-location .loc-sep { color: var(--gray-300); font-size: 10px; }
.form-location .loc-current { color: var(--gray-800); font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: var(--s-1-5);
  padding: 10px var(--s-5); border-radius: var(--r-md);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; transition: all var(--t-fast);
  font-family: var(--font-sans);
}
.btn i { width: 16px; height: 16px; }
.btn-brand {
  background: var(--brand); color: var(--white); border-color: var(--brand);
}
.btn-brand:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-ghost {
  background: var(--white); color: var(--gray-600); border-color: var(--gray-200);
}
.btn-ghost:hover { background: var(--gray-50); border-color: var(--gray-300); color: var(--gray-700); }
.btn-danger {
  background: var(--error); color: var(--white); border-color: var(--error);
}
.btn-danger:hover { background: #DC2626; border-color: #DC2626; }
.btn-outline-brand {
  background: var(--white); color: var(--brand); border-color: var(--brand);
}
.btn-outline-brand:hover { background: var(--brand-wash); }

/* Share Dialog */
.share-input-row {
  display: flex; gap: var(--s-2); margin-bottom: var(--s-4);
}
.share-input-row .form-input { flex: 1; }
.share-role-select {
  padding: 10px var(--s-3);
  border: 1px solid var(--gray-200); border-radius: var(--r-md);
  font-size: 13px; font-family: var(--font-sans); color: var(--gray-700);
  background: var(--white); cursor: pointer; outline: none;
  min-width: 110px; transition: border-color var(--t-fast);
}
.share-role-select:focus { border-color: var(--brand); }
.share-divider {
  height: 1px; background: var(--gray-200); margin: var(--s-4) 0;
}
.share-people-label {
  font-size: 12px; font-weight: 600; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: var(--s-3);
}
.share-person {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-2) 0; border-bottom: 1px solid var(--gray-100);
}
.share-person:last-child { border-bottom: none; }
.share-avatar {
  width: 32px; height: 32px; border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--white); flex-shrink: 0;
}
.share-person-info { flex: 1; min-width: 0; }
.share-person-name {
  font-size: 13px; font-weight: 600; color: var(--gray-800);
}
.share-person-email {
  font-size: 12px; color: var(--gray-400);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.share-person-role {
  font-size: 12px; font-weight: 500; color: var(--gray-500);
  padding: 3px 8px; border-radius: var(--r-sm); background: var(--gray-100);
}
.share-person-role.owner {
  color: var(--brand); background: var(--brand-wash); font-weight: 600;
}
.share-link-row {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3); background: var(--gray-50);
  border: 1px solid var(--gray-200); border-radius: var(--r-md);
  margin-top: var(--s-4);
}
.share-link-url {
  flex: 1; font-size: 12px; font-family: var(--font-mono);
  color: var(--gray-500); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.share-link-copy {
  display: inline-flex; align-items: center; gap: var(--s-1);
  padding: var(--s-1-5) var(--s-3); border-radius: var(--r-sm);
  font-size: 12px; font-weight: 600; color: var(--brand);
  background: var(--brand-wash); border: none; cursor: pointer;
  transition: all var(--t-fast); white-space: nowrap;
}
.share-link-copy i { width: 14px; height: 14px; }
.share-link-copy:hover { background: var(--brand-subtle); }

/* Rename Inline */
.rename-tree-bg {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-xs);
}
.rename-head {
  display: grid; grid-template-columns: 1fr 110px 70px;
  padding: 0 var(--s-4); border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.rename-th {
  padding: var(--s-2) var(--s-2); font-size: 11px; font-weight: 600;
  color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.06em;
}
.rename-row {
  display: grid; grid-template-columns: 1fr 110px 70px;
  align-items: center; padding: 0 var(--s-4);
  border-bottom: 1px solid var(--gray-100);
  transition: background var(--t-fast);
  animation: docSlideUp 0.3s ease both;
}
.rename-row:last-child { border-bottom: none; }
.rename-row:hover { background: var(--gray-50); }
.rename-row.editing { background: var(--brand-wash); }
.rename-cell { padding: 10px var(--s-2); }
.rename-cell-name {
  display: flex; align-items: center; gap: var(--s-2);
  padding: 10px var(--s-2); min-width: 0;
}
.rename-icon {
  width: 28px; height: 28px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.rename-icon i { width: 16px; height: 16px; }
.rename-icon.folder { background: rgba(251,188,4,0.12); color: #C79500; }
.rename-icon.sheets { background: rgba(15,157,88,0.12); color: var(--sheets-green); }
.rename-icon.docs { background: rgba(66,133,244,0.12); color: var(--docs-blue); }
.rename-icon.pdf { background: rgba(234,67,53,0.12); color: #EA4335; }
.rename-fname {
  font-size: 13px; font-weight: 500; color: var(--gray-700);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rename-input-wrap {
  display: flex; align-items: center; gap: var(--s-1-5); flex: 1; min-width: 0;
}
.rename-input {
  flex: 1; padding: var(--s-1-5) var(--s-2);
  border: 1.5px solid var(--brand); border-radius: var(--r-sm);
  font-size: 13px; font-family: var(--font-sans); color: var(--gray-800);
  background: var(--white); outline: none;
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.rename-action-btn {
  width: 26px; height: 26px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer; transition: all var(--t-fast);
}
.rename-action-btn i { width: 14px; height: 14px; }
.rename-action-btn.save { background: var(--brand); color: var(--white); }
.rename-action-btn.save:hover { background: var(--brand-dark); }
.rename-action-btn.cancel { background: var(--gray-100); color: var(--gray-500); }
.rename-action-btn.cancel:hover { background: var(--gray-200); color: var(--gray-600); }
.rename-cell-date { font-size: 12px; color: var(--gray-400); font-family: var(--font-mono); }
.rename-cell-size { font-size: 12px; color: var(--gray-400); font-family: var(--font-mono); }

/* Delete Dialog */
.delete-icon-wrap {
  width: 48px; height: 48px; border-radius: var(--r-lg);
  background: var(--error-wash); color: var(--error);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto var(--s-4);
}
.delete-icon-wrap i, .delete-icon-wrap svg { width: 24px; height: 24px; }
.delete-title {
  font-size: 16px; font-weight: 700; color: var(--gray-900);
  text-align: center; margin-bottom: var(--s-2);
}
.delete-desc {
  font-size: 13px; color: var(--gray-500); text-align: center;
  line-height: 1.6; max-width: 340px; margin: 0 auto;
}
.delete-file-preview {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4); background: var(--gray-50);
  border: 1px solid var(--gray-200); border-radius: var(--r-md);
  margin: var(--s-4) 0 0;
}
.delete-file-preview .rename-icon { width: 32px; height: 32px; }
.delete-file-name {
  font-size: 13px; font-weight: 600; color: var(--gray-700);
}
.delete-file-meta {
  font-size: 12px; color: var(--gray-400);
}

/* Shortcut Dialog */
.shortcut-target {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4); background: var(--gray-50);
  border: 1px solid var(--gray-200); border-radius: var(--r-md);
}
.shortcut-target-icon {
  width: 36px; height: 36px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  background: rgba(251,188,4,0.12); color: #C79500;
}
.shortcut-target-icon i, .shortcut-target-icon svg { width: 18px; height: 18px; }
.shortcut-target-info { flex: 1; }
.shortcut-target-name { font-size: 14px; font-weight: 600; color: var(--gray-800); }
.shortcut-target-path { font-size: 12px; color: var(--gray-400); }
.shortcut-arrow {
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-300); margin: var(--s-3) 0;
}
.shortcut-arrow i, .shortcut-arrow svg { width: 20px; height: 20px; }

/* Folder Picker (Shortcut Modal) */
.folder-picker {
  border: 1px solid var(--gray-200); border-radius: var(--r-md);
  overflow: hidden;
}
.folder-picker-head {
  padding: var(--s-2) var(--s-3); background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  font-size: 12px; font-weight: 600; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.folder-picker-item {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--gray-100);
  cursor: pointer; transition: background var(--t-fast); font-size: 13px;
}
.folder-picker-item:last-child { border-bottom: none; }
.folder-picker-item:hover { background: var(--gray-50); }
.folder-picker-item.selected { background: var(--brand-wash); }
.folder-picker-item i { width: 16px; height: 16px; color: #C79500; flex-shrink: 0; }
.folder-picker-item .fp-name { color: var(--gray-700); font-weight: 500; }
.folder-picker-item.selected .fp-name { color: var(--brand); font-weight: 600; }
.folder-picker-item .fp-check {
  margin-left: auto; color: var(--brand); width: 16px; height: 16px;
  display: none;
}
.folder-picker-item.selected .fp-check { display: block; }
.folder-picker-item .fp-indent { width: 20px; flex-shrink: 0; }


/* ─── Documents Tab: Task Integration ─── */

/* Panel Shell */
.panel-shell {
  max-width: 640px; margin: 0 auto; padding: var(--s-5) var(--s-6);
}
.panel-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: var(--s-5); gap: var(--s-4);
}
.panel-header-left { display: flex; align-items: flex-start; gap: var(--s-3); }
.panel-back {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--r-md);
  border: 1px solid var(--gray-200); background: var(--white);
  cursor: pointer; transition: all var(--t-fast); color: var(--gray-500);
  flex-shrink: 0; margin-top: 2px;
}
.panel-back:hover { border-color: var(--brand); color: var(--brand); }
.panel-back i { width: 16px; height: 16px; }
.panel-title {
  font-size: 18px; font-weight: 800; color: var(--gray-900);
  letter-spacing: -0.3px; line-height: 1.2;
}
.panel-subtitle {
  font-size: 13px; color: var(--gray-500); margin-top: 2px;
}

/* Panel Meta Row */
.panel-meta {
  display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-6);
  padding: var(--s-4) 0; border-bottom: 1px solid var(--gray-200);
  margin-bottom: var(--s-5);
}
.panel-meta-item { display: flex; flex-direction: column; gap: 2px; }
.panel-meta-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--gray-400);
}
.panel-meta-value {
  font-size: 13px; font-weight: 600; color: var(--gray-700);
  display: flex; align-items: center; gap: var(--s-1-5);
}
.panel-meta-value i { width: 14px; height: 14px; }

/* Class-based Status Pills (task-integration alternative) */
.pill-working { color: var(--sub-progress); background: var(--sub-progress-wash); }
.pill-working .pill-dot { background: var(--sub-progress); }
.pill-todo { color: var(--sub-assigned); background: var(--sub-assigned-wash); }
.pill-todo .pill-dot { background: var(--sub-assigned); }

/* Section Card */
.section-card {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-xs);
  margin-bottom: var(--s-5);
}
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.section-title {
  font-size: 13px; font-weight: 700; color: var(--gray-700);
  display: flex; align-items: center; gap: var(--s-2);
}
.section-title i { width: 16px; height: 16px; color: var(--gray-400); }
.section-count {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--r-full); background: var(--gray-100); color: var(--gray-500);
  display: inline-flex; align-items: center; justify-content: center;
}
.section-body { padding: 0; }

/* Deliverables */
.deliverable-row {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--gray-100);
  animation: docSlideUp 0.3s ease both;
}
.deliverable-row:last-child { border-bottom: none; }
.deliverable-row:hover { background: var(--gray-50); }
.deliv-icon {
  width: 28px; height: 28px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.deliv-icon i { width: 14px; height: 14px; }
.deliv-icon.pdf { background: rgba(234,67,53,0.10); color: #EA4335; }
.deliv-icon.docx { background: rgba(59,130,246,0.10); color: #3B82F6; }
.deliv-icon.check { background: var(--success-wash); color: var(--success); }
.deliv-info { flex: 1; min-width: 0; }
.deliv-name {
  font-size: 13px; font-weight: 500; color: var(--gray-700);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.deliv-meta { font-size: 11px; color: var(--gray-400); }
.deliv-action {
  display: inline-flex; align-items: center; gap: var(--s-1);
  font-size: 12px; font-weight: 500; color: var(--brand);
  cursor: pointer; padding: 3px 8px; border-radius: var(--r-sm);
  transition: all var(--t-fast); border: none; background: none;
}
.deliv-action i { width: 14px; height: 14px; }
.deliv-action:hover { background: var(--brand-wash); }

/* Task Files (Drive) */
.task-files-open {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--gray-100);
  color: var(--brand); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background var(--t-fast);
}
.task-files-open:hover { background: var(--brand-wash); }
.task-files-open i { width: 16px; height: 16px; }
.task-files-open .tfo-external {
  margin-left: auto; color: var(--gray-400); padding: 2px;
  border-radius: var(--r-sm); transition: color var(--t-fast);
}
.task-files-open .tfo-external:hover { color: var(--brand); }
.task-files-open .tfo-count {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  background: var(--brand-subtle); color: var(--brand);
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: var(--r-full); display: inline-flex;
  align-items: center; justify-content: center;
}

/* Task Files — expanded container */
.td-task-files-list {
  background: var(--gray-50); border-radius: var(--r-lg);
  padding: var(--s-3); margin-top: var(--s-1);
}
.td-task-files-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--s-2);
}
.td-task-files-header-actions {
  display: flex; align-items: center; gap: var(--s-1);
}
.td-files-link {
  font-size: 12px; font-weight: 500; color: var(--brand);
  text-decoration: none; display: inline-flex; align-items: center; gap: 3px;
  transition: color var(--t-fast);
}
.td-files-link:hover { color: var(--brand-dark, #3a6565); }
.td-files-link i { width: 11px; height: 11px; }
.td-files-btn {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500; color: var(--gray-500);
  background: none; border: none; cursor: pointer; padding: 4px 8px;
  border-radius: var(--r-sm); transition: all var(--t-fast);
}
.td-files-btn:hover { background: var(--gray-100); color: var(--gray-600); }
.td-files-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.td-files-btn i { width: 12px; height: 12px; }
/* CSS-only spinner (avoids Lucide DOM persistence) */
.td-spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--gray-200); border-top-color: var(--brand);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
.td-spinner.sm { width: 12px; height: 12px; }
/* Retry link for error state */
.td-retry-link {
  font-size: 12px; font-weight: 500; color: var(--brand);
  background: none; border: none; cursor: pointer; padding: 0;
  transition: color var(--t-fast);
}
.td-retry-link:hover { text-decoration: underline; }

/* Task Files — file rows */
.drive-file-row {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-2); border-radius: var(--r-sm);
  transition: background var(--t-fast);
}
.drive-file-row:hover { background: var(--gray-100); }
.drive-icon {
  width: 28px; height: 28px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.drive-icon i { width: 14px; height: 14px; }
.drive-file-info { flex: 1; min-width: 0; }
.drive-file-name {
  font-size: 13px; font-weight: 500; color: var(--gray-700);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: block;
}
.drive-file-size { font-size: 11px; color: var(--gray-400); font-family: var(--font-mono); }
.drive-file-attach {
  display: inline-flex; align-items: center; gap: var(--s-1);
  font-size: 12px; font-weight: 500; color: var(--brand);
  cursor: pointer; padding: 3px 10px; border-radius: var(--r-md);
  border: 1px solid var(--brand-subtle); background: var(--white);
  transition: all var(--t-fast);
}
.drive-file-attach i { width: 12px; height: 12px; }
.drive-file-attach:hover { background: var(--brand-wash); border-color: var(--brand); }
.drive-file-attached {
  display: inline-flex; align-items: center; gap: var(--s-1);
  font-size: 12px; font-weight: 500; color: var(--success);
  padding: 3px 10px;
}
.drive-file-attached i { width: 12px; height: 12px; }

/* Add Task Form */
.form-card {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm);
  max-width: 520px; margin: 0 auto;
}
.form-card-header {
  padding: var(--s-5) var(--s-6); border-bottom: 1px solid var(--gray-200);
}
.form-card-title {
  font-size: 16px; font-weight: 700; color: var(--gray-900); letter-spacing: -0.2px;
}
.form-card-subtitle { font-size: 13px; color: var(--gray-500); margin-top: 2px; }
.form-card-body { padding: var(--s-5) var(--s-6); }
.form-card-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: var(--s-3);
  padding: var(--s-4) var(--s-6); border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}

/* Toggle Switch */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-3) 0;
}
.toggle-label-wrap { display: flex; flex-direction: column; gap: 2px; }
.toggle-label {
  font-size: 14px; font-weight: 600; color: var(--gray-700);
  display: flex; align-items: center; gap: var(--s-2);
}
.toggle-label i { width: 16px; height: 16px; color: var(--drive-yellow); }
.toggle-hint { font-size: 12px; color: var(--gray-400); }
.toggle-switch {
  width: 40px; height: 22px; border-radius: 11px;
  background: var(--brand); cursor: pointer; position: relative;
  transition: background var(--t-fast); border: none; flex-shrink: 0;
}
.toggle-switch .toggle-knob {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--white); position: absolute; top: 2px;
  transition: left var(--t-fast); box-shadow: var(--shadow-sm);
}
.toggle-switch.on .toggle-knob { left: 20px; }
.toggle-switch.off { background: var(--gray-300); }
.toggle-switch.off .toggle-knob { left: 2px; }

/* Notification Card */
.notif-card {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--r-lg); padding: var(--s-4); box-shadow: var(--shadow-sm);
  max-width: 400px; margin: 0 auto;
  animation: docSlideUp 0.3s ease both;
}
.notif-header {
  display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-3);
}
.notif-icon {
  width: 36px; height: 36px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.notif-icon i { width: 18px; height: 18px; }
.notif-icon.drive { background: rgba(251,188,4,0.12); color: #C79500; }
.notif-title { font-size: 14px; font-weight: 700; color: var(--gray-800); }
.notif-time { font-size: 11px; color: var(--gray-400); }
.notif-body {
  font-size: 13px; color: var(--gray-600); line-height: 1.6;
  margin-bottom: var(--s-3);
}
.notif-link {
  display: inline-flex; align-items: center; gap: var(--s-1-5);
  font-size: 13px; font-weight: 600; color: var(--brand);
  cursor: pointer; padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md); background: var(--brand-wash);
  border: none; transition: all var(--t-fast);
}
.notif-link i { width: 16px; height: 16px; }
.notif-link:hover { background: var(--brand-subtle); }

/* Toast */
.toast {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-5); border-radius: var(--r-lg);
  background: var(--gray-900); color: var(--white);
  font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg);
  animation: docToastIn 0.3s ease both;
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 100;
}
.toast i { width: 16px; height: 16px; }
.toast .toast-check { color: var(--success); }


/* ─── Documents Tab: Edge Cases ─── */

/* Not Configured */
.doc-not-configured {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px var(--s-8); text-align: center;
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--r-lg); animation: docSlideUp 0.3s ease both;
}
.doc-not-configured .doc-nc-icon {
  width: 56px; height: 56px; border-radius: var(--r-xl);
  display: flex; align-items: center; justify-content: center;
  background: var(--gray-100); color: var(--gray-400);
  margin-bottom: var(--s-5);
}
.doc-not-configured .doc-nc-icon i { width: 28px; height: 28px; }
.doc-not-configured h3 {
  font-size: 16px; font-weight: 700; color: var(--gray-800);
  margin-bottom: var(--s-2); letter-spacing: -0.2px;
}
.doc-not-configured p {
  font-size: 13px; color: var(--gray-500); max-width: 360px;
  line-height: 1.6; margin-bottom: var(--s-6);
}
.doc-not-configured .doc-nc-btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 10px var(--s-5);
  background: var(--brand); color: var(--white);
  border: none; border-radius: var(--r-md); cursor: pointer;
  font-size: 13px; font-weight: 600; transition: all var(--t-fast);
  box-shadow: var(--shadow-brand);
}
.doc-not-configured .doc-nc-btn:hover { background: var(--brand-dark); }
.doc-not-configured .doc-nc-btn i { width: 16px; height: 16px; }

/* API Error */
.doc-error-card {
  display: flex; align-items: flex-start; gap: var(--s-4);
  padding: var(--s-5); border-radius: var(--r-lg);
  background: var(--white); border: 1px solid rgba(239,68,68,0.3);
  box-shadow: var(--shadow-sm); animation: docSlideUp 0.3s ease both;
}
.doc-error-icon {
  width: 40px; height: 40px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--error-wash); color: var(--error);
  flex-shrink: 0;
}
.doc-error-icon i { width: 20px; height: 20px; }
.doc-error-body { flex: 1; min-width: 0; }
.doc-error-title {
  font-size: 14px; font-weight: 700; color: var(--gray-800);
  margin-bottom: var(--s-1); letter-spacing: -0.1px;
}
.doc-error-desc {
  font-size: 13px; color: var(--gray-500); line-height: 1.5;
  margin-bottom: var(--s-3);
}
.doc-error-code {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  color: var(--error); background: var(--error-wash);
  padding: var(--s-1) var(--s-2); border-radius: var(--r-sm);
  display: inline-block; margin-bottom: var(--s-3);
}
.doc-error-actions { display: flex; gap: var(--s-2); }
.doc-error-retry {
  display: inline-flex; align-items: center; gap: var(--s-1-5);
  padding: var(--s-2) var(--s-4);
  background: var(--white); color: var(--error);
  border: 1px solid rgba(239,68,68,0.3); border-radius: var(--r-md);
  cursor: pointer; font-size: 13px; font-weight: 500;
  transition: all var(--t-fast);
}
.doc-error-retry i { width: 14px; height: 14px; }
.doc-error-retry:hover { background: var(--error-wash); border-color: var(--error); }
.doc-error-dismiss {
  padding: var(--s-2) var(--s-4);
  background: var(--white); color: var(--gray-500);
  border: 1px solid var(--gray-200); border-radius: var(--r-md);
  cursor: pointer; font-size: 13px; font-weight: 500;
  transition: all var(--t-fast);
}
.doc-error-dismiss:hover { background: var(--gray-50); border-color: var(--gray-300); }

/* Read-Only Overlay */
.doc-readonly-banner {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-5); border-radius: var(--r-md);
  background: var(--gray-100); border: 1px solid var(--gray-200);
  margin-bottom: var(--s-5); animation: docSlideUp 0.3s ease both;
}
.doc-readonly-icon {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--warning-wash); color: var(--warning);
  flex-shrink: 0;
}
.doc-readonly-icon i { width: 16px; height: 16px; }
.doc-readonly-text {
  font-size: 13px; font-weight: 600; color: var(--gray-600);
  letter-spacing: -0.1px;
}
.doc-readonly-sub {
  font-weight: 400; color: var(--gray-400); margin-left: var(--s-1);
}

/* Disabled Action Bar */
.doc-action-bar.disabled { opacity: 0.45; pointer-events: none; }
.doc-action-bar {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--r-lg); margin-bottom: var(--s-4);
  box-shadow: var(--shadow-xs); animation: docSlideUp 0.3s ease both;
}
.doc-action-btn {
  display: inline-flex; align-items: center; gap: var(--s-1-5);
  padding: var(--s-2) var(--s-3); border-radius: var(--r-md);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--gray-200); background: var(--white);
  color: var(--gray-600); transition: all var(--t-fast);
}
.doc-action-btn i { width: 16px; height: 16px; }
.doc-action-btn:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-wash); }

/* Submitter Role Badge */
.doc-role-badge {
  display: inline-flex; align-items: center; gap: var(--s-1-5);
  padding: var(--s-1) var(--s-3); border-radius: var(--r-full);
  font-size: 11px; font-weight: 600;
  background: var(--info-wash); color: var(--info);
  margin-bottom: var(--s-5); animation: docSlideUp 0.3s ease both;
}
.doc-role-badge i { width: 14px; height: 14px; }

/* Pagination */
.doc-pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.doc-pagination-info {
  font-size: 12px; font-weight: 500; color: var(--gray-500);
  font-family: var(--font-mono);
}
.doc-pagination-btns { display: flex; gap: var(--s-1); }
.doc-page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--r-md);
  font-size: 12px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--gray-200); background: var(--white);
  color: var(--gray-600); transition: all var(--t-fast);
}
.doc-page-btn i { width: 14px; height: 14px; }
.doc-page-btn:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-wash); }
.doc-page-btn.active {
  color: var(--white); background: var(--brand);
  border-color: var(--brand);
}
.doc-page-btn.disabled {
  opacity: 0.35; cursor: not-allowed; pointer-events: none;
}

/* Tooltip */
.doc-tooltip-wrapper { position: relative; display: flex; align-items: center; min-width: 0; }
.doc-tooltip {
  position: absolute; bottom: calc(100% + 6px); left: 0;
  background: var(--gray-900); color: var(--white);
  padding: var(--s-1-5) var(--s-3); border-radius: var(--r-sm);
  font-size: 11px; font-weight: 500; white-space: nowrap;
  pointer-events: none; opacity: 0; transition: opacity var(--t-fast);
  z-index: 10; box-shadow: var(--shadow-md);
  max-width: 400px; overflow: hidden; text-overflow: ellipsis;
}
.doc-tooltip::after {
  content: ''; position: absolute; top: 100%; left: 16px;
  border: 5px solid transparent; border-top-color: var(--gray-900);
}
.doc-tooltip-wrapper:hover .doc-tooltip { opacity: 1; }

/* Empty Task Card */
.doc-task-empty {
  display: flex; align-items: center; justify-content: center;
  padding: var(--s-6) var(--s-4); text-align: center;
}
.doc-task-empty-content {
  display: flex; flex-direction: column; align-items: center; gap: var(--s-2);
}
.doc-task-empty-content i { width: 24px; height: 24px; color: var(--gray-300); }
.doc-task-empty-text {
  font-size: 13px; color: var(--gray-400); font-weight: 500;
}


/* ─── Documents Tab: Animations ─── */

@keyframes docSlideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes docCtxFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes docFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes docSlideIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes docToastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Stagger Delays: File Rows */
.doc-file-row:nth-child(1) { animation-delay: 0.02s; }
.doc-file-row:nth-child(2) { animation-delay: 0.05s; }
.doc-file-row:nth-child(3) { animation-delay: 0.08s; }
.doc-file-row:nth-child(4) { animation-delay: 0.11s; }
.doc-file-row:nth-child(5) { animation-delay: 0.14s; }
.doc-file-row:nth-child(6) { animation-delay: 0.17s; }
.doc-file-row:nth-child(7) { animation-delay: 0.20s; }

/* Stagger Delays: Task Rows */
.doc-task-row:nth-child(1) { animation-delay: 0.02s; }
.doc-task-row:nth-child(2) { animation-delay: 0.05s; }
.doc-task-row:nth-child(3) { animation-delay: 0.08s; }
.doc-task-row:nth-child(4) { animation-delay: 0.11s; }
.doc-task-row:nth-child(5) { animation-delay: 0.14s; }
.doc-task-row:nth-child(6) { animation-delay: 0.17s; }
.doc-task-row:nth-child(7) { animation-delay: 0.20s; }
.doc-task-row:nth-child(8) { animation-delay: 0.23s; }

/* Stagger Delays: Rename Rows */
.rename-row:nth-child(2) { animation-delay: 0.02s; }
.rename-row:nth-child(3) { animation-delay: 0.05s; }
.rename-row:nth-child(4) { animation-delay: 0.08s; }
.rename-row:nth-child(5) { animation-delay: 0.11s; }
.rename-row:nth-child(6) { animation-delay: 0.14s; }
.rename-row:nth-child(7) { animation-delay: 0.17s; }

/* Stagger Delays: Deliverable Rows */
.deliverable-row:nth-child(1) { animation-delay: 0.02s; }
.deliverable-row:nth-child(2) { animation-delay: 0.05s; }
.deliverable-row:nth-child(3) { animation-delay: 0.08s; }

/* Stagger Delays: Drive File Rows */
.drive-file-row:nth-child(1) { animation-delay: 0.05s; }
.drive-file-row:nth-child(2) { animation-delay: 0.08s; }
.drive-file-row:nth-child(3) { animation-delay: 0.11s; }

/* Stagger Delays: Upload File Rows */
.upload-file:nth-child(1) { animation-delay: 0.02s; }
.upload-file:nth-child(2) { animation-delay: 0.05s; }
.upload-file:nth-child(3) { animation-delay: 0.08s; }

/* Stagger Utility Classes */
.doc-stagger-1 { animation: docSlideUp 0.3s ease both; animation-delay: 0.02s; }
.doc-stagger-2 { animation: docSlideUp 0.3s ease both; animation-delay: 0.06s; }
.doc-stagger-3 { animation: docSlideUp 0.3s ease both; animation-delay: 0.10s; }
.doc-stagger-4 { animation: docSlideUp 0.3s ease both; animation-delay: 0.14s; }



/* ==========================================================================
   10. ACTIVITY TAB
   ========================================================================== */

.act-filter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s-4);
}

.act-filter-label {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--gray-800);
}

/* --- Timeline --- */

.act-timeline {
  list-style: none;
  padding: 0;
  position: relative;
}

.act-timeline::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--gray-100);
}

.act-entry {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  position: relative;
}

.act-entry:first-child {
  padding-top: 0;
}

.act-dot {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 1;
}

.act-dot i {
  width: 14px;
  height: 14px;
}

.act-info {
  flex: 1;
  min-width: 0;
}

.act-desc {
  font-size: var(--text-sm);
  color: var(--gray-600);
  line-height: 1.5;
}

.act-desc strong {
  color: var(--gray-800);
  font-weight: 600;
}

.act-time {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 2px;
}


/* ==========================================================================
   11. DETAIL MODALS
   ========================================================================== */

.pd-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: var(--z-modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn 150ms ease;
}

.pd-modal {
  background: var(--white);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  max-width: 480px;
  width: 90%;
  padding: var(--s-6);
  animation: scaleIn 200ms ease;
}

.pd-modal-header {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}

.pd-modal-icon-badge {
  width: 40px; height: 40px; border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.pd-modal-header-text {
  flex: 1; min-width: 0;
}

.pd-modal-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--gray-900);
}

.pd-modal-subtitle {
  font-size: var(--text-sm);
  color: var(--gray-500);
  margin-top: 2px;
}

.pd-modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  border-radius: var(--r-md);
  cursor: pointer;
  color: var(--gray-400);
  transition: all var(--t-fast);
  font-size: 20px;
  line-height: 1;
}

.pd-modal-close:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

.pd-modal-close i {
  width: 18px;
  height: 18px;
}

.pd-modal-body {
  margin-bottom: var(--s-5);
  font-size: var(--text-base);
  color: var(--gray-600);
  line-height: 1.6;
}

.pd-modal-context {
  padding: var(--s-3); margin-top: var(--s-3);
  background: var(--gray-50); border-radius: var(--r-md);
  border: 1px solid var(--gray-100);
  font-size: var(--text-sm); color: var(--gray-700);
}

.pd-modal-warning {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3); margin-top: var(--s-3);
  background: var(--warning-wash, rgba(245,158,11,0.08));
  border-radius: var(--r-md);
  border: 1px solid rgba(245,158,11,0.15);
  font-size: var(--text-sm); color: var(--warning, #F59E0B);
}

.pd-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-2);
}

/* --- Modal Buttons --- */

.btn-pd-modal {
  padding: 8px 20px;
  border-radius: var(--r-md);
  font: 600 var(--text-base)/1 var(--font-sans);
  cursor: pointer;
  transition: all var(--t-fast);
  border: 1.5px solid;
  display: inline-flex; align-items: center; gap: var(--s-1-5);
}
.btn-pd-modal:disabled {
  opacity: 0.5; cursor: not-allowed;
}
.btn-pd-modal i { width: 14px; height: 14px; }

.btn-pd-modal.ghost {
  background: var(--white);
  color: var(--gray-600);
  border-color: var(--gray-200);
}

.btn-pd-modal.ghost:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
}

.btn-pd-modal.primary {
  background: var(--brand);
  color: var(--white);
  border-color: var(--brand);
}

.btn-pd-modal.primary:hover {
  background: var(--brand-dark);
}

.btn-pd-modal.danger {
  background: var(--error);
  color: var(--white);
  border-color: var(--error);
}

.btn-pd-modal.danger:hover {
  filter: brightness(0.9);
}

.btn-pd-modal.warning {
  background: var(--sub-hold);
  color: var(--white);
  border-color: var(--sub-hold);
}

.btn-pd-modal.warning:hover {
  filter: brightness(0.9);
}

.btn-pd-modal.cancel {
  background: var(--white);
  color: var(--gray-600);
  border-color: var(--gray-200);
}

.btn-pd-modal.cancel:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
}

/* --- Modal Textarea (for decline reason, etc.) --- */

.pd-modal-textarea {
  width: 100%;
  min-height: 80px;
  padding: var(--s-3);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--r-md);
  font: 400 var(--text-base)/1.5 var(--font-sans);
  color: var(--gray-800);
  resize: vertical;
  margin-top: var(--s-3);
  transition: border-color var(--t-fast);
}

.pd-modal-textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}


/* --- Shared Empty State (dashed-border card with icon + text) --- */

.empty-state-card {
  padding: var(--s-8) var(--s-6);
  text-align: center;
  border: 1px dashed var(--gray-200);
  border-radius: var(--r-lg);
}

.empty-state-card.compact {
  padding: var(--s-6);
  border-radius: var(--r-md);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--r-lg);
  background: var(--gray-100);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--s-3);
}

.empty-state-icon i {
  width: 24px;
  height: 24px;
  color: var(--gray-400);
}

.empty-state-icon.error {
  background: rgba(239, 68, 68, 0.08);
}

.empty-state-icon.error i {
  color: var(--error);
}

.empty-state-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 4px;
}

.empty-state-desc {
  font-size: var(--text-sm);
  color: var(--gray-400);
}


/* ==========================================================================
   6b. SUB-TASKS TAB V2 — TABLE LAYOUT + STATUS PILLS
   ========================================================================== */

/* Stage progress bar */
.st-progress {
  display: flex; align-items: center; gap: var(--s-3);
  margin-bottom: var(--s-5);
}
.st-progress-label {
  font-size: 13px; font-weight: 600; color: var(--gray-600); white-space: nowrap;
}
.st-progress-label .stage-name { color: var(--gray-800); }
.st-progress-bar {
  flex: 1; height: 6px; background: var(--gray-200);
  border-radius: var(--r-full); overflow: hidden;
}
.st-progress-fill {
  height: 100%; border-radius: var(--r-full);
  transition: width 0.5s ease; background: var(--brand);
}
.st-progress-fill.complete { background: var(--success); }
.st-progress-text {
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  color: var(--gray-500); white-space: nowrap;
}
.st-progress-text.complete { color: var(--success); }

/* Sub-Tasks V2 table */
.stv2-table {
  width: 100%; background: var(--white);
  border: 1px solid var(--gray-200); border-radius: var(--r-lg);
  overflow: visible; box-shadow: var(--shadow-xs);
}
.stv2-table-head { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.stv2-table-head {
  display: grid;
  grid-template-columns: minmax(200px, 1.5fr) 100px 130px 100px 44px;
  gap: 0; padding: 0 var(--s-4);
  background: var(--gray-50); border-bottom: 1px solid var(--gray-200);
}
.stv2-table-head .stv2-th,
.stv2-table-head .th {
  padding: var(--s-2) var(--s-3);
  font-size: 11px; font-weight: 600; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.stv2-row {
  display: grid;
  grid-template-columns: minmax(200px, 1.5fr) 100px 130px 100px 44px;
  gap: 0; padding: 0 var(--s-4); align-items: center;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer; transition: background var(--t-fast), box-shadow var(--t-fast);
  animation: tv2SlideUp 0.3s ease both;
}
/* Admin view: add 40px actions column */
.stv2-table.has-actions .stv2-table-head,
.stv2-table.has-actions .stv2-row {
  grid-template-columns: minmax(200px, 1.5fr) 100px 130px 100px 44px 40px;
}
.stv2-row:last-child { border-bottom: none; }
.stv2-row:hover { background: var(--gray-50); box-shadow: inset 0 0 0 1px var(--gray-200); }
.stv2-cell {
  padding: var(--s-3) var(--s-3); min-width: 0;
}
.stv2-title { font-size: 14px; font-weight: 600; color: var(--gray-800); }
.stv2-assigned { display: flex; align-items: center; justify-content: center; }
.stv2-files { display: flex; align-items: center; justify-content: center; gap: 4px; }
.stv2-actions { display: flex; align-items: center; justify-content: center; }
/* Stage accent (left border via data-stage attribute on .stv2-row) */
.stv2-row[data-stage]::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
}
.stv2-row { position: relative; }
.stv2-row[data-stage="1"]::before { background: var(--stage-1); }
.stv2-row[data-stage="2"]::before { background: var(--stage-2); }
.stv2-row[data-stage="3"]::before { background: var(--stage-3); }
.stv2-row[data-stage="4"]::before { background: var(--stage-4); }
.stv2-row[data-stage="5"]::before { background: var(--stage-5); }
.stv2-row[data-stage="6"]::before { background: var(--stage-6); }
.stv2-row[data-stage="7"]::before { background: var(--stage-7); }
.stv2-row[data-stage="8"]::before { background: var(--stage-8); }
.stv2-stage-group { margin-bottom: var(--s-6); }
.stv2-stage-dimmed { opacity: 0.6; }
.stv2-stage-dimmed .stv2-table { border-color: var(--gray-100); }
.stv2-stage-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-3) 0; margin-bottom: var(--s-3);
}
.stv2-stage-header-left { display: flex; align-items: center; gap: var(--s-3); }
.stv2-stage-badge {
  display: inline-flex; align-items: center; gap: var(--s-1);
  font-size: 11px; font-weight: 600; padding: 3px 8px;
  border-radius: var(--r-full);
}
.stv2-stage-current-label {
  font-size: 12px; font-weight: 500; color: var(--gray-500);
}
.stv2-stage-complete {
  display: inline-flex; align-items: center; gap: var(--s-1);
  font-size: 12px; font-weight: 600; color: var(--success);
}
.stv2-stage-complete i { width: 14px; height: 14px; }
.stv2-stage-progress-sm {
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  color: var(--gray-500);
}
/* Avatar override for subtasks tab (28px per mockup E1) */
.stv2-assigned .tv2-lead-avatar { width: 28px; height: 28px; font-size: 10px; }
/* Attach badge hover for stv2-row context */
.stv2-row:hover .tv2-attach-badge { background: var(--gray-200); color: var(--gray-600); }
/* Folder link in task row */
.tv2-folder-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: var(--r-sm);
  color: #C79500; transition: all 0.15s ease;
}
.tv2-folder-link:hover { background: rgba(251,188,4,0.12); }

/* ==========================================================================
   6b-2. SUB-TASKS TAB — MOCKUP-MATCHED STYLES (E1/E2/E3)
   ========================================================================== */

/* ── Container (max-width + center) ── */
.st-container {
  max-width: 960px;
  margin: 0 auto;
}

/* ── Loading skeleton ── */
.st-skeleton { padding: var(--s-4) 0; display: flex; flex-direction: column; gap: var(--s-3); }
.st-skeleton-bar {
  height: 12px; width: 60%; border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%; animation: skeletonShimmer 1.5s ease-in-out infinite;
}
.st-skeleton-row {
  height: 48px; width: 100%; border-radius: var(--r-md);
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%; animation: skeletonShimmer 1.5s ease-in-out infinite;
}
.st-skeleton-row.short { width: 80%; }
@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Tab header ── */
.st-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--s-5);
}
.st-header-left { display: flex; align-items: center; gap: var(--s-4); }
.st-header-right { display: flex; align-items: center; gap: var(--s-2); }
.st-title {
  font-size: 18px; font-weight: 700; color: var(--gray-900);
  letter-spacing: -0.2px;
}

/* ── Stage toggle (segmented control) ── */
.st-stage-toggle {
  display: flex; border: 1px solid var(--gray-200); border-radius: var(--r-md);
  overflow: hidden;
}
.st-stage-btn {
  padding: var(--s-1-5) var(--s-3); font-size: 12px; font-weight: 500;
  color: var(--gray-500); background: var(--white); border: none;
  cursor: pointer; transition: all var(--t-fast); white-space: nowrap;
}
.st-stage-btn:hover { color: var(--gray-700); background: var(--gray-50); }
.st-stage-btn.active { color: var(--brand); background: var(--brand-wash); font-weight: 600; }

/* ── Action buttons ── */
.st-btn {
  display: inline-flex; align-items: center; gap: var(--s-1-5);
  padding: var(--s-2) var(--s-3); border-radius: var(--r-md);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all var(--t-fast); border: 1px solid;
}
.st-btn i { width: 15px; height: 15px; }
.st-btn.drive {
  color: var(--gray-500); background: var(--white); border-color: var(--gray-200);
}
.st-btn.drive:hover { color: var(--gray-700); border-color: var(--gray-300); background: var(--gray-50); }
.st-btn.add {
  color: var(--brand); background: var(--brand-wash); border-color: transparent;
  font-weight: 600;
}
.st-btn.add:hover { background: var(--brand-subtle); }

/* ── Add Task form ── */
.st-add-form {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--r-lg); padding: var(--s-5) var(--s-6);
  box-shadow: var(--shadow-sm); margin-bottom: var(--s-5);
  animation: tv2SlideUp 0.2s ease;
}
.st-add-form-title {
  font-size: 15px; font-weight: 700; color: var(--gray-800);
  margin-bottom: var(--s-4); display: flex; align-items: center; gap: var(--s-2);
}
.st-add-form-title i { width: 18px; height: 18px; color: var(--brand); }

/* ── Tabbed mode toggle ── */
.st-form-mode-toggle {
  display: flex; border: 1px solid var(--gray-200); border-radius: var(--r-md);
  overflow: hidden; margin-bottom: var(--s-4);
}
.st-form-mode-btn {
  flex: 1; padding: var(--s-2) var(--s-3); font-size: 12px; font-weight: 500;
  color: var(--gray-500); background: var(--white); border: none;
  cursor: pointer; transition: all var(--t-fast); text-align: center;
}
.st-form-mode-btn:hover { background: var(--gray-50); color: var(--gray-700); }
.st-form-mode-btn.active { color: var(--brand); background: var(--brand-wash); font-weight: 600; }

/* ── Form grid (2-column) ── */
.st-form-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4);
  margin-bottom: var(--s-4);
}
.st-form-group { display: flex; flex-direction: column; gap: var(--s-1); }
.st-form-group.full { grid-column: 1 / -1; }
.st-form-label {
  font-size: 12px; font-weight: 600; color: var(--gray-600);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.st-form-label .optional { color: var(--gray-400); font-weight: 400; text-transform: none; letter-spacing: normal; }

/* ── Form inputs ── */
.st-form-input,
.st-form-select {
  padding: var(--s-2) var(--s-3); border-radius: var(--r-md);
  border: 1px solid var(--gray-200); font-size: 14px; font-family: var(--font-sans);
  color: var(--gray-800); background: var(--white);
  transition: border-color var(--t-fast);
}
.st-form-input:focus, .st-form-select:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow);
}
.st-form-input::placeholder { color: var(--gray-400); }
.st-form-input.disabled {
  background: var(--gray-50); color: var(--gray-500); cursor: not-allowed;
}
.st-form-textarea {
  padding: var(--s-2) var(--s-3); border-radius: var(--r-md);
  border: 1px solid var(--gray-200); font-size: 14px; font-family: var(--font-sans);
  color: var(--gray-800); background: var(--white);
  transition: border-color var(--t-fast); resize: vertical; min-height: 80px;
}
.st-form-textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow);
}
.st-form-textarea::placeholder { color: var(--gray-400); }

/* ── Form actions ── */
.st-form-actions {
  display: flex; align-items: center; gap: var(--s-3); justify-content: flex-end;
  padding-top: var(--s-3); border-top: 1px solid var(--gray-100);
}
.st-form-btn {
  display: inline-flex; align-items: center; gap: var(--s-1-5);
  padding: var(--s-2) var(--s-4); border-radius: var(--r-md);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all var(--t-fast); border: 1px solid;
}
.st-form-btn i { width: 15px; height: 15px; }
.st-form-btn.cancel {
  color: var(--gray-500); background: var(--white); border-color: var(--gray-200);
}
.st-form-btn.cancel:hover { background: var(--gray-50); border-color: var(--gray-300); }
.st-form-btn.submit {
  color: var(--white); background: var(--brand); border-color: var(--brand);
}
.st-form-btn.submit:hover { background: var(--brand-dark); }
.st-form-btn.submit:disabled {
  opacity: 0.5; cursor: not-allowed;
}

/* ── Advance gate (mockup-matched) ── */
.st-advance-gate {
  display: flex; flex-direction: column; align-items: center;
  gap: var(--s-3); padding: var(--s-5) 0;
  border-top: 1px solid var(--gray-200); margin-top: var(--s-3);
}
.st-advance-btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-6); border-radius: var(--r-md);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all var(--t-fast); border: 1.5px solid;
}
.st-advance-btn i { width: 16px; height: 16px; }
.st-advance-btn.enabled {
  background: var(--success); color: var(--white); border-color: var(--success);
  box-shadow: 0 4px 14px rgba(16,185,129,0.25);
}
.st-advance-btn.enabled:hover { background: #059669; transform: translateY(-1px); }
.st-advance-btn.review {
  background: var(--brand); color: var(--white); border-color: var(--brand);
  box-shadow: var(--shadow-brand);
}
.st-advance-btn.review:hover { background: var(--brand-dark); transform: translateY(-1px); }
.st-advance-btn.disabled {
  background: var(--gray-100); color: var(--gray-400); border-color: var(--gray-200);
  cursor: not-allowed;
}
.st-advance-note {
  font-size: 12px; color: var(--gray-500); display: flex; align-items: center; gap: var(--s-1);
}
.st-advance-note i { width: 14px; height: 14px; }
.st-advance-note.warning { color: var(--warning); }
.st-advance-note.ready { color: var(--success); }

/* ── Empty state (subtasks) ── */
.st-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px var(--s-8); text-align: center;
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
}
.st-empty .empty-state-icon {
  width: 64px; height: 64px; border-radius: var(--r-full);
  background: var(--gray-100); display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
}
.st-empty .empty-state-icon i { width: 28px; height: 28px; color: var(--gray-400); }
.st-empty .empty-state-icon.gray { color: var(--gray-400); }
.st-empty h3 {
  font-size: 16px; font-weight: 700; color: var(--gray-800);
  margin: 0 0 var(--s-2) 0;
}
.st-empty p {
  font-size: var(--text-base); color: var(--gray-500); max-width: 360px; line-height: 1.6;
  margin: 0;
}
.st-empty .st-btn { margin-top: var(--s-5); }

@media (max-width: 640px) {
  .st-form-row { grid-template-columns: 1fr; }
  .st-header { flex-direction: column; align-items: flex-start; gap: var(--s-3); }
}


/* ==========================================================================
   6c. TASK DETAIL PANEL — SLIDE-OUT
   ========================================================================== */

.td-panel-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.20);
  z-index: var(--z-panel-backdrop);
  animation: fadeIn 200ms ease;
}

.td-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 440px; max-width: 100vw;
  background: var(--white);
  box-shadow: var(--shadow-panel);
  z-index: var(--z-panel);
  display: flex; flex-direction: column;
  animation: slideInRight 250ms ease;
}

.td-panel-header {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-5) var(--s-5) var(--s-4);
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.td-panel-header-text { flex: 1; min-width: 0; }
.td-panel-title {
  font-size: 16px; font-weight: 700; color: var(--gray-900);
  line-height: 1.3; margin-bottom: var(--s-1);
}
.td-panel-context {
  font-size: 12px; color: var(--gray-500);
  display: flex; align-items: center; gap: var(--s-1-5);
}
.td-panel-context .dot-sep { color: var(--gray-300); }
.td-panel-header-actions { display: flex; gap: var(--s-1); flex-shrink: 0; margin-top: 2px; }
.td-panel-btn {
  width: 32px; height: 32px; border-radius: var(--r-md);
  border: 1px solid var(--gray-200); background: var(--white);
  color: var(--gray-500); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t-fast);
}
.td-panel-btn:hover { background: var(--gray-50); color: var(--gray-700); border-color: var(--gray-300); }
.td-panel-btn i { width: 16px; height: 16px; }
.td-panel-close {
  width: 32px; height: 32px; border-radius: var(--r-md);
  border: 1px solid var(--gray-200); background: var(--white);
  color: var(--gray-500); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t-fast);
}
.td-panel-close:hover { background: var(--gray-50); color: var(--gray-700); border-color: var(--gray-300); }
.td-panel-close i { width: 16px; height: 16px; }

/* Panel body */
.td-panel-body {
  flex: 1; overflow-y: auto; padding: var(--s-5);
  display: flex; flex-direction: column; gap: var(--s-5);
}
.td-panel-body::-webkit-scrollbar { width: 4px; }
.td-panel-body::-webkit-scrollbar-track { background: transparent; }
.td-panel-body::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: var(--r-full); }

/* Metadata grid */
.td-meta-grid {
  display: grid; grid-template-columns: 80px 1fr;
  gap: var(--s-2) var(--s-3); align-items: center;
}
.td-meta-label {
  font-size: 12px; font-weight: 500; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.td-meta-value {
  font-size: 13px; color: var(--gray-700);
  display: flex; align-items: center; gap: var(--s-2);
}
.td-meta-assignee { display: flex; align-items: center; gap: var(--s-2); }
.td-meta-avatar {
  width: 22px; height: 22px; border-radius: var(--r-full);
  background: var(--brand); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; flex-shrink: 0;
}
/* Reassign button + dropdown */
.td-reassign-btn {
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: var(--r-sm);
  background: none; border: 1px solid var(--gray-200); cursor: pointer;
  color: var(--gray-400); transition: all var(--t-fast); margin-left: auto;
}
.td-reassign-btn:hover { background: var(--gray-100); color: var(--brand); border-color: var(--brand-subtle, rgba(72,122,123,0.3)); }
.td-reassign-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  padding: 4px; margin-top: 4px; max-height: 200px; overflow-y: auto;
}
.td-reassign-option {
  display: flex; align-items: center; gap: var(--s-2);
  width: 100%; padding: 6px 8px; font-size: 13px; color: var(--gray-700);
  background: none; border: none; border-radius: var(--r-sm);
  cursor: pointer; text-align: left; transition: background var(--t-fast);
}
.td-reassign-option:hover { background: var(--gray-50); }

.td-meta-name { font-size: 13px; color: var(--gray-700); font-weight: 500; }
.td-meta-due { font-size: 13px; font-weight: 500; }
.td-meta-due.overdue { color: var(--error); }
.td-meta-due.soon { color: var(--warning); }
.td-meta-due.normal { color: var(--gray-700); }
.td-due-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  padding: 1px 6px; border-radius: var(--r-full); margin-left: var(--s-1);
}
.td-due-badge.overdue { background: var(--error-wash); color: var(--error); }
.td-due-badge.soon { background: var(--warning-wash); color: var(--warning); }

/* Section labels */
.td-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--gray-500);
  display: flex; align-items: center; gap: var(--s-2);
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--gray-100);
}
.td-section-label i { width: 14px; height: 14px; opacity: 0.5; }

/* Description */
.td-description {
  font-size: 13px; color: var(--gray-700); line-height: 1.6;
}
.td-description.empty {
  color: var(--gray-400); font-style: italic;
  padding: var(--s-3) var(--s-4);
  border: 1px dashed var(--gray-200); border-radius: var(--r-md);
  background: var(--gray-50);
}

/* Deliverables */
.td-deliverables-empty {
  padding: var(--s-3) var(--s-4);
  border: 1px dashed var(--gray-300); border-radius: var(--r-md);
  color: var(--gray-400); font-size: 13px;
  display: flex; align-items: center; gap: var(--s-2);
}
.td-deliverables-empty i { width: 18px; height: 18px; flex-shrink: 0; }

.td-deliverable-list { display: flex; flex-direction: column; }
.td-deliverable-item {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-2) var(--s-3); border-radius: var(--r-md);
  transition: background var(--t-fast);
}
.td-deliverable-item:hover { background: var(--gray-50); }
.td-deliverable-icon {
  width: 30px; height: 30px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.td-deliverable-icon.sheets { background: rgba(52,168,83,0.10); color: #34A853; }
.td-deliverable-icon.docs { background: rgba(66,133,244,0.10); color: #4285F4; }
.td-deliverable-icon.drive { background: rgba(251,188,4,0.10); color: #FBBC04; }
.td-deliverable-icon.slides { background: rgba(234,134,0,0.10); color: #EA8600; }
.td-deliverable-icon.pdf { background: rgba(234,67,53,0.10); color: #EA4335; }
.td-deliverable-icon.link { background: var(--gray-100); color: var(--gray-500); }
.td-deliverable-icon i { width: 16px; height: 16px; }
.td-deliverable-info { flex: 1; min-width: 0; }
.td-deliverable-label {
  font-size: 13px; font-weight: 500; color: var(--gray-700);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.td-deliverable-url {
  font-size: 11px; color: var(--gray-400); font-family: var(--font-mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.td-deliverable-open {
  font-size: 12px; font-weight: 500; color: var(--brand);
  background: none; border: 1px solid var(--brand-subtle);
  padding: 3px 10px; border-radius: var(--r-md);
  cursor: pointer; transition: all var(--t-fast);
  white-space: nowrap; display: flex; align-items: center; gap: var(--s-1);
}
.td-deliverable-open:hover { background: var(--brand-wash); border-color: var(--brand); }
.td-deliverable-open i { width: 12px; height: 12px; }
.td-deliverable-remove {
  width: 24px; height: 24px; border-radius: var(--r-sm);
  border: none; background: none; color: var(--gray-300);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all var(--t-fast); opacity: 0;
}
.td-deliverable-item:hover .td-deliverable-remove { opacity: 1; }
.td-deliverable-remove:hover { color: var(--error); background: var(--error-wash); }
.td-deliverable-remove i { width: 14px; height: 14px; }

.td-deliverable-actions {
  display: flex; align-items: center; gap: var(--s-2); margin-top: var(--s-2);
}
.td-attach-btn {
  display: inline-flex; align-items: center; gap: var(--s-1-5);
  font-size: 12px; font-weight: 600; color: var(--brand);
  background: none; border: 1px solid var(--brand-subtle);
  padding: var(--s-1-5) var(--s-3); border-radius: var(--r-md);
  cursor: pointer; transition: all var(--t-fast);
}
.td-attach-btn:hover { background: var(--brand-wash); border-color: var(--brand); }
.td-attach-btn i { width: 14px; height: 14px; }

/* Attach form */
.td-attach-form {
  padding: var(--s-3);
  border: 1px solid var(--brand-subtle); border-radius: var(--r-md);
  background: var(--brand-wash);
  display: flex; flex-direction: column; gap: var(--s-2);
}
.td-attach-input {
  flex: 1; padding: var(--s-2) var(--s-3); font-size: 13px;
  font-family: var(--font-sans); color: var(--gray-700);
  border: 1px solid var(--gray-200); border-radius: var(--r-md);
  background: var(--white); outline: none;
  transition: border-color var(--t-fast);
}
.td-attach-input:focus { border-color: var(--brand); }
.td-attach-input::placeholder { color: var(--gray-400); }
.td-attach-input.url { font-family: var(--font-mono); font-size: 12px; }
.td-attach-input.invalid { border-color: var(--error); background: rgba(239,68,68,0.03); }
.td-attach-input.invalid:focus { border-color: var(--error); box-shadow: 0 0 0 3px rgba(239,68,68,0.1); }
.td-attach-form-row { display: flex; gap: var(--s-2); }
.td-attach-form-actions { display: flex; gap: var(--s-2); justify-content: flex-end; }

/* Feedback card */
.td-feedback-card {
  padding: var(--s-3) var(--s-4); border-radius: var(--r-md);
  border-left: 3px solid var(--sub-hold); background: var(--sub-hold-wash);
}
.td-feedback-card.resolved {
  opacity: 0.55; border-left-color: var(--gray-300); background: var(--gray-50);
}
.td-feedback-header {
  display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-2);
}
.td-feedback-header i { width: 14px; height: 14px; color: var(--sub-hold); flex-shrink: 0; }
.td-feedback-card.resolved .td-feedback-header i { color: var(--gray-400); }
.td-feedback-meta { font-size: 11px; font-weight: 600; color: var(--sub-hold); }
.td-feedback-card.resolved .td-feedback-meta { color: var(--gray-500); }
.td-feedback-date {
  font-size: 11px; color: rgba(245,158,11,0.60);
  font-family: var(--font-mono); margin-left: auto;
}
.td-feedback-card.resolved .td-feedback-date { color: var(--gray-400); }
.td-feedback-text {
  font-size: 13px; color: var(--gray-700); line-height: 1.5; margin-bottom: var(--s-2);
}
.td-feedback-card.resolved .td-feedback-text { text-decoration: line-through; color: var(--gray-500); }
.td-feedback-actions { display: flex; align-items: center; gap: var(--s-2); }
.td-resolve-btn {
  display: inline-flex; align-items: center; gap: var(--s-1);
  font-size: 12px; font-weight: 600; color: var(--brand);
  background: var(--white); border: 1px solid var(--brand-subtle);
  padding: var(--s-1) var(--s-3); border-radius: var(--r-md);
  cursor: pointer; transition: all var(--t-fast);
}
.td-resolve-btn:hover { background: var(--brand-wash); border-color: var(--brand); }
.td-resolve-btn i { width: 14px; height: 14px; }
.td-resolved-badge {
  display: inline-flex; align-items: center; gap: var(--s-1);
  font-size: 11px; font-weight: 600; color: var(--sub-approved);
}
.td-resolved-badge i { width: 12px; height: 12px; }

/* Request changes form */
.td-rc-form {
  display: flex; flex-direction: column; gap: var(--s-2);
  padding: var(--s-3);
  border: 1px solid rgba(245,158,11,0.20); border-radius: var(--r-md);
  background: var(--sub-hold-wash);
}
.td-rc-form .form-label {
  font-size: 12px; font-weight: 600; color: var(--sub-hold);
  display: flex; align-items: center; gap: var(--s-1-5);
}
.td-rc-form .form-label i { width: 14px; height: 14px; }
.td-rc-textarea {
  width: 100%; padding: var(--s-2) var(--s-3); font-size: 13px;
  font-family: var(--font-sans); color: var(--gray-700);
  border: 1px solid rgba(245,158,11,0.25); border-radius: var(--r-md);
  background: var(--white); resize: vertical; min-height: 60px;
  outline: none; transition: border-color var(--t-fast);
  box-sizing: border-box;
}
.td-rc-textarea:focus { border-color: var(--sub-hold); }
.td-rc-textarea::placeholder { color: var(--gray-400); }
.td-rc-actions {
  display: flex; gap: var(--s-2); justify-content: flex-end; align-items: center;
}
.td-rc-count {
  font-size: 11px; color: var(--gray-400); font-family: var(--font-mono); margin-right: auto;
}

/* Activity log */
.td-activity-list, .td-activity-log { display: flex; flex-direction: column; }
.td-activity-item {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-2) 0; position: relative;
}
.td-activity-item:not(:last-child)::after {
  content: ''; position: absolute;
  left: 7px; top: 24px; bottom: -4px;
  width: 1px; background: var(--gray-200);
}
.td-activity-dot {
  width: 15px; height: 15px; border-radius: var(--r-full);
  border: 2px solid var(--gray-200); background: var(--white);
  flex-shrink: 0; margin-top: 2px;
}
.td-activity-dot.created { border-color: var(--brand); background: var(--brand-wash); }
.td-activity-dot.status { border-color: var(--sub-progress); background: var(--sub-progress-wash); }
.td-activity-dot.deliverable { border-color: var(--sub-approved); background: var(--sub-approved-wash); }
.td-activity-dot.submitted { border-color: var(--sub-review); background: var(--sub-review-wash); }
.td-activity-dot.changes { border-color: var(--sub-hold); background: var(--sub-hold-wash); }
.td-activity-dot.approved { border-color: var(--sub-approved); background: var(--sub-approved-wash); }
.td-activity-text { font-size: 12px; color: var(--gray-600); line-height: 1.4; }
.td-activity-date {
  font-size: 11px; font-family: var(--font-mono); color: var(--gray-400); margin-bottom: 1px;
}

/* Load more button (activity + comments) */
.td-load-more {
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 6px 0; font-size: 12px; font-weight: 500;
  color: var(--brand); background: none; border: none; cursor: pointer;
  transition: color var(--t-fast);
}
.td-load-more:hover { color: var(--brand-dark, #3a6565); text-decoration: underline; }

/* Comments list */
.td-comments-list {
  display: flex; flex-direction: column; gap: var(--s-3);
  max-height: 300px; overflow-y: auto; padding-right: var(--s-1);
}
.td-comment-item {
  display: flex; align-items: flex-start; gap: var(--s-2);
}
.td-comment-avatar {
  width: 24px; height: 24px; border-radius: var(--r-full);
  background: var(--brand-wash); color: var(--brand);
  font-size: 10px; font-weight: 700; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  margin-top: 2px;
}
.td-comment-header {
  display: flex; align-items: baseline; gap: var(--s-2);
  margin-bottom: 2px;
}
.td-comment-name {
  font-size: 12px; font-weight: 600; color: var(--gray-700);
}
.td-comment-date {
  font-size: 11px; color: var(--gray-400); font-family: var(--font-mono);
}
.td-comment-body {
  font-size: 13px; color: var(--gray-600); line-height: 1.4;
  word-break: break-word;
}
.td-comment-compose {
  margin-top: var(--s-2); position: relative;
}
.td-comment-send {
  position: absolute; right: 8px; bottom: 8px;
  padding: 4px 12px; font-size: 12px; font-weight: 600;
  background: var(--brand); color: var(--white);
  border: none; border-radius: var(--r-md); cursor: pointer;
  transition: all var(--t-fast);
}
.td-comment-send:hover { background: var(--brand-dark); }
.td-comment-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* Comment input */
.td-comment-input {
  width: 100%; padding: var(--s-3); font-size: 13px;
  font-family: var(--font-sans); color: var(--gray-700);
  border: 1px solid var(--gray-200); border-radius: var(--r-md);
  background: var(--gray-50); resize: vertical; min-height: 60px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  box-sizing: border-box;
}
.td-comment-input::placeholder { color: var(--gray-400); }
.td-comment-input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-wash); background: var(--white);
}

/* Panel actions footer */
.td-panel-actions {
  flex-shrink: 0; padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--gray-200); background: var(--gray-50);
  display: flex; flex-direction: column; gap: var(--s-3);
}
.td-actions-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--gray-400);
}
.td-actions-row { display: flex; gap: var(--s-2); }

/* Approved task — completed action bar */
.td-actions-completed {
  display: flex; align-items: center; gap: var(--s-2);
  color: var(--sub-approved); font-size: 13px; font-weight: 600;
}
.td-actions-completed i { width: 16px; height: 16px; }
.td-actions-completed-note {
  font-size: 11px; color: var(--gray-400); font-style: italic;
}

/* Action buttons */
.td-action-btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: var(--s-2) var(--s-4); border-radius: var(--r-md);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all var(--t-fast); border: none;
}
.td-action-btn i { width: 16px; height: 16px; }
.td-action-btn.primary { background: var(--brand); color: var(--white); }
.td-action-btn.primary:hover { background: var(--brand-dark); }
.td-action-btn.primary:disabled { background: var(--gray-200); color: var(--gray-400); cursor: not-allowed; }
.td-action-btn.resubmit { background: var(--sub-hold); color: var(--white); }
.td-action-btn.resubmit:hover { filter: brightness(0.9); }
.td-action-btn.approve { background: var(--sub-approved); color: var(--white); }
.td-action-btn.approve:hover { filter: brightness(0.9); }
.td-action-btn.approve:disabled { background: var(--gray-200); color: var(--gray-400); cursor: not-allowed; }
.td-action-btn.changes {
  background: var(--sub-hold-wash); color: var(--sub-hold);
  border: 1px solid rgba(245,158,11,0.20);
}
.td-action-btn.changes:hover { background: rgba(245,158,11,0.15); }
.td-action-btn.ghost {
  background: none; color: var(--gray-500);
  border: 1px solid var(--gray-200);
}
.td-action-btn.ghost:hover { background: var(--gray-50); color: var(--gray-600); }
.td-action-btn.self-blocked {
  background: var(--gray-50); color: var(--gray-400);
  border: 1px solid var(--gray-200); cursor: pointer;
}
.td-action-btn.self-blocked:hover { background: var(--gray-100); }
/* Self-approval amber banner (mockup C2) */
.td-self-approval-notice {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--warning-wash, rgba(245,158,11,0.08));
  border: 1px solid rgba(245,158,11,0.18);
  border-radius: var(--r-md);
}
.td-self-approval-icon {
  width: 28px; height: 28px; border-radius: var(--r-full, 50%);
  background: var(--warning, #F59E0B); color: var(--white, #fff);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.td-self-approval-text { display: flex; flex-direction: column; gap: 2px; }
.td-self-approval-title { font-size: 13px; font-weight: 700; color: var(--warning, #F59E0B); }
.td-self-approval-sub { font-size: 12px; color: var(--gray-600); line-height: 1.4; }
.td-action-disabled-note {
  font-size: 11px; color: var(--gray-400); font-style: italic; margin-top: var(--s-0-5);
}

/* Approved banner */
.td-approved-banner {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--sub-approved-wash); border-radius: var(--r-md);
  border: 1px solid rgba(16,185,129,0.18);
}
.td-approved-banner-icon {
  width: 32px; height: 32px; border-radius: var(--r-full);
  background: var(--sub-approved); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.td-approved-banner-icon i { width: 18px; height: 18px; }
.td-approved-banner-text {
  display: flex; flex-direction: column; gap: 2px;
}
.td-approved-banner-title {
  font-size: 13px; font-weight: 700; color: var(--sub-approved);
}
.td-approved-banner-sub {
  font-size: 11px; color: var(--gray-500);
}

/* Submitted banner (done status) */
.td-submitted-banner {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  background: var(--sub-review-wash); border-radius: var(--r-md);
  border: 1px solid rgba(139,92,246,0.15);
}
.td-submitted-banner i { width: 16px; height: 16px; color: var(--sub-review); flex-shrink: 0; }
.td-submitted-banner-text { font-size: 13px; font-weight: 500; color: var(--sub-review); }


/* ==========================================================================
   6d. REVIEW PANEL — STAGE GATE SLIDE-OUT
   ========================================================================== */

.rv-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 580px; max-width: 100vw;
  background: var(--white);
  box-shadow: var(--shadow-panel);
  z-index: var(--z-panel);
  display: flex; flex-direction: column;
  animation: slideInRight 250ms ease;
}

.rv-panel-header {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-5); border-bottom: 1px solid var(--gray-200); flex-shrink: 0;
}
.rv-panel-header-text { flex: 1; min-width: 0; }
.rv-panel-title { font-size: 16px; font-weight: 700; color: var(--gray-900); line-height: 1.3; }
.rv-panel-context { font-size: 12px; color: var(--gray-500); margin-top: var(--s-1); }

.rv-panel-body {
  flex: 1; overflow-y: auto; padding: var(--s-5);
  display: flex; flex-direction: column; gap: var(--s-4);
}
.rv-panel-body::-webkit-scrollbar { width: 4px; }
.rv-panel-body::-webkit-scrollbar-track { background: transparent; }
.rv-panel-body::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: var(--r-full); }

/* Review progress */
.rv-progress {
  display: flex; align-items: center; gap: var(--s-3);
}
.rv-progress-bar {
  flex: 1; height: 6px; border-radius: var(--r-full);
  background: var(--gray-200); overflow: hidden;
}
.rv-progress-fill {
  height: 100%; border-radius: var(--r-full); transition: width 0.4s ease;
}
.rv-progress-fill.green { background: var(--sub-approved); }
.rv-progress-fill.violet { background: var(--sub-review); }
.rv-progress-text {
  font: 600 13px/1 var(--font-mono); color: var(--gray-500); white-space: nowrap;
}
.rv-summary { font-size: 14px; color: var(--gray-600); line-height: 1.5; }
.rv-summary strong { color: var(--gray-800); font-weight: 600; }

/* Review card */
.rv-card {
  border: 1px solid var(--gray-200); border-radius: var(--r-lg);
  transition: border-color var(--t-base), box-shadow var(--t-base);
}
.rv-card:hover { border-color: var(--gray-300); box-shadow: var(--shadow-sm); }
.rv-card.st-approved, .rv-card.approved { border-color: rgba(16,185,129,0.25); background: rgba(16,185,129,0.015); }
.rv-card.st-changes, .rv-card.changes { border-color: rgba(245,158,11,0.25); background: rgba(245,158,11,0.015); }

.rv-card-header {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4) var(--s-5) 0;
}
/* Compact variant — single-row card for non-done statuses */
.rv-card.compact .rv-card-header {
  padding: var(--s-3) var(--s-4);
}
.rv-card.compact .rv-card-title { font-size: 14px; }
.rv-inline-badge {
  display: inline-flex; align-items: center; gap: var(--s-1);
  font-size: 11px; font-weight: 600; padding: 3px 10px;
  border-radius: var(--r-full); white-space: nowrap; flex-shrink: 0;
}
.rv-inline-badge i { width: 12px; height: 12px; }
.rv-inline-badge.approved { background: var(--sub-approved-wash); color: var(--sub-approved); }
.rv-inline-badge.changes { background: var(--sub-hold-wash); color: var(--sub-hold); }
.rv-inline-badge.working { background: var(--sub-progress-wash); color: var(--sub-progress); }
.rv-inline-badge.todo { background: var(--sub-assigned-wash); color: var(--sub-assigned); }
/* Compact card — inline deliverable icons */
.rv-card.compact .rv-del-icons { margin-right: var(--s-1); }
/* Compact feedback row (changes_requested) */
.rv-compact-feedback {
  padding: var(--s-2) var(--s-4) var(--s-3);
  font-size: 12px; color: var(--gray-500); font-style: italic;
  line-height: 1.4; border-top: 1px solid var(--gray-100);
}
.rv-compact-feedback .arrow { color: var(--gray-400); font-style: normal; }
.rv-card-dot {
  width: 10px; height: 10px; border-radius: var(--r-full); flex-shrink: 0;
}
.rv-card-dot.done { background: var(--sub-review); }
.rv-card-dot.approved { background: var(--sub-approved); }
.rv-card-dot.changes { background: var(--sub-hold); }
.rv-card-dot.working { background: var(--sub-progress); }
.rv-card-dot.todo { background: var(--sub-assigned); }
.rv-card-info { flex: 1; min-width: 0; }
.rv-card-title { font-size: 15px; font-weight: 600; color: var(--gray-800); line-height: 1.3; }
.rv-card.st-approved .rv-card-title, .rv-card.approved .rv-card-title { color: var(--gray-500); }
.rv-card-submitted {
  font-size: 12px; color: var(--gray-400); font-family: var(--font-mono); margin-top: 2px;
}
.rv-card-avatar {
  width: 28px; height: 28px; border-radius: var(--r-full);
  background: var(--brand); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; flex-shrink: 0;
}

.rv-card-footer {
  display: flex; flex-direction: column; gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--gray-100);
}

/* Deliverable row inside card footer */
.rv-del-row {
  display: flex; align-items: center; gap: var(--s-2); min-width: 0;
}
.rv-del-icons { display: flex; gap: 4px; flex-shrink: 0; }
.rv-del-icon {
  width: 22px; height: 22px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.rv-del-icon.sheets { background: rgba(52,168,83,0.10); color: #34A853; }
.rv-del-icon.docs { background: rgba(66,133,244,0.10); color: #4285F4; }
.rv-del-icon.drive { background: rgba(251,188,4,0.10); color: #FBBC04; }
.rv-del-icon.slides { background: rgba(234,134,0,0.10); color: #EA8600; }
.rv-del-icon.pdf { background: rgba(234,67,53,0.10); color: #EA4335; }
.rv-del-icon.link { background: var(--gray-100); color: var(--gray-500); }
.rv-del-icon i { width: 12px; height: 12px; }
.rv-del-label {
  font-size: 13px; color: var(--gray-500); flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rv-del-open {
  font-size: 12px; font-weight: 500; color: var(--brand);
  background: none; border: 1px solid var(--brand-subtle, rgba(72,122,123,0.2));
  padding: 3px 10px; border-radius: var(--r-sm);
  cursor: pointer; transition: all var(--t-fast);
  white-space: nowrap; display: flex; align-items: center; gap: 4px;
}
.rv-del-open:hover { background: var(--brand-wash); border-color: var(--brand); }
.rv-del-open i { width: 11px; height: 11px; }
.rv-no-del {
  font-size: 12px; color: var(--gray-400); font-style: italic; flex: 1;
}

/* Legacy compat */
.rv-card-del-icon { /* kept for any older references */
  width: 22px; height: 22px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.rv-card-del-icon.sheets { background: rgba(52,168,83,0.10); color: #34A853; }
.rv-card-del-icon.docs { background: rgba(66,133,244,0.10); color: #4285F4; }
.rv-card-del-icon.drive { background: rgba(251,188,4,0.10); color: #FBBC04; }
.rv-card-del-icon.link { background: var(--gray-100); color: var(--gray-500); }
.rv-card-del-icon i { width: 12px; height: 12px; }

.rv-card-actions { display: flex; align-items: center; gap: var(--s-2); flex-shrink: 0; }
.rv-act-btn {
  display: inline-flex; align-items: center; gap: var(--s-1-5);
  padding: 6px 14px; border-radius: var(--r-md);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all var(--t-fast); border: none; white-space: nowrap;
}
.rv-act-btn i { width: 14px; height: 14px; }
.rv-act-btn.approve { background: var(--sub-approved); color: var(--white); }
.rv-act-btn.approve:hover { filter: brightness(0.9); }
.rv-act-btn.changes-btn {
  background: none; color: var(--sub-hold);
  border: 1px solid rgba(245,158,11,0.25); padding: 5px 13px;
}
.rv-act-btn.changes-btn:hover { background: var(--sub-hold-wash); }

.rv-approved-badge {
  display: flex; align-items: center; gap: var(--s-1-5);
  font-size: 13px; font-weight: 600; color: var(--sub-approved);
  padding: 5px 12px; border-radius: var(--r-md); background: var(--sub-approved-wash);
}
.rv-approved-badge i { width: 15px; height: 15px; }
.rv-changes-badge {
  display: flex; align-items: center; gap: var(--s-1-5);
  font-size: 13px; font-weight: 600; color: var(--sub-hold);
  padding: 5px 12px; border-radius: var(--r-md); background: var(--sub-hold-wash);
}
.rv-changes-badge i { width: 15px; height: 15px; }

/* Auto-approve info banner */
.rv-auto-approve-banner {
  display: flex; align-items: flex-start; gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  background: var(--info-wash, rgba(59,130,246,0.06));
  border: 1px solid rgba(59,130,246,0.15);
  border-radius: var(--r-md);
  font-size: 12px; color: var(--gray-600); line-height: 1.5;
  margin-bottom: var(--s-3);
}
.rv-auto-approve-banner i { color: var(--info, #3B82F6); margin-top: 1px; }
.rv-auto-approve-banner strong { color: var(--gray-800); font-weight: 600; }

/* Review panel feedback block */
.rv-feedback {
  padding: 0 var(--s-5) var(--s-4);
}
.rv-feedback-inner {
  display: flex; gap: var(--s-3); align-items: flex-start;
  padding: var(--s-3) var(--s-4);
  background: rgba(245,158,11,0.04);
  border-left: 3px solid var(--sub-hold);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}
.rv-feedback-icon { flex-shrink: 0; color: var(--sub-hold); margin-top: 1px; }
.rv-feedback-icon i { width: 14px; height: 14px; }
.rv-feedback-text { font-size: 13px; color: var(--gray-600); line-height: 1.5; flex: 1; }
.rv-feedback-date {
  font-size: 11px; color: var(--gray-400); margin-top: 3px; font-family: var(--font-mono);
}

/* Review section label */
.rv-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--gray-500);
  display: flex; align-items: center; gap: var(--s-2);
  padding-bottom: var(--s-2); border-bottom: 1px solid var(--gray-100);
}

/* Review panel action bar */
.rv-panel-actions {
  flex-shrink: 0; padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--gray-200); background: var(--gray-50);
  display: flex; flex-direction: column; gap: var(--s-3);
}
.rv-advance-btn {
  display: flex; align-items: center; justify-content: center; gap: var(--s-2);
  width: 100%; padding: var(--s-3) var(--s-5); border-radius: var(--r-md);
  font-size: 15px; font-weight: 700; cursor: pointer;
  transition: all var(--t-base); border: none;
}
.rv-advance-btn i { width: 18px; height: 18px; }
.rv-advance-btn.enabled {
  background: var(--sub-approved); color: var(--white);
  box-shadow: 0 2px 8px rgba(16,185,129,0.25);
}
.rv-advance-btn.enabled:hover { filter: brightness(0.92); box-shadow: 0 4px 12px rgba(16,185,129,0.35); }
.rv-advance-btn.enabled.pulse {
  animation: rvPulse 2s ease-in-out infinite;
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes rvPulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(16,185,129,0.25); }
  50% { box-shadow: 0 4px 16px rgba(16,185,129,0.45); }
}
.rv-advance-btn.disabled {
  background: var(--gray-200); color: var(--gray-400); cursor: not-allowed;
}
.rv-sendback-btn {
  display: flex; align-items: center; justify-content: center; gap: var(--s-2);
  width: 100%; padding: var(--s-2-5, 10px) var(--s-5); border-radius: var(--r-md);
  font-size: 13px; font-weight: 500; cursor: pointer;
  background: none; color: var(--gray-500);
  border: 1px solid var(--gray-200); transition: all var(--t-fast);
}
.rv-sendback-btn:hover { background: var(--gray-100); color: var(--gray-600); border-color: var(--gray-300); }
.rv-sendback-btn i { width: 14px; height: 14px; }
.rv-advance-tooltip {
  font-size: 12px; color: var(--gray-500); text-align: center;
  line-height: 1.4; padding-top: var(--s-0-5);
}
.rv-advance-tooltip .hl { font-weight: 600; color: var(--sub-hold); }

/* Review empty states */
.rv-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center;
  padding: var(--s-12) var(--s-6); gap: var(--s-4);
}
.rv-empty-icon {
  width: 64px; height: 64px; border-radius: var(--r-xl);
  background: var(--gray-100); color: var(--gray-400);
  display: flex; align-items: center; justify-content: center;
}
.rv-empty-icon i { width: 28px; height: 28px; }
.rv-empty-title { font-size: 16px; font-weight: 700; color: var(--gray-700); }
.rv-empty-text { font-size: 14px; color: var(--gray-500); max-width: 340px; line-height: 1.5; }


/* ==========================================================================
   12. RESPONSIVE
   ========================================================================== */

/* --- Tablet (<=1024px) --- */

@media (max-width: 1024px) {
  .detail-header {
    padding: var(--s-4) var(--s-5);
  }

  .detail-tab-bar {
    padding: 0 var(--s-5);
  }

  .detail-content {
    padding: var(--s-5);
  }

  .ov-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .ov-card.span-2 {
    grid-column: span 2;
  }

  .ov-card.span-3 {
    grid-column: span 2;
  }

  .deal-layout,
  .deal-two-panel,
  .notes-layout,
  .comm-layout,
  .docs-layout {
    grid-template-columns: 1fr;
  }

  .deal-panel-completed {
    border-left: none;
    padding-left: var(--s-5);
  }

  .reports-grid {
    grid-template-columns: 1fr;
  }

  /* v1.1: Threaded layout → 2-column (hide ops panel) */
  .comm-threaded-layout {
    grid-template-columns: 260px 1fr;
    height: auto;
    min-height: auto;
  }

  .comm-ops-panel {
    display: none;
  }

  .comm-thread-list {
    border-right: 1px solid var(--gray-200);
  }
}

/* --- Mobile (<=768px) --- */

@media (max-width: 768px) {
  .detail-header {
    padding: var(--s-3) var(--s-4);
  }

  .detail-title-row {
    flex-direction: column;
    gap: var(--s-3);
  }

  .detail-actions {
    margin-top: 0;
    width: 100%;
  }

  .btn-detail {
    flex: 1;
    justify-content: center;
  }

  .detail-address {
    font-size: var(--text-lg);
  }

  .detail-tab-bar {
    padding: 0 var(--s-4);
    gap: 0;
  }

  .detail-tab {
    padding: var(--s-2-5, 10px) var(--s-3);
    font-size: var(--text-xs);
  }

  .detail-content {
    padding: var(--s-4);
  }

  .ov-grid {
    grid-template-columns: 1fr;
  }

  .ov-card.span-2,
  .ov-card.span-3 {
    grid-column: span 1;
  }

  .ov-score-num {
    font-size: 26px;
  }

  .deal-info-grid {
    grid-template-columns: 1fr;
  }

  .doc-btns {
    flex-direction: column;
  }

  .pd-modal {
    width: 95%;
    padding: var(--s-5);
    margin: var(--s-4);
  }

  .pd-modal-title {
    font-size: 16px;
  }

  .notes-layout {
    gap: var(--s-4);
  }

  .act-timeline::before {
    left: 11px;
  }

  .act-dot {
    width: 24px;
    height: 24px;
  }

  .act-dot i {
    width: 12px;
    height: 12px;
  }

  /* v1.1: Threaded layout → single column (stacked) */
  .comm-threaded-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
  }

  .comm-thread-list {
    border-right: none;
    border-bottom: 1px solid var(--gray-200);
    max-height: 250px;
  }

  .comm-conv-messages {
    min-height: 350px;
  }

  .comm-reply-bar {
    padding: var(--s-3) var(--s-4);
  }
}
