/* Connect+ Dashboard Editor - 12-col widget grid + edit toolbar. */

.dash-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

/* ---- Edit toolbar (edit mode only). Buttons/inputs come from components.css. ---- */
.edit-toolbar {
  min-height: 44px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px var(--sp-4);
  border-bottom: 1px solid var(--ln);
  background: var(--sf);
  flex: none;
}
.edit-toolbar .badge-edit {
  font: 600 var(--fs-xs) var(--font-body);
  color: var(--ac-on);
  background: var(--ac);
  padding: 4px 8px;
  border-radius: var(--r-sm);
  flex: none;
}
.edit-toolbar .dash-name-input { width: 220px; max-width: 100%; font-weight: 600; }
.edit-toolbar .spacer { flex: 1; }

/* ---- Body row: library rail / grid / settings rail ---- */
.dash-body {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.dash-grid-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.dash-grid-wrap > .dash-grid { flex: none; }

.dash-grid {
  position: relative;
  min-height: 120px;
}

/* Stacked view-mode layout (phones/tablets, < 720px - see dash.js
   STACK_BREAKPOINT_PX). Slots leave absolute positioning and flow. */
.dash-grid--stacked { display: flex; flex-direction: column; gap: 2px; }
.dash-grid--stacked .widget-slot--stacked {
  position: static;
  width: 100%;
  padding: 6px 2px;
}
/* On screen (not on paper) the stacked view is two columns: small KPI tiles sit
   side by side, charts, tables and lists take the full row. */
.dash-grid--stacked:not(.dash-grid--print) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2);
}
.dash-grid--stacked:not(.dash-grid--print) .widget-slot--stacked { grid-column: span 2; padding: 0; }
.dash-grid--stacked:not(.dash-grid--print) .widget-slot--stacked[data-size="sm"] {
  grid-column: span 1;
  height: 136px !important;
}

/* Edit mode below the breakpoint: an honest note beats a broken rail. */
.dash-small-edit-note {
  margin: 10px 16px 0;
  padding: 10px 14px;
  border: 1px solid var(--ln);
  border-radius: var(--r-lg);
  background: var(--sf);
  color: var(--tx2);
  font: 500 var(--fs-md)/1.5 var(--font-body);
}

/* Empty-tenant CTA - replaces the grid when a tenant has zero dashboards. */
.dash-empty {
  max-width: 460px;
  margin: 12vh auto 0;
  padding: 28px;
  text-align: center;
  background: var(--sf);
  border: 1px solid var(--ln);
  border-radius: var(--r-lg);
}
.dash-empty h2 { font: 600 var(--fs-xl) var(--font-display); color: var(--tx); margin: 0 0 10px; }
.dash-empty p { font: 500 var(--fs-md)/1.6 var(--font-body); color: var(--tx2); margin: 0 0 18px; }

.widget-slot {
  position: absolute;
  padding: 6px;
  transition: left .16s ease, top .16s ease, width .16s ease, height .16s ease;
}
.widget-slot.no-anim { transition: none; }

.grid-ghost {
  position: absolute;
  padding: 6px;
  z-index: 1;
  pointer-events: none;
}
.grid-ghost > div {
  width: 100%;
  height: 100%;
  border: 2px dashed var(--ac);
  border-radius: var(--r-lg);
  background: var(--acT);
}

.drag-chip {
  position: fixed;
  z-index: 600;
  pointer-events: none;
  background: var(--sf);
  border: 1px solid var(--ac);
  border-radius: 8px;
  padding: 6px 10px;
  font: 600 11.5px var(--font-body);
  color: var(--tx);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}

/* ---- Edit toolbar: the one toolbar while editing ---- */
.edit-toolbar { border-radius: var(--r-canvas) var(--r-canvas) 0 0; }
.edit-toolbar .badge-edit { letter-spacing: 0; }
