/* Dashboard module — toolbar, canvas, widgets (Figma: ktd-grid-item, app-dashboard-element-header) */

.screen-dashboard-host {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.dash-root {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  font-family: Montserrat, Arial, sans-serif;
  color: #404040;
}

/* ── Toolbar (Figma: 6143:15306 add pill) ── */

.dash-toolbar {
  flex-shrink: 0;
  margin-bottom: 16px;
}

.dash-toolbar-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
}

.dash-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.dash-add-wrap {
  position: relative;
}

.dash-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  padding: 6px 12px;
  border: 1px solid #c8cdd2;
  border-radius: 6px;
  background: #ffffff;
  color: #111111;
  font-family: inherit;
  font-size: 14px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.dash-add-btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border: 1px solid #c8cdd2;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 300;
  line-height: 1;
  color: #404040;
  flex-shrink: 0;
}

.dash-add-chevron {
  font-size: 10px;
  margin-left: -2px;
  color: #848f99;
}

.dash-add-btn:hover {
  background: #f6f8fa;
  border-color: #b8bdc2;
}

.dash-add-menu {
  position: absolute;
  right: 0;
  left: auto;
  top: calc(100% + 6px);
  z-index: 50;
  display: flex;
  flex-direction: column;
  min-width: 220px;
  padding: 6px;
  background: #ffffff;
  border: 1px solid rgba(200, 205, 210, 0.7);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(38, 60, 85, 0.16);
}

.dash-add-menu[hidden] {
  display: none;
}

.dash-add-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  color: #404040;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.dash-add-menu-item .ti {
  font-size: 14px;
  color: #0f70b7;
}

.dash-add-menu-item:hover {
  background: rgba(15, 112, 183, 0.06);
}

/* ── Canvas (Figma: 6143:15266 dashboard area — grey canvas, white widgets) ── */

.dash-canvas {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 520px;
  padding: 0;
  background: #f6f6f6;
  border: none;
  border-radius: 0;
  overflow: auto;
}

.dash-canvas-layer {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: minmax(160px, auto);
  gap: 12px;
  width: 100%;
  min-height: 480px;
  padding: 12px;
  align-content: start;
  position: relative;
}

.dash-canvas.is-resizing {
  cursor: nwse-resize;
  user-select: none;
}

.dash-canvas.is-resizing .dash-widget:not(.is-resizing) {
  pointer-events: none;
}

.dash-canvas-empty {
  position: absolute;
  inset: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
  color: #c8cdd2;
  text-align: center;
}

.dash-canvas-empty.is-hidden {
  display: none;
}

.dash-canvas-empty .ti {
  font-size: 40px;
  opacity: 0.6;
}

.dash-canvas-empty p {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
}

/* ── Widget card (Figma: ktd-grid-item / Background+Shadow) ── */

.dash-widget {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  padding: 14px;
  background: #ffffff;
  border: none;
  border-radius: 6px;
  box-shadow: 0 2px 14px rgba(38, 60, 85, 0.16);
  overflow: visible;
  transition: box-shadow 0.15s ease;
}

.dash-widget:not(.is-selected):hover {
  box-shadow: 0 4px 18px rgba(38, 60, 85, 0.2);
}

.dash-widget:focus-within {
  box-shadow: 0 4px 18px rgba(15, 112, 183, 0.18);
}

.dash-widget.is-selected {
  z-index: 10;
  box-shadow: 0 0 0 2px rgba(15, 112, 183, 0.35), 0 4px 18px rgba(38, 60, 85, 0.2);
}

.dash-widget:hover {
  z-index: 10;
}

.dash-widget.is-dragging {
  z-index: 20;
  box-shadow: 0 12px 32px rgba(15, 112, 183, 0.22);
}

.dash-widget.is-resizing {
  z-index: 30;
  transition: none;
  box-shadow: 0 0 0 2px rgba(15, 112, 183, 0.45), 0 8px 24px rgba(38, 60, 85, 0.22);
}

.dash-widget-resize-handle {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  cursor: nwse-resize;
  touch-action: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 20;
  pointer-events: auto;
}

.dash-widget-resize-grip {
  display: block;
  width: 10px;
  height: 10px;
  border-right: 2px solid #c8cdd2;
  border-bottom: 2px solid #c8cdd2;
  border-radius: 0 0 2px 0;
  pointer-events: none;
  transition: border-color 0.15s ease;
}

.dash-widget:hover .dash-widget-resize-handle,
.dash-widget.is-selected .dash-widget-resize-handle,
.dash-widget.is-resizing .dash-widget-resize-handle {
  opacity: 1;
}

.dash-widget-resize-handle:hover .dash-widget-resize-grip,
.dash-widget.is-resizing .dash-widget-resize-grip {
  border-color: #0f70b7;
}

.dash-resize-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 40;
}

.dash-resize-overlay[hidden] {
  display: none;
}

.dash-resize-preview {
  position: absolute;
  border: 2px solid #0f70b7;
  border-radius: 6px;
  background: rgba(15, 112, 183, 0.08);
  box-shadow: 0 4px 20px rgba(15, 112, 183, 0.2);
  transition: width 0.06s ease-out, height 0.06s ease-out;
  pointer-events: none;
}

.dash-resize-label {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 4px 10px;
  border-radius: 4px;
  background: #0f70b7;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(15, 112, 183, 0.35);
}

/* Hide the visible "maat"/preset label while resizing.
   Keep it in the DOM for screen readers (role="status" + aria-live). */
.dash-resize-label {
  opacity: 0;
}

.dash-widget.is-drop-before::before,
.dash-widget.is-drop-after::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: #0f70b7;
  border-radius: 2px;
  z-index: 25;
  pointer-events: none;
}

.dash-widget.is-drop-before::before {
  top: -8px;
}

.dash-widget.is-drop-after::after {
  bottom: -8px;
}

.dash-widget-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-height: 32px;
  margin-bottom: 8px;
  user-select: none;
}

.dash-widget-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  color: #c8cdd2;
  cursor: grab;
  touch-action: none;
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}

.dash-widget-drag-handle .ti {
  font-size: 14px;
  pointer-events: none;
}

.dash-widget-drag-handle:hover,
.dash-widget.is-selected .dash-widget-drag-handle {
  color: #848f99;
  background: rgba(15, 112, 183, 0.06);
}

.dash-widget.is-dragging .dash-widget-drag-handle {
  cursor: grabbing;
  color: #0f70b7;
}

.dash-widget-width-select {
  flex-shrink: 0;
  height: 28px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: #848f99;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23848f99' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  padding-right: 22px;
}

.dash-widget-width-select.is-visible,
.dash-widget:hover .dash-widget-width-select,
.dash-widget:focus-within .dash-widget-width-select {
  opacity: 1;
  pointer-events: auto;
}

.dash-widget-width-select:hover,
.dash-widget-width-select:focus {
  outline: none;
  border-color: #c8cdd2;
  background-color: #ffffff;
  color: #404040;
}

.dash-widget-title {
  flex: 1;
  min-width: 0;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.35;
  color: #383838;
  outline: none;
  border-radius: 3px;
  padding: 2px 0;
  cursor: text;
}

.dash-widget-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  margin-left: auto;
  padding-left: 4px;
}

.dash-widget-source-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  margin-right: 2px;
  border-radius: 6px;
  border: 1px solid #e4e7ea;
  background: #f6f8fa;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  color: #848f99;
  cursor: default;
  flex-shrink: 0;
}

.dash-widget-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.dash-widget-chart-area {
  position: relative;
  flex: 1;
  min-height: 120px;
}

.dash-widget-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.dash-chart-grid {
  stroke: rgba(200, 205, 210, 0.6);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.dash-widget-axis {
  position: absolute;
  font-size: 11px;
  font-weight: 500;
  color: #848f99;
  outline: none;
  border-radius: 2px;
  padding: 1px 3px;
  cursor: text;
  max-width: 45%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-widget-axis-x {
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
}

.dash-widget-axis-y {
  top: 50%;
  left: 2px;
  transform: translateY(-50%) rotate(-90deg);
  transform-origin: left center;
}

.dash-widget-legend-wrap {
  margin-top: 6px;
}

.dash-widget-legend {
  font-size: 12px;
  font-weight: 500;
  color: #6d7582;
  text-align: center;
  outline: none;
  border-radius: 2px;
  padding: 2px 4px;
  cursor: text;
}

.dash-chart-legend-items {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 12px;
  margin-top: 4px;
}

.dash-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #6d7582;
}

.dash-chart-legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.dash-chart-legend-label {
  outline: none;
  border-radius: 2px;
  padding: 1px 2px;
  cursor: text;
  font-size: 11px;
  color: #6d7582;
}

.dash-chart-legend-value {
  font-size: 11px;
  color: #848f99;
  user-select: none;
}

.dash-widget-title:focus,
.dash-widget-axis:focus,
.dash-widget-legend:focus,
.dash-chart-legend-label:focus {
  background: rgba(15, 112, 183, 0.08);
  box-shadow: 0 0 0 1px #0f70b7;
}

/* Wordcloud */

.dash-wordcloud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  height: 100%;
  padding: 8px;
}

.dash-wordcloud-word {
  font-weight: 600;
  line-height: 1.1;
  cursor: default;
  user-select: none;
}

/* Widget config panel */

.dash-widget-config {
  position: absolute;
  top: 46px;
  right: 14px;
  z-index: 30;
  width: 260px;
  background: #ffffff;
  border: 1px solid rgba(200, 205, 210, 0.7);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.dash-config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(200, 205, 210, 0.4);
}

.dash-config-title {
  font-size: 13px;
  font-weight: 600;
  color: #404040;
}

.dash-config-close {
  flex-shrink: 0;
}

.dash-config-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  max-height: 280px;
  overflow-y: auto;
}

.dash-config-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-config-field[hidden] {
  display: none;
}

.dash-config-sources {
  border: none;
  padding: 0;
  margin: 0;
}

.dash-config-sources legend {
  padding: 0;
}

.dash-config-label {
  font-size: 11px;
  font-weight: 600;
  color: #848f99;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.dash-config-select {
  height: 32px;
  padding: 0 8px;
  border: 1px solid #c8cdd2;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  color: #404040;
  background: #ffffff;
}

.dash-config-select:focus {
  outline: none;
  border-color: #0f70b7;
  box-shadow: 0 0 0 2px rgba(15, 112, 183, 0.15);
}

.dash-config-source-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.dash-config-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #404040;
  cursor: pointer;
}

.dash-config-checkbox input {
  accent-color: #0f70b7;
}

.dash-config-hint {
  margin: 0;
  font-size: 12px;
  color: #c8cdd2;
}

.dash-config-footer {
  padding: 8px 12px 12px;
}

.dash-config-apply {
  width: 100%;
  height: 34px;
  border: none;
  border-radius: 6px;
  background: #0f70b7;
  color: #ffffff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.dash-config-apply:hover {
  background: #0d5f9c;
}

@media (max-width: 720px) {
  .dash-add-btn span:not(.dash-add-btn-icon) {
    display: none;
  }

  .dash-add-btn {
    padding: 6px 10px;
  }

  .dash-add-menu {
    min-width: 200px;
  }

  .dash-widget-title {
    font-size: 16px;
  }
}

/* Contenteditable placeholder hint */

[contenteditable="true"]:empty::before {
  content: attr(aria-label);
  color: #c8cdd2;
  font-weight: 400;
}

/* ── Dashboard filter pills (onderzoeken .chip style) ── */

.dash-filters-bar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.dash-filters-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.dash-filter-chip-wrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.dash-filter-chip {
  max-width: min(320px, 70vw);
}

.dash-filter-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-filter-chip:not(.is-active) {
  opacity: 0.55;
}

.dash-filter-chip-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #848f99;
  cursor: pointer;
  flex-shrink: 0;
}

.dash-filter-chip-edit:hover {
  background: #f0f3f6;
  color: #404040;
}

.dash-filter-chip-edit .ti {
  font-size: 12px;
}

.dash-filter-add-wrap {
  position: relative;
}

.dash-filter-add-btn .ti {
  font-size: 11.2px;
}

.dash-filter-add-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 60;
  min-width: 240px;
  max-width: min(360px, 90vw);
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
  background: #ffffff;
  border: 1px solid rgba(200, 205, 210, 0.7);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(38, 60, 85, 0.16);
}

.dash-filter-add-menu[hidden] {
  display: none;
}

.dash-filter-add-group-label {
  padding: 6px 10px 4px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #848f99;
}

.dash-filter-add-step-title {
  padding: 6px 10px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #848f99;
}

.dash-filter-add-step-subtitle {
  padding: 4px 10px 8px;
  font-size: 13px;
  font-weight: 500;
  color: #404040;
}

.dash-filter-add-back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #404040;
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  text-align: left;
}

.dash-filter-add-back-btn:hover {
  background: #f6f8fa;
}

.dash-filter-add-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #404040;
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
}

.dash-filter-add-item:hover {
  background: #f6f8fa;
}

.dash-filter-add-empty {
  margin: 8px 10px;
  font-size: 13px;
  color: #848f99;
}

.dash-filter-popover {
  position: absolute;
  z-index: 70;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: min(480px, 92vw);
  padding: 12px;
  background: #ffffff;
  border: 1px solid rgba(200, 205, 210, 0.7);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(38, 60, 85, 0.16);
}

.dash-filter-popover[hidden] {
  display: none;
}

.dash-filter-popover-label {
  flex: 1 1 100%;
  font-size: 12px;
  font-weight: 500;
  color: #848f99;
}

.dash-filter-popover-select {
  flex: 1 1 120px;
  min-width: 0;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #c8cdd2;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
}

.dash-filter-popover-select--op {
  flex: 0 0 88px;
}

.dash-filter-popover-select--value {
  flex: 0 0 120px;
}

.dash-filter-popover-remove {
  flex: 1 1 100%;
  height: 30px;
  margin-top: 4px;
  padding: 0 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #d64545;
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.dash-filter-popover-remove:hover {
  background: #fef2f2;
}
