/**
 * Deal Workspace CSS
 * =================
 * Premium, action-oriented styling for the full-screen deal page.
 * Responsive design with mobile-friendly sidebar collapse.
 */

/* ===========================================
   BASE & CONTAINER
   =========================================== */

.deal-workspace-open {
  overflow: hidden;
}

#dealWorkspaceMount {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 50%;
  min-width: 600px;
  max-width: 900px;
  z-index: 9000;
  background: #f8fafc;
  box-shadow: -4px 0 30px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.3s ease, opacity 0.2s ease, visibility 0.2s ease;
}

#dealWorkspaceMount.visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

/* Overlay behind the deal panel */
.deal-workspace-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 8999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.deal-workspace-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.deal-workspace {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ===========================================
   HEADER (Sticky)
   =========================================== */

.deal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: white;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.deal-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.deal-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: #f1f5f9;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.deal-back-btn:hover {
  background: #e2e8f0;
  color: #334155;
}

.deal-header-info {
  min-width: 0;
  flex: 1;
}

.deal-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.deal-title {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.deal-star-btn {
  font-size: 20px;
  background: none;
  border: none;
  cursor: pointer;
  color: #cbd5e1;
  transition: color 0.15s ease, transform 0.15s ease;
  padding: 4px;
}

.deal-star-btn:hover {
  color: #fbbf24;
  transform: scale(1.1);
}

.deal-star-btn.starred {
  color: #fbbf24;
}

.deal-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.deal-stage-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.deal-prob-badge {
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
}

.deal-health-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

.deal-health-good {
  background: #dcfce7;
  color: #166534;
}

.deal-health-at_risk {
  background: #fef3c7;
  color: #92400e;
}

.deal-health-critical {
  background: #fee2e2;
  color: #991b1b;
}

/* Header Center - KPIs */
.deal-header-center {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 16px;
  border-left: 1px solid #e2e8f0;
  border-right: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.deal-kpi {
  text-align: center;
  min-width: 100px;
}

.deal-kpi-value {
  font-size: 18px;
  font-weight: 600;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.deal-kpi-value.overdue {
  color: #dc2626;
}

.deal-kpi-value.soon {
  color: #f59e0b;
}

.deal-kpi-label {
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 2px;
}

/* Header Right - Actions */
.deal-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.deal-actions-primary {
  display: flex;
  align-items: center;
  gap: 8px;
}

.deal-actions-secondary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 12px;
  border-left: 1px solid #e2e8f0;
}

/* Buttons */
.deal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.deal-btn-primary {
  background: #6366f1;
  color: white;
}

.deal-btn-primary:hover {
  background: #4f46e5;
}

.deal-btn-secondary {
  background: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}

.deal-btn-secondary:hover {
  background: #e2e8f0;
}

.deal-btn-ghost {
  background: transparent;
  color: #64748b;
}

.deal-btn-ghost:hover {
  background: #f1f5f9;
  color: #334155;
}

.deal-btn-success {
  background: #22c55e;
  color: white;
}

.deal-btn-success:hover {
  background: #16a34a;
}

.deal-btn-danger {
  background: #fee2e2;
  color: #dc2626;
}

.deal-btn-danger:hover {
  background: #fecaca;
}

.deal-btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.deal-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.deal-action-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.deal-action-btn.deal-action-primary {
  background: #6366f1;
  color: white;
  border-color: #6366f1;
}

.deal-action-btn.deal-action-primary:hover {
  background: #4f46e5;
}

.deal-action-btn.deal-action-success {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}

.deal-action-btn.deal-action-success:hover {
  background: #bbf7d0;
}

.deal-action-btn.deal-action-danger {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fecaca;
}

.deal-action-btn.deal-action-danger:hover {
  background: #fecaca;
}

.deal-action-btn.deal-action-icon {
  padding: 8px;
}

/* Dropdowns */
.deal-action-dropdown {
  position: relative;
}

.deal-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 180px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
  padding: 6px;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.15s ease;
}

.deal-dropdown-menu.deal-dropdown-right {
  left: auto;
  right: 0;
}

.deal-dropdown-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.deal-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 6px;
  background: none;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s ease;
}

.deal-dropdown-item:hover {
  background: #f1f5f9;
}

.deal-dropdown-item.deal-dropdown-danger {
  color: #dc2626;
}

.deal-dropdown-item.deal-dropdown-danger:hover {
  background: #fee2e2;
}

.deal-dropdown-divider {
  height: 1px;
  background: #e2e8f0;
  border: none;
  margin: 6px 0;
}

/* ===========================================
   BODY (Main + Sidebar)
   =========================================== */

.deal-workspace-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.deal-main-content {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.deal-sidebar {
  background: #f1f5f9;
  border-top: 1px solid #e2e8f0;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  flex-shrink: 0;
  max-height: 280px;
  overflow-y: auto;
}

.deal-sidebar .deal-sidebar-card {
  margin: 0;
}

/* ===========================================
   CARDS
   =========================================== */

.deal-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  /* overflow: hidden; Removed to prevent clipping */
}

.deal-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
}

.deal-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  margin: 0;
}

/* ===========================================
   NEXT ACTION CARD
   =========================================== */

.deal-next-action-card {
  border: 2px solid #6366f1;
  background: linear-gradient(135deg, white 0%, #f8f7ff 100%);
}

.deal-next-action-card.deal-next-action-overdue {
  border-color: #dc2626;
  background: linear-gradient(135deg, white 0%, #fff5f5 100%);
}

.deal-next-action-card.deal-next-action-empty {
  border-style: dashed;
  border-color: #cbd5e1;
  background: white;
}

.deal-next-action-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px;
}

.deal-next-action-main {
  flex: 1;
  min-width: 0;
}

.deal-next-action-text {
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 6px;
}

.deal-next-action-due {
  font-size: 13px;
  color: #64748b;
}

.deal-next-action-due.overdue {
  color: #dc2626;
  font-weight: 600;
}

.deal-next-action-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.deal-next-action-empty-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 20px;
  gap: 16px;
}

.deal-next-action-empty-icon {
  font-size: 40px;
  opacity: 0.5;
}

.deal-next-action-empty-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.deal-next-action-empty-text strong {
  font-size: 15px;
  color: #334155;
}

.deal-next-action-empty-text span {
  font-size: 13px;
  color: #64748b;
}

.deal-streak-badge {
  font-size: 12px;
  font-weight: 600;
  color: #f59e0b;
}

/* ===========================================
   STAGE PROGRESS
   =========================================== */

.deal-stage-card .deal-card-header {
  border-bottom: none;
  padding-bottom: 8px;
}

.deal-stage-progress {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 20px 24px;
  gap: 0;
}

.deal-stage-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex: 0 0 auto;
  min-width: 80px;
  transition: transform 0.15s ease;
}

.deal-stage-step:hover {
  transform: translateY(-2px);
}

.deal-stage-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  background: #e2e8f0;
  transition: all 0.2s ease;
}

.deal-stage-step.completed .deal-stage-dot {
  color: white;
}

.deal-stage-step.current .deal-stage-dot {
  color: white;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.deal-stage-step.won .deal-stage-dot {
  background: #22c55e !important;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2);
}

.deal-stage-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-align: center;
  max-width: 80px;
}

.deal-stage-step.current .deal-stage-label,
.deal-stage-step.completed .deal-stage-label {
  color: #334155;
}

.deal-stage-prob {
  font-size: 10px;
  font-weight: 600;
  color: #6366f1;
  background: #eef2ff;
  padding: 2px 8px;
  border-radius: 10px;
}

.deal-stage-connector {
  flex: 1;
  height: 3px;
  background: #e2e8f0;
  margin-top: 17px;
  min-width: 20px;
}

.deal-stage-connector.completed {
  background: #6366f1;
}

/* ===========================================
   ACTIVITY SECTION
   =========================================== */

.deal-activity-card {
  flex: 1;
  min-height: 300px;
  display: flex;
  flex-direction: column;
}

.deal-activity-filters {
  display: flex;
  gap: 4px;
}

.deal-filter-btn {
  padding: 5px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
}

.deal-filter-btn:hover {
  background: #f1f5f9;
}

.deal-filter-btn.active {
  background: #6366f1;
  color: white;
}

.deal-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #e2e8f0;
  font-size: 10px;
  font-weight: 600;
  margin-left: 4px;
}

.deal-filter-btn.active .deal-filter-count {
  background: rgba(255, 255, 255, 0.3);
}

.deal-filter-count-danger {
  background: #fee2e2;
  color: #dc2626;
}

.deal-activity-composer {
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  background: #fafbfc;
}

.deal-activity-input {
  width: 100%;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  resize: none;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.deal-activity-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.deal-activity-composer-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.deal-activity-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.deal-activity-empty {
  text-align: center;
  padding: 40px 20px;
  color: #94a3b8;
  font-size: 13px;
}

.deal-activity-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid #f1f5f9;
}

.deal-activity-item:last-child {
  border-bottom: none;
}

.deal-activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.deal-activity-content {
  flex: 1;
  min-width: 0;
}

.deal-activity-text {
  font-size: 13px;
  color: #334155;
  line-height: 1.5;
}

.deal-activity-meta {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  font-size: 11px;
  color: #94a3b8;
}

/* ===========================================
   TASKS SECTION
   =========================================== */

.deal-tasks-card .deal-card-header {
  flex-wrap: wrap;
  gap: 12px;
}

.deal-task-filters {
  display: flex;
  gap: 4px;
}

.deal-tasks-list {
  padding: 12px 20px;
}

.deal-tasks-empty {
  text-align: center;
  padding: 24px;
  color: #94a3b8;
  font-size: 13px;
}

.deal-task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
}

.deal-task-item:last-child {
  border-bottom: none;
}

.deal-task-item.overdue {
  background: #fff5f5;
  margin: 0 -20px;
  padding-left: 20px;
  padding-right: 20px;
}

.deal-task-check {
  width: 28px;
  height: 28px;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  color: transparent;
}

.deal-task-check:hover {
  border-color: #6366f1;
  color: #6366f1;
}

.deal-task-item.completed .deal-task-check {
  background: #22c55e;
  border-color: #22c55e;
  color: white;
}

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

.deal-task-title {
  font-size: 13px;
  font-weight: 500;
  color: #334155;
}

.deal-task-title.completed {
  text-decoration: line-through;
  color: #94a3b8;
}

.deal-task-meta {
  display: flex;
  gap: 6px;
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}

.deal-task-meta .overdue {
  color: #dc2626;
  font-weight: 600;
}

.deal-task-edit {
  padding: 6px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.deal-task-item:hover .deal-task-edit {
  opacity: 1;
}

.deal-add-task-btn {
  width: 100%;
  margin: 12px 20px 16px;
  width: calc(100% - 40px);
  justify-content: center;
}

/* ===========================================
   SIDEBAR CARDS
   =========================================== */

.deal-sidebar-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}

.deal-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
}

.deal-sidebar-header h4 {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin: 0;
}

.deal-sidebar-empty {
  padding: 20px;
  text-align: center;
}

.deal-sidebar-empty p {
  margin: 0 0 8px;
  color: #94a3b8;
  font-size: 13px;
}

.deal-sidebar-hint {
  font-size: 11px !important;
  color: #cbd5e1 !important;
}

/* Company Card */
.deal-company-info {
  padding: 16px;
}

.deal-company-name {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}

.deal-company-industry {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 8px;
}

.deal-company-website {
  font-size: 12px;
  color: #6366f1;
  text-decoration: none;
}

.deal-company-website:hover {
  text-decoration: underline;
}

.deal-company-details {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 11px;
  color: #64748b;
}

/* Contacts Card */
.deal-contacts-list {
  padding: 8px;
}

.deal-contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.deal-contact-item:hover {
  background: #f8fafc;
}

.deal-contact-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.deal-contact-info {
  flex: 1;
  min-width: 0;
}

.deal-contact-name {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.deal-contact-title {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 4px;
}

.deal-contact-role {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
}

.deal-contact-actions {
  display: flex;
  gap: 4px;
}

.deal-contact-action {
  padding: 6px;
  border: none;
  border-radius: 6px;
  background: #f1f5f9;
  cursor: pointer;
  transition: background 0.15s ease;
  font-size: 12px;
}

.deal-contact-action:hover {
  background: #e2e8f0;
}

/* Health Card */
.deal-health-card .deal-sidebar-header {
  border-bottom: none;
}

.deal-health-score {
  font-size: 24px;
  font-weight: 700;
}

.deal-health-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 12px;
  font-size: 14px;
  font-weight: 600;
}

.deal-health-icon {
  font-size: 18px;
}

.deal-health-risks {
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.deal-health-risk {
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8fafc;
  border-left: 3px solid #cbd5e1;
}

.deal-health-risk-high {
  border-left-color: #dc2626;
  background: #fef2f2;
}

.deal-health-risk-medium {
  border-left-color: #f59e0b;
  background: #fffbeb;
}

.deal-health-risk-low {
  border-left-color: #6366f1;
  background: #f5f3ff;
}

.deal-risk-message {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

.deal-risk-action {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
}

.deal-health-good {
  padding: 16px;
}

.deal-health-good p {
  margin: 0;
  font-size: 13px;
  color: #166534;
}

/* Documents Card */
.deal-documents-list {
  padding: 8px;
}

.deal-document-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.deal-document-item:hover {
  background: #f8fafc;
}

.deal-document-icon {
  font-size: 24px;
}

.deal-document-info {
  flex: 1;
  min-width: 0;
}

.deal-document-name {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deal-document-meta {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 2px;
}

.deal-document-action {
  padding: 6px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.deal-document-item:hover .deal-document-action {
  opacity: 1;
}

/* ===========================================
   MODALS
   =========================================== */

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

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

.deal-modal {
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: dealModalSlideIn 0.2s ease;
}

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

.deal-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
}

.deal-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.deal-modal-close {
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  color: #64748b;
  transition: background 0.15s ease;
}

.deal-modal-close:hover {
  background: #f1f5f9;
}

.deal-modal-body {
  padding: 24px;
  overflow-y: auto;
}

.deal-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
  background: #fafbfc;
}

.deal-modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.deal-modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.deal-modal-field label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.deal-modal-input,
.deal-modal-select,
.deal-modal-textarea {
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.deal-modal-input:focus,
.deal-modal-select:focus,
.deal-modal-textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.deal-modal-textarea {
  resize: vertical;
  min-height: 80px;
}

.deal-modal-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
}

.deal-modal-checkbox label {
  font-size: 13px;
  font-weight: normal;
  color: #334155;
}

.deal-snooze-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.deal-snooze-btn {
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: white;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.deal-snooze-btn:hover {
  border-color: #6366f1;
  background: #f5f3ff;
}

/* ===========================================
   CELEBRATIONS & TOASTS
   =========================================== */

.deal-celebration {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(34, 197, 94, 0.1);
  z-index: 20000;
  animation: dealCelebrateFade 3s ease forwards;
  pointer-events: none;
}

@keyframes dealCelebrateFade {
  0% { opacity: 0; }
  10% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

.deal-celebration-content {
  text-align: center;
  animation: dealCelebratePop 0.5s ease;
}

@keyframes dealCelebratePop {
  0% { transform: scale(0.5); opacity: 0; }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

.deal-celebration-emoji {
  font-size: 80px;
  margin-bottom: 16px;
}

.deal-celebration-text {
  font-size: 32px;
  font-weight: 700;
  color: #166534;
}

.deal-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1e293b;
  color: white;
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  z-index: 20000;
  opacity: 0;
  transition: all 0.3s ease;
}

.deal-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===========================================
   PANEL MODE ADJUSTMENTS (50% width)
   =========================================== */

/* Header adjustments for narrow panel */
.deal-header-left {
  flex: 1;
  min-width: 0;
}

.deal-header-center {
  display: none; /* Hide KPIs in panel mode - they're shown in cards instead */
}

.deal-header-right {
  flex-shrink: 0;
}

.deal-actions-secondary {
  display: none; /* Hide secondary actions in panel, use dropdown */
}

/* Show secondary actions in More menu instead */
.deal-action-btn.deal-action-success,
.deal-action-btn.deal-action-danger {
  display: none;
}

/* Stage progress - horizontal scroll in narrow panel */
.deal-stage-progress {
  overflow-x: auto;
  padding-bottom: 8px;
}

.deal-stage-step {
  min-width: 70px;
}

/* Sidebar as bottom grid */
.deal-sidebar {
  grid-template-columns: repeat(2, 1fr);
}

/* Activity and tasks cards fill available space */
.deal-activity-card,
.deal-tasks-card {
  max-height: 300px;
}

.deal-activity-list,
.deal-tasks-list {
  max-height: 200px;
  overflow-y: auto;
}

/* ===========================================
   RESPONSIVE (Narrower panels)
   =========================================== */

@media (max-width: 700px) {
  #dealWorkspaceMount {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .deal-sidebar {
    grid-template-columns: 1fr;
    max-height: none;
  }

  .deal-header {
    padding: 12px 16px;
  }

  .deal-title {
    font-size: 16px;
  }

  .deal-action-btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .deal-action-btn svg {
    width: 14px;
    height: 14px;
  }
}

