/* ── Monitor Bar ──────────────────────────────────────────────────────────── */

.monitor-bar {
  background: var(--bg-el);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 5;
  flex-shrink: 0;
}

/* ── Header row (always visible) ── */

.monitor-header {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 16px;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.monitor-header:hover {
  background: rgba(255,255,255,0.02);
}

.mon-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.mon-pills {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  overflow: hidden;
  min-width: 0;
}

.mon-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  font-size: 12px;
}

.mon-pill-val {
  color: var(--text-1);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

.mon-sep {
  color: var(--border-h);
  font-size: 11px;
}

.mon-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.mon-dot-ok   { background: var(--green); box-shadow: 0 0 4px var(--green); }
.mon-dot-err  { background: var(--red);   box-shadow: 0 0 4px var(--red); }
.mon-dot-warn { background: var(--yellow);}

.mon-mini-bar {
  width: 36px;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.mon-mini-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

.mon-refresh-btn {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: var(--r-sm);
  transition: var(--t);
  flex-shrink: 0;
}

.mon-refresh-btn:hover {
  color: var(--accent);
  background: var(--accent-glow);
}

.mon-refresh-btn.spinning {
  display: inline-block;
  animation: mon-spin 0.8s linear infinite;
}

@keyframes mon-spin {
  to { transform: rotate(360deg); }
}

.mon-updated {
  font-size: 10px;
  color: var(--text-3);
  white-space: nowrap;
  flex-shrink: 0;
}

.monitor-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-3);
  border-radius: var(--r-sm);
  width: 26px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--t);
  flex-shrink: 0;
}

.monitor-toggle:hover {
  color: var(--text-1);
  border-color: var(--border-h);
  background: rgba(255,255,255,0.04);
}

.monitor-toggle svg {
  transition: transform 250ms ease;
}

.monitor-toggle.open svg {
  transform: rotate(180deg);
}

/* ── Collapsible body ── */

.monitor-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 380ms cubic-bezier(0.4, 0, 0.2, 1);
}

.monitor-body.open {
  max-height: 480px;
  overflow-y: auto;
}

.monitor-body::-webkit-scrollbar { width: 4px; }
.monitor-body::-webkit-scrollbar-track { background: transparent; }
.monitor-body::-webkit-scrollbar-thumb { background: var(--border-h); border-radius: 2px; }

/* ── Card grid ── */

.mon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.mon-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 11px 13px 10px;
}

.mon-card-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  font-weight: 600;
  margin-bottom: 9px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ── Connectivity status ── */

.mon-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  margin-bottom: 8px;
}

.mon-status-label {
  color: var(--text-2);
}

.mon-latency {
  margin-left: auto;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-3);
}

/* ── Data rows ── */

.mon-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  margin-bottom: 3px;
  gap: 8px;
}

.mon-row-label {
  color: var(--text-3);
  white-space: nowrap;
}

.mon-row-val {
  color: var(--text-1);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-align: right;
}

/* ── Progress bars ── */

.mon-bar-wrap {
  margin: 2px 0 7px;
}

.mon-bar-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-3);
  margin-bottom: 3px;
}

.mon-bar {
  height: 5px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}

.mon-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

.mon-bar-ok   { background: var(--green); }
.mon-bar-warn { background: var(--yellow); }
.mon-bar-crit { background: var(--red); }
.mon-bar-blue { background: var(--accent); }
.mon-bar-purple { background: var(--purple); }

/* ── Bucket table ── */

.mon-bucket-list {
  margin-top: 4px;
}

.mon-bucket-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  gap: 8px;
}

.mon-bucket-row:last-child { border-bottom: none; }

.mon-bucket-name {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mon-bucket-meta {
  color: var(--text-3);
  white-space: nowrap;
  font-size: 10px;
}

.mon-bucket-type {
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(255,255,255,0.06);
  color: var(--text-3);
}

/* ── Op type breakdown ── */

.mon-ops-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  margin-bottom: 2px;
}

.mon-ops-type {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-3);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mon-ops-count {
  color: var(--text-2);
  white-space: nowrap;
}

/* ── Session counters ── */

.mon-session-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.mon-session-item {
  background: rgba(255,255,255,0.03);
  border-radius: var(--r-sm);
  padding: 6px 8px;
  text-align: center;
}

.mon-session-num {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-1);
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.2;
}

.mon-session-sub {
  font-size: 9px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Cost card ── */

.mon-cost-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  padding: 2px 0;
}

.mon-cost-label { color: var(--text-3); }

.mon-cost-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-1);
}

.mon-cost-total {
  border-top: 1px solid var(--border);
  margin-top: 5px;
  padding-top: 5px;
}

.mon-cost-total .mon-cost-label { color: var(--text-2); font-weight: 500; }
.mon-cost-total .mon-cost-val   { color: var(--green); }

.mon-tier-tag {
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--accent-glow);
  color: var(--accent);
  margin-left: 4px;
}

/* ── Error / notice states ── */

.mon-error {
  font-size: 11px;
  color: var(--red);
  padding: 3px 0;
}

.mon-notice {
  font-size: 10px;
  color: var(--text-3);
  margin-top: 4px;
  line-height: 1.4;
}

.mon-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 0;
}

/* ── Loading skeleton ── */

.mon-loading {
  color: var(--text-3);
  font-size: 11px;
}

@keyframes mon-pulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.9; }
}

.mon-loading-pulse {
  animation: mon-pulse 1.4s ease-in-out infinite;
}

/* ── Alert badges on header pills ── */
.mon-alert-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-left: 4px;
  vertical-align: middle;
  flex-shrink: 0;
}
.mon-alert-amber { background: var(--yellow); }
.mon-alert-red   { background: var(--red); box-shadow: 0 0 4px var(--red); }

/* ── Countdown ── */
.mon-countdown {
  font-size: 0.7rem;
  color: var(--text-3);
  margin-left: 8px;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
  flex-shrink: 0;
}
