.workspace {
  grid-template-rows: minmax(0, 1fr) auto;
}

.workplace-profile-dock-host {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  min-height: 200px;
  overflow: hidden;
  border: 1px solid var(--mv-border);
  border-radius: var(--mv-radius-panel);
  background: rgba(255,255,255,.985);
  box-shadow: var(--mv-shadow);
}

.workplace-profile-dock-host .mv-profile-dock {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  color: var(--mv-text);
}

.mv-profile-dock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px 9px;
  border-bottom: 1px solid var(--mv-border);
  background: #fff;
}

.mv-profile-dock-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.mv-profile-dock-heading strong { font-size: 14px; font-weight: 700; }
.mv-profile-dock-heading span { color: var(--mv-muted); font-size: 11px; }
.mv-profile-dock-actions { display: flex; align-items: center; gap: 7px; }

.mv-profile-dock-btn,
.mv-profile-dock-mode button,
.mv-profile-dock-icon,
.mv-profile-water-save,
.mv-profile-water-remove { font: inherit; }

.mv-profile-dock-btn {
  border: 1px solid var(--mv-accent);
  border-radius: 7px;
  background: var(--mv-accent);
  color: #fff;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.mv-profile-dock-mode {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--mv-border-strong);
  border-radius: 7px;
  background: var(--mv-surface-soft);
}

.mv-profile-dock-mode button {
  border: 0;
  border-right: 1px solid var(--mv-border-strong);
  background: transparent;
  color: var(--mv-muted);
  padding: 6px 8px;
  font-size: 11px;
  cursor: pointer;
}
.mv-profile-dock-mode button:last-child { border-right: 0; }
.mv-profile-dock-mode button.is-active { background: #fff; color: var(--mv-text); font-weight: 650; }
.mv-profile-dock-mode button:disabled { opacity: .4; cursor: default; }

.mv-profile-dock-icon {
  width: 29px;
  height: 29px;
  border: 1px solid var(--mv-border-strong);
  border-radius: 7px;
  background: #fff;
  color: #475569;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.mv-profile-dock-icon:hover { background: var(--mv-surface-soft); }
.mv-profile-dock-remove:hover { color: var(--mv-danger); border-color: #fecaca; background: #fef2f2; }

.mv-profile-tabs {
  display: flex;
  gap: 5px;
  padding: 7px 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--mv-border);
  background: var(--mv-surface-soft);
}

.mv-profile-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #475569;
  padding: 5px 8px;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.mv-profile-tab-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--profile-color, var(--mv-accent)); }
.mv-profile-tab small { color: var(--mv-faint); font-size: 9px; }
.mv-profile-tab.is-active { border-color: var(--mv-border-strong); background: #fff; color: var(--mv-text); font-weight: 650; }

.mv-profile-dock-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  min-height: 0;
  flex: 1 1 auto;
}

.mv-profile-chart-shell { min-width: 0; min-height: 0; }
.mv-profile-dock-chart {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 8px 10px 10px;
  background: #fff;
}
.mv-profile-dock-chart .comparison-profile + .comparison-profile { margin-top: 8px; }

.mv-profile-dock-side {
  min-width: 0;
  overflow: auto;
  border-left: 1px solid var(--mv-border);
  background: var(--mv-surface-soft);
  padding: 10px;
}

.workplace-profile-dock-host [data-profile-water-slot] { display: none; }
.workplace-profile-dock-host .mv-profile-export-panel { margin-top: 0 !important; padding-top: 0 !important; border-top: 0 !important; }

.mv-profile-dock-empty {
  display: grid;
  gap: 5px;
  place-content: center;
  min-height: 160px;
  color: var(--mv-muted);
  text-align: center;
}
.mv-profile-dock-empty strong { color: var(--mv-text-soft); }

.mv-profile-legend { scrollbar-width: thin; }
.mv-profile-chart-zoom button:disabled { opacity: .35; cursor: default !important; }

.profile-legend-groups { display: grid; gap: 12px; }
.profile-legend-group { display: grid; gap: 6px; }
.profile-legend-group-title { font-size: 10px; font-weight: 700; color: var(--mv-text-soft); }
.profile-legend-items { display: grid; gap: 4px; }
.profile-legend-row { display: grid; grid-template-columns: 14px minmax(0,1fr); gap: 7px; align-items: center; font-size: 10px; color: var(--mv-muted); }
.profile-legend-swatch { width: 14px; height: 8px; border-radius: 3px; background: var(--legend-color, #e2e8f0); border: 1px solid rgba(15,23,42,.08); }
.profile-legend-label { overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 900px) {
  .mv-profile-dock-header { align-items: flex-start; }
  .mv-profile-dock-content { grid-template-columns: 1fr; }
  .mv-profile-dock-side { border-top: 1px solid var(--mv-border); border-left: 0; }
}
