/* ============================================================
   database.css — Test Database page styles
   Design tokens from theme.css; component patterns from components.css
   ============================================================ */

/* ── Page shell ── */
.tdb-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Service banner styles removed — empty-state inside table handles this now */

/* ── Toolbar buttons — uniform size ── */
.tdb-btn {
  width: 90px;
  text-align: center;
  padding: 5px 0;
  font-size: 12px;
  box-sizing: border-box;
}

.tdb-control-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px 8px 8px;
}

.tdb-control-side {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tdb-panel-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--txt-muted);
}

.tdb-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tdb-panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.tdb-action-btn {
  width: 96px;
  min-width: 96px;
  text-align: center;
  padding-left: 0;
  padding-right: 0;
}

.tdb-status-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 14px;
  align-items: center;
  font-size: 11px;
  color: var(--txt-main);
}

.tdb-mini-status {
  font-size: 10px;
  border: 1px solid #cfd8e3;
  border-radius: 3px;
  padding: 1px 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.tdb-mini-status.stable {
  background: #e6f4e6;
  color: #107c10;
  border-color: #8bcb8b;
}
.tdb-mini-status.watch {
  background: #fff3e0;
  color: #f28e2b;
  border-color: #f3c57a;
}
.tdb-mini-status.fault {
  background: #fde8e8;
  color: #d13438;
  border-color: #f1a0a0;
}

.tdb-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: end;
}

.tdb-settings-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10px;
  color: var(--txt-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.tdb-settings-grid input {
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--txt-main);
  padding: 0 8px;
}

/* ── Main content area: table + drawer ── */
.tdb-body {
  display: flex;
  flex: 1;
  min-height: 0;
  height: 100%;
  gap: 0;
  padding: 8px;
  overflow: hidden;
}

/* ── Table panel ── */
.tdb-table-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

/* Table toolbar */
.tdb-table-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.tdb-table-toolbar-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #4e5a66;
}
.tdb-count {
  font-size: 10px;
  color: var(--txt-muted);
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
}

/* Import drop zone overlay */
.tdb-table-wrap.drag-over {
  outline: 2px dashed var(--brand);
  outline-offset: -2px;
}

/* Table scroll */
.tdb-table-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  max-height: none;
  display: flex;
  flex-direction: column;
}

/* Table */
.tdb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.tdb-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
  padding: 5px 10px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--txt-muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
}
.tdb-table thead th:hover { color: var(--txt-main); }
.tdb-table thead th.sorted { color: var(--brand); }
.tdb-table thead th .sort-icon { margin-left: 3px; opacity: .6; }

.tdb-table tbody tr {
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .1s;
}
.tdb-table tbody tr:last-child { border-bottom: none; }
.tdb-table tbody tr:hover   { background: var(--bg-alt); }
.tdb-table tbody tr.active  {
  background: var(--bg-alt);
  box-shadow: inset 3px 0 0 var(--brand);
}
.tdb-table tbody td {
  padding: 7px 10px;
  color: var(--txt-main);
  white-space: nowrap;
}
.tdb-table tbody td.mono {
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 11px;
}
.tdb-table tbody td.muted { color: var(--txt-muted); }

/* Checkbox column */
.tdb-table th.col-check,
.tdb-table td.col-check {
  width: 32px;
  text-align: center;
  cursor: default;
  padding: 0 6px;
}
.tdb-check {
  width: 14px; height: 14px;
  cursor: pointer;
  accent-color: var(--brand);
}

/* Row action (export icon on hover) */
.tdb-row-action {
  opacity: 0;
  font-family: 'Segoe MDL2 Assets', sans-serif;
  font-size: 13px;
  color: var(--txt-muted);
  padding: 2px 4px;
  border-radius: 3px;
  cursor: pointer;
  transition: opacity .15s, color .15s, background .15s;
  margin-right: 2px;
}
.tdb-table tbody tr:hover .tdb-row-action { opacity: 1; }
.tdb-row-action:hover { color: var(--brand); background: var(--bg-alt); }
.tdb-row-delete:hover { color: #d13438; background: #fde8e8; }

.tdb-icon {
  font-family: 'Segoe MDL2 Assets', sans-serif;
  font-size: 13px;
  line-height: 1;
}

.tdb-btn-danger {
  color: #d13438;
  border-color: #f1a0a0;
  background: #fde8e8;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tdb-btn-danger:hover {
  color: #b02a2f;
  border-color: #e68c93;
  background: #fbd7db;
}

.tdb-mode-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid #cfd8e3;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.tdb-mode-badge.good {
  color: #107c10;
  background: #e6f4e6;
  border-color: #8bcb8b;
}

.tdb-mode-badge.mid {
  color: #7b5b1a;
  background: #fff3e0;
  border-color: #f3c57a;
}

.tdb-mode-badge.poor {
  color: #d13438;
  background: #fde8e8;
  border-color: #f1a0a0;
}

/* Empty state — fills the entire tbody cell and centres content */
.tdb-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  /* Fill the scroll container — works via the table height rules below */
  min-height: calc(100vh - 220px);
  padding: 24px;
  color: var(--txt-muted);
  font-size: 12px;
  box-sizing: border-box;
  text-align: center;
}
.tdb-empty-icon {
  font-family: 'Segoe MDL2 Assets', sans-serif;
  font-size: 40px;
  color: var(--txt-muted);
  opacity: .35;
  margin-bottom: 4px;
}

/* Table bottom bar */
.tdb-table-bottom {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.tdb-selected-label {
  font-size: 11px;
  color: var(--txt-muted);
  margin-right: 2px;
}

/* ── Detail drawer ── */
.tdb-drawer {
  display: none;
  flex-direction: column;
  width: 340px;
  min-width: 340px;
  max-width: 340px;
  margin-left: 8px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.tdb-drawer.open { display: flex; }

.tdb-drawer-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.tdb-drawer-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #4e5a66;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tdb-drawer-close {
  font-family: 'Segoe MDL2 Assets', sans-serif;
  font-size: 14px;
  color: var(--txt-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  transition: color .15s, background .15s;
  line-height: 1;
}
.tdb-drawer-close:hover { color: var(--txt-main); background: var(--bg-alt); }

.tdb-drawer-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* KPI block */
.tdb-kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.tdb-kpi-cell {
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  background: var(--bg-card);
  gap: 1px;
}
.tdb-kpi-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--txt-muted);
}
.tdb-kpi-val {
  font-size: 16px;
  font-weight: 700;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  color: var(--txt-main);
  line-height: 1.2;
}
.tdb-kpi-sub {
  font-size: 10px;
  color: var(--txt-muted);
  font-family: 'Cascadia Code', 'Consolas', monospace;
}

/* Section headers inside drawer */
.tdb-section-head {
  padding: 6px 10px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--txt-muted);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

/* Time series chart container */
.tdb-chart { flex: 0 0 130px; min-height: 130px; }

.tdb-drawer-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-bottom: 1px solid var(--line);
}

.tdb-drawer-tabs-two {
  grid-template-columns: repeat(2, 1fr);
}

.tdb-drawer-tab {
  height: 30px;
  border: none;
  border-right: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--txt-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  cursor: pointer;
}

.tdb-drawer-tab:last-child {
  border-right: none;
}

.tdb-drawer-tab.active {
  color: var(--brand);
  background: var(--bg-alt);
}

.tdb-drawer-panel {
  padding-bottom: 6px;
}

.tdb-event-chips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 8px 10px 4px;
}

.tdb-event-chip {
  border: 1px solid var(--line);
  border-left: 3px solid var(--evt, var(--brand));
  border-radius: 6px;
  padding: 5px 6px;
  background: var(--bg-alt);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tdb-event-chip span {
  font-size: 9px;
  color: var(--txt-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.tdb-event-chip strong {
  font-size: 11px;
  color: var(--txt-main);
  font-family: 'Cascadia Code', 'Consolas', monospace;
}

.tdb-pin-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 10px;
}

.tdb-pin-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-card);
  padding: 6px 7px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tdb-pin-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tdb-pin-card-title {
  font-size: 11px;
  font-weight: 700;
}

.tdb-pin-card-peak {
  font-size: 10px;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-weight: 700;
}

.tdb-pin-metrics {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 9px;
  color: var(--txt-muted);
  font-family: 'Cascadia Code', 'Consolas', monospace;
}

.tdb-exposure-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tdb-exposure-list span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9px;
  color: var(--txt-main);
  font-family: 'Cascadia Code', 'Consolas', monospace;
  white-space: nowrap;
}

.tdb-exposure-list em {
  color: var(--txt-muted);
  font-style: normal;
}

.tdb-exposure-list b {
  color: var(--txt-main);
  font-weight: 700;
}

.tdb-baseline-panel {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tdb-baseline-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tdb-baseline-state {
  font-size: 10px;
  color: var(--txt-muted);
}

.tdb-health-score {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-alt);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tdb-health-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.tdb-health-score span {
  font-size: 26px;
  line-height: 1;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-weight: 700;
}

.tdb-health-score small {
  font-size: 10px;
  letter-spacing: .08em;
  font-weight: 700;
}

.tdb-health-meter {
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.tdb-health-meter i {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ef4444 0%, #f59e0b 45%, #10b981 100%);
}

.tdb-health-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.tdb-health-breakdown span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--txt-muted);
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 9px;
  padding: 3px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tdb-health-score.healthy { color: #107c10; }
.tdb-health-score.watch   { color: #b26a00; }
.tdb-health-score.risk    { color: #d13438; }

.tdb-baseline-table td,
.tdb-baseline-table th {
  padding-left: 6px;
  padding-right: 6px;
}

.tdb-insights {
  margin: 0;
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 10px;
  color: var(--txt-main);
}

.tdb-hardware-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tdb-hw-row {
  display: grid;
  grid-template-columns: 66px 1fr 1fr;
  gap: 6px;
  align-items: start;
  font-size: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-alt);
  padding: 4px 6px;
}

.tdb-hw-row.tdb-hw-single {
  grid-template-columns: 66px 1fr;
}

.tdb-hw-label {
  color: var(--txt-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.tdb-hw-cur,
.tdb-hw-base {
  color: var(--txt-main);
  font-family: 'Cascadia Code', 'Consolas', monospace;
  word-break: break-word;
}

/* Pin bars */
.tdb-pin-bars { padding: 6px 0; flex-shrink: 0; }
.tdb-pin-bar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  font-size: 11px;
}
.tdb-pin-bar-dot  { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.tdb-pin-bar-name { font-weight: 700; color: var(--txt-main); width: 28px; flex-shrink: 0; }
.tdb-pin-bar-wrap { flex: 1; height: 4px; background: var(--line); border-radius: 2px; }
.tdb-pin-bar-fill { height: 4px; border-radius: 2px; transition: width .2s; }
.tdb-pin-bar-val  {
  min-width: 44px;
  text-align: right;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 10px;
  color: var(--txt-main);
}

/* Drawer footer */
.tdb-drawer-foot {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

/* ── Compare modal ── */
.tdb-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.tdb-modal {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  width: min(820px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .18);
}
.tdb-modal-head {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.tdb-modal-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #4e5a66;
  flex: 1;
}
.tdb-modal-close {
  font-family: 'Segoe MDL2 Assets', sans-serif;
  font-size: 16px;
  color: var(--txt-muted);
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 3px;
  transition: color .15s, background .15s;
}
.tdb-modal-close:hover { color: var(--txt-main); background: var(--bg-alt); }
.tdb-modal-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Compare chart */
.tdb-compare-chart { flex: 0 0 200px; min-height: 200px; }

/* Compare diff table */
.tdb-diff-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.tdb-diff-table th {
  padding: 5px 10px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--txt-muted);
  border-bottom: 1px solid var(--line);
}
.tdb-diff-table td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--txt-main);
}
.tdb-diff-table tbody tr:last-child td { border-bottom: none; }
.tdb-diff-table td.mono {
  font-family: 'Cascadia Code', 'Consolas', monospace;
}
.tdb-diff-pos { color: #d13438; }
.tdb-diff-neg { color: #107c10; }

/* ── Toolbar status chip ── */
.tdb-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
}
.tdb-status-chip::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.tdb-status-chip.connected    { color: #107c10; background: #e6f4e6; border-color: #8bcb8b; }
.tdb-status-chip.disconnected { color: var(--txt-muted); background: var(--bg-alt); border-color: var(--line); }
.tdb-status-chip.installing   { color: #c47a1a; background: #fff3e0; border-color: #f3c57a; }
.tdb-status-chip.testing      { color: var(--brand); background: #e8f1fb; border-color: #9fc5ef; }

/* ── Progress bar (during test run) ── */
.tdb-progress-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  flex-shrink: 0;
  opacity: .9;
}
.tdb-progress-bar-bg {
  flex: 1;
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.tdb-progress-bar-fill {
  height: 3px;
  background: var(--brand);
  border-radius: 2px;
  width: 0%;
  transition: width .5s linear;
}
.tdb-progress-label {
  font-size: 10px;
  color: var(--txt-muted);
  min-width: 36px;
  text-align: right;
  font-family: 'Cascadia Code', 'Consolas', monospace;
}

/* ── Dark mode overrides ── */
body.dark-mode .tdb-table-wrap,
body.dark-mode .tdb-drawer,
body.dark-mode .tdb-modal        { background: #1e1e1e; border-color: #2f2f2f; }
body.dark-mode .tdb-service-banner { background: #1e1e1e; border-color: #2f2f2f; }
body.dark-mode .tdb-table-toolbar,
body.dark-mode .tdb-drawer-head,
body.dark-mode .tdb-modal-head,
body.dark-mode .tdb-drawer-foot,
body.dark-mode .tdb-table-bottom { border-color: #2a2a2a; }
body.dark-mode .tdb-table thead th { background: #1e1e1e; border-bottom-color: #2a2a2a; }
body.dark-mode .tdb-table tbody tr { border-bottom-color: #2a2a2a; }
body.dark-mode .tdb-table tbody tr:hover { background: #252525; }
body.dark-mode .tdb-table tbody tr.active { background: #252525; }
body.dark-mode .tdb-kpi-grid { background: #2a2a2a; }
body.dark-mode .tdb-kpi-cell { background: #1e1e1e; }
body.dark-mode .tdb-section-head { border-bottom-color: #2a2a2a; }
body.dark-mode .tdb-drawer-tabs,
body.dark-mode .tdb-drawer-tab,
body.dark-mode .tdb-event-chip,
body.dark-mode .tdb-pin-card,
body.dark-mode .tdb-health-score { border-color: #2a2a2a; }
body.dark-mode .tdb-drawer-tab.active { background: #252525; }
body.dark-mode .tdb-event-chip,
body.dark-mode .tdb-health-score { background: #252525; }
body.dark-mode .tdb-exposure-list em { color: #9aa0a6; }
body.dark-mode .tdb-health-breakdown span { border-color: #2a2a2a; background: #1f1f1f; }
body.dark-mode .tdb-hw-row { border-color: #2a2a2a; background: #1f1f1f; }
body.dark-mode .tdb-diff-table th { border-bottom-color: #2a2a2a; }
body.dark-mode .tdb-diff-table td { border-bottom-color: #2a2a2a; }
body.dark-mode .tdb-status-chip.connected  { background: #1a2e1a; color: #4caf50; border-color: #2d5a2d; }
body.dark-mode .tdb-status-chip.installing { background: #2d1f00; color: #f5a623; border-color: #5a3d00; }
body.dark-mode .tdb-status-chip.testing    { background: #0d2240; color: #4da3e8; border-color: #1e4a80; }
body.dark-mode .tdb-modal-backdrop         { background: rgba(0, 0, 0, .65); }
body.dark-mode .tdb-mini-status.stable { background: #1a2e1a; color: #4caf50; border-color: #2d5a2d; }
body.dark-mode .tdb-mini-status.watch  { background: #2d1f00; color: #f5a623; border-color: #5a3d00; }
body.dark-mode .tdb-mini-status.fault  { background: #2d1414; color: #e05252; border-color: #5a2a2a; }
body.dark-mode .tdb-btn-danger {
  color: #e05252;
  border-color: #5a2a2a;
  background: #2d1414;
}
body.dark-mode .tdb-btn-danger:hover {
  color: #f06a6a;
  border-color: #704040;
  background: #361818;
}

@media (max-width: 980px) {
  .tdb-control-panel {
    grid-template-columns: 1fr;
  }

  .tdb-settings-grid {
    grid-template-columns: 1fr 1fr;
  }

  .tdb-settings-grid .tdb-btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .tdb-panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .tdb-panel-actions {
    width: 100%;
  }

  .tdb-panel-actions .tdb-action-btn {
    width: 100%;
    min-width: 0;
  }

  .tdb-pin-details {
    grid-template-columns: 1fr;
  }

  .tdb-event-chips {
    grid-template-columns: 1fr;
  }

  .tdb-health-breakdown {
    grid-template-columns: 1fr;
  }

  .tdb-hw-row {
    grid-template-columns: 62px 1fr;
  }

  .tdb-hw-base {
    grid-column: 2;
  }
}

@media (max-width: 640px) {
  .tdb-pin-card { padding: 6px; }
}
