/* Canvas Outputs: dashboard widgets, editor modal, measure builder. */

.epi-output-chart-head span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ps-charcoal);
  font-weight: 800;
}

.epi-output-chart-head small {
  color: var(--ps-muted);
  font-size: 11px;
  font-weight: 800;
}

.epi-output-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(520px, 1fr));
  gap: 14px;
  min-height: 0;
  padding: 16px;
  overflow: auto;
}

.epi-output-chart {
  height: 320px;
}

.epi-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: 88px;
  grid-auto-flow: dense;
  gap: 14px;
  min-height: 0;
  padding: 16px;
  overflow: auto;
  position: relative;
  contain: layout paint;
  touch-action: none;
}

.dashboard-interacting,
.dashboard-interacting * {
  user-select: none !important;
  -webkit-user-select: none !important;
}
.dashboard-interacting {
  cursor: grabbing;
}

.epi-dashboard-grid.dashboard-dragging::after {
  content: "";
  position: absolute;
  z-index: 7;
  display: grid;
  place-items: center;
  grid-column: var(--epi-drop-x) / span var(--epi-drop-w);
  grid-row: var(--epi-drop-y) / span var(--epi-drop-h);
  margin: 0;
  border: 2px dashed var(--ps-teal);
  border-radius: var(--radius);
  background: rgba(23, 126, 137, 0.12);
  color: var(--ps-teal-dark);
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
}

/* Vertical pointer movement resolves to a real row target.  Present that
   target as an insertion rule, rather than a misleading free-space box. */
.epi-dashboard-grid.dashboard-dragging[data-dashboard-drag-intent="row-insert"]::after,
.epi-dashboard-grid.dashboard-dragging[data-dashboard-drag-intent="row-move"]::after {
  content: "";
  grid-column: 1 / -1;
  grid-row: var(--epi-drop-y);
  align-self: start;
  height: 0;
  min-height: 0;
  margin: -7px 0 0;
  border: 0;
  border-top: 2px solid var(--ps-teal);
  border-radius: 0;
  background: transparent;
}

.epi-dashboard-studio-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--ps-line);
  background: var(--ps-panel);
}

.epi-dashboard-view-tabs,
.epi-dashboard-slicers,
.epi-dashboard-view-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.epi-dashboard-view-tabs button {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--ps-line);
  border-radius: 7px;
  background: var(--ps-panel);
  color: var(--ps-charcoal);
  font-size: 12px;
  font-weight: 800;
}

.epi-dashboard-view-tabs button.active {
  border-color: rgba(36, 124, 138, 0.38);
  background: var(--ps-teal-soft);
  color: var(--ps-teal-dark);
}

.epi-dashboard-slicers select {
  min-height: 32px;
  max-width: 170px;
  padding: 5px 28px 5px 9px;
  border: 1px solid var(--ps-line);
  border-radius: 7px;
  background: var(--ps-input);
  color: var(--ps-charcoal);
  font-size: 11px;
  font-weight: 700;
}

.epi-dashboard-widget {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 220px;
  border: 1px solid var(--ps-line);
  border-radius: var(--radius);
  background: var(--dash-bg, var(--ps-panel));
  box-shadow: var(--shadow-tight);
  overflow: hidden;
  cursor: default;
  border-top: 4px solid var(--dash-accent, transparent);
  position: relative;
  will-change: transform, grid-column, grid-row;
  transition: box-shadow 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
  touch-action: none;
}

.epi-dashboard-grid.viewing .epi-dashboard-widget {
  cursor: default;
}

.epi-dashboard-widget:active {
  cursor: grabbing;
}

.epi-dashboard-widget.dragging {
  opacity: 0.58;
  transition: opacity 0.12s ease;
}

.epi-dashboard-widget.dashboard-swap-preview {
  outline: 2px solid var(--ps-teal);
  outline-offset: 3px;
}

.epi-dashboard-widget.small {
  grid-column: span 1;
  min-height: 180px;
}

.epi-dashboard-widget.medium {
  grid-column: span 2;
}

.epi-dashboard-widget.kind-line,
.epi-dashboard-widget.kind-area,
.epi-dashboard-widget.kind-bar,
.epi-dashboard-widget.kind-stackedBar {
  min-height: 390px;
}

.epi-dashboard-widget.wide {
  grid-column: span 2;
  min-height: 390px;
}

.epi-dashboard-widget.full {
  grid-column: 1 / -1;
  min-height: 420px;
}

.epi-dashboard-widget-head {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 8px;
  padding: 12px 12px 9px;
  border-bottom: 1px solid var(--ps-line);
  text-align: left;
}

/* Keep the grip and title together on the left.  The previous space-between
   distribution made the title appear centred whenever edit actions existed. */
.epi-dashboard-widget-head > div:not(.epi-dashboard-widget-actions) {
  min-width: 0;
  text-align: left;
}

.epi-dashboard-widget-head h4,
.epi-dashboard-widget-head .epi-dashboard-widget-subtitle {
  text-align: left;
}

.epi-dashboard-grid.editing .epi-dashboard-widget-head {
  cursor: grab;
}
.epi-dashboard-grid.editing .epi-dashboard-widget.kind-kpi {
  cursor: grab;
  touch-action: none;
}
.epi-dashboard-grid.editing .epi-dashboard-widget.kind-kpi .epi-dashboard-widget-actions,
.epi-dashboard-grid.editing .epi-dashboard-widget.kind-kpi button,
.epi-dashboard-grid.editing .epi-dashboard-widget.kind-kpi a,
.epi-dashboard-grid.editing .epi-dashboard-widget.kind-kpi input {
  touch-action: manipulation;
}
.epi-dashboard-grid.editing .epi-dashboard-widget-head:active {
  cursor: grabbing;
}
.epi-dashboard-widget.drop-target {
  outline: 2px dashed var(--ps-teal);
  outline-offset: 3px;
}
.epi-dashboard-widget.drop-target::after {
  content: "";
  position: absolute;
  inset: 8px;
  display: grid;
  place-items: center;
  background: rgba(23, 126, 137, 0.12);
  color: var(--ps-teal-dark);
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
  z-index: 4;
}

.epi-dashboard-widget.density-compact .epi-dashboard-widget-head {
  padding: 8px 10px 6px;
}

.epi-dashboard-widget.density-comfortable .epi-dashboard-widget-head {
  padding: 16px 16px 12px;
}

.epi-dashboard-widget-head h4 {
  margin: 0 0 3px;
  color: var(--ps-charcoal);
  font-size: 13px;
  font-weight: 900;
}

.epi-dashboard-widget.title-small h4 {
  font-size: 12px;
}

.epi-dashboard-widget.title-large h4 {
  font-size: 16px;
}

.epi-dashboard-kpi strong {
  color: var(--dash-value, var(--ps-charcoal));
}

.epi-dashboard-widget-subtitle {
  margin: 0;
  color: var(--ps-muted);
  font-size: 10.5px;
  line-height: 1.35;
}

.epi-dashboard-widget-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease;
}

.epi-dashboard-grip {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 16px;
  height: 28px;
  color: var(--ps-muted);
  cursor: grab;
  font-size: 17px;
  line-height: 1;
  letter-spacing: -3px;
  opacity: 0;
  transition: opacity 0.14s ease, color 0.14s ease;
}
.epi-dashboard-widget-menu {
  position: relative;
}
.epi-dashboard-widget-menu summary {
  list-style: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  cursor: pointer;
  color: var(--ps-muted);
}
.epi-dashboard-widget-menu summary::-webkit-details-marker {
  display: none;
}
.epi-dashboard-widget-menu > div {
  position: absolute;
  right: 0;
  top: 30px;
  z-index: 12;
  width: 128px;
  padding: 5px;
  border: 1px solid var(--ps-line);
  border-radius: 7px;
  background: var(--ps-overlay);
  box-shadow: var(--shadow-tight);
}
.epi-dashboard-widget-menu button {
  display: block;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ps-charcoal);
  font: inherit;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}
.epi-dashboard-widget-menu button:hover {
  background: var(--ps-teal-soft);
  color: var(--ps-teal-dark);
}

.epi-dashboard-resize-handle {
  position: absolute;
  display: block;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: default;
  opacity: 0;
  pointer-events: auto;
  z-index: 8;
}

.epi-dashboard-grid.editing .epi-dashboard-resize-handle {
  opacity: 0;
}

.epi-dashboard-grid.editing .epi-dashboard-widget.selected .resize-corner-cue {
  opacity: 1;
}

.epi-dashboard-resize-handle.resize-n { top: -7px; right: 12px; left: 12px; height: 14px; cursor: ns-resize; }
.epi-dashboard-resize-handle.resize-ne { top: -9px; right: -9px; width: 18px; height: 18px; cursor: nesw-resize; z-index: 9; }
.epi-dashboard-resize-handle.resize-e { top: 12px; right: -7px; bottom: 12px; width: 14px; cursor: ew-resize; }
.epi-dashboard-resize-handle.resize-se { right: -9px; bottom: -9px; width: 18px; height: 18px; cursor: nwse-resize; z-index: 9; }
.epi-dashboard-resize-handle.resize-s { right: 12px; bottom: -7px; left: 12px; height: 14px; cursor: ns-resize; }
.epi-dashboard-resize-handle.resize-sw { bottom: -9px; left: -9px; width: 18px; height: 18px; cursor: nesw-resize; z-index: 9; }
.epi-dashboard-resize-handle.resize-w { top: 12px; bottom: 12px; left: -7px; width: 14px; cursor: ew-resize; }
.epi-dashboard-resize-handle.resize-nw { top: -9px; left: -9px; width: 18px; height: 18px; cursor: nwse-resize; z-index: 9; }

.resize-corner-cue::after {
  position: absolute;
  width: 8px;
  height: 8px;
  content: "";
  border: solid rgba(36, 124, 138, 0.78);
  pointer-events: none;
}

.resize-corner-cue.resize-nw::after { top: 3px; left: 3px; border-width: 1px 0 0 1px; }
.resize-corner-cue.resize-ne::after { top: 3px; right: 3px; border-width: 1px 1px 0 0; }
.resize-corner-cue.resize-se::after { right: 3px; bottom: 3px; border-width: 0 1px 1px 0; }
.resize-corner-cue.resize-sw::after { bottom: 3px; left: 3px; border-width: 0 0 1px 1px; }

.resize-corner-cue:hover::after {
  border-color: var(--ps-teal-dark);
}

.epi-dashboard-grid.editing .epi-dashboard-widget:hover .epi-dashboard-widget-actions,
.epi-dashboard-grid.editing .epi-dashboard-widget:focus-within .epi-dashboard-widget-actions {
  opacity: 1;
  pointer-events: auto;
}

.epi-dashboard-grid.editing .epi-dashboard-widget.selected {
  border-color: rgba(23, 126, 137, 0.72);
  box-shadow: 0 0 0 2px rgba(23, 126, 137, 0.15), var(--shadow-tight);
}

.epi-dashboard-grid.editing .epi-dashboard-widget {
  overflow: visible;
}

.epi-dashboard-grid.editing .epi-dashboard-widget.selected .epi-dashboard-grip {
  color: var(--ps-teal-dark);
  opacity: 1;
}

.epi-dashboard-grid.editing .epi-dashboard-widget:hover .epi-dashboard-grip,
.epi-dashboard-grid.editing .epi-dashboard-widget.selected .epi-dashboard-grip {
  opacity: 0.88;
}

.epi-dashboard-chart {
  min-height: 0;
  width: 100%;
  height: 100%;
  min-height: 330px;
  padding: 6px 6px 0;
}

.epi-dashboard-widget.small .epi-dashboard-chart,
.epi-dashboard-widget.medium .epi-dashboard-chart,
.epi-dashboard-widget.wide .epi-dashboard-chart,
.epi-dashboard-widget.full .epi-dashboard-chart {
  min-height: 330px;
}

.epi-dashboard-kpi {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 0;
  padding: 20px;
}

.epi-dashboard-widget.density-compact .epi-dashboard-kpi {
  padding: 14px;
}

.epi-dashboard-widget.density-comfortable .epi-dashboard-kpi {
  padding: 28px;
}

.epi-dashboard-kpi span {
  color: var(--ps-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.epi-dashboard-kpi strong {
  color: var(--dash-value, var(--ps-charcoal));
  font-size: clamp(24px, 2.1vw, 36px);
  line-height: 1;
  font-weight: 900;
}

.epi-dashboard-widget.value-small .epi-dashboard-kpi strong {
  font-size: clamp(20px, 1.6vw, 28px);
}

.epi-dashboard-widget.value-large .epi-dashboard-kpi strong {
  font-size: clamp(30px, 2.8vw, 46px);
}

.epi-dashboard-kpi small {
  color: var(--ps-muted);
  font-size: 11px;
  line-height: 1.35;
}

.epi-dashboard-table-wrap {
  min-height: 0;
  overflow: auto;
  max-height: 420px;
}

.epi-dashboard-widget.kind-table {
  min-height: 0;
}
.epi-dashboard-widget.kind-table .epi-dashboard-table-wrap {
  align-self: start;
}

.epi-dashboard-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px;
}

.epi-dashboard-table th,
.epi-dashboard-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--ps-line);
  text-align: right;
}

.epi-dashboard-table th:first-child,
.epi-dashboard-table td:first-child {
  text-align: left;
  width: 92px;
  min-width: 92px;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.epi-dashboard-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--ps-surface-soft);
  color: var(--ps-charcoal);
  font-weight: 900;
}

.epi-dashboard-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 23, 42, 0.12);
}

.epi-dashboard-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 61;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(420px, calc(100vw - 32px));
  height: 100vh;
  border-left: 1px solid var(--ps-line);
  background: var(--ps-overlay);
  box-shadow: -12px 0 30px rgba(31, 42, 68, 0.14);
}

.epi-dashboard-drawer-head,
.epi-dashboard-drawer-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--ps-line);
}

.epi-dashboard-drawer-actions {
  align-items: center;
  justify-content: flex-end;
  border-top: 1px solid var(--ps-line);
  border-bottom: 0;
}

.epi-dashboard-drawer-head h3 {
  margin: 0 0 4px;
  color: var(--ps-charcoal);
  font-size: 16px;
  font-weight: 900;
}

.epi-dashboard-drawer-head p {
  margin: 0;
  color: var(--ps-muted);
  font-size: 12px;
  line-height: 1.4;
}

.epi-dashboard-drawer-body {
  display: grid;
  align-content: start;
  gap: 13px;
  min-height: 0;
  padding: 16px;
  overflow: auto;
}

.epi-dashboard-drawer-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--ps-line);
  border-radius: 8px;
  background: var(--ps-surface-soft);
}

.epi-dashboard-drawer-section-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ps-charcoal);
  font-size: 12px;
  font-weight: 900;
}

.epi-dashboard-style-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.epi-dashboard-style-grid input[type="color"],
.epi-dashboard-rule-grid input[type="color"] {
  min-height: 36px;
  padding: 2px;
}

.epi-dashboard-rule-grid {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) 54px;
  gap: 8px;
}

.epi-dashboard-metric-note {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--ps-line);
  border-radius: 8px;
  background: var(--ps-surface-soft);
  color: var(--ps-muted);
  font-size: 11px;
}

.epi-dashboard-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ps-charcoal);
  font-size: 12px;
  font-weight: 800;
}

.epi-dashboard-check input {
  width: 15px;
  height: 15px;
}

.epi-dashboard-widget-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.34);
  overflow: hidden;
}

body.epi-dashboard-widget-modal-open {
  overflow: hidden;
}

.epi-dashboard-widget-modal {
  position: fixed;
  inset: 50% auto auto 50%;
  z-index: 71;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(1180px, calc(100vw - 48px));
  max-height: 88vh;
  transform: translate(-50%, -50%);
  border: 1px solid var(--ps-line);
  border-radius: var(--radius-lg, 14px);
  background: var(--ps-overlay);
  box-shadow: 0 26px 70px rgba(31, 42, 68, 0.24);
  overflow: hidden;
}

.epi-dashboard-widget-modal-head,
.epi-dashboard-widget-modal-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--ps-line);
}

.epi-dashboard-widget-modal-head h3 {
  margin: 0 0 4px;
  color: var(--ps-charcoal);
  font-size: 18px;
  font-weight: 900;
}

.epi-dashboard-widget-modal-head p {
  margin: 0;
  color: var(--ps-muted);
  font-size: 12px;
  line-height: 1.4;
}

.epi-dashboard-widget-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--ps-line);
  background: var(--ps-surface-soft);
}

.epi-dashboard-widget-stepper button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--ps-line);
  border-radius: 8px;
  background: var(--ps-panel);
  color: var(--ps-muted);
  font-size: 12px;
  font-weight: 900;
}

.epi-dashboard-widget-stepper button span {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #edf2f7;
  color: var(--ps-muted);
  font-size: 11px;
}

.epi-dashboard-widget-stepper button.active {
  border-color: rgba(36, 124, 138, 0.4);
  background: var(--ps-teal-soft);
  color: var(--ps-teal-dark);
}

.epi-dashboard-widget-stepper button.active span {
  background: var(--ps-teal);
  color: #ffffff;
}

.epi-dashboard-widget-stepper button:hover:not(.active),
.epi-dashboard-widget-stepper button:focus-visible {
  border-color: rgba(36, 124, 138, 0.48);
  background: var(--ps-teal-soft);
  color: var(--ps-teal-dark);
  outline: none;
}

.epi-dashboard-widget-stepper button:focus-visible {
  box-shadow: 0 0 0 3px rgba(36, 124, 138, 0.16);
}

.epi-dashboard-widget-stepper button.future {
  color: #94a3b8;
}

.epi-dashboard-widget-stepper button.completed {
  border-color: rgba(36, 124, 138, 0.28);
  color: var(--ps-teal-dark);
}

.epi-dashboard-widget-stepper button.completed span {
  background: #d9f0f1;
  color: var(--ps-teal-dark);
}

.epi-dashboard-widget-stepper button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.epi-dashboard-widget-modal-body {
  min-height: 0;
  padding: 18px 18px 28px;
  overflow: auto;
  overscroll-behavior: contain;
}

.epi-dashboard-widget-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  align-items: start;
  gap: 16px;
}

.epi-dashboard-widget-workflow {
  min-width: 0;
}

.epi-dashboard-widget-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
}

.epi-dashboard-widget-form-main {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
}

.epi-dashboard-widget-preview,
.epi-dashboard-widget-modal-section {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--ps-line);
  border-radius: 8px;
  background: var(--ps-overlay);
}

.epi-dashboard-widget-preview {
  align-content: start;
  background: var(--ps-surface-soft);
  position: sticky;
  top: 2px;
  max-height: calc(88vh - 176px);
  overflow: hidden;
}

.epi-dashboard-widget-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.epi-dashboard-widget-preview-body {
  min-width: 0;
}

.epi-dashboard-widget-preview-body .epi-dashboard-widget {
  min-height: 0;
  grid-column: auto;
  cursor: default;
}

.epi-dashboard-widget-preview-body .epi-dashboard-widget-head {
  padding: 10px;
}

.epi-dashboard-widget-preview-body .epi-dashboard-chart {
  min-height: 300px;
  height: 300px;
}

.epi-dashboard-widget-preview.preview-kpi .epi-dashboard-widget {
  min-height: 190px;
}

.epi-dashboard-widget-preview.preview-kpi .epi-dashboard-kpi {
  min-height: 132px;
}

.epi-dashboard-widget-preview.preview-table .epi-dashboard-widget {
  min-height: 0;
  max-height: 330px;
}

.epi-dashboard-widget-preview.preview-table .epi-dashboard-table-wrap {
  max-height: 240px;
}

.epi-dashboard-widget-preview.preview-line .epi-dashboard-widget,
.epi-dashboard-widget-preview.preview-area .epi-dashboard-widget,
.epi-dashboard-widget-preview.preview-bar .epi-dashboard-widget,
.epi-dashboard-widget-preview.preview-stackedBar .epi-dashboard-widget {
  min-height: 365px;
}

.epi-dashboard-widget-empty-preview {
  display: grid;
  place-items: center;
  min-height: 250px;
  padding: 20px;
  border: 1px dashed var(--ps-line);
  border-radius: 8px;
  background: var(--ps-panel);
  color: var(--ps-muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.epi-dashboard-widget-preview.preview-kpi .epi-dashboard-widget-empty-preview {
  min-height: 190px;
}

.epi-dashboard-widget-preview h4,
.epi-dashboard-widget-modal-section h4,
.epi-dashboard-widget-future-step h4 {
  margin: 0;
  color: var(--ps-charcoal);
  font-size: 13px;
  font-weight: 900;
}

.epi-dashboard-widget-preview p,
.epi-dashboard-widget-future-step p {
  margin: 0;
  color: var(--ps-muted);
  font-size: 12px;
  line-height: 1.45;
}

.epi-dashboard-widget-modal-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.epi-dashboard-widget-type-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.epi-dashboard-widget-type-tile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px;
  border: 1px solid var(--ps-line);
  border-radius: 8px;
  background: var(--ps-panel);
  color: var(--ps-charcoal);
  text-align: left;
  font-size: 12px;
  font-weight: 900;
}

.epi-dashboard-widget-type-tile.selected {
  border-color: rgba(36, 124, 138, 0.42);
  background: var(--ps-teal-soft);
  color: var(--ps-teal-dark);
  box-shadow: inset 0 0 0 1px rgba(36, 124, 138, 0.12);
}

.epi-dashboard-basic-grid,
.epi-dashboard-period-grid,
.epi-dashboard-axis-title-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.epi-dashboard-widget-modal .filter-field {
  min-width: 0;
}

.epi-dashboard-widget-modal .filter-field label {
  display: block;
  margin: 0 0 6px;
  color: var(--ps-charcoal);
  font-size: 11px;
  font-weight: 800;
}

.epi-dashboard-widget-modal .filter-field input:not([type="checkbox"]),
.epi-dashboard-widget-modal .filter-field select,
.epi-dashboard-widget-modal .epi-dashboard-rule-grid input,
.epi-dashboard-widget-modal .epi-dashboard-rule-grid select {
  box-sizing: border-box;
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--ps-line);
  border-radius: 8px;
  outline: none;
  background: var(--ps-overlay);
  color: var(--ps-charcoal);
  box-shadow: none;
  font: inherit;
}

.epi-dashboard-widget-modal .filter-field input[type="color"],
.epi-dashboard-widget-modal .epi-dashboard-rule-grid input[type="color"] {
  padding: 3px;
}

.epi-dashboard-color-control {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.epi-dashboard-widget-modal .epi-dashboard-color-control input[type="color"] {
  width: 38px;
  min-width: 38px;
  height: 40px;
  padding: 3px;
}

.epi-dashboard-widget-modal .epi-dashboard-color-control input:not([type="color"]) {
  min-width: 0;
  height: 40px;
  padding: 0 9px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0;
}

.epi-dashboard-widget-modal .filter-field input:focus,
.epi-dashboard-widget-modal .filter-field select:focus,
.epi-dashboard-widget-modal .epi-dashboard-rule-grid input:focus,
.epi-dashboard-widget-modal .epi-dashboard-rule-grid select:focus,
.epi-dashboard-selected-metric-chip button:focus-visible {
  border-color: var(--ps-teal);
  box-shadow: 0 0 0 3px rgba(36, 124, 138, 0.16);
}

.epi-dashboard-metric-picker {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.epi-measure-filter-tabs {
  display: flex;
  gap: 4px;
  margin: 8px 0;
}
.epi-measure-filter-tabs button,
.epi-measure-operators button,
.epi-measure-token-list button {
  border: 1px solid var(--border, #dbe4ee);
  background: var(--ps-panel);
  border-radius: 6px;
  padding: 5px 9px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.epi-measure-filter-tabs button.active {
  background: #e7f7f7;
  color: #087e8b;
  border-color: #83ced2;
}
.epi-measure-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(22, 36, 56, 0.38);
  z-index: 70;
}
.epi-measure-library,
.epi-measure-builder {
  position: fixed;
  z-index: 71;
  background: var(--ps-panel);
  border: 1px solid #dbe4ee;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(18, 37, 63, 0.24);
  overflow: auto;
}
.epi-measure-library {
  width: min(820px, calc(100vw - 32px));
  max-height: 78vh;
  left: 50%;
  top: 12vh;
  transform: translateX(-50%);
}
.epi-measure-builder {
  width: min(900px, calc(100vw - 32px));
  max-height: 88vh;
  left: 50%;
  top: 6vh;
  transform: translateX(-50%);
}
.epi-measure-library header,
.epi-measure-library footer,
.epi-measure-builder header,
.epi-measure-builder footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid #e7edf3;
}
.epi-measure-library footer,
.epi-measure-builder footer {
  border-top: 1px solid #e7edf3;
  border-bottom: 0;
}
.epi-measure-library h3,
.epi-measure-builder h3 {
  margin: 0;
}
.epi-measure-library p,
.epi-measure-builder p {
  margin: 4px 0 0;
  color: var(--ps-muted);
  font-size: 13px;
}
.epi-measure-library-list {
  padding: 10px 22px;
}
.epi-measure-library-list article {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid #edf1f5;
}
.epi-measure-library-list article small {
  display: block;
  color: var(--ps-muted);
  margin-top: 4px;
}
.epi-measure-builder-body {
  padding: 18px 22px;
}
.epi-measure-builder-body section {
  margin-bottom: 20px;
}
.epi-measure-builder-body h4 {
  margin: 0 0 10px;
}
.epi-measure-formula {
  width: 100%;
  min-height: 64px;
  border: 1px solid #cbd8e6;
  border-radius: 7px;
  padding: 10px;
  font: inherit;
  box-sizing: border-box;
}
.epi-measure-operators,
.epi-measure-token-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.epi-measure-token-list {
  max-height: 125px;
  overflow: auto;
  padding: 4px;
  background: var(--ps-raised);
  border-radius: 7px;
}
.epi-measure-builder .epi-dashboard-table {
  width: 100%;
}

.epi-dashboard-metric-list .epi-dashboard-widget-modal:has(~ .epi-measure-builder) {
  filter: brightness(0.82);
  pointer-events: none;
}
.epi-measure-backdrop.builder {
  z-index: 100;
}
.epi-measure-builder {
  z-index: 101;
  display: flex;
  flex-direction: column;
  top: 4vh;
  max-height: 92vh;
}
.epi-measure-builder header,
.epi-measure-builder footer {
  flex: 0 0 auto;
  background: var(--ps-panel);
  position: sticky;
  z-index: 2;
}
.epi-measure-builder header {
  top: 0;
}
.epi-measure-builder footer {
  bottom: 0;
}
.epi-measure-builder-body {
  overflow: auto;
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(250px, 3fr);
  gap: 18px;
}
.epi-measure-builder-body > section:nth-child(1),
.epi-measure-builder-body > section:nth-child(2) {
  grid-column: 1;
}
.epi-measure-builder-body > section:nth-child(3) {
  grid-column: 2;
  grid-row: 1 / span 2;
  padding: 14px;
  border: 1px solid #dfe8ef;
  border-radius: 10px;
  background: #fbfdff;
}
.epi-measure-builder-body > section:nth-child(4) {
  grid-column: 1 / -1;
}
.epi-measure-builder .epi-measure-formula {
  min-height: 90px;
  background: #fbfdff;
  border-color: #a8cbd3;
}
.epi-measure-builder .epi-measure-operators button {
  width: 30px;
  height: 30px;
  padding: 0;
  color: #176c76;
  background: #edf9f9;
  border-color: #b9e0e2;
}
.epi-measure-builder .epi-dashboard-table {
  max-height: 210px;
  overflow: auto;
  display: block;
}
.epi-dashboard-widget-modal-section-head .btn {
  background: var(--ps-teal);
  color: #fff;
  border-color: var(--ps-teal-text);
}
@media (max-width: 760px) {
  .epi-measure-builder {
    width: calc(100vw - 20px);
    top: 10px;
  }
  .epi-measure-builder-body {
    display: block;
  }
  .epi-measure-builder-body > section:nth-child(3) {
    margin: 16px 0;
  }
  .epi-measure-library-list article {
    align-items: flex-start;
    flex-direction: column;
  }
}
.epi-measure-builder.modern {
  width: min(1060px, calc(100vw - 28px));
  border-radius: 10px;
}
.epi-measure-builder.modern .epi-measure-builder-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  padding: 0;
  gap: 0;
}
.epi-measure-builder.modern main {
  padding: 16px 18px;
  min-width: 0;
}
.custom-output-measure-builder header h3 {
  color: #183b56;
  font-size: 13px;
  letter-spacing: .04em;
}
.custom-output-measure-builder header p {
  color: #607485;
  font-size: 13px;
}
.epi-measure-top-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 14px;
}
.epi-measure-description {
  display: grid;
  gap: 6px;
}
.epi-measure-description > label,
.epi-measure-top-fields label,
.epi-measure-properties label {
  color: #52677a;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.epi-measure-description textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 64px;
  resize: vertical;
  border: 1px solid #cbd8e6;
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--ps-ink);
  background: #fbfdff;
  font: inherit;
}
.epi-measure-readonly {
  box-sizing: border-box;
  min-height: 32px;
  padding: 8px 9px;
  border: 1px solid #dce8ee;
  border-radius: 6px;
  color: #52677a;
  background: #f5f8fa;
  font-size: 11px;
  font-weight: 750;
}
.custom-output-measure-builder .epi-measure-formula {
  min-height: 82px;
  margin-top: 10px;
  overflow: auto;
  white-space: pre-wrap;
  caret-color: #183b56;
  outline: none;
}
.custom-output-measure-builder .epi-measure-formula:empty::before {
  content: attr(data-placeholder);
  color: #91a0ad;
}
.custom-output-measure-builder .epi-measure-formula:focus {
  border-color: #168c94;
  box-shadow: 0 0 0 3px rgba(22, 140, 148, .12);
}
.custom-output-measure-builder .epi-measure-formula mark {
  display: inline-block;
  margin: 1px 2px;
  padding: 2px 5px;
  border: 1px solid var(--measure-chip-border, #d7e2ea);
  border-radius: 4px;
  color: var(--measure-chip-text, #34495b);
  background: var(--measure-chip-bg, #f5f8fa);
}
.custom-output-measure-builder .epi-measure-formula mark[contenteditable="false"] { user-select: all; }
.epi-measure-properties-actions {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid #e5edf2;
}
.epi-measure-properties-actions .btn-primary {
  width: 100%;
  justify-content: center;
  background: #147d86;
  border-color: #147d86;
}
.epi-measure-preview {
  border: 1px solid #dce8ee;
  border-radius: 8px;
  padding: 11px;
  background: #fbfdff;
}
.epi-measure-preview-line,
.epi-measure-preview-operands {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.epi-measure-preview-operands {
  flex: 1 1 260px;
  margin-top: 0;
}
.epi-measure-preview-operands > i,
.epi-measure-preview-equals {
  display: grid;
  place-items: center;
  color: #17836d;
  font-size: 18px;
  font-style: normal;
}
.epi-measure-preview-value {
  display: grid;
  min-width: 120px;
  flex: 1 1 120px;
  gap: 2px;
  padding: 8px 9px;
  border: 1px solid #dce8ee;
  border-radius: 6px;
  background: var(--ps-panel);
}
.epi-measure-preview-value strong { color: #365064; font-size: 11px; }
.epi-measure-preview-value span { color: #183b56; font-size: 15px; font-weight: 800; }
.epi-measure-preview-value small { color: #718096; font-size: 10px; }
.epi-measure-preview-value.result { border-color: #afdfce; background: #eef9f7; }
.epi-measure-preview-empty { margin-top: 9px; color: #718096; font-size: 11px; }

/* Create Measure deliberately consumes the Calculation Engine modal proportions
   and editor language without changing the engine itself. */
.epi-measure-builder.modern.custom-output-measure-builder {
  top: 50%;
  width: min(1380px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  transform: translate(-50%, -50%);
  border-color: #d8e1eb;
  border-radius: 11px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, .28);
}
.custom-output-measure-builder > header {
  min-height: 58px;
  padding: 10px 14px;
  border-bottom-color: var(--ps-line);
}
.custom-output-measure-builder header h3 {
  color: var(--ps-teal-text);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.custom-output-measure-builder header p {
  margin: 2px 0 0;
  color: var(--ps-charcoal);
  font-size: 16px;
  font-weight: 700;
}
.epi-measure-builder.modern.custom-output-measure-builder .epi-measure-builder-body {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, .85fr);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.epi-measure-builder.modern.custom-output-measure-builder main {
  overflow: auto;
  overflow-x: hidden;
  padding: 14px;
}
.custom-output-measure-builder .epi-measure-top-fields {
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.custom-output-measure-builder .epi-measure-top-fields input,
.custom-output-measure-builder .epi-measure-properties select,
.custom-output-measure-builder .epi-measure-properties input {
  min-height: 38px;
  border-color: var(--ps-line-strong);
  border-radius: 7px;
}
.custom-output-measure-builder .epi-measure-description {
  margin-top: 10px;
}
.custom-output-measure-builder .epi-measure-description textarea {
  min-height: 76px;
  border-color: var(--ps-line-strong);
  border-radius: 7px;
  background: var(--ps-input);
}
.custom-output-measure-builder .epi-measure-formula-section,
.custom-output-measure-builder .epi-measure-preview {
  margin-top: 12px;
  padding: 12px;
  border-color: var(--ps-line);
  border-radius: 8px;
  background: var(--ps-panel);
}
.custom-output-measure-builder .epi-measure-formula {
  min-height: 84px;
  margin-top: 0;
  padding: 9px 10px;
  border-color: var(--ps-line-strong);
  border-radius: 6px;
  background: var(--ps-input);
  font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace;
}
.custom-output-measure-builder .epi-measure-formula mark {
  margin: 0;
  padding: 1px 3px;
  border-color: var(--measure-chip-border, #b9dfe2);
  border-radius: 3px;
  color: var(--ps-charcoal);
  background: var(--measure-chip-bg, #effafa);
}
.custom-output-measure-builder .epi-measure-section-head {
  display: block;
  margin-top: 10px;
}
.custom-output-measure-builder .epi-measure-section-head h4,
.custom-output-measure-builder main > section:not(.epi-measure-formula-section):not(.epi-measure-preview) > h4 {
  margin: 0;
  color: #526277;
  font-size: 10px;
  font-weight: 800;
}
.custom-output-measure-builder .custom-output-measure-legend {
  margin: 8px 0 0;
}
.custom-output-measure-builder .epi-measure-search {
  width: 100%;
  min-height: 30px;
  margin-top: 8px;
  border: 1px solid var(--ps-line);
  border-radius: 6px;
  padding: 0 9px;
  font-size: 10px;
}
.custom-output-measure-builder .epi-measure-token-list.modern,
.custom-output-measure-builder .epi-measure-function-list {
  max-height: none;
  margin-top: 8px;
  padding: 0;
  background: transparent;
}
.custom-output-measure-builder .epi-measure-token-list.modern button,
.custom-output-measure-builder .epi-measure-function-list button {
  padding: 5px 7px;
  border-radius: 5px;
  font-size: 9.5px;
  font-weight: 750;
}
.custom-output-measure-builder .epi-measure-preview {
  min-height: 0;
}
.custom-output-measure-builder .epi-measure-preview-empty {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.45;
}
/* Formula, Variables, and Functions read as one Calculation workspace. */
.custom-output-measure-builder .epi-measure-formula-section {
  margin-bottom: 0;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}
.custom-output-measure-builder .epi-measure-formula-section + section,
.custom-output-measure-builder .epi-measure-formula-section + section + section {
  margin-top: 0;
  padding: 10px 12px 0;
  border-right: 1px solid var(--ps-line);
  border-left: 1px solid var(--ps-line);
  background: var(--ps-panel);
}
.custom-output-measure-builder .epi-measure-formula-section + section + section {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ps-line);
  border-radius: 0 0 8px 8px;
}
.custom-output-measure-builder .epi-tech-preview-row {
  padding: 8px 0 2px;
}
.custom-output-measure-builder .epi-tech-preview-row > div {
  min-width: 120px;
  text-align: center;
}
.custom-output-measure-builder .epi-tech-preview-row .result {
  padding: 0;
  border: 0;
  background: transparent;
}
.epi-measure-preview-status {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  color: #17836d;
  font-size: 10px;
}
.custom-output-measure-builder .epi-measure-properties {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: min-content;
  grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
  align-content: start;
  column-gap: 10px;
  overflow: auto;
  padding: 12px;
  border-left-color: var(--ps-line);
  background: var(--ps-overlay);
}
.custom-output-measure-builder .epi-measure-properties h4,
.custom-output-measure-builder .epi-measure-properties p { order: 0; }
.custom-output-measure-builder:not(.epi-canvas-measure-builder) .epi-measure-properties .filter-field:nth-of-type(3),
.epi-canvas-measure-builder .epi-measure-properties .filter-field:nth-of-type(1) { order: 1; }
.custom-output-measure-builder:not(.epi-canvas-measure-builder) .epi-measure-properties .filter-field:nth-of-type(1),
.custom-output-measure-builder:not(.epi-canvas-measure-builder) .epi-measure-properties .filter-field:nth-of-type(2),
.epi-canvas-measure-builder .epi-measure-properties .filter-field:nth-of-type(2),
.epi-canvas-measure-builder .epi-measure-properties .filter-field:nth-of-type(3) { order: 2; }
.custom-output-measure-builder .epi-measure-properties .filter-field:nth-of-type(4) { order: 3; }
.custom-output-measure-builder .epi-measure-properties .filter-field:nth-of-type(4) { align-self: start; }
.custom-output-measure-builder .epi-measure-properties h4 {
  grid-column: 1 / -1;
  color: var(--ps-charcoal);
  font-size: 14px;
}
.custom-output-measure-builder .epi-measure-properties p {
  grid-column: 1 / -1;
  margin: 2px 0 12px;
  color: var(--ps-muted);
  font-size: 11px;
}
.custom-output-measure-builder .epi-measure-properties .filter-field {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
}
.custom-output-measure-builder .epi-measure-properties .filter-field:nth-of-type(3),
.epi-canvas-measure-builder .epi-measure-properties .filter-field:nth-of-type(1),
.custom-output-measure-builder .epi-measure-properties .filter-field:nth-of-type(4) {
  grid-column: 1 / -1;
}
.custom-output-measure-builder:not(.epi-canvas-measure-builder) .epi-measure-properties .filter-field:nth-of-type(1),
.custom-output-measure-builder:not(.epi-canvas-measure-builder) .epi-measure-properties .filter-field:nth-of-type(2),
.epi-canvas-measure-builder .epi-measure-properties .filter-field:nth-of-type(2),
.epi-canvas-measure-builder .epi-measure-properties .filter-field:nth-of-type(3) {
  grid-column: auto;
}
.custom-output-measure-builder .epi-measure-function-list button b { display: none; }
.custom-output-measure-builder .epi-measure-properties-actions {
  grid-column: 1 / -1;
  grid-row: 6;
  align-self: end;
  margin-top: 0;
  padding-top: 12px;
  border-top-color: var(--ps-line);
}
.custom-output-measure-builder .epi-measure-properties-actions .btn-primary {
  min-height: 36px;
  border-radius: 6px;
  background: #0f8b83;
  border-color: #0f8b83;
}
.custom-output-measure-builder .epi-measure-properties-actions .btn-primary:not(:disabled):hover { background: #08766f; border-color: #08766f; }
.custom-output-measure-builder > footer {
  position: absolute;
  z-index: 3;
  bottom: 14px;
  left: 14px;
  padding: 0;
  border: 0;
  background: transparent;
}
.custom-output-measure-builder > footer .epi-measure-footer-status { display: none; }
.custom-output-measure-builder > footer .btn { min-height: 30px; font-size: 11px; }

/* Calculation/Measure visual language: scoped to the two Outputs measure
   builders so the calculation engine remains the source of truth. */
.custom-output-measure-builder {
  --measure-control-height: 38px;
  --measure-label-color: #526277;
}
.custom-output-measure-builder .filter-field label,
.custom-output-measure-builder .epi-measure-description > label {
  color: var(--measure-label-color);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.custom-output-measure-builder input,
.custom-output-measure-builder select,
.custom-output-measure-builder textarea {
  font-size: 12px;
}
.custom-output-measure-builder .epi-measure-top-fields input,
.custom-output-measure-builder .epi-measure-properties select,
.custom-output-measure-builder .epi-measure-properties input,
.custom-output-measure-builder .epi-measure-readonly {
  min-height: var(--measure-control-height);
  border-radius: 7px;
}
.custom-output-measure-builder .epi-measure-readonly {
  display: flex;
  align-items: center;
  color: var(--ps-charcoal);
  background: var(--ps-input);
  font-weight: 700;
}
.custom-output-measure-builder .epi-tech-section-title strong {
  color: var(--ps-charcoal);
  font-size: 12px;
  font-weight: 700;
}
.custom-output-measure-builder .epi-tech-section-title small {
  color: var(--ps-muted);
  font-size: 10.5px;
  line-height: 1.4;
}
.custom-output-measure-builder .epi-formula-operators {
  gap: 4px;
}
.custom-output-measure-builder .epi-formula-operators button {
  width: 27px;
  height: 27px;
  padding: 0;
  border: 1px solid var(--ps-line-strong);
  border-radius: 5px;
  background: var(--ps-panel);
  color: #46566b;
  font-size: 13px;
  font-weight: 900;
}
.custom-output-measure-builder .epi-measure-search {
  min-height: 32px;
  border-radius: 6px;
  color: var(--ps-charcoal);
  font-size: 10.5px;
}
.custom-output-measure-builder .epi-measure-search:focus {
  border-color: var(--ps-teal);
  box-shadow: 0 0 0 2px rgba(15, 139, 131, .12);
  outline: 0;
}
.custom-output-measure-builder .epi-measure-token-list.modern,
.custom-output-measure-builder .epi-measure-function-list {
  gap: 5px;
}
.custom-output-measure-builder .epi-measure-token-list.modern button,
.custom-output-measure-builder .epi-measure-function-list button {
  min-height: 27px;
  padding: 4px 7px;
  border-radius: 5px;
  font-size: 9.5px;
  font-weight: 750;
}
.custom-output-measure-builder .epi-measure-function-list button {
  border-color: #b9dfe2;
  background: #effafa;
  color: #11636c;
}
.custom-output-measure-builder .epi-measure-function-list button:hover {
  border-color: var(--ps-teal);
  background: #e8f6f7;
}
.custom-output-measure-builder .epi-tech-preview-row .result {
  margin-left: auto;
  padding-left: 14px;
  border-left: 1px solid var(--ps-line);
}
.custom-output-measure-builder .epi-tech-preview-row .result strong {
  color: var(--ps-teal-text);
}
.custom-output-measure-builder .custom-output-measure-legend,
.custom-output-measure-builder .epi-stage-legend {
  gap: 8px;
}
.custom-output-measure-builder .custom-output-measure-legend span,
.custom-output-measure-builder .epi-stage-legend span {
  gap: 3px;
  font-size: 9px;
}
.custom-output-measure-builder .custom-output-measure-legend i,
.custom-output-measure-builder .epi-stage-legend i {
  width: 6px;
  height: 6px;
}
.custom-output-measure-builder .epi-measure-properties h4 {
  font-size: 14px;
  line-height: 1.2;
}
.custom-output-measure-builder .epi-measure-properties p {
  font-size: 11px;
}
.custom-output-measure-builder .epi-measure-properties-actions .btn-primary,
.custom-output-measure-builder > footer .btn {
  border-radius: 6px;
  font-weight: 700;
}
/* Canvas Outputs keeps required-name validation on Save, without rendering a
   redundant status message beside the action. */
.epi-canvas-measure-builder .epi-measure-properties-actions .epi-measure-footer-status {
  display: none;
}
.epi-measure-properties {
  padding: 16px;
  border-left: 1px solid #e5edf2;
  background: #fbfdff;
}
.epi-measure-properties h4 {
  margin: 0;
}
.epi-measure-properties p,
.epi-measure-properties small {
  color: #718096;
  font-size: 11px;
}
.epi-measure-formula-section {
  border: 1px solid #dce8ee;
  border-radius: 8px;
  padding: 10px;
  background: var(--ps-panel);
}
.epi-measure-formula-tokens {
  min-height: 24px;
  margin-top: 7px;
  display: flex;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
}
.epi-measure-formula-tokens mark {
  padding: 4px 7px;
  border-radius: 4px;
  color: var(--stage-color);
  background: var(--stage-tint);
  border: 1px solid var(--stage-border);
}
.epi-measure-valid {
  color: #17836d;
  font-size: 11px;
}
.epi-measure-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.epi-measure-segments button,
.epi-measure-function-tabs button {
  border: 0;
  background: transparent;
  padding: 4px 7px;
  font-size: 11px;
}
.epi-measure-segments .active,
.epi-measure-function-tabs .active {
  color: #147681;
  background: #e7f8f8;
  border-radius: 4px;
}
.epi-measure-variable-controls {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 7px;
}
.epi-measure-variable-controls input,
.epi-measure-variable-controls select {
  height: 29px;
  border: 1px solid #d7e2ea;
  border-radius: 5px;
  padding: 0 8px;
  font-size: 11px;
}
.epi-measure-token-list.modern {
  max-height: 92px;
  background: transparent;
  padding: 0;
}
.epi-measure-token-list.modern button {
  background: var(--stage-tint);
  border-color: var(--stage-border);
  color: #34495b;
}
.custom-output-measure-builder .epi-measure-formula-tokens mark {
  background: #f5f8fa;
  border-color: #d7e2ea;
  color: #34495b;
}
.custom-output-measure-builder .custom-output-measure-tokens button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--measure-chip-bg, #f5f8fa);
  border-color: var(--measure-chip-border, #d7e2ea);
  color: var(--measure-chip-text, #34495b);
}
.custom-output-measure-builder .custom-output-measure-tokens button:hover {
  filter: brightness(0.98);
}
.custom-output-measure-builder .custom-output-measure-tokens button:focus-visible {
  outline: 2px solid var(--measure-chip-border, #97aabd);
  outline-offset: 1px;
}
.custom-output-measure-builder .type-forecast-driver,
.custom-output-measure-builder .custom-output-measure-legend .forecast-driver {
  --measure-chip-bg: #f3effb;
  --measure-chip-border: #cfbdea;
  --measure-chip-text: #67449d;
}
.custom-output-measure-builder .type-calculated,
.custom-output-measure-builder .custom-output-measure-legend .calculated {
  --measure-chip-bg: #fff3e8;
  --measure-chip-border: #efc99d;
  --measure-chip-text: #a8581d;
}
.custom-output-measure-builder .type-measure,
.custom-output-measure-builder .custom-output-measure-legend .measure {
  --measure-chip-bg: #e9f7f2;
  --measure-chip-border: #afdfce;
  --measure-chip-text: #187462;
}
.custom-output-measure-builder .type-field {
  --measure-chip-bg: #f3f5f7;
  --measure-chip-border: #d2d9df;
  --measure-chip-text: #596875;
}
.custom-output-measure-builder .custom-output-measure-legend {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-left: auto;
}
.custom-output-measure-builder .custom-output-measure-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--measure-chip-text, #607485);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.custom-output-measure-builder .custom-output-measure-legend i {
  width: 8px;
  height: 8px;
  border: 1px solid var(--measure-chip-border, #d7e2ea);
  border-radius: 50%;
  background: var(--measure-chip-bg, #f5f8fa);
}
.epi-measure-function-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.epi-measure-function-list button {
  border: 1px solid #d6e3e8;
  border-radius: 5px;
  background: var(--ps-panel);
  padding: 5px 8px;
  font-size: 11px;
  color: #365064;
}
.epi-measure-preview {
  border-top: 1px solid #e5edf2;
  padding-top: 10px;
}
.epi-measure-preview-grid {
  display: grid;
  grid-template-columns: 120px 210px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}
.epi-measure-preview-grid article {
  border: 1px solid #dce8ee;
  border-radius: 7px;
  padding: 10px;
  display: grid;
  gap: 5px;
}
.epi-measure-preview-grid article b {
  font-size: 21px;
  color: #183b56;
}
.epi-measure-preview-grid article small {
  font-size: 10px;
  color: #718096;
}
.epi-measure-preview-grid svg {
  width: 100%;
  height: 125px;
  border: 1px solid #dce8ee;
  border-radius: 7px;
}
.epi-measure-preview-grid svg line {
  stroke: #b9c8d2;
}
.epi-measure-preview-grid svg polyline {
  fill: none;
  stroke: #168c94;
  stroke-width: 3;
}
.epi-measure-preview-table {
  max-height: 145px;
  overflow: auto;
}
.epi-measure-preview-table .epi-dashboard-table {
  font-size: 10px;
}
.epi-measure-fx {
  font-family: serif;
  font-size: 22px;
  font-style: italic;
  color: #137d88;
}
.epi-measure-heading {
  display: flex;
  gap: 10px;
  align-items: center;
}
.epi-measure-properties details {
  margin-top: 15px;
  border-top: 1px solid #e5edf2;
  padding-top: 10px;
}
.epi-measure-properties summary {
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
@media (max-width: 800px) {
  .epi-measure-builder.modern .epi-measure-builder-body {
    display: block;
  }
  .epi-measure-top-fields {
    grid-template-columns: 1fr;
  }
  .epi-measure-properties {
    border-left: 0;
    border-top: 1px solid #e5edf2;
  }
  .epi-measure-preview-grid {
    grid-template-columns: 1fr;
  }
  .epi-measure-preview-grid svg {
    height: 100px;
  }
}

.epi-dashboard-metric-list {
  display: grid;
  gap: 6px;
  max-height: 300px;
  overflow: auto;
  padding: 2px;
}

.epi-dashboard-metric-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--ps-line);
  border-radius: 8px;
  background: var(--ps-panel);
  cursor: pointer;
}

.epi-dashboard-metric-row.selected {
  border-color: rgba(36, 124, 138, 0.35);
  background: var(--ps-teal-soft);
}

.epi-dashboard-metric-row strong,
.epi-dashboard-selected-metric-chip strong {
  display: block;
  color: var(--ps-charcoal);
  font-size: 12px;
  font-weight: 900;
}

.epi-dashboard-metric-row small,
.epi-dashboard-selected-metric-chip small {
  display: block;
  color: var(--ps-muted);
  font-size: 10.5px;
  line-height: 1.35;
}

.epi-dashboard-selected-metrics {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.epi-dashboard-selected-metric-chip {
  display: inline-grid;
  grid-template-columns: minmax(80px, 1fr) auto auto auto;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 7px 8px;
  border: 1px solid rgba(36, 124, 138, 0.24);
  border-radius: 8px;
  background: var(--ps-teal-soft);
}

.epi-dashboard-selected-metric-chip button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--ps-line);
  border-radius: 6px;
  background: var(--ps-panel);
  color: var(--ps-muted);
  cursor: pointer;
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    color 0.14s ease;
}

.epi-dashboard-selected-metric-chip button:hover:not(:disabled) {
  border-color: rgba(36, 124, 138, 0.4);
  background: var(--ps-teal-soft);
  color: var(--ps-teal-dark);
}

.epi-dashboard-selected-metric-chip button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.epi-dashboard-rule-grid {
  grid-template-columns: 80px minmax(0, 1fr) minmax(118px, 0.8fr);
}

.epi-dashboard-rule-grid.is-disabled {
  opacity: 0.58;
}

.epi-dashboard-rule-grid :disabled {
  cursor: not-allowed;
  background: #f1f5f7 !important;
  color: var(--ps-muted);
}

.epi-dashboard-selected-empty,
.epi-dashboard-metric-empty {
  color: var(--ps-muted);
  font-size: 12px;
  font-weight: 700;
}

.epi-dashboard-axis-mapping {
  display: grid;
  gap: 8px;
}

.epi-dashboard-axis-mapping label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  align-items: center;
  gap: 10px;
  color: var(--ps-charcoal);
  font-size: 12px;
  font-weight: 800;
}

.epi-dashboard-validation {
  margin: 0;
  color: var(--ps-red);
  font-size: 11px;
  font-weight: 800;
}

.epi-dashboard-helper {
  margin: 0;
  color: var(--ps-muted);
  font-size: 12px;
  line-height: 1.45;
}

.epi-dashboard-widget-future-step {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 280px;
  gap: 8px;
  border: 1px dashed var(--ps-line);
  border-radius: 8px;
  background: var(--ps-surface-soft);
  text-align: center;
}

.epi-dashboard-widget-display,
.epi-dashboard-widget-style {
  display: grid;
  gap: 14px;
}

.epi-dashboard-widget-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.epi-dashboard-widget-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--ps-line);
  border-radius: 8px;
  color: var(--ps-charcoal);
  font-size: 12px;
  font-weight: 800;
}

.epi-dashboard-widget-toggle input {
  width: 16px;
  height: 16px;
}

.epi-dashboard-axis-summary,
.epi-dashboard-style-note {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--ps-line);
  border-radius: 8px;
  background: var(--ps-surface-soft);
  color: var(--ps-muted);
  font-size: 11px;
  line-height: 1.4;
}

.epi-dashboard-axis-summary strong {
  color: var(--ps-charcoal);
  font-size: 12px;
}

.epi-dashboard-series-style-list {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
}

.epi-dashboard-series-style-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--ps-line);
  border-radius: 8px;
  color: var(--ps-charcoal);
  font-size: 12px;
  font-weight: 800;
}

.epi-dashboard-series-style-row input,
.epi-dashboard-widget-option-grid input[type="color"] {
  width: 34px;
  height: 28px;
  padding: 2px;
  border: 1px solid var(--ps-line);
  border-radius: 6px;
  background: var(--ps-input);
}

.epi-dashboard-series-style-row > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.epi-dashboard-series-style-row > .epi-dashboard-color-control {
  flex: 0 0 124px;
}

.epi-dashboard-series-style-row .epi-dashboard-color-control input[type="color"] {
  width: 38px;
  min-width: 38px;
}

.epi-dashboard-series-style-row .epi-dashboard-color-control input:not([type="color"]) {
  width: 78px;
  min-width: 78px;
}

.epi-dashboard-widget-modal-actions {
  align-items: center;
  justify-content: flex-end;
  border-top: 1px solid var(--ps-line);
  border-bottom: 0;
  background: var(--ps-overlay);
}

@media (max-width: 1280px) {
  .epi-dashboard-studio-bar {
    grid-template-columns: 1fr;
  }

  .epi-dashboard-widget-form {
    grid-template-columns: 1fr;
  }

  .epi-dashboard-widget-modal-body {
    grid-template-columns: 1fr;
  }

  .epi-dashboard-widget-preview {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .epi-dashboard-widget.small,
  .epi-dashboard-widget.medium,
  .epi-dashboard-widget.wide {
    grid-column: span 1;
  }
}

@media (max-width: 820px) {
  .epi-dashboard-grid {
    grid-template-columns: repeat(12, minmax(36px, 1fr));
  }

  .epi-dashboard-widget-head {
    flex-direction: column;
  }

  .epi-dashboard-widget-modal-backdrop {
    padding: 12px;
  }

  .epi-dashboard-widget-modal {
    width: min(100vw - 24px, 720px);
    max-height: 92vh;
  }

  .epi-dashboard-widget-stepper,
  .epi-dashboard-widget-modal-head,
  .epi-dashboard-widget-modal-actions {
    padding-inline: 12px;
  }

  .epi-dashboard-widget-modal-body {
    padding: 12px 12px 24px;
  }

  .epi-dashboard-widget-type-grid,
  .epi-dashboard-basic-grid,
  .epi-dashboard-period-grid,
  .epi-dashboard-axis-title-grid,
  .epi-dashboard-widget-option-grid {
    grid-template-columns: 1fr;
  }

  .epi-dashboard-widget-stepper {
    overflow-x: auto;
  }
}

.epi-output-chart-empty {
  display: grid;
  place-items: center;
  min-height: 100%;
  padding: 24px 16px;
  font-size: 12px;
  color: var(--color-text-secondary, var(--ps-muted));
  text-align: center;
}

.epi-output-chart-empty.compact {
  min-height: 160px;
}

.epi-forecast-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px;
}

.epi-forecast-table th,
.epi-forecast-table td {
  min-width: 108px;
  padding: 7px 9px;
  border: 1px solid var(--ps-line);
  text-align: right;
}

.epi-forecast-table thead {
  position: sticky;
  top: 0;
  z-index: 6;
}

.epi-forecast-table th {
  position: sticky;
  top: 0;
  z-index: 7;
  background: var(--ps-surface-soft);
  color: var(--ps-charcoal);
  font-size: 10px;
  font-weight: 800;
  box-shadow:
    0 1px 0 var(--ps-line),
    0 5px 10px rgba(31, 42, 68, 0.06);
}

.epi-forecast-table .epi-sticky-col {
  position: sticky;
  left: 0;
  z-index: 8;
  min-width: 270px;
  max-width: 270px;
  width: 270px;
  box-sizing: border-box;
  background: var(--ps-panel);
  text-align: left;
  box-shadow: 1px 0 0 var(--ps-line);
}

.epi-forecast-table th.epi-sticky-col {
  z-index: 9;
  background: var(--ps-surface-soft);
}

.epi-forecast-table .epi-table-model-col {
  position: sticky;
  left: 270px;
  z-index: 7;
  min-width: 100px;
  max-width: 100px;
  width: 100px;
  box-sizing: border-box;
  padding: 5px 6px;
  text-align: center;
  white-space: nowrap;
  background: var(--ps-panel);
  box-shadow: 1px 0 0 var(--ps-line);
}

.epi-forecast-table th.epi-table-model-col {
  z-index: 9;
  background: var(--ps-surface-soft);
}

.epi-forecast-table tr.calc .epi-table-model-col {
  background: var(--ps-row-calc);
}
.epi-forecast-table tr.output .epi-table-model-col {
  background: #fff8f3;
}
.epi-forecast-table tr.base-value .epi-table-model-col {
  background: var(--ps-row-hover);
}
.epi-forecast-table tr.period-growth .epi-table-model-col {
  background: var(--ps-row-growth);
}

.epi-forecast-table tr.input td {
  background: var(--ps-panel);
}
