/* ─────────────────────────────────────────────────────────────────
   Dashboard Styles
   ─────────────────────────────────────────────────────────────────
   Styles for the dashboard renderer and editor. Uses the same
   CSS variable system as chat.css (--bg-primary, --accent, etc.)
   ───────────────────────────────────────────────────────────────── */


/* ── Dashboard Container ──────────────────────────────────────── */

.barq-dashboard {
  background: var(--bg-primary, #0f1117);
  border: 1px solid var(--border, #2a2d3a);
  border-radius: 12px;
  padding: 20px;
  margin: 12px 0;
  position: relative;
}

.barq-dashboard-loading {
  opacity: 0.6;
  pointer-events: none;
}

.barq-dashboard-loading::after {
  content: 'Refreshing...';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--accent, #4f8ff7);
  font-size: 14px;
  font-weight: 600;
}


/* ── Dashboard Header ─────────────────────────────────────────── */

.barq-dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border, #2a2d3a);
  gap: 12px;
  flex-wrap: wrap;
}

.barq-dashboard-title-area {
  flex: 1;
  min-width: 200px;
}

.barq-dashboard-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary, #e8eaed);
  margin: 0 0 4px 0;
}

.barq-dashboard-desc {
  font-size: 13px;
  color: var(--text-secondary, #8b8fa3);
  margin: 0;
}

.barq-dashboard-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.barq-dashboard-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 7px;
  border: 1px solid var(--border, #2a2d3a);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.barq-dashboard-btn-secondary {
  background: var(--bg-card, #1a1d29);
  color: var(--text-secondary, #8b8fa3);
}

.barq-dashboard-btn-secondary:hover {
  background: var(--bg-card-hover, #222636);
  color: var(--text-primary, #e8eaed);
  border-color: var(--accent, #4f8ff7);
}

.barq-dashboard-btn-primary {
  background: var(--accent, #4f8ff7);
  color: #fff;
  border-color: var(--accent, #4f8ff7);
}

.barq-dashboard-btn-primary:hover {
  background: #3a7de6;
}


/* ── Widget Grid ──────────────────────────────────────────────── */

.barq-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.barq-dashboard-widget {
  background: var(--bg-card, #1a1d29);
  border: 1px solid var(--border, #2a2d3a);
  border-radius: 10px;
  padding: 16px;
  position: relative;
  transition: border-color 0.15s, box-shadow 0.15s;
  overflow: hidden;
}

/* ── Widget Accent Colors ──────────────────────────────────── */
.barq-dashboard-widget.barq-widget-kpi {
  border-left: 3px solid #4f8ff7;
  background: linear-gradient(135deg, rgba(79, 143, 247, 0.06) 0%, var(--bg-card, #1a1d29) 60%);
}
.barq-dashboard-widget.barq-widget-chart {
  border-left: 3px solid #8b5cf6;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.04) 0%, var(--bg-card, #1a1d29) 60%);
}
.barq-dashboard-widget.barq-widget-table {
  border-left: 3px solid #06b6d4;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.04) 0%, var(--bg-card, #1a1d29) 60%);
}
.barq-dashboard-widget.barq-widget-stat {
  border-left: 3px solid #f59e0b;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.04) 0%, var(--bg-card, #1a1d29) 60%);
}
.barq-dashboard-widget.barq-widget-monitor {
  border-left: 3px solid #34d399;
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.04) 0%, var(--bg-card, #1a1d29) 60%);
}

.barq-dashboard-widget:hover {
  border-color: rgba(79, 143, 247, 0.3);
}


/* ── KPI Widget ───────────────────────────────────────────────── */

.barq-widget-kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.barq-kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary, #8b8fa3);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.barq-kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary, #e8eaed);
  line-height: 1.2;
}

.barq-kpi-change {
  font-size: 12px;
  font-weight: 500;
}

.barq-kpi-change.positive { color: #34d399; }
.barq-kpi-change.negative { color: #ef4444; }
.barq-kpi-change.neutral  { color: #8b8fa3; }


/* ── Chart Widget ─────────────────────────────────────────────── */

.barq-widget-chart {
  padding: 12px;
}

.barq-dashboard-chart-container {
  min-height: 280px;
}

.barq-dashboard-echart {
  width: 100%;
  min-height: 280px;
}


/* ── Table Widget ─────────────────────────────────────────────── */

.barq-widget-table {
  padding: 12px;
}

.barq-dashboard-table-container {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 320px;
}

.barq-dashboard-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-card, #1a1d29);
}

.barq-dashboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.barq-dashboard-table th {
  text-align: left;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary, #8b8fa3);
  border-bottom: 1px solid var(--border, #2a2d3a);
  white-space: nowrap;
}

.barq-dashboard-table td {
  padding: 8px 12px;
  color: var(--text-primary, #e8eaed);
  border-bottom: 1px solid rgba(42, 45, 58, 0.5);
}

.barq-dashboard-table tbody tr:hover {
  background: rgba(79, 143, 247, 0.04);
}

.barq-dashboard-table tbody tr:last-child td {
  border-bottom: none;
}


/* ── Stat Widget ──────────────────────────────────────────────── */

.barq-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 16px;
  padding: 8px 0;
}

.barq-stat-item {
  text-align: center;
}

.barq-stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary, #8b8fa3);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.barq-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary, #e8eaed);
}


/* ── Monitor Widget ───────────────────────────────────────────── */

.barq-monitor-card {
  padding: 4px 0;
}

.barq-monitor-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.barq-monitor-critical .barq-monitor-badge {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}
.barq-monitor-warning .barq-monitor-badge {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}
.barq-monitor-healthy .barq-monitor-badge,
.barq-monitor-info .barq-monitor-badge {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
}

.barq-monitor-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #e8eaed);
  margin-bottom: 4px;
}

.barq-monitor-message {
  font-size: 12px;
  color: var(--text-secondary, #8b8fa3);
}

.barq-monitor-time {
  font-size: 11px;
  color: var(--text-muted, #5f6372);
  margin-top: 8px;
}


/* ── Shared Widget Elements ───────────────────────────────────── */

.barq-widget-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.barq-widget-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #e8eaed);
}

/* Legacy source line — hidden; replaced by info icon on title bar */
.barq-widget-source {
  display: none;
}

/* ── Widget Info Icon & Tooltip ────────────────────────────── */
.barq-widget-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border, #2a2d3a);
  background: transparent;
  color: var(--text-muted, #5f6372);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-style: italic;
  font-family: Georgia, serif;
  transition: all 0.15s;
  flex-shrink: 0;
  margin-left: 6px;
  line-height: 1;
}
.barq-widget-info-btn:hover {
  background: rgba(79, 143, 247, 0.12);
  color: var(--accent, #4f8ff7);
  border-color: var(--accent, #4f8ff7);
}

.barq-widget-info-tooltip {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  width: 280px;
  max-width: calc(100vw - 32px);
  padding: 12px 14px;
  background: var(--bg-card, #1a1d29);
  border: 1px solid var(--border, #2a2d3a);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 30;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary, #8b8fa3);
}

.barq-widget-info-tooltip .barq-info-desc {
  color: var(--text-primary, #e8eaed);
  margin-bottom: 8px;
  font-size: 13px;
}

.barq-widget-info-tooltip .barq-info-query-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted, #5f6372);
  margin-bottom: 4px;
}

.barq-widget-info-tooltip .barq-info-query {
  font-family: 'Fira Code', 'Cascadia Code', Consolas, monospace;
  font-size: 11px;
  color: var(--text-muted, #5f6372);
  word-break: break-all;
  white-space: pre-wrap;
}

.barq-widget-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  font-size: 13px;
  color: var(--text-muted, #5f6372);
}


/* ── Edit Mode ────────────────────────────────────────────────── */

.barq-dashboard-editing .barq-dashboard-widget {
  outline: 1px dashed rgba(79, 143, 247, 0.3);
  outline-offset: -1px;
  overflow: visible;   /* allow config panel to overflow small widgets */
}

.barq-dashboard-editing .barq-dashboard-widget:hover {
  outline-color: var(--accent, #4f8ff7);
}

.barq-widget-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  background: rgba(15, 17, 23, 0.8);
  backdrop-filter: blur(4px);
  z-index: 10;
  border-radius: 10px 10px 0 0;
}

.barq-widget-drag-handle {
  cursor: grab;
  font-size: 16px;
  color: var(--text-muted, #5f6372);
  padding: 2px 6px;
  user-select: none;
}

.barq-widget-drag-handle:active { cursor: grabbing; }

.barq-widget-action-bar {
  display: flex;
  gap: 4px;
}

.barq-widget-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: rgba(42, 45, 58, 0.6);
  color: var(--text-secondary, #8b8fa3);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
}

.barq-widget-action-btn:hover {
  background: var(--accent, #4f8ff7);
  color: #fff;
}

.barq-widget-action-delete:hover {
  background: #ef4444;
}

/* Drag states */
.barq-widget-dragging {
  opacity: 0.4;
}

.barq-widget-drop-target {
  outline: 2px solid var(--accent, #4f8ff7) !important;
  outline-offset: -2px;
}

.barq-widget-loading {
  opacity: 0.5;
  pointer-events: none;
}


/* ── Widget Config Panel ──────────────────────────────────────── */

.barq-widget-config-panel {
  position: absolute;
  top: 40px;
  right: 8px;
  width: 280px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-primary, #0f1117);
  border: 1px solid var(--accent, #4f8ff7);
  border-radius: 8px;
  padding: 14px;
  z-index: 20;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.barq-config-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary, #8b8fa3);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.barq-config-input {
  width: 100%;
  padding: 6px 10px;
  font-size: 13px;
  background: var(--bg-input, #12141e);
  color: var(--text-primary, #e8eaed);
  border: 1px solid var(--border, #2a2d3a);
  border-radius: 6px;
  outline: none;
}

.barq-config-input:focus {
  border-color: var(--accent, #4f8ff7);
}

textarea.barq-config-input {
  resize: vertical;
  min-height: 48px;
  font-family: inherit;
}

select.barq-config-input {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.barq-config-btn {
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid var(--border, #2a2d3a);
  background: var(--bg-card, #1a1d29);
  color: var(--text-secondary, #8b8fa3);
  cursor: pointer;
  transition: all 0.15s;
}

.barq-config-btn:hover {
  background: var(--bg-card-hover, #222636);
  color: var(--text-primary, #e8eaed);
}

.barq-config-btn-primary {
  background: var(--accent, #4f8ff7);
  color: #fff;
  border-color: var(--accent, #4f8ff7);
}

.barq-config-btn-primary:hover {
  background: #3a7de6;
}


/* ── Add Widget ───────────────────────────────────────────────── */

.barq-add-widget-row {
  margin-top: 16px;
  text-align: center;
  position: relative;
}

.barq-add-widget-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  border: 1px dashed var(--border, #2a2d3a);
  background: transparent;
  color: var(--text-secondary, #8b8fa3);
  cursor: pointer;
  transition: all 0.15s;
}

.barq-add-widget-btn:hover {
  border-color: var(--accent, #4f8ff7);
  color: var(--accent, #4f8ff7);
}

.barq-widget-type-picker {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 12px;
  background: var(--bg-card, #1a1d29);
  border: 1px solid var(--border, #2a2d3a);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  margin-bottom: 8px;
  z-index: 20;
}

.barq-widget-type-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border, #2a2d3a);
  background: transparent;
  color: var(--text-secondary, #8b8fa3);
  cursor: pointer;
  transition: all 0.15s;
  min-width: 80px;
}

.barq-widget-type-option:hover {
  background: var(--bg-card-hover, #222636);
  border-color: var(--accent, #4f8ff7);
  color: var(--text-primary, #e8eaed);
}

.barq-wt-icon {
  font-size: 20px;
}

.barq-wt-label {
  font-size: 11px;
  font-weight: 500;
}


/* ── Edit Toolbar ─────────────────────────────────────────────── */

.barq-edit-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
  background: var(--bg-card, #1a1d29);
  border: 1px solid var(--border, #2a2d3a);
  border-radius: 8px;
}

.barq-edit-toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid var(--border, #2a2d3a);
  background: transparent;
  color: var(--text-secondary, #8b8fa3);
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}

.barq-edit-toolbar-btn:hover {
  background: var(--bg-card-hover, #222636);
  color: var(--text-primary, #e8eaed);
  border-color: var(--accent, #4f8ff7);
}

.barq-edit-toolbar-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted, #5f6372);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-left: 12px;
}

.barq-edit-cols-btn {
  width: 30px;
  padding: 5px 0;
  text-align: center;
  justify-content: center;
}

.barq-edit-cols-btn.active {
  background: var(--accent, #4f8ff7);
  color: #fff;
  border-color: var(--accent, #4f8ff7);
}


/* ── Widget Bottom Bar (drag + span controls) ─────────────────── */

.barq-widget-bottom-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.barq-widget-span-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(42, 45, 58, 0.6);
  border-radius: 6px;
  padding: 1px;
}

.barq-widget-span-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: var(--text-secondary, #8b8fa3);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.12s;
}

.barq-widget-span-btn:hover {
  background: var(--accent, #4f8ff7);
  color: #fff;
}

.barq-widget-span-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary, #8b8fa3);
  min-width: 28px;
  text-align: center;
  padding: 0 2px;
}


/* ── Dashboard Frame Width ────────────────────────────────────── */

.barq-dashboard-frame {
  margin: 0 auto;
  transition: max-width 0.25s ease;
}

.barq-dashboard-frame.frame-compact  { max-width: 960px; }
.barq-dashboard-frame.frame-standard { max-width: 1200px; }
.barq-dashboard-frame.frame-wide     { max-width: 1600px; }
.barq-dashboard-frame.frame-full     { max-width: 100%; }

.barq-frame-picker {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.barq-frame-picker-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted, #5f6372);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-right: 6px;
}

.barq-frame-btn {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 5px;
  border: 1px solid var(--border, #2a2d3a);
  background: transparent;
  color: var(--text-secondary, #8b8fa3);
  cursor: pointer;
  transition: all 0.12s;
}

.barq-frame-btn:hover {
  background: var(--bg-card-hover, #222636);
  color: var(--text-primary, #e8eaed);
  border-color: var(--accent, #4f8ff7);
}

.barq-frame-btn.active {
  background: var(--accent, #4f8ff7);
  color: #fff;
  border-color: var(--accent, #4f8ff7);
}


/* ── Responsive ───────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .barq-dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .barq-dashboard-widget {
    grid-column: span min(var(--widget-span, 1), 2) !important;
  }
  /* Tables always full-width on medium screens */
  .barq-widget-table {
    grid-column: 1 / -1 !important;
  }
}

/* ── Dashboard List View ──────────────────────────────────────── */

.barq-dash-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.barq-dash-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.barq-dash-empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary, #e8eaed);
  margin-bottom: 8px;
}

.barq-dash-empty-desc {
  font-size: 13px;
  color: var(--text-secondary, #8b8fa3);
  max-width: 360px;
  line-height: 1.5;
}

.barq-dash-list {
  border: 1px solid var(--border, #2a2d3a);
  border-radius: 10px;
  overflow: hidden;
}

.barq-dash-list-header {
  display: grid;
  grid-template-columns: 36px 1fr 100px 80px 110px 70px;
  gap: 8px;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary, #8b8fa3);
  background: var(--bg-card, #1a1d29);
  border-bottom: 1px solid var(--border, #2a2d3a);
}

.barq-dash-list-row {
  display: grid;
  grid-template-columns: 36px 1fr 100px 80px 110px 70px;
  gap: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary, #e8eaed);
  border-bottom: 1px solid rgba(42, 45, 58, 0.5);
  cursor: pointer;
  transition: background 0.12s;
  align-items: center;
}

.barq-dash-list-row:hover {
  background: rgba(79, 143, 247, 0.04);
}

.barq-dash-list-row.active {
  background: rgba(79, 143, 247, 0.08);
  border-left: 3px solid var(--accent, #4f8ff7);
}

.barq-dash-list-row:last-child {
  border-bottom: none;
}

.barq-dash-col-vis {
  text-align: center;
  font-size: 14px;
}

.barq-dash-col-title strong {
  display: block;
  font-weight: 600;
}

.barq-dash-row-desc {
  display: block;
  font-size: 11px;
  color: var(--text-secondary, #8b8fa3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.barq-dash-col-owner,
.barq-dash-col-gran,
.barq-dash-col-last,
.barq-dash-col-count {
  font-size: 12px;
  color: var(--text-secondary, #8b8fa3);
}

.barq-dash-col-count {
  text-align: center;
}


/* ── Dashboard Detail View ───────────────────────────────────── */

.barq-dash-loading {
  text-align: center;
  padding: 40px 20px;
  font-size: 14px;
  color: var(--text-secondary, #8b8fa3);
}

.barq-dash-error {
  text-align: center;
  padding: 40px 20px;
  font-size: 14px;
  color: var(--negative, #ef4444);
}

/* ── Compact Detail Toolbar ─────────────────────────────────── */

.barq-dash-detail-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--bg-card, #1a1d29);
  border: 1px solid var(--border, #2a2d3a);
  border-radius: 8px;
  margin-bottom: 4px;
  min-height: 36px;
  flex-wrap: wrap;
}

/* ── Control Strip (timeline + frame width in one row) ──────── */
.barq-dash-control-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.barq-dash-control-strip .barq-dash-timeline {
  flex: 1;
  margin-bottom: 0;
}

.barq-dash-frame-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.barq-frame-btn-sm {
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  line-height: 26px;
}

.barq-dash-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border, #2a2d3a);
  background: transparent;
  color: var(--text-secondary, #8b8fa3);
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  transition: all 0.12s;
}
.barq-dash-back-btn:hover {
  background: var(--bg-card-hover, #222636);
  color: var(--text-primary, #e8eaed);
  border-color: var(--accent, #4f8ff7);
}

.barq-dash-toolbar-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex: 1;
  min-width: 120px;
  overflow: hidden;
}

.barq-dash-toolbar-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary, #e8eaed);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.barq-dash-toolbar-desc {
  font-size: 12px;
  color: var(--text-muted, #5f6372);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.barq-dash-toolbar-pills {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.barq-dash-pill {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 10px;
  background: rgba(79, 143, 247, 0.08);
  color: var(--text-secondary, #8b8fa3);
  white-space: nowrap;
}

.barq-dash-toolbar-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.barq-btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* Legacy classes kept for compat but hidden */
.barq-dash-detail-nav { display: none; }
.barq-dash-detail-card { display: none; }
.barq-dash-detail-header { display: none; }
.barq-dash-detail-meta { display: none; }

.barq-dash-tag {
  display: inline-block;
  padding: 1px 8px;
  font-size: 11px;
  border-radius: 10px;
  background: rgba(79, 143, 247, 0.12);
  color: var(--accent, #4f8ff7);
  margin-left: 4px;
}


/* ── Timeline ────────────────────────────────────────────────── */

.barq-dash-timeline {
  background: var(--bg-card, #1a1d29);
  border: 1px solid var(--border, #2a2d3a);
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 4px;
}

.barq-dash-timeline-empty {
  text-align: center;
  padding: 12px;
  font-size: 13px;
  color: var(--text-secondary, #8b8fa3);
}

.barq-dash-timeline-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.barq-timeline-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border, #2a2d3a);
  background: transparent;
  color: var(--text-secondary, #8b8fa3);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.12s;
  flex-shrink: 0;
}

.barq-timeline-btn:hover {
  background: var(--bg-card-hover, #222636);
  color: var(--text-primary, #e8eaed);
  border-color: var(--accent, #4f8ff7);
}

.barq-timeline-play-btn {
  background: var(--accent, #4f8ff7);
  color: #fff;
  border-color: var(--accent, #4f8ff7);
}

.barq-timeline-play-btn:hover {
  background: #3a7de6;
  color: #fff;
}

.barq-timeline-scrubber {
  flex: 1;
  padding: 0 8px;
}

.barq-timeline-range {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border, #2a2d3a);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.barq-timeline-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent, #4f8ff7);
  cursor: pointer;
  border: 2px solid var(--bg-card, #1a1d29);
}

.barq-timeline-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent, #4f8ff7);
  cursor: pointer;
  border: 2px solid var(--bg-card, #1a1d29);
}

.barq-timeline-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent, #4f8ff7);
  min-width: 80px;
  text-align: center;
  flex-shrink: 0;
}

.barq-timeline-count {
  font-size: 11px;
  color: var(--text-muted, #5f6372);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Snapshot label (single instance, no timeConfig) */
.barq-timeline-snapshot-label {
  font-size: 12px;
  color: var(--text-secondary, #8b8fa3);
  font-weight: 500;
}

/* Range labels below scrubber (start — end) */
.barq-timeline-range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted, #5f6372);
  margin-top: 2px;
  padding: 0 2px;
}

/* ── Timeline Ticks ──────────────────────────────────────────── */
.barq-timeline-ticks {
  position: relative;
  height: 20px;
  margin-top: 4px;
}

.barq-timeline-tick {
  position: absolute;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.barq-tick-mark {
  width: 1px;
  height: 6px;
  background: var(--text-muted, #5f6372);
  opacity: 0.4;
}

.barq-timeline-tick.major .barq-tick-mark {
  height: 8px;
  opacity: 0.7;
}

.barq-timeline-tick.computed .barq-tick-mark {
  background: #34d399;
  opacity: 0.8;
}

.barq-tick-label {
  font-size: 9px;
  color: var(--text-muted, #5f6372);
  white-space: nowrap;
  margin-top: 2px;
}

.barq-dash-instance-render {
  margin-top: 2px;
}

/* Hide the dashboard's own header when inside the detail view —
   the detail toolbar already shows title, desc, and actions. */
.barq-dash-instance-render .barq-dashboard-header {
  display: none;
}

/* Also reduce padding on the dashboard container itself in detail view */
.barq-dash-instance-render .barq-dashboard {
  padding: 12px;
  margin: 0;
  border-radius: 8px;
}

/* ── Definition Drift Banner ─────────────────────────────────── */
.barq-dash-drift-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  margin-bottom: 8px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 8px;
  font-size: 12px;
  color: #f59e0b;
  line-height: 1.4;
}

.barq-dash-drift-icon {
  font-size: 14px;
  flex-shrink: 0;
}

/* ── No-Data Overlay for Added Widgets ────────────────────────── */
.barq-widget-no-data-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(15, 17, 23, 0.75);
  backdrop-filter: blur(2px);
  border-radius: 8px;
  z-index: 5;
  font-size: 13px;
  color: var(--text-secondary, #8b8fa3);
  font-weight: 500;
}

.barq-widget-no-data-hint {
  font-size: 11px;
  color: var(--text-muted, #5f6372);
  font-weight: 400;
}

/* ── Timeline Computed Badge ─────────────────────────────────── */
.barq-timeline-computed-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.barq-timeline-computed {
  color: #34d399;
  background: rgba(52, 211, 153, 0.1);
}

.barq-timeline-uncomputed {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

/* ── Uncomputed Period Placeholder ────────────────────────────── */
.barq-dash-uncomputed {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
  border: 2px dashed var(--border, #2a2d3a);
  border-radius: 12px;
  margin: 12px 0;
}

.barq-dash-uncomputed-icon {
  font-size: 36px;
  opacity: 0.5;
}

.barq-dash-uncomputed-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary, #e8eaed);
}

.barq-dash-uncomputed-msg {
  font-size: 13px;
  color: var(--text-secondary, #8b8fa3);
}


/* ── Dashboard View Tabs ─────────────────────────────────────── */

.barq-dash-view-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border, #2a2d3a);
  padding-bottom: 0;
}

.barq-dash-view-tab {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary, #8b8fa3);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.12s;
}

.barq-dash-view-tab:hover {
  color: var(--text-primary, #e8eaed);
}

.barq-dash-view-tab.active {
  color: var(--accent, #4f8ff7);
  border-bottom-color: var(--accent, #4f8ff7);
}


/* ── Responsive (list view) ──────────────────────────────────── */

@media (max-width: 900px) {
  .barq-dash-list-header,
  .barq-dash-list-row {
    grid-template-columns: 36px 1fr 80px 70px;
  }
  .barq-dash-col-owner,
  .barq-dash-col-gran {
    display: none;
  }
}


@media (max-width: 640px) {
  .barq-dashboard-grid {
    grid-template-columns: 1fr;
  }
  .barq-dashboard-widget {
    grid-column: span 1 !important;
  }
  .barq-kpi-value {
    font-size: 22px;
  }
  .barq-dashboard-header {
    flex-direction: column;
  }
}
