:root {
  --emerald-50: rgba(11, 143, 91, 0.05);
  --emerald-100: rgba(11, 143, 91, 0.1);
  --emerald-200: rgba(11, 143, 91, 0.16);
  --emerald-500: #0b8f5b;
  --emerald-600: #0a7b50;
  --emerald-700: #086842;
  --emerald-900: #063522;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-900: #0f172a;
  --amber-100: rgba(201, 169, 122, 0.2);
  --amber-700: #9b7a4b;
  --rose-50: #fff1f2;
  --rose-200: #fecdd3;
  --rose-700: #be123c;
}

/* Global shell + navigation */
.app-header {
  border-radius: 1.75rem;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}
.app-header-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.6fr) auto;
  align-items: center;
  gap: 16px;
}
.app-brand h1 {
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}
.app-brand p {
  font-size: 0.9rem;
  color: rgba(15, 26, 28, 0.6);
}
.app-header-search-input {
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.9);
  padding: 10px 16px;
  font-size: 0.9rem;
}
.app-header-tabs {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}
.top-tabs {
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.04);
  padding: 6px;
  border: 1px solid rgba(15, 23, 42, 0.08);
}
.tab-button {
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(15, 26, 28, 0.65);
  border: 1px solid transparent;
  transition: all 0.2s ease;
}
.tab-button:hover {
  color: var(--emerald-700);
  background: rgba(11, 143, 91, 0.08);
}
.tab-button.tab-active,
.tab-button.active,
.tab-button[data-active="true"] {
  background: rgba(11, 143, 91, 0.14);
  color: var(--emerald-900);
  border-color: rgba(11, 143, 91, 0.2);
}
.tab-button .tab-icon {
  width: 18px;
  height: 18px;
}
.app-menu {
  backdrop-filter: blur(12px);
}
.app-menu-panel {
  border-radius: 1.25rem;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

/* Buttons */
.primary-button {
  border-radius: 999px;
  background: linear-gradient(135deg, var(--emerald-500), var(--emerald-700));
  border: none;
  color: #fff;
  box-shadow: 0 10px 20px rgba(11, 143, 91, 0.24);
}
.secondary-button,
.stage-button {
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.9);
  color: rgba(15, 26, 28, 0.75);
}
.secondary-button:hover,
.stage-button:hover {
  border-color: rgba(11, 143, 91, 0.2);
  color: var(--emerald-700);
}

/* Context bar */
.context-bar {
  border-radius: 1.5rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  padding: 12px 18px;
}
.context-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(15, 26, 28, 0.6);
}

/* Pipeline polish */
.pipeline-view { gap: 16px; }
.metrics-wrap {
  border-radius: 1.5rem;
  border: 1px solid rgba(11, 143, 91, 0.14);
  background: rgba(255, 255, 255, 0.9);
  padding: 16px;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
}
.metrics-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(11, 143, 91, 0.72);
}
#metrics-bar .metrics-item {
  border-radius: 1.25rem;
  border: 1px solid rgba(11, 143, 91, 0.14);
  background: rgba(11, 143, 91, 0.05);
  padding: 14px;
  box-shadow: 0 4px 8px rgba(15, 23, 42, 0.05);
}
#metrics-bar .metrics-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--slate-900);
}
#metrics-bar .metrics-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(11, 143, 91, 0.72);
}
#metrics-bar .metrics-amount {
  font-size: 12px;
  color: var(--slate-500);
}
.controls-panel {
  border: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}
.control-group label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--slate-500);
}
.pipeline-stage-tabs {
  border: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}
.pipeline-stage-tab {
  text-transform: none;
}
.pipeline-stage-tab.active,
.pipeline-stage-tab[data-active="true"] {
  background: transparent;
  color: inherit;
}
.pipeline-stage-count {
  margin-left: 6px;
}
.kanban-board { gap: 12px; }
.kanban-column {
  padding: 0;
}
.kanban-column h2 {
  padding: 0;
  border-bottom: 0;
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(11, 143, 91, 0.78);
}
.kanban-column-body {
  padding: 0;
  gap: 12px;
}
.deal-card {
  padding: 0;
  transition: box-shadow 0.2s ease;
}
.deal-card:hover {
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.08);
}
.deal-card {
  overflow: visible;
}
.action-menu .action-menu-pop {
  z-index: 60;
}
.action-menu.dropdown-open .action-menu-pop {
  display: block;
}
.deal-card::before,
.deal-card::after {
  content: none;
}
.deal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.deal-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--slate-900);
}
.deal-amount-primary {
  font-size: 13px;
  font-weight: 600;
  color: var(--emerald-700);
}
.deal-top {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}
.deal-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
}
.deal-meta-chip {
  border-radius: 999px;
  background: var(--emerald-50);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--emerald-700);
}
.urgency-chip {
  background: var(--amber-100);
  color: var(--amber-700);
}
.deal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag {
  border-radius: 999px;
  background: var(--slate-100);
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--slate-600);
}
.deal-footer {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid rgba(11, 143, 91, 0.14);
  padding-top: 12px;
}

/* Work + command center */
.work-top {
  padding: 18px 20px;
  border-radius: 1.5rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
}
.work-subtabs {
  border-radius: 999px;
  padding: 6px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.08);
}
.work-subtab {
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: rgba(15, 26, 28, 0.65);
}
.work-subtab.active {
  background: rgba(11, 143, 91, 0.14);
  color: var(--emerald-900);
}
.work-card {
  border-radius: 1.5rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}
.work-card-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(15, 26, 28, 0.55);
}

/* Files */
.files-panel,
.files-panel-list {
  border-radius: 1.5rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}
.files-panel-header {
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

/* Calendar */
.calendar-ai-scheduler {
  border-radius: 1.5rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}
.calendar-subtabs {
  border-radius: 999px;
  padding: 6px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.08);
}
.calendar-subtab {
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: rgba(15, 26, 28, 0.6);
}
.calendar-subtab.active {
  background: rgba(11, 143, 91, 0.14);
  color: var(--emerald-900);
}
.fc {
  font-size: 0.9rem;
}
.fc .fc-toolbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--slate-900);
}
.fc .fc-button {
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  color: rgba(15, 26, 28, 0.7);
}
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  background: rgba(11, 143, 91, 0.16);
  border-color: rgba(11, 143, 91, 0.24);
  color: var(--emerald-900);
}
.fc .fc-col-header-cell,
.fc .fc-daygrid-day {
  background: rgba(255, 255, 255, 0.9);
}
.fc .fc-daygrid-day-frame {
  border-radius: 10px;
}

/* Deal page */
.deal-tabs {
  gap: 8px;
}
.deal-tab {
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  padding: 8px 14px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.deal-tab.active {
  background: rgba(11, 143, 91, 0.14);
  color: var(--emerald-900);
}
.deal-summary-card,
.deal-analysis-card,
.deal-tasks-card,
.deal-files-card {
  border-radius: 1.5rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}
.deal-stage {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--slate-500);
}
.stage-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.deal-subitems {
  margin-top: 12px;
  border-radius: 1rem;
  border: 1px solid rgba(209, 250, 229, 0.7);
  background: rgba(236, 253, 245, 0.4);
  padding: 12px;
}
.subitems-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(4, 120, 87, 0.7);
}
.subitems-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.subitem-row {
  border-radius: 1rem;
  border: 1px solid rgba(209, 250, 229, 0.7);
  background: #fff;
  padding: 10px 12px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}
.subitem-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--slate-900);
}
.subitem-when,
.subitem-deps {
  font-size: 11px;
  color: var(--slate-500);
}
.subitem-actions {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.stage-tag {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.stage-todo {
  background: var(--slate-100);
  color: var(--slate-600);
}
.stage-doing {
  background: var(--emerald-100);
  color: var(--emerald-700);
}
.stage-waiting {
  background: var(--amber-100);
  color: var(--amber-700);
}
.stage-done {
  background: var(--slate-200);
  color: var(--slate-500);
}

/* Deal page polish */
.deal-main {
  margin: 0 auto;
  width: 100%;
  max-width: 1500px;
  padding: 0 24px 64px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.deal-hero {
  border-radius: 1.5rem;
  border: 1px solid rgba(209, 250, 229, 0.7);
  background: rgba(255, 255, 255, 0.95);
  padding: 20px;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.06);
}
.deal-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--slate-900);
}
.deal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.deal-tab {
  border-radius: 999px;
  border: 1px solid rgba(209, 250, 229, 0.8);
  background: #fff;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-700);
}
.deal-tab.active {
  background: var(--emerald-100);
  color: var(--emerald-900);
}
.deal-tab-panel {
  border-radius: 1.5rem;
  border: 1px solid rgba(209, 250, 229, 0.7);
  background: rgba(255, 255, 255, 0.95);
  padding: 20px;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.06);
}
.deal-overview-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}
.deal-actions-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.deal-summary-row {
  display: grid;
  gap: 16px;
}
@media (min-width: 1024px) {
  .deal-summary-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.deal-summary-card {
  border-radius: 1.5rem;
  border: 1px solid rgba(209, 250, 229, 0.7);
  background: rgba(255, 255, 255, 0.95);
  padding: 20px;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
}
.deal-summary-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(4, 120, 87, 0.7);
}
.deal-summary-body {
  font-size: 14px;
  color: var(--slate-700);
}
.deal-contacts-add {
  margin-top: 16px;
  border-radius: 1rem;
  border: 1px solid rgba(209, 250, 229, 0.7);
  background: rgba(236, 253, 245, 0.4);
  padding: 12px;
}
.deal-contacts-add-row {
  display: grid;
  gap: 8px;
}
@media (min-width: 768px) {
  .deal-contacts-add-row {
    grid-template-columns: 1fr auto auto;
  }
}
.deal-contact-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.deal-contact-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 1rem;
  border: 1px solid rgba(209, 250, 229, 0.7);
  background: #fff;
  padding: 12px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}
.deal-contact-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.deal-contact-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--slate-900);
}
.deal-contact-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--slate-500);
}
.deal-role-pill {
  border-radius: 999px;
  background: var(--emerald-100);
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--emerald-700);
}
.deal-contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.deal-analysis {
  border-radius: 1.5rem;
  border: 1px solid rgba(209, 250, 229, 0.7);
  background: rgba(255, 255, 255, 0.95);
  padding: 20px;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
}
.deal-analysis-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.deal-analysis-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(4, 120, 87, 0.7);
}
.deal-analysis-sub {
  font-size: 12px;
  color: var(--slate-500);
}
.deal-analysis-body {
  margin-top: 16px;
  display: grid;
  gap: 16px;
}
@media (min-width: 1024px) {
  .deal-analysis-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.deal-analysis-card {
  border-radius: 1rem;
  border: 1px solid rgba(209, 250, 229, 0.7);
  background: rgba(236, 253, 245, 0.4);
  padding: 16px;
}
.deal-analysis-card-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(4, 120, 87, 0.7);
}
.deal-analysis-share {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--slate-600);
}
.deal-analysis-share-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.deal-notes-preview {
  margin-top: 8px;
  font-size: 14px;
  color: var(--slate-600);
}
.deal-panel {
  border-radius: 1.5rem;
  border: 1px solid rgba(209, 250, 229, 0.7);
  background: rgba(255, 255, 255, 0.95);
  padding: 20px;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
}
.deal-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.deal-panel-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(4, 120, 87, 0.7);
}
.deal-panel-sub {
  font-size: 12px;
  color: var(--slate-500);
}
.deal-panel-body {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}
.deal-panel-grid {
  display: grid;
  gap: 16px;
}
@media (min-width: 1024px) {
  .deal-panel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.deal-panel-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.deal-task-quickadd {
  margin-top: 16px;
  display: grid;
  gap: 8px;
}
@media (min-width: 768px) {
  .deal-task-quickadd {
    grid-template-columns: 2fr 1fr auto;
  }
}
.deal-pack-row,
.deal-assign-row {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.deal-assign-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.deal-email-grid {
  display: grid;
  gap: 12px;
}
@media (min-width: 768px) {
  .deal-email-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.deal-conditions-actions {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.deal-conditions-upload {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}
@media (min-width: 768px) {
  .deal-conditions-upload {
    grid-template-columns: 1fr auto;
  }
}
.deal-conditions-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.deal-condition-group {
  border-radius: 1rem;
  border: 1px solid rgba(209, 250, 229, 0.7);
  background: #fff;
  padding: 16px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}
.deal-condition-group-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(4, 120, 87, 0.7);
}
.deal-condition-row {
  border-radius: 1rem;
  border: 1px solid rgba(209, 250, 229, 0.7);
  background: rgba(236, 253, 245, 0.4);
  padding: 12px;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.06);
}
.deal-condition-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.deal-condition-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--slate-900);
}
.deal-condition-meta {
  font-size: 11px;
  color: var(--slate-500);
}
.deal-condition-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.deal-condition-note {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}
.deal-fees-toolbar {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.deal-fees-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.deal-fees-summary {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}
@media (min-width: 768px) {
  .deal-fees-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.deal-fees-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.deal-file-meta {
  margin-top: 12px;
  font-size: 12px;
  color: var(--slate-500);
}
.deal-file-ai-block {
  margin-top: 16px;
  border-radius: 1rem;
  border: 1px solid rgba(209, 250, 229, 0.7);
  background: rgba(236, 253, 245, 0.4);
  padding: 16px;
}
.deal-file-ai-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(4, 120, 87, 0.7);
}
.deal-file-ai {
  margin-top: 8px;
  font-size: 14px;
  color: var(--slate-700);
}
.deal-file-ai-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.deal-drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
}
.deal-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(6px);
}

/* Lender portal condition fix */
.lender-conditions-actions {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lender-conditions-upload {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Work, contacts, files, settings polish */
.work-view {
  gap: 20px;
}
.work-top {
  border-radius: 1.5rem;
  border: 1px solid rgba(209, 250, 229, 0.7);
  background: rgba(255, 255, 255, 0.9);
  padding: 16px 20px;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.05);
}
.work-card {
  border-radius: 1.5rem;
  border: 1px solid rgba(209, 250, 229, 0.7);
  background: rgba(255, 255, 255, 0.95);
  padding: 16px;
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.05);
}
.work-card-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(4, 120, 87, 0.75);
}
.work-card-sub {
  font-size: 12px;
  color: var(--slate-500);
}
.work-grid {
  gap: 16px;
}

.contacts-panel {
  border-radius: 1.5rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.96);
  padding: 16px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
}
.contacts-summary-card {
  border-radius: 1rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(248, 250, 248, 0.9);
  padding: 12px;
}
.contacts-toolbar {
  border-radius: 1rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.94);
  padding: 10px 12px;
}
.contact-row {
  border-radius: 1rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #fff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.files-panel {
  border-radius: 1.5rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.96);
  padding: 16px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
}
.files-panel-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(11, 143, 91, 0.7);
}
.files-panel-subtitle {
  font-size: 12px;
  color: var(--slate-500);
}
.files-shell {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(420px, 1.8fr);
  gap: 18px;
}
@media (max-width: 1024px) {
  .files-shell {
    grid-template-columns: 1fr;
  }
}

.settings-card {
  border-radius: 1.5rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
}
.settings-tabs {
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.94);
  padding: 6px;
}
.settings-tab {
  border-radius: 999px;
}

.ai-panel {
  border-radius: 20px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 22px 46px rgba(15, 23, 42, 0.16);
}
.ai-section {
  border-radius: 16px;
  border: 1px solid rgba(209, 250, 229, 0.7);
  background: rgba(236, 253, 245, 0.3);
  box-shadow: none;
}
.ai-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(4, 120, 87, 0.8);
}

/* Daisy-inspired rebrand + dark theme overrides */
body,
.app-body,
.deal-body,
.settings-body,
.borrower-body,
.lender-portal-body,
.referral-body,
.referral-auth-body,
.onboarding-body {
  background: linear-gradient(180deg, var(--bg0) 0%, var(--bg1) 100%);
  color: var(--text);
}

.app-header,
.app-header-tabs {
  background: var(--glass);
  border-color: var(--stroke);
  box-shadow: var(--shadow2);
}

.app-brand h1,
.app-brand p {
  color: var(--text);
}

.app-header-search-input {
  background: var(--surface-strong);
  border-color: var(--stroke);
  color: var(--text);
}

.top-tabs,
.pipeline-stage-tabs,
.controls-panel,
.metrics-wrap,
.kanban-column,
.deal-card,
.work-card,
.files-panel,
.contacts-panel,
.contact-row,
.deal-panel,
.deal-summary-card,
.deal-analysis,
.deal-condition-group,
.deal-condition-row,
.deal-file-ai-block,
.deal-drawer-panel {
  background: var(--surface);
  border-color: var(--stroke);
  box-shadow: var(--shadow2);
}

.primary-button {
  background: var(--primary);
  border-radius: 0.8rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
  color: #f8fffb;
}

.primary-button:hover {
  background: var(--primary2);
}

.secondary-button,
.stage-button,
.deal-drawer-tab {
  background: transparent;
  border-color: var(--stroke);
  color: var(--text);
}

.secondary-button:hover,
.stage-button:hover,
.deal-drawer-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.tab-button {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.tab-button.tab-active,
.tab-button:hover {
  background: var(--chipBg);
  border-color: var(--primary);
  color: var(--text);
}

.modal-content,
.deal-modal,
.modal {
  background: var(--surface);
  border-color: var(--stroke2);
  box-shadow: var(--shadow);
}

.modal-input,
.modal-textarea,
.modal-select,
.settings-input,
.settings-textarea {
  background: var(--surface-strong);
  border-color: var(--stroke);
  color: var(--text);
}

.modal-input::placeholder,
.modal-textarea::placeholder {
  color: var(--muted);
}

.metrics-title,
.deal-panel-title,
.deal-summary-title,
.deal-analysis-title,
.work-card-title,
.contacts-title,
.files-title {
  color: var(--muted);
}

.stage-tag,
.pipeline-stage-count,
.deal-role-pill,
.contact-tag,
.status-pill {
  background: var(--chipBg);
  color: var(--chipText);
}

.lender-conditions-actions,
.lender-conditions-upload {
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Owner status page */
.owner-status-main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.status-hero {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: 1.5rem;
  display: flex;
  justify-content: space-between;
  padding: 1.5rem;
}

.status-title {
  font-size: 1.4rem;
  font-weight: 600;
}

.status-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
}

.status-pill {
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 0.4rem 0.9rem;
  text-transform: uppercase;
}

.status-pill-good {
  background: rgba(34, 197, 94, 0.2);
  color: #5df29f;
}

.status-pill-warn {
  background: rgba(245, 158, 11, 0.2);
  color: #f5c66c;
}

.status-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 768px) {
  .status-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.status-card {
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: 1.25rem;
  padding: 1.25rem;
}

.status-card-label {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.status-card-value {
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: 0.35rem;
}

.status-card-sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.35rem;
}

.status-panel {
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: 1.5rem;
  padding: 1.5rem;
}

.status-panel-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.status-panel-title {
  font-size: 1rem;
  font-weight: 600;
}

.status-panel-sub {
  color: var(--muted);
  font-size: 0.85rem;
}

.status-metrics {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

@media (min-width: 768px) {
  .status-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.status-metric {
  border: 1px solid var(--stroke);
  border-radius: 1rem;
  padding: 0.9rem;
}

.status-metric-label {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status-metric-value {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 0.35rem;
}

.status-services {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

@media (min-width: 768px) {
  .status-services {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.status-service {
  border: 1px solid var(--stroke);
  border-radius: 1rem;
  padding: 0.9rem;
}

.status-service-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.status-service-name {
  font-weight: 600;
}

.status-service-detail {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.4rem;
}

.status-badge {
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  padding: 0.3rem 0.6rem;
  text-transform: uppercase;
}

.status-badge-good {
  background: rgba(34, 197, 94, 0.2);
  color: #5df29f;
}

.status-badge-warn {
  background: rgba(245, 158, 11, 0.2);
  color: #f5c66c;
}

.home-body {
  --ink: var(--text);
  --ink-soft: var(--muted);
  --accent: var(--primary);
  --accent-strong: var(--primary2);
  --accent-brass: var(--accent);
  --surface: var(--surface);
  --surface-soft: var(--surface-strong);
  --stroke: var(--stroke);
  --shadow: var(--shadow);
  --shadow-soft: var(--shadow2);
  background: linear-gradient(180deg, var(--bg0) 0%, var(--bg1) 100%);
  color: var(--text);
}

/* Dark theme overrides */
html[data-theme="business"] .app-header,
html[data-theme="business"] .context-bar,
html[data-theme="business"] .metrics-wrap,
html[data-theme="business"] .controls-panel,
html[data-theme="business"] .pipeline-stage-tabs,
html[data-theme="business"] .kanban-column,
html[data-theme="business"] .deal-card,
html[data-theme="business"] .work-top,
html[data-theme="business"] .work-card,
html[data-theme="business"] .files-panel,
html[data-theme="business"] .files-panel-list,
html[data-theme="business"] .calendar-ai-scheduler,
html[data-theme="business"] .deal-summary-card,
html[data-theme="business"] .deal-analysis-card,
html[data-theme="business"] .deal-tasks-card,
html[data-theme="business"] .deal-files-card,
html[data-theme="business"] .deal-hero,
html[data-theme="business"] .deal-tab-panel,
html[data-theme="business"] .deal-panel {
  background: var(--glass);
  border-color: var(--stroke);
  box-shadow: var(--shadow2);
}

html[data-theme="business"] .app-header-tabs,
html[data-theme="business"] .top-tabs,
html[data-theme="business"] .work-subtabs,
html[data-theme="business"] .calendar-subtabs {
  background: var(--surface-strong);
  border-color: var(--stroke);
}

html[data-theme="business"] .app-brand p,
html[data-theme="business"] .context-label,
html[data-theme="business"] .metrics-label,
html[data-theme="business"] .deal-stage,
html[data-theme="business"] .work-card-title {
  color: var(--muted);
}

html[data-theme="business"] .app-header-search-input,
html[data-theme="business"] .secondary-button,
html[data-theme="business"] .stage-button,
html[data-theme="business"] .deal-tab {
  background: var(--surface);
  border-color: var(--stroke);
  color: var(--text);
}

html[data-theme="business"] .tab-button {
  color: var(--muted);
}

html[data-theme="business"] .tab-button.tab-active,
html[data-theme="business"] .tab-button.active,
html[data-theme="business"] .tab-button[data-active="true"],
html[data-theme="business"] .work-subtab.active,
html[data-theme="business"] .calendar-subtab.active,
html[data-theme="business"] .deal-tab.active {
  background: rgba(29, 181, 123, 0.18);
  color: var(--text);
  border-color: rgba(29, 181, 123, 0.28);
}

html[data-theme="business"] .metrics-item,
html[data-theme="business"] #metrics-bar .metrics-item {
  background: var(--surface-strong);
  border-color: var(--stroke);
}

html[data-theme="business"] .deal-meta-chip,
html[data-theme="business"] .tag,
html[data-theme="business"] .stage-tag {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

html[data-theme="business"] .urgency-chip,
html[data-theme="business"] .stage-waiting {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

html[data-theme="business"] .deal-name,
html[data-theme="business"] .deal-title,
html[data-theme="business"] .subitem-title {
  color: var(--text);
}

html[data-theme="business"] .subitem-row,
html[data-theme="business"] .deal-contact-row {
  background: var(--surface);
  border-color: var(--stroke);
  box-shadow: none;
}

html[data-theme="business"] .fc .fc-button {
  background: var(--surface);
  border-color: var(--stroke);
  color: var(--text);
}

html[data-theme="business"] .fc .fc-col-header-cell,
html[data-theme="business"] .fc .fc-daygrid-day {
  background: var(--surface);
}
