* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0f1117;
  --surface: #181a20;
  --surface-raised: #1e2028;
  --border: #2a2d37;
  --text: #e1e4eb;
  --text-muted: #7a7f8e;
  --accent: #6c8cff;
  --accent-hover: #8aa4ff;
  --danger: #ff6b6b;
  --danger-hover: #ff8585;
  --success: #4ecdc4;
  --warning: #ffe66d;
  --stderr: #ff6b6b;
  --stdout: #c8cdd8;
  --highlight: rgba(255, 230, 109, 0.25);
  --radius: 6px;
  --mono: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.header-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-name {
  font-size: 13px;
  color: var(--text-muted);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
}

.tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}

.tab:hover {
  color: var(--text);
  background: var(--surface-raised);
}

.tab.active {
  color: var(--text);
  background: var(--surface-raised);
  border-color: var(--border);
}

/* Main */
main {
  padding: 20px 24px;
  height: calc(100vh - 65px);
}

.tab-content {
  display: none;
  height: 100%;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
}

/* Filters */
.filters {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.filter-group input,
.filter-group select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  min-width: 140px;
}

.filter-group input:focus,
.filter-group select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Multi-select dropdown */
.multiselect {
  position: relative;
}

.multiselect-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  min-width: 160px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.multiselect-toggle:focus {
  outline: none;
  border-color: var(--accent);
}

.multiselect-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 200px;
  max-height: 260px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.multiselect-dropdown.open {
  display: block;
}

.multiselect-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 8px 12px 4px;
}

.multiselect-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.1s;
}

.multiselect-item:hover {
  background: var(--surface-raised);
}

.multiselect-item input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
}

.multiselect-item label {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
}

.multiselect-actions {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
}

.multiselect-actions button {
  font-size: 11px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.multiselect-actions button:hover {
  text-decoration: underline;
}

.file-size-label {
  color: var(--text-muted);
  font-size: 11px;
}

/* Range inputs */
.range-inputs {
  display: flex;
  align-items: center;
  gap: 4px;
}

.range-inputs input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 8px;
  border-radius: var(--radius);
  font-size: 13px;
  width: 80px;
}

.range-inputs input:focus {
  outline: none;
  border-color: var(--accent);
}

.range-sep {
  color: var(--text-muted);
  font-size: 13px;
}

/* Buttons */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-small {
  padding: 5px 12px;
  font-size: 12px;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--text);
}

.btn-outline.active {
  border-color: var(--success);
  color: var(--success);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Split panels */
.split-panel {
  display: flex;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.docker-layout {
  display: flex;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.file-list-panel,
.container-list-panel {
  width: 320px;
  min-width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.log-viewer-panel {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.viewer-controls {
  display: flex;
  gap: 6px;
}

.badge {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

/* File list */
.file-list {
  overflow-y: auto;
  flex: 1;
}

.file-item {
  position: relative;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}

.file-item:hover {
  background: var(--surface-raised);
}

.file-item.active {
  background: var(--surface-raised);
  border-left: 3px solid var(--accent);
  padding-left: 13px;
}

.file-item-name {
  font-size: 13px;
  font-family: var(--mono);
  color: var(--text);
  word-break: break-all;
  padding-right: 24px;
}

.file-item-meta {
  display: flex;
  gap: 12px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Container list */
.container-list {
  overflow-y: auto;
  flex: 1;
}

.container-item {
  position: relative;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}

.container-item:hover {
  background: var(--surface-raised);
}

.container-item.active {
  background: var(--surface-raised);
  border-left: 3px solid var(--accent);
  padding-left: 13px;
}

.container-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.container-image {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text-muted);
  margin-top: 2px;
}

.container-status {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.container-status.running {
  background: rgba(78, 205, 196, 0.15);
  color: var(--success);
}

.container-status.exited {
  background: rgba(255, 107, 107, 0.15);
  color: var(--danger);
}

.container-status.other {
  background: rgba(122, 127, 142, 0.15);
  color: var(--text-muted);
}

/* Log panel */
.log-panel {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
}

.log-line {
  padding: 1px 16px;
  white-space: pre-wrap;
  word-break: break-all;
}

.log-line:hover {
  background: var(--surface-raised);
}

.log-stdout {
  color: var(--stdout);
}

.log-stderr {
  color: var(--stderr);
}

.log-line mark {
  background: var(--highlight);
  color: var(--warning);
  border-radius: 2px;
  padding: 0 2px;
}

.empty-state {
  color: var(--text-muted);
  text-align: center;
  padding: 40px 20px;
  font-size: 13px;
}

/* Streaming indicator */
.streaming-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--success);
}

.streaming-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Timeout table */
.data-table-wrap {
  flex: 1;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

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

.data-table thead {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}

.data-table tbody tr:hover {
  background: var(--surface-raised);
}

.data-mono {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
}

.data-muted {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
}

.detail-type-badge.error {
  background: rgba(255, 107, 107, 0.15);
  color: var(--danger);
}

.detail-type-badge.slow {
  background: rgba(255, 230, 109, 0.15);
  color: var(--warning);
}

.expand-arrow {
  color: var(--text-muted);
  font-size: 10px;
  transition: transform 0.15s;
}

.expanded .expand-arrow {
  transform: rotate(90deg);
}

/* Detail row */
.timeout-detail-row td {
  padding: 0 !important;
  border-bottom: 1px solid var(--border);
}

.timeout-detail {
  padding: 12px 16px 12px 44px;
  background: var(--bg);
}

.timeout-detail h4 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-family: var(--mono);
  margin-bottom: 12px;
}

.detail-table td {
  padding: 4px 10px;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

.detail-table .stderr {
  color: var(--danger);
}

.dyno-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Flash animation for new live entries */
@keyframes flash-new {
  0% { background: rgba(255, 107, 107, 0.25); }
  100% { background: transparent; }
}

.timeout-flash {
  animation: flash-new 1.5s ease-out;
}

.time-ago {
  font-size: 12px;
  color: var(--text-muted);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ─── Container search ─────────────────────────────── */

.container-search-wrap {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.container-search {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 12px;
  outline: none;
}

.container-search:focus {
  border-color: var(--accent);
}

/* ─── 3-dot action button + menu ────────────────────── */

.container-actions-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

.container-item:hover .container-actions-btn,
.file-item:hover .container-actions-btn,
.container-actions-btn.open {
  display: inline-flex;
}

.container-actions-btn:hover {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.container-menu {
  position: fixed;
  z-index: 1000;
  min-width: 180px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  padding: 4px 0;
}

.container-menu-item {
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.container-menu-item:hover {
  background: var(--surface);
}

/* ─── Modal ─────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 520px;
  max-width: 92vw;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-fullscreen {
  width: 92vw;
  height: 86vh;
  max-width: 1400px;
}

/* ─── Terminal modal (container bash session) ────────── */

.modal-terminal {
  width: 84vw;
  max-width: 1100px;
  height: 70vh;
}

.terminal-wrap {
  flex: 1;
  min-height: 0;
  background: #0d1117;
  padding: 8px 8px 8px 12px;
}

.terminal-wrap .xterm {
  height: 100%;
}

.terminal-conn-status {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
}

.terminal-conn-status.connected {
  color: var(--success, #3fb950);
  border-color: var(--success, #3fb950);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 12px;
}

.modal-section-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
}

.modal-section-label {
  color: var(--text-muted);
}

.modal-section-value {
  color: var(--text);
  font-family: var(--mono);
}

.modal-form label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.modal-file-input,
.modal-text-input {
  width: 100%;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 12px;
  font-family: var(--mono);
}

.modal-text-input:focus {
  outline: none;
  border-color: var(--accent);
}

.modal-form-row {
  display: flex;
  gap: 12px;
}

.modal-form-col {
  flex: 1;
  min-width: 0;
}

.modal-warning {
  background: rgba(255, 107, 107, 0.08);
  border: 1px solid rgba(255, 107, 107, 0.4);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.modal-warning strong {
  color: var(--danger);
}

/* ─── Progress bar ──────────────────────────────────── */

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.15s linear;
}

.progress-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  font-family: var(--mono);
}

/* ─── Live restore stdout viewer ────────────────────── */

.restore-stdout {
  background: var(--bg);
  font-family: var(--mono);
  font-size: 12px;
  padding: 12px;
  height: 100%;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.restore-stdout .log-line {
  padding: 1px 0;
}

.restore-stdout .log-stderr {
  color: var(--stderr);
}

.restore-stdout .log-stdout {
  color: var(--stdout);
}

.restore-status-pill {
  display: inline-block;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 10px;
  font-weight: 600;
  margin-left: 8px;
}

.restore-status-pill.running {
  background: rgba(108, 140, 255, 0.15);
  color: var(--accent);
}

.restore-status-pill.success {
  background: rgba(78, 205, 196, 0.15);
  color: var(--success);
}

.restore-status-pill.failed {
  background: rgba(255, 107, 107, 0.15);
  color: var(--danger);
}

/* ─── Toasts ────────────────────────────────────────── */

#toast-root {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1100;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 420px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  animation: toast-in 0.2s ease-out;
}

.toast-success {
  border-left: 3px solid var(--success);
}

.toast-error {
  border-left: 3px solid var(--danger);
}

.toast-info {
  border-left: 3px solid var(--accent);
}

.toast-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.toast-body {
  color: var(--text-muted);
  font-size: 12px;
  word-break: break-word;
}

.toast-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.toast-actions .btn {
  font-size: 11px;
  padding: 3px 8px;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ─── Floating upload progress chip ─────────────────── */

.upload-chip {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 1100;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 10px 14px;
  min-width: 260px;
  max-width: 320px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  animation: toast-in 0.2s ease-out;
}

.upload-chip:hover {
  border-color: var(--accent);
}

.upload-chip-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.upload-chip-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--mono);
  margin-bottom: 2px;
}

.upload-chip-eta {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--mono);
  margin-bottom: 6px;
}

.upload-chip-bar {
  width: 100%;
  height: 4px;
  background: var(--bg);
  border-radius: 2px;
  overflow: hidden;
}

.upload-chip-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.15s linear;
}

/* ─── Observability page ──────────────────────────────── */

/* The panels below set `display` on elements that are also toggled with the
   `hidden` attribute, and a `display` rule beats the attribute's UA default. */
[hidden] {
  display: none !important;
}

.obs-store-status {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--success);
}

.obs-store-status.obs-store-down {
  color: var(--danger);
}

/* Setup / indexing gate */

.obs-setup {
  display: flex;
  justify-content: center;
  padding-top: 48px;
}

.obs-setup-card {
  max-width: 620px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.obs-setup-card h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
}

.obs-setup-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
}

.obs-setup-error {
  margin-top: 14px;
  font-size: 13px;
  color: var(--danger);
}

/* Filters */

.obs-filters {
  margin-bottom: 18px;
}

.obs-filter-note {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--mono);
  padding-bottom: 9px;
}

/* Stat tiles */

.obs-stats {
  display: grid;
  grid-template-columns: 1.6fr repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.obs-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.obs-stat-value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.obs-hero-value {
  font-size: 48px;
  line-height: 1.05;
}

.obs-stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-top: 6px;
}

.obs-stat-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Status tones are the reserved status palette, always paired with the tile
   label — the colour never carries the meaning on its own. */
.obs-tone-good { color: #0ca30c; }
.obs-tone-warning { color: #fab219; }
.obs-tone-critical { color: #d03b3b; }

/* Panels */

.obs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding-bottom: 24px;
  transition: opacity 0.2s;
}

.obs-grid.obs-loading {
  opacity: 0.45;
  pointer-events: none;
}

.obs-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 16px;
  min-width: 0;
}

.obs-panel-full {
  grid-column: 1 / -1;
}

.obs-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.obs-panel-heading h3 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.obs-panel-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.obs-panel-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.obs-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.obs-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
}

.obs-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.obs-legend-line {
  width: 14px;
  height: 2px;
  border-radius: 1px;
}

.obs-panel-body {
  min-height: 60px;
  outline: none;
}

.obs-panel-body:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
  border-radius: 3px;
}

.obs-chart-svg {
  display: block;
  overflow: visible;
}

.obs-axis-label {
  font-size: 10px;
  fill: #8a90a0;
  font-family: var(--mono);
}

.obs-peak-label,
.obs-end-label {
  font-size: 11px;
  font-weight: 600;
  fill: var(--text);
  font-family: var(--mono);
}

.obs-cursor-band {
  fill: rgba(255, 255, 255, 0.05);
}

/* Top lists */

.obs-toplist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.obs-toplist-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px auto;
  align-items: center;
  gap: 10px;
  padding: 3px 4px;
  border-radius: 3px;
  outline: none;
}

.obs-toplist-row:hover,
.obs-toplist-row:focus-visible {
  background: var(--surface-raised);
}

.obs-toplist-label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Keeps the tail of a long name visible (Sidekiq worker classes) by moving the
   ellipsis to the front. These names are letters and `::` only, so flipping the
   base direction does not reorder anything inside them. */
.obs-toplist-label.obs-truncate-start {
  direction: rtl;
  text-align: left;
}

.obs-toplist-track {
  display: block;
  height: 10px;
}

.obs-toplist-bar {
  display: block;
  height: 100%;
  border-radius: 0 4px 4px 0;
}

.obs-toplist-value {
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  min-width: 60px;
  text-align: right;
}

/* Recent errors */

.obs-error-list {
  list-style: none;
  max-height: 340px;
  overflow-y: auto;
}

.obs-error-row {
  display: grid;
  grid-template-columns: 150px 170px minmax(0, 1fr);
  gap: 12px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-family: var(--mono);
}

.obs-error-row:last-child {
  border-bottom: none;
}

.obs-error-time {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.obs-error-source {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.obs-error-message {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Table views */

.obs-panel-table {
  max-height: 340px;
  overflow: auto;
}

.obs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.obs-table thead {
  position: sticky;
  top: 0;
  background: var(--surface);
}

.obs-table th {
  text-align: left;
  padding: 7px 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.obs-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.obs-td-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Tooltip */

.obs-tooltip {
  position: fixed;
  /* Above the modal backdrop (999): the dyno window has charts of its own. */
  z-index: 1001;
  pointer-events: none;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  min-width: 150px;
  max-width: 440px;
}

.obs-tooltip-title {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  word-break: break-all;
}

.obs-tooltip-row {
  display: flex;
  align-items: baseline;
  gap: 7px;
  line-height: 1.7;
}

.obs-tooltip-key {
  width: 12px;
  height: 2px;
  border-radius: 1px;
  flex-shrink: 0;
  transform: translateY(-3px);
}

.obs-tooltip-value {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.obs-tooltip-label {
  font-size: 11px;
  color: var(--text-muted);
}

@media (max-width: 1280px) {
  .obs-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .obs-stat-hero {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .obs-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .obs-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Live refresh toggle */

.obs-live-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.obs-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.obs-live-btn.active .obs-live-dot {
  background: var(--success);
  animation: obs-live-pulse 2s ease-in-out infinite;
}

@keyframes obs-live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

@media (prefers-reduced-motion: reduce) {
  .obs-live-btn.active .obs-live-dot {
    animation: none;
  }
}

.obs-setup-auto {
  margin-bottom: 16px;
  padding: 10px 12px;
  border-left: 2px solid var(--accent);
  background: var(--surface-raised);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

/* Legend entries double as series filters */

.obs-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 2px 7px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}

.obs-legend-item:hover {
  background: var(--surface-raised);
  border-color: var(--border);
  color: var(--text);
}

.obs-legend-item:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

/* Switched off: the swatch keeps its hue at low opacity so the row is still
   recognisable as the series you turned off. */
.obs-legend-item.obs-legend-off {
  opacity: 0.4;
}

.obs-legend-item.obs-legend-off span:last-child {
  text-decoration: line-through;
}

.obs-toplist-row {
  cursor: pointer;
  user-select: none;
}

.obs-toplist-row.obs-toplist-off {
  opacity: 0.35;
}

.obs-toplist-row.obs-toplist-off .obs-toplist-label,
.obs-toplist-row.obs-toplist-off .obs-toplist-value {
  text-decoration: line-through;
}

/* Section headings inside the panel grid */

.obs-section {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}


/* ─── Heroku tab toolbar + searchable comboboxes ─────── */

.heroku-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.heroku-toolbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 6px;
}

.heroku-view-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

/* Toolbar icon buttons */

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.icon-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  fill: currentColor;
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.icon-btn:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

/* The two view buttons are one control: a segmented pair sharing a border. */
.icon-group {
  display: inline-flex;
}

.icon-group .icon-btn {
  border-radius: 0;
}

.icon-group .icon-btn:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.icon-group .icon-btn:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-left: -1px;
}

.icon-group .icon-btn[aria-pressed="true"] {
  background: var(--surface-raised);
  border-color: var(--accent);
  color: var(--text);
  z-index: 1;
}

/* Below this the toolbar needs the width more than the labels */
@media (max-width: 1180px) {
  .icon-btn span {
    display: none;
  }
  .icon-btn {
    padding: 6px 8px;
  }
}

.heroku-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.combobox {
  position: relative;
  width: 220px;
}

.combobox-wide {
  width: 260px;
}

.combobox-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--mono);
  text-overflow: ellipsis;
}

.combobox-input:focus {
  outline: none;
  border-color: var(--accent);
}

.combobox-list {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 60;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.combobox-list.open {
  display: block;
}

.combobox-option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--mono);
}

.combobox-option:hover {
  background: var(--surface);
}

.combobox-option-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combobox-option-meta {
  color: var(--text-muted);
  flex-shrink: 0;
}

.combobox-empty {
  padding: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

/* The Observability view scrolls as a whole inside the tab */

#heroku-obs-view {
  overflow-y: auto;
}

.obs-dashboard {
  display: flex;
  flex-direction: column;
}

/* ─── Drill-down modal ────────────────────────────────── */

.obs-chart-clickable {
  cursor: pointer;
}

.obs-entries-modal {
  width: min(1180px, 94vw);
  max-height: 84vh;
  display: flex;
  flex-direction: column;
}

.obs-entries-subtitle {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 3px;
  font-family: var(--mono);
  word-break: break-all;
  max-height: 3.4em;
  overflow: hidden;
}

.obs-entries-body {
  flex: 1;
  overflow: auto;
  min-height: 120px;
}

.obs-entries-foot {
  flex-shrink: 0;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.obs-entries-table {
  table-layout: auto;
}

.obs-entries-table td {
  max-width: 520px;
}

.obs-col-time {
  white-space: nowrap;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.obs-col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.obs-col-wide {
  max-width: 640px;
}

.obs-entry-error td:nth-child(2),
.obs-entry-fatal td:nth-child(2) {
  color: var(--danger);
}

.obs-entry-warn td:nth-child(2) {
  color: var(--warning);
}

/* Exclude control on a top-list row */

.obs-toplist-exclude {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s, color 0.12s, border-color 0.12s;
}

.obs-toplist-row {
  grid-template-columns: minmax(0, 1fr) 96px auto 20px;
}

.obs-toplist-row:hover .obs-toplist-exclude,
.obs-toplist-row:focus-within .obs-toplist-exclude,
.obs-toplist-row.obs-toplist-off .obs-toplist-exclude {
  opacity: 1;
}

.obs-toplist-exclude:hover {
  color: var(--text);
  border-color: var(--border);
}

.obs-toplist-exclude:focus-visible {
  opacity: 1;
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

/* Recent-error rows are drill-downs too */

.obs-error-row {
  cursor: pointer;
  outline: none;
}

.obs-error-row:hover,
.obs-error-row:focus-visible {
  background: var(--surface-raised);
}

/* Drill-down rows that lead somewhere */

.obs-entry-clickable {
  cursor: pointer;
}

.obs-entry-clickable:hover,
.obs-entry-clickable:focus-visible {
  background: var(--surface-raised);
  outline: none;
}

.obs-entries-back {
  margin-right: 12px;
  flex-shrink: 0;
  align-self: flex-start;
}

.obs-entries-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.obs-entries-note {
  color: var(--text-muted);
  opacity: 0.75;
  text-align: right;
}

/* ─── Users ───────────────────────────────────────────── */

.user-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.user-badge-active {
  color: #0ca30c;
  border-color: rgba(12, 163, 12, 0.35);
}

.user-badge-temp {
  color: #fab219;
  border-color: rgba(250, 178, 25, 0.35);
}

.user-badge-set {
  color: var(--text-muted);
}

.user-self {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin-left: 6px;
}

.user-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

#user-table tbody tr {
  cursor: default;
}

#user-table td:first-child,
#user-table td:nth-child(5),
#user-table td:nth-child(6) {
  white-space: nowrap;
}

#user-table td:last-child {
  width: 1%;
  white-space: nowrap;
}

.modal-small {
  width: min(460px, 92vw);
}

/* The user form stacks its fields; the shared .modal-body rules are unchanged. */
.modal-small .modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.user-form-field input {
  width: 100%;
}

.user-form-note {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.user-form-note code {
  font-family: var(--mono);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--text);
}

/* Links found inside log text */

.obs-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.obs-link:hover {
  color: var(--accent-hover);
}

/* ─── Webhooks panel ─────────────────────────────────── */

.obs-webhook-list {
  max-height: 520px;
  overflow-y: auto;
}

.obs-webhook-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px 116px 136px 64px 64px 64px 132px;
  align-items: center;
  gap: 12px;
  padding: 7px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  outline: none;
}

.obs-webhook-row:last-child {
  border-bottom: none;
}

.obs-webhook-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.obs-webhook-head span:not(:first-child) {
  text-align: right;
}

.obs-webhook-clickable {
  cursor: pointer;
}

.obs-webhook-clickable:hover,
.obs-webhook-clickable:focus-visible {
  background: var(--surface-raised);
}

.obs-webhook-name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  min-width: 0;
}

.obs-webhook-name strong {
  font-weight: 600;
  color: var(--text);
}

.obs-webhook-name > span:not(.obs-webhook-route) {
  color: var(--text);
}

.obs-webhook-route {
  flex-basis: 100%;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.obs-webhook-deliveries {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.obs-webhook-spark {
  flex-shrink: 0;
}

.obs-webhook-spark-base {
  stroke: var(--border);
  stroke-width: 1;
}

.obs-webhook-num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--text);
  white-space: nowrap;
}

.obs-webhook-muted {
  color: var(--text-muted);
}

.obs-webhook-failed {
  justify-self: end;
  display: block;
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--danger);
  background: rgba(208, 59, 59, 0.12);
  border: 1px solid rgba(208, 59, 59, 0.35);
  border-radius: 10px;
  padding: 1px 8px;
  cursor: pointer;
  white-space: nowrap;
}

.obs-webhook-failed:hover,
.obs-webhook-failed:focus-visible {
  background: rgba(208, 59, 59, 0.22);
  outline: none;
}

/* A webhook that sent nothing stays listed, just quieter — a silent provider
   is the row worth finding, so it is dimmed, not hidden. */
.obs-webhook-silent .obs-webhook-name strong,
.obs-webhook-silent .obs-webhook-name > span:not(.obs-webhook-route),
.obs-webhook-silent .obs-webhook-num {
  color: var(--text-muted);
}

.obs-legend-item:disabled {
  cursor: default;
  background: transparent;
  border-color: transparent;
}

@media (max-width: 1180px) {
  .obs-webhook-row {
    grid-template-columns: minmax(0, 1fr) 124px 108px 128px 64px 124px;
  }
  /* p50 and max drop out first; p95 and last received carry the signal. */
  .obs-webhook-row > :nth-child(5),
  .obs-webhook-row > :nth-child(7) {
    display: none;
  }
}

@media (max-width: 720px) {
  .obs-webhook-row {
    grid-template-columns: minmax(0, 1fr) 60px 96px 110px;
  }
  .obs-webhook-row > :nth-child(6),
  .obs-webhook-row > :nth-child(8),
  .obs-webhook-spark {
    display: none;
  }
}

/* ─── Drill-down modal filters ─────────────────────────── */

.obs-entries-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.obs-entries-search,
.obs-entries-select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius);
  font-size: 13px;
}

.obs-entries-search {
  flex: 1 1 260px;
  min-width: 0;
  font-family: var(--mono);
}

.obs-entries-select {
  flex: 0 1 auto;
  max-width: 240px;
}

.obs-entries-search:focus,
.obs-entries-select:focus {
  outline: none;
  border-color: var(--accent);
}

.obs-entries-count {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
}

.obs-webhook-jobs {
  justify-self: end;
  display: block;
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 8px;
  cursor: pointer;
  white-space: nowrap;
}

.obs-webhook-jobs:hover,
.obs-webhook-jobs:focus-visible {
  border-color: var(--accent);
  outline: none;
}

/* ─── Exceptions panel ───────────────────────────────── */

.obs-exc-list {
  max-height: 460px;
  overflow-y: auto;
}

.obs-exc-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 70px 128px 128px;
  align-items: center;
  gap: 12px;
  padding: 7px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

.obs-exc-row:last-child {
  border-bottom: none;
}

.obs-exc-row:not(.obs-exc-head):hover,
.obs-exc-row:not(.obs-exc-head):focus-visible {
  background: var(--surface-raised);
}

.obs-exc-head {
  position: sticky;
  top: 0;
  z-index: 1;
  cursor: default;
  background: var(--surface);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.obs-exc-head span:not(:first-child) {
  text-align: right;
}

.obs-exc-name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  min-width: 0;
}

.obs-exc-name strong {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
}

.obs-exc-message {
  flex-basis: 100%;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.obs-exc-count {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.obs-exc-bar {
  display: block;
  height: 8px;
  flex: none;
  background: var(--danger);
  opacity: 0.7;
  border-radius: 0 3px 3px 0;
}

.obs-badge {
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 8px;
  padding: 1px 6px;
}

.obs-badge-new {
  color: #1a1206;
  background: var(--warning);
}

@media (max-width: 900px) {
  .obs-exc-row {
    grid-template-columns: minmax(0, 1fr) 110px 110px;
  }
  .obs-exc-row > :nth-child(3),
  .obs-exc-row > :nth-child(4) {
    display: none;
  }
}

/* Deploy markers */

.obs-deploy-label {
  font-size: 10px;
  font-family: var(--mono);
  fill: #b58cf5;
}

/* ─── Trends view ────────────────────────────────────── */

.obs-trends-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 16px;
}

.obs-day {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: transparent;
  white-space: nowrap;
}

button.obs-day {
  cursor: pointer;
}

.obs-day-indexed {
  color: var(--text);
  background: rgba(57, 135, 229, 0.14);
  border-color: rgba(57, 135, 229, 0.45);
}

button.obs-day-indexed:hover,
button.obs-day-indexed:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.obs-day-archived {
  color: var(--text);
  background: rgba(57, 135, 229, 0.07);
  border-style: dashed;
}

.obs-day-not-indexed {
  border-color: rgba(250, 178, 25, 0.5);
  color: var(--warning);
}

.obs-day-no-file {
  opacity: 0.55;
}

/* Indexed by an older parser: counts are fine, exception groups are missing. */
.obs-day-stale {
  box-shadow: inset 0 -2px 0 var(--warning);
}

/* ─── Popup link button ──────────────────────────────── */

.obs-entries-copy {
  margin-left: auto;
}

/* ─── Keyboard shortcuts ─────────────────────────────── */

.shortcut-modal {
  width: min(420px, 92vw);
}

.shortcut-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  padding: 16px 20px 20px;
  font-size: 13px;
}

.shortcut-list dt {
  text-align: right;
}

.shortcut-list dd {
  color: var(--text-muted);
}

kbd {
  display: inline-block;
  min-width: 22px;
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
  color: var(--text);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
}

#heroku-shortcuts-btn {
  min-width: 30px;
  justify-content: center;
  font-weight: 600;
}

/* The heading keeps its width; a long legend wraps under the title instead
   of squeezing it into a column. */
.obs-panel-heading {
  flex: 1 1 220px;
  min-width: 0;
}

.obs-panel-tools {
  flex: 0 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.obs-panel-head {
  flex-wrap: wrap;
}

.icon-btn-glyph {
  font-weight: 600;
}

/* ─── Global search ──────────────────────────────────── */

.heroku-toolbar {
  flex-wrap: wrap;
}

.global-search {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 360px;
  min-width: 0;
  max-width: 640px;
}

.global-search label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.global-search-row {
  display: flex;
  gap: 6px;
  min-width: 0;
}

.global-search-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.global-search-row select {
  flex: 0 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 8px;
  border-radius: var(--radius);
  font-size: 13px;
}

.global-search-row select:focus {
  outline: none;
  border-color: var(--accent);
}

.global-search-row .btn {
  flex: 0 0 auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .global-search {
    flex-basis: 100%;
    max-width: none;
    order: 3;
  }
}

/* View switcher: with more than two buttons the middle ones overlap their
   neighbour's border too, so the group reads as one control. */
.icon-group .icon-btn + .icon-btn {
  margin-left: -1px;
}

/* ─── Infrastructure view ─────────────────────────────── */

.obs-ref-label {
  font-size: 10px;
  font-weight: 600;
  fill: #d03b3b;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.infra-table-wrap {
  overflow-x: auto;
}

.infra-events-wrap {
  max-height: 320px;
  overflow-y: auto;
}

.infra-dyno-table tbody tr.obs-row-clickable {
  cursor: pointer;
}

.infra-dyno-table tbody tr.obs-row-clickable:hover,
.infra-dyno-table tbody tr.obs-row-clickable:focus-visible {
  background: var(--surface-raised);
  outline: none;
}

.infra-row-finished td {
  color: var(--text-muted);
}

.infra-dyno-name {
  white-space: nowrap;
}

/* The colour tab ties a row to its line on the charts below. */
.infra-dyno-name strong {
  display: inline-block;
  padding-left: 8px;
  border-left: 3px solid transparent;
  font-weight: 600;
}

.infra-dyno-tag {
  margin-left: 8px;
  padding: 1px 6px;
  font-family: inherit;
  font-size: 10px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.infra-state {
  display: inline-block;
  padding: 2px 8px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid currentColor;
}

.infra-state-good { color: #0ca30c; }
.infra-state-warning { color: #fab219; }
.infra-state-critical { color: #d03b3b; }
.infra-state-muted { color: var(--text-muted); }

.infra-meter {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
}

.infra-meter-track {
  flex: 0 0 90px;
  height: 6px;
  background: var(--surface-raised);
  border-radius: 3px;
  overflow: hidden;
}

.infra-meter-fill {
  height: 100%;
  background: #3987e5;
  border-radius: 3px;
}

.infra-meter-warning { background: #fab219; }
.infra-meter-critical { background: #d03b3b; }

.infra-meter-label {
  white-space: nowrap;
}

.infra-notice {
  margin: 0 0 16px;
}

/* Dyno detail window */

.infra-dyno-modal {
  width: min(1240px, 95vw);
  max-height: 90vh;
}

.infra-dyno-titleline {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
}

.infra-dyno-body {
  padding: 16px 18px 18px;
  overflow-y: auto;
  transition: opacity 0.2s;
}

.infra-dyno-body.obs-loading {
  opacity: 0.45;
}

.infra-mini-stats {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.infra-mini-stat {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  min-width: 0;
}

.infra-mini-value {
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.infra-mini-stat .obs-stat-note {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.infra-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.infra-legend-static {
  cursor: default;
}

.infra-lines-list {
  list-style: none;
  height: 216px;
  overflow-y: auto;
  font-size: 12px;
}

.infra-line {
  display: grid;
  grid-template-columns: 64px 118px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  padding: 5px 2px;
  border-bottom: 1px solid var(--border);
}

.infra-line-time {
  font-family: var(--mono);
  color: var(--text-muted);
}

.infra-line-kind {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  white-space: nowrap;
}

.infra-line-text {
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.infra-line-event .infra-line-kind,
.infra-line-event .infra-line-text {
  color: var(--text);
}

@media (max-width: 1100px) {
  .infra-mini-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .infra-detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .infra-mini-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* What a dyno was started to run */

.infra-dyno-task {
  display: block;
  margin-top: 3px;
  padding-left: 11px;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

.infra-dyno-task-rake {
  color: var(--accent);
}

.infra-run {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  font-size: 13px;
}

.infra-run-verb {
  color: var(--text-muted);
}

.infra-run-command {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

.infra-run-facts {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
}

/* The one-off run(s) behind a folded series point */
.obs-tooltip-note {
  margin: -2px 0 4px 19px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.45;
  color: var(--accent);
  overflow-wrap: anywhere;
}

/* ─── Staging tab ───────────────────────────────────── */

.staging-tab {
  overflow-y: auto;
}

.staging-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.staging-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.staging-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.staging-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.staging-head-actions {
  display: flex;
  gap: 8px;
}

.staging-head-actions a.btn {
  text-decoration: none;
}

.staging-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding-bottom: 24px;
}

.staging-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

#staging-snapshot-meta {
  margin-bottom: 10px;
}

.staging-grid code,
.staging-confirm-form code,
.terminal-note code {
  font-family: var(--mono);
  font-size: 0.92em;
  color: var(--text);
}

.staging-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  font-size: 13px;
}

.staging-notice-warning { border-left-color: #fab219; }
.staging-notice-error { border-left-color: var(--danger); }

.staging-notice-title {
  font-weight: 600;
}

.staging-notice-body {
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.staging-notice .btn {
  flex-shrink: 0;
}

.staging-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 16px;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: var(--surface-raised);
  border-radius: var(--radius);
}

.staging-facts dt {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.staging-facts dd {
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.staging-facts dd small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
}

.staging-warning {
  margin: -4px 0 14px;
  font-size: 12px;
  color: #fab219;
}

.staging-plan {
  margin: 0 0 14px 18px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-muted);
}

.staging-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
}

.staging-check input {
  margin-top: 2px;
  accent-color: var(--accent);
}

.staging-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.staging-last {
  font-size: 12px;
  color: var(--text-muted);
}

.staging-run-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
}

#staging-refresh-meta {
  margin-bottom: 10px;
}

.staging-run-success { color: var(--success); }
.staging-run-failed { color: var(--danger); }

.staging-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.staging-step {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
  font-size: 13px;
}

.staging-step-icon {
  text-align: center;
  font-weight: 700;
}

.staging-step-pending,
.staging-step-skipped { color: var(--text-muted); }
.staging-step-running .staging-step-icon { color: var(--accent); animation: pulse 1.5s infinite; }
.staging-step-done .staging-step-icon { color: #0ca30c; }
.staging-step-failed { color: var(--danger); }

.staging-step-note {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  overflow-wrap: anywhere;
}

.staging-log {
  flex: none;
  height: 280px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.log-info {
  color: var(--accent);
}

.staging-formation {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.staging-chip {
  padding: 2px 8px;
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.staging-chip-off {
  color: var(--text-muted);
}

.staging-dyno {
  display: grid;
  grid-template-columns: minmax(96px, auto) auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 7px 0;
  font-size: 12px;
  border-top: 1px solid var(--border);
}

.staging-dyno-name {
  font-family: var(--mono);
  font-weight: 600;
}

.staging-dyno-cmd {
  font-family: var(--mono);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.staging-dyno-cmd b {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-weight: 600;
  color: var(--accent);
}

.staging-dyno-when,
.staging-empty {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.staging-run-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.staging-run-form:focus-within { border-color: var(--accent); }
.staging-run-form.blocked { border-color: var(--danger); }

.staging-prompt {
  font-family: var(--mono);
  color: var(--success);
}

.staging-command {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
}

.staging-block-msg {
  margin-top: 6px;
  font-size: 12px;
  color: var(--danger);
}

.staging-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.staging-preset {
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}

.staging-preset:hover,
.staging-preset:focus-visible {
  color: var(--text);
  border-color: var(--accent);
  outline: none;
}

.staging-rules {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.staging-rules summary {
  cursor: pointer;
  width: fit-content;
}

.staging-rules ul {
  margin: 8px 0 6px 18px;
  line-height: 1.7;
}

.staging-output {
  margin-top: 14px;
}

.staging-output-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.staging-output-head .restore-status-pill {
  margin-left: 0;
}

.staging-output-head .btn {
  margin-left: auto;
}

.staging-output-cmd {
  max-width: 100%;
  padding: 3px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--surface-raised);
  border-radius: 4px;
}

.restore-status-pill.stopped {
  background: rgba(122, 127, 142, 0.15);
  color: var(--text-muted);
}

.staging-table-wrap {
  overflow-x: auto;
}

.staging-activity td {
  font-size: 12px;
}

.staging-activity tbody tr {
  cursor: default;
}

.staging-activity tbody tr.staging-row-live {
  cursor: pointer;
}

.staging-activity tbody tr.staging-row-live:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

.staging-detail {
  max-width: 520px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
}

.staging-confirm .modal-section-row {
  gap: 16px;
}

.staging-confirm .modal-section-value {
  text-align: right;
  overflow-wrap: anywhere;
}

.staging-confirm-form {
  margin-top: 14px;
}

.terminal-note {
  padding: 8px 18px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
}

@media (max-width: 1100px) {
  .staging-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .staging-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .staging-dyno {
    grid-template-columns: minmax(80px, auto) auto minmax(0, 1fr);
  }

  .staging-dyno-when {
    display: none;
  }

  .staging-notice {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Deploy marker toggle: the swatch matches the dashed chart line. */
.obs-deploys-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.obs-deploys-swatch {
  width: 0;
  height: 12px;
  border-left: 2px dashed #b58cf5;
  opacity: 0.4;
}

.obs-deploys-toggle.active .obs-deploys-swatch {
  opacity: 1;
}

.obs-deploys-toggle:not(.active) span:last-child {
  text-decoration: line-through;
  color: var(--text-muted);
}

.staging-confirm-note {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}
