.playground:has(.calendar-month-view),
.playground:has(.day-planner),
.playground:has(.notes-board-view),
.playground:has(.forms-screen),
.playground:has(.contacts-screen),
.playground:has(.inbox-layout),
.playground:has(.sales-screen),
.playground:has(.automation-screen),
.playground:has(.settings-screen),
.playground:has(.lounge-settings),
.playground:has(.statistics-workspace),
.playground:has(.treasury-screen),
.playground.is-empty-view {
  padding: 0;
  border: 0;
  background: transparent;
}

.opportunity-toolbar {
  display: flex;
  justify-content: flex-start;
  width: 100%;
  margin-bottom: 10px;
}

.opportunity-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.opportunity-composer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid rgba(224, 168, 76, 0.28);
  background:
    linear-gradient(180deg, rgba(196, 122, 44, 0.12), rgba(49, 49, 53, 0.48)),
    rgba(28, 28, 31, 0.92);
}

.opportunity-composer h3,
.opportunity-composer p {
  margin: 0;
}

.opportunity-composer p {
  color: rgba(242, 244, 246, 0.78);
  line-height: 1.45;
}

.opportunity-composer label {
  display: grid;
  gap: 8px;
  color: var(--text);
}

.opportunity-composer-span-3 {
  grid-column: 1 / -1;
}

.opportunity-composer input,
.opportunity-composer textarea,
.opportunity-composer select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--panel-line);
  background: rgba(18, 18, 20, 0.92);
  color: var(--text);
  padding: 12px 14px;
  resize: vertical;
}

.opportunity-composer input:focus,
.opportunity-composer input:focus-visible,
.opportunity-composer textarea:focus,
.opportunity-composer textarea:focus-visible,
.opportunity-composer select:focus,
.opportunity-composer select:focus-visible {
  outline: none;
  border-color: rgba(224, 168, 76, 0.34);
}

.opportunity-composer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 2px;
}

.opportunity-grid-header {
  display: grid;
  grid-template-columns: 24px minmax(320px, 1.6fr) minmax(160px, 0.8fr);
  gap: 14px;
  align-items: center;
  padding: 0 0 2px;
  margin-bottom: 8px;
  color: rgba(242, 244, 246, 0.78);
  font-size: 0.84rem;
}

.opportunity-list-item {
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.opportunity-list-item.is-selected {
  border-color: rgba(224, 168, 76, 0.28);
  background: rgba(196, 122, 44, 0.08);
}

.opportunity-list-toggle {
  width: 100%;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
}

.opportunity-list-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.6fr) minmax(160px, 0.8fr);
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.opportunity-list-arrow {
  justify-self: end;
  width: 12px;
  height: 12px;
  position: relative;
}

.opportunity-list-arrow::before {
  content: "";
  position: absolute;
  inset: 2px 3px 2px 2px;
  border-top: 2px solid rgba(242, 244, 246, 0.88);
  border-right: 2px solid rgba(242, 244, 246, 0.88);
  transform: rotate(45deg);
  transform-origin: center;
}

.opportunity-list-arrow.is-open::before {
  inset: 1px 2px 3px 2px;
  transform: rotate(135deg);
}

.opportunity-detail-panel {
  display: grid;
  gap: 14px;
  padding: 14px 16px 16px;
  border-top: 1px solid rgba(230, 225, 217, 0.08);
}

.opportunity-detail-form {
  margin-top: 0;
}

.opportunity-activity {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 0;
}

.opportunity-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
}

.opportunity-tab-button {
  background: rgba(74, 74, 80, 0.92);
  border: 1px solid rgba(230, 225, 217, 0.08);
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
  padding: 8px 16px;
  border-radius: 0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.opportunity-tab-button:hover {
  background: rgba(94, 94, 100, 0.92);
}

.opportunity-tab-button.active {
  background: linear-gradient(180deg, rgba(196, 122, 44, 0.28), rgba(78, 58, 31, 0.4));
  border-color: rgba(224, 168, 76, 0.34);
  color: var(--text);
}

.opportunity-scrollable-container {
  max-height: 350px;
  overflow-y: auto;
  padding-right: 8px;
}

.opportunity-scrollable-container::-webkit-scrollbar {
  width: 6px;
}

.opportunity-scrollable-container::-webkit-scrollbar-track {
  background: transparent;
}

.opportunity-scrollable-container::-webkit-scrollbar-thumb {
  background: var(--panel-line-strong);
  border-radius: 4px;
}

.opportunity-activity-column {
  display: grid;
  gap: 10px;
  align-content: start;
}

.opportunity-activity-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.opportunity-activity-column h3 {
  margin: 0;
}

.opportunity-note-composer {
  margin-bottom: 0;
}

.record-list-item:has(.pipeline-stage-picker) {
  z-index: 10;
}

.sales-screen {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 100%;
  padding: 0;
}

.sales-opportunity-card {
  display: grid;
  gap: 8px;
  padding: 0 0 10px;
  border: 0;
  background: transparent;
  box-shadow: none;
  position: relative;
}

.sales-opportunity-card:has(.pipeline-stage-picker) {
  z-index: 10;
}

.sales-opportunity-card + .sales-opportunity-card {
  padding-top: 10px;
  border-top: 1px solid rgba(230, 225, 217, 0.08);
}

.sales-opportunity-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
}

.sales-opportunity-heading h3,
.sales-opportunity-heading p {
  margin: 0;
}

.sales-opportunity-heading p,
.sales-opportunity-heading span {
  color: rgba(242, 244, 246, 0.78);
}

.pipeline-bar {
  display: flex;
  align-items: stretch;
  width: 100%;
  flex-wrap: wrap;
  min-height: 28px;
}

.pipeline-stage,
.pipeline-add-stage {
  appearance: none;
  border: 1px solid rgba(230, 225, 217, 0.08);
  border-radius: 0;
  background: rgba(54, 54, 58, 0.76);
  color: var(--text);
  min-height: 28px;
  padding: 5px 10px;
  font-size: 0.78rem;
  line-height: 1.1;
}

.pipeline-stage {
  flex: 0 0 148px;
  width: 148px;
}

.pipeline-stage + .pipeline-stage,
.pipeline-add-stage {
  margin-left: -1px;
}

.pipeline-stage.is-complete {
  background: linear-gradient(180deg, rgba(196, 122, 44, 0.28), rgba(78, 58, 31, 0.4));
  border-color: rgba(224, 168, 76, 0.34);
}

.pipeline-stage.is-clickable,
.pipeline-add-stage {
  cursor: pointer;
}

.pipeline-stage:disabled {
  cursor: default;
}

.pipeline-add-stage {
  width: 42px;
  font-weight: 700;
}

.pipeline-stage-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pipeline-empty-state {
  padding: 4px 0 0;
  border: 0;
  background: transparent;
  color: rgba(242, 244, 246, 0.78);
}

.sales-editor-screen {
  width: min(620px, 100%);
}

.sales-stage-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.sales-stage-form label,
.sales-handoff-field {
  display: grid;
  gap: 8px;
  color: var(--text);
}

.sales-stage-form input,
.sales-stage-form select,
.sales-stage-form textarea,
.sales-handoff-field select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--panel-line);
  background: var(--field-bg);
  color: var(--text);
  padding: 12px 14px;
}

.sales-stage-form input:focus,
.sales-stage-form input:focus-visible,
.sales-stage-form select:focus,
.sales-stage-form select:focus-visible,
.sales-stage-form textarea:focus,
.sales-stage-form textarea:focus-visible,
.sales-handoff-field select:focus,
.sales-handoff-field select:focus-visible {
  outline: none;
  border-color: rgba(224, 168, 76, 0.34);
}

.sales-stage-list {
  display: grid;
  gap: 10px;
}

.sales-stage-list-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.sales-stage-list-item:not(.is-locked) {
  cursor: grab;
}

.sales-stage-list-item.is-dragging {
  opacity: 0.55;
}

.sales-stage-list-item.is-drop-target {
  border-color: rgba(224, 168, 76, 0.34);
  background: rgba(196, 122, 44, 0.1);
}

.sales-stage-list-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.sales-stage-remove,
.sales-stage-lock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
}

.sales-stage-remove {
  border: 1px solid var(--panel-line);
  border-radius: 0;
  background: var(--field-bg);
  color: var(--text);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.sales-stage-remove:hover {
  transform: translateY(-1px);
  border-color: var(--panel-line-strong);
}

.sales-stage-lock {
  color: rgba(242, 244, 246, 0.58);
  font-size: 0.78rem;
}

body[data-theme="light"] .tab-switcher button,
body[data-theme="light"] .workspace-tab,
body[data-theme="light"] .opportunity-tab-button,
body[data-theme="light"] .secondary-button,
body[data-theme="light"] .settings-option,
body[data-theme="light"] .record-launch-card,
body[data-theme="light"] .form-toolbar-button,
body[data-theme="light"] .sales-stage-remove {
  background: #e8ecef;
  border-color: #d4dadf;
  color: #172026;
}

body[data-theme="light"] .company-menu button,
body[data-theme="light"] .flyout-menu button,
body[data-theme="light"] .workspace-tab.active,
body[data-theme="light"] .opportunity-tab-button.active,
body[data-theme="light"] .action-button,
body[data-theme="light"] .calendar-reminder-submit,
body[data-theme="light"] .theme-choice.active,
body[data-theme="light"] .form-toolbar-button.active {
  background: #4f6272;
  border-color: #3d4d5a;
  color: #ffffff;
}

body[data-theme="light"] .playground:has(.calendar-month-view),
body[data-theme="light"] .playground:has(.day-planner),
body[data-theme="light"] .playground:has(.notes-board-view),
body[data-theme="light"] .playground:has(.forms-screen),
body[data-theme="light"] .playground:has(.contacts-screen),
body[data-theme="light"] .playground:has(.inbox-layout),
body[data-theme="light"] .playground:has(.sales-screen),
body[data-theme="light"] .playground:has(.automation-screen),
body[data-theme="light"] .playground:has(.statistics-workspace),
body[data-theme="light"] .playground:has(.treasury-screen),
body[data-theme="light"] .playground.is-empty-view {
  background: transparent;
}

body[data-theme="light"] .surface-card,
body[data-theme="light"] .notes-editor,
body[data-theme="light"] .calendar-card,
body[data-theme="light"] .placeholder-screen,
body[data-theme="light"] .contact-list-item,
body[data-theme="light"] .record-list-item,
body[data-theme="light"] .opportunity-list-item,
body[data-theme="light"] .sales-stage-list-item,
body[data-theme="light"] .opportunity-composer {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
  color: #172026;
}

body[data-theme="light"] .opportunity-composer p {
  color: #5d6872;
}

body[data-theme="light"] input,
body[data-theme="light"] textarea,
body[data-theme="light"] select,
body[data-theme="light"] .forms-search,
body[data-theme="light"] .forms-sort,
body[data-theme="light"] .list-name-input,
body[data-theme="light"] .bulk-tag-picker select,
body[data-theme="light"] .record-form input,
body[data-theme="light"] .record-form textarea,
body[data-theme="light"] .record-form select,
body[data-theme="light"] .contact-email-form input,
body[data-theme="light"] .contact-email-form textarea,
body[data-theme="light"] .opportunity-composer input,
body[data-theme="light"] .opportunity-composer textarea,
body[data-theme="light"] .opportunity-composer select,
body[data-theme="light"] .sales-stage-form input,
body[data-theme="light"] .sales-stage-form select,
body[data-theme="light"] .sales-stage-form textarea,
body[data-theme="light"] .sales-handoff-field select,
body[data-theme="light"] .day-reminder-form select {
  background: rgba(0, 0, 0, 0.08);
  border-color: transparent;
  color: #172026;
  color-scheme: light;
}

body[data-theme="light"] .contact-list-item.is-selected,
body[data-theme="light"] .opportunity-list-item.is-selected,
body[data-theme="light"] .sales-stage-list-item.is-drop-target {
  background: rgba(79, 98, 114, 0.08);
  border-color: rgba(79, 98, 114, 0.32);
}

body[data-theme="light"] .pipeline-stage,
body[data-theme="light"] .pipeline-add-stage {
  background: #e8ecef;
  border-color: #d4dadf;
  color: #172026;
}

body[data-theme="light"] .pipeline-stage.is-complete {
  background: #4f6272;
  border-color: #3d4d5a;
  color: #ffffff;
}

body[data-theme="light"] .pipeline-stage.is-clickable:hover,
body[data-theme="light"] .pipeline-add-stage:hover {
  border-color: #4f6272;
  background: rgba(79, 98, 114, 0.12);
  color: #172026;
}

.timeline-mode .pipeline-bar {
    overflow-x: visible;
  }

.timeline-mode .pipeline-stage, .timeline-mode .timeline-date-cell {
  flex: 0 0 200px;
  width: 200px;
}

.timeline-mode .pipeline-bar {
  overflow-x: hidden !important;
  min-width: 0 !important;
  width: 100% !important;
  flex-wrap: nowrap !important;
}

.timeline-mode .pipeline-stage-wrapper, .timeline-mode .timeline-date-cell {
  flex: 1 !important;
  min-width: 0 !important;
  width: auto !important;
}

.timeline-mode .pipeline-stage-wrapper {
  display: flex;
}

.timeline-mode .pipeline-stage {
  flex: 1 !important;
  width: 100% !important;
  min-width: 0 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.pipeline-stage-wrapper {
  position: relative;
  display: flex;
}

.pipeline-stage-wrapper + .pipeline-stage-wrapper,
.pipeline-stage-wrapper + .pipeline-add-stage {
  margin-left: -1px;
}

.timeline-mode .pipeline-stage-wrapper {
  flex: 1 !important;
  min-width: 0 !important;
}

.pipeline-stage-wrapper:hover .remove-stage-btn {
  opacity: 1;
}

/* Sales-specific structural overrides (Independent of Production timeline) */
.sales-pipeline-shell {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
}

.sales-pipeline-bar {
  width: max-content;
  max-width: 100%;
}

.global-sales-stage-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: var(--card-bg);
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  position: absolute;
  z-index: 999999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.sales-pipeline-bar .pipeline-stage,
.sales-pipeline-bar .pipeline-add-stage {
  min-height: 38px;
}