/* DSP Console app shell — uses the report's own theme variables (--bg2,
   --border2, --text, --text2), so light/dark mode follow the report toggle. */
.app-tabs {
  display: flex; gap: 2px; padding: 0 14px;
  border-bottom: 1px solid var(--border2); background: var(--bg2);
  position: sticky; top: 0; z-index: 50; overflow-x: auto;
}
.app-tabs a {
  padding: 9px 14px; font-size: 13px; color: var(--text2); text-decoration: none;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.app-tabs a:hover { color: var(--text); }
.app-tabs a.active { color: var(--text); border-bottom-color: #3b82f6; font-weight: 500; }
.app-status { margin-left: 12px; font-size: 12px; color: var(--text2); white-space: nowrap; }
.app-status.app-warn { color: #d97706; }
.app-status a { color: inherit; }
.app-coming { color: var(--text2); font-size: 14px; padding: 32px 16px; }

/* Live: the focus overlay becomes an in-flow section below the tabs. */
.app-sec[data-tab="live"] #focus-overlay {
  position: relative; inset: auto; z-index: auto;
  height: calc(100vh - 96px); min-height: 360px;
}
@media (max-width: 640px) {
  .app-tabs { padding: 0 8px; }
  .app-tabs a { padding: 9px 10px; }
  .app-status { display: block; margin: 4px 0 0; }
}
@media print { .app-tabs, .app-status { display: none !important; } }

/* Flags (phase 3) */
.flag-btn {
  margin-right: 4px; padding: 0 3px; font-size: 13px; line-height: 18px;
  background: none; border: 1px solid transparent; border-radius: 4px;
  color: var(--text2); opacity: .45; cursor: pointer;
}
tr:hover .flag-btn, .flag-btn:focus-visible { opacity: 1; border-color: var(--border2); }
.flag-btn.on { opacity: 1; color: #dc2626; font-weight: 600; }
tr.is-flagged td:first-child { box-shadow: inset 3px 0 0 #dc2626; }
.flag-filter.active { outline: 2px solid #dc2626; }
.app-flags { margin-left: 6px; font-size: 12px; color: #dc2626; }
.flag-pop {
  position: absolute; z-index: 9000; padding: 10px 12px;
  background: var(--bg2); color: var(--text);
  border: 1px solid var(--border2); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); font-size: 13px;
}
.flag-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.flag-state { font-size: 12px; color: var(--text2); white-space: nowrap; }
.flag-thread { list-style: none; margin: 0 0 8px; padding: 0; max-height: 220px; overflow-y: auto; }
.flag-thread li { padding: 6px 0; border-top: 1px solid var(--border2); }
.flag-meta { font-size: 11px; color: var(--text2); }
.flag-body { white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.flag-thread .fc-resolve .flag-meta { color: #16a34a; }
.flag-pop textarea {
  width: 100%; box-sizing: border-box; resize: vertical; font: inherit;
  background: var(--bg, transparent); color: inherit;
  border: 1px solid var(--border2); border-radius: 6px; padding: 6px;
}
.flag-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.flag-err { color: #dc2626; font-size: 12px; margin-top: 6px; }
.flag-history { margin-top: 8px; font-size: 12px; }
.flag-history summary { cursor: pointer; color: var(--text2); }
@media print { .flag-btn, .flag-filter, .flag-pop { display: none !important; } }

/* Summary (phase 4) */
.sum-kpis { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.sum-kpi { min-width: 96px; padding: 8px 12px; border: 1px solid var(--border2); border-radius: 8px; background: var(--bg2); }
.sum-kpi-v { font-size: 20px; font-weight: 600; color: var(--text); }
.sum-kpi-l { font-size: 11px; color: var(--text2); }
.sum-kpi.good .sum-kpi-v { color: #16a34a; }
.sum-kpi.warn .sum-kpi-v { color: #d97706; }
.sum-kpi.bad .sum-kpi-v { color: #dc2626; }
.sum-group h3 { font-size: 12px; letter-spacing: .04em; margin: 14px 0 6px; color: var(--text2); }
.sum-gcount { font-weight: 400; }
.sum-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.sum-tile {
  display: block; padding: 6px 8px; border-radius: 6px; text-decoration: none; color: var(--text);
  border: 1px solid var(--border2); background: var(--bg2); border-left-width: 4px; min-width: 0;
}
.sum-tile:hover { outline: 2px solid #3b82f6; }
.sum-tile-top { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text2); }
.sum-dot { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; flex-shrink: 0; }
.sum-flag { margin-left: auto; }
.sum-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sum-sub { font-size: 11px; color: var(--text2); }
.st-ok { border-left-color: #16a34a; } .st-ok .sum-dot { background: #16a34a; }
.st-warn { border-left-color: #d97706; } .st-warn .sum-dot { background: #d97706; }
.st-down { border-left-color: #dc2626; } .st-down .sum-dot { background: #dc2626; }
.st-down .sum-sub { color: #dc2626; }
.st-unmon .sum-dot { background: transparent; border: 2px solid currentColor; width: 6px; height: 6px; }
.sum-note { font-size: 12px; color: var(--text2); }

/* Monitor (phase 4) */
.mon-offline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 12px 0; font-size: 13px; }
.mon-offline strong { margin-right: 6px; }
.mon-chip {
  padding: 3px 8px; border-radius: 999px; font-size: 12px; text-decoration: none;
  color: #dc2626; border: 1px solid #dc262666; background: #dc262614;
}
.mon-controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.mon-controls input, .mon-controls select {
  font: inherit; font-size: 13px; padding: 4px 6px; border-radius: 6px;
  border: 1px solid var(--border2); background: var(--bg2); color: var(--text);
}
.mon-live { font-size: 12px; color: var(--text2); margin-left: auto; }
.mon-live.on { color: #16a34a; }
.mon-newbar {
  display: block; width: 100%; padding: 6px; margin-bottom: 4px; font: inherit; font-size: 12px;
  border: 1px dashed #3b82f6; background: #3b82f614; color: var(--text); border-radius: 6px; cursor: pointer;
}
.mon-log { max-height: calc(100vh - 260px); min-height: 240px; overflow-y: auto; border: 1px solid var(--border2); border-radius: 8px; }
.mon-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mon-table th { position: sticky; top: 0; background: var(--bg2); text-align: left; font-weight: 500; font-size: 11px; color: var(--text2); padding: 6px 10px; }
.mon-table td { padding: 5px 10px; border-top: 1px solid var(--border2); white-space: nowrap; }
.mon-t { font-variant-numeric: tabular-nums; color: var(--text2); }
.mon-ch { font-weight: 500; }
.mon-grp { font-size: 10px; color: var(--text2); }
.ev-offline .mon-ev { color: #dc2626; }
.ev-online .mon-ev { color: #16a34a; }
.mon-d { font-variant-numeric: tabular-nums; }
.ev-fresh { animation: mon-flash 2.5s ease-out; }
@keyframes mon-flash { from { background: #3b82f633; } to { background: transparent; } }
.mon-empty { padding: 16px; color: var(--text2); font-size: 13px; }
.mon-older { margin: 8px; }
@media (max-width: 640px) { .mon-table td:nth-child(4), .mon-table th:nth-child(4) { display: none; } }

/* Diagnostics (phase 5) */
.dg-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0 8px; font-size: 13px; }
.dg-controls input[type=search] { font: inherit; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--border2); background: var(--bg2); color: var(--text); min-width: 220px; }
.dg-count { margin-left: auto; color: var(--text2); font-size: 12px; }
.dg-list { border: 1px solid var(--border2); border-radius: 8px; overflow: hidden; }
.dg-item + .dg-item { border-top: 1px solid var(--border2); }
.dg-head {
  display: grid; grid-template-columns: 14px 26px minmax(80px, 1.2fr) 64px minmax(90px, 1fr) 56px 70px minmax(110px, 1.2fr) 90px 22px;
  gap: 8px; align-items: center; width: 100%; padding: 7px 12px; border: 0; background: none;
  color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.dg-head:hover, .dg-item.open .dg-head { background: var(--bg2); }
.dg-dot { width: 9px; height: 9px; border-radius: 50%; background: #9ca3af; }
.dg-dot.st-ok { background: #16a34a; } .dg-dot.st-warn { background: #d97706; } .dg-dot.st-down { background: #dc2626; }
.dg-ch { color: var(--text2); font-variant-numeric: tabular-nums; }
.dg-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dg-grp, .dg-state, .dg-port { font-size: 12px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dg-av { font-variant-numeric: tabular-nums; }
.dg-err { font-size: 11px; color: #dc2626; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dg-body { padding: 4px 12px 14px; font-size: 13px; color: var(--text2); }
.dg-detail { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; color: var(--text); }
.dg-card { border: 1px solid var(--border2); border-radius: 8px; padding: 8px 10px; background: var(--bg2); min-width: 0; }
.dg-card h4 { margin: 0 0 6px; font-size: 12px; color: var(--text2); font-weight: 500; letter-spacing: .03em; }
.dg-kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; margin: 0; font-size: 12px; }
.dg-kv dt { color: var(--text2); } .dg-kv dd { margin: 0; overflow-wrap: anywhere; }
.dg-label { font-size: 11px; color: var(--text2); margin-top: 6px; }
.dg-spark { width: 100%; height: 36px; display: block; }
.dg-spark path { fill: none; stroke: #3b82f6; stroke-width: 1.5; }
.dg-spark.bad path { stroke: #dc2626; }
.dg-spark text { font-size: 11px; fill: var(--text2); }
.dg-strip { display: flex; gap: 1px; height: 14px; margin-top: 3px; }
.dg-strip span { flex: 1; border-radius: 1px; background: #9ca3af44; }
.dg-strip .g { background: #16a34a; } .dg-strip .w { background: #d97706; } .dg-strip .b { background: #dc2626; } .dg-strip .u { background: #9ca3af; }
.dg-strip em { font-size: 11px; color: var(--text2); }
.dg-changes, .dg-events { margin: 4px 0 0; padding-left: 16px; font-size: 12px; max-height: 120px; overflow-y: auto; }
.dg-events .ev-offline { color: #dc2626; } .dg-events .ev-online { color: #16a34a; }
.dg-table { width: 100%; font-size: 12px; border-collapse: collapse; }
.dg-table th { text-align: left; color: var(--text2); font-weight: 500; }
.dg-table td, .dg-table th { padding: 2px 4px; border-top: 1px solid var(--border2); }
.dg-none { font-size: 12px; color: var(--text2); margin: 4px 0; }
.dg-quote { font-size: 12px; white-space: pre-wrap; border-left: 3px solid #dc2626; padding-left: 6px; margin: 4px 0 6px; }
@media (max-width: 760px) {
  .dg-head { grid-template-columns: 14px 26px 1fr 56px 22px; }
  .dg-grp, .dg-state, .dg-stream, .dg-port, .dg-err { display: none; }
}
