/* ==========================================================================
   CloudScale Performance Monitor, DevTools-style bottom panel
   ========================================================================== */

/* ── Panel shell ─────────────────────────────────────────────────────────── */
#cs-perf {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 12px;
    line-height: 1.4;
    color: #d4d4d4;
    background: #1e1e1e;
    border-top: 2px solid #007acc;
    box-shadow: 0 -4px 24px rgba(0,0,0,.6);
    display: flex;
    flex-direction: column;
    /* No overflow:hidden here, iOS Safari suppresses child touch events on
       position:fixed elements that have overflow:hidden. Collapse is handled
       by hiding #cs-perf-body instead. */
}
/* Collapsed: only the 48px header is visible */
#cs-perf.cs-perf-collapsed {
    height: 48px;
}
#cs-perf.cs-perf-collapsed #cs-perf-body {
    display: none;
}
/* Open: body visible, height set by JS */
#cs-perf.cs-perf-open {
    height: 320px; /* overridden by JS from localStorage */
    overflow: hidden; /* clip body content when open */
    transition: height .2s ease;
}

/* ── Resize handle ───────────────────────────────────────────────────────── */
#cs-perf-resize {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    cursor: ns-resize;
    z-index: 1;
}
#cs-perf-resize:hover {
    background: rgba(0,122,204,.35);
}

/* ── Header bar (always visible) ─────────────────────────────────────────── */
#cs-perf-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    height: 48px;
    min-height: 48px;
    padding: 0 10px;
    background: #252526;
    flex-shrink: 0;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    gap: 8px;
}
.cs-perf-hl,
.cs-perf-hr {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── CS Monitor toggle button (pill) ─────────────────────────────────────── */
.cs-perf-monitor-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #2d2d30;
    border: 1px solid #555;
    border-radius: 6px;
    padding: 6px 25px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background .15s, border-color .15s;
    flex-shrink: 0;
    min-height: 34px;
    position: relative;
    z-index: 2;
    /* Force GPU layer, fixes iOS Safari touch suppression on fixed containers */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}
.cs-perf-monitor-btn:hover { background: #3c3c3c; border-color: #007acc; }
.cs-perf-logo {
    font-size: 16px;
    line-height: 1;
    color: #e8c74a;
}
.cs-perf-name {
    font-weight: 600;
    font-size: 12px;
    color: #cccccc;
    white-space: nowrap;
}
.cs-perf-name-short {
    display: none;
    font-weight: 600;
    font-size: 12px;
    color: #cccccc;
}
.cs-perf-toggle-arrow {
    font-size: 9px;
    color: #888;
    margin-left: 2px;
}

/* ── Header badges ───────────────────────────────────────────────────────── */
.cs-perf-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    cursor: default;
}
.cs-pb-db   { background: #1a3a5c; color: #5aa8e8; }
.cs-pb-http { background: #3a1a5c; color: #b07ae8; }
.cs-pb-log  { background: #1a3a2a; color: #4ec9b0; }
.cs-pb-issues-critical { background: #4a1a1a; color: #f44747; }
.cs-pb-issues-warning  { background: #3a2e10; color: #ffaa00; }
.cs-perf-badge em { font-style: normal; font-weight: 700; }

/* ── Total time chip ─────────────────────────────────────────────────────── */
.cs-perf-total {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
}

/* ── Help button ─────────────────────────────────────────────────────────── */
.cs-perf-help-btn {
    font-weight: 700;
    font-size: 12px;
    width: 24px;
    padding: 0;
    text-align: center;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Help overlay panel ──────────────────────────────────────────────────── */
#cs-perf-help {
    position: fixed;
    bottom: 56px;
    right: 10px;
    left: 10px;
    width: auto;
    max-width: 520px;
    max-height: calc(100svh - 80px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: #252526;
    border: 1px solid #007acc;
    border-radius: 8px;
    padding: 16px;
    z-index: 999999;
    box-shadow: 0 -6px 32px rgba(0,0,0,.7);
    margin-left: auto;
}
.cs-perf-help-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}
.cs-perf-help-close:hover { color: #fff; }
.cs-help-title {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 700;
    color: #e8c74a;
}
.cs-help-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}
@media (max-width: 500px) { .cs-help-grid { grid-template-columns: 1fr; } }
.cs-help-card {
    background: #1e1e1e;
    border-radius: 6px;
    padding: 10px;
}
.cs-help-card p {
    margin: 4px 0 0;
    font-size: 11px;
    color: #aaa;
    line-height: 1.5;
}
.cs-help-card-title {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
}
.cs-help-db   { color: #5aa8e8; }
.cs-help-http { color: #b07ae8; }
.cs-help-log  { color: #4ec9b0; }
.cs-help-sum  { color: #4ec9b0; }
.cs-help-legend { border-top: 1px solid #3c3c3c; padding-top: 10px; }
.cs-help-legend-title {
    font-size: 11px;
    font-weight: 700;
    color: #888;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.cs-help-swatches {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    font-size: 11px;
    color: #aaa;
}
.cs-hs {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}
.cs-hs-fast { background: #4ec9b0; }
.cs-hs-med  { background: #dcdcaa; }
.cs-hs-slow { background: #ce9178; }
.cs-hs-crit { background: #f44747; }
.cs-hs-dupe { background: #dcdcaa; opacity: .6; }
.cs-hs-n1   { background: #c586c0; }

/* ── Action buttons (JSON export etc) ────────────────────────────────────── */
.cs-perf-btn {
    background: none;
    border: 1px solid #555;
    color: #aaa;
    cursor: pointer;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 10px;
    line-height: 1.6;
    transition: background .15s, color .15s;
    flex-shrink: 0;
}
.cs-perf-btn:hover { background: #3c3c3c; color: #fff; border-color: #777; }

/* Help button */
.cs-perf-help-btn {
    background: #2a4a9f;
    border-color: #2a4a9f;
    color: #fff;
    font-weight: 700;
}
.cs-perf-help-btn:hover { background: #3558b8; border-color: #3558b8; color: #fff; }

/* ── Panel body ──────────────────────────────────────────────────────────── */
#cs-perf-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── Tab bar ─────────────────────────────────────────────────────────────── */
#cs-perf-tabs {
    display: flex;
    background: #2d2d30;
    border-bottom: 1px solid #3c3c3c;
    flex-shrink: 0;
    overflow: hidden;  /* outer never scrolls */
}
#cs-ptab-scroll {
    display: flex;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
}
#cs-ptab-scroll::-webkit-scrollbar { display: none; }
.cs-ptab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #aaa;
    cursor: pointer;
    padding: 7px 14px;
    font-size: 12px;
    font-family: inherit;
    white-space: nowrap;
    transition: color .15s, border-color .15s;
    display: flex;
    align-items: center;
    gap: 5px;
}
.cs-ptab:hover { color: #ddd; }
.cs-ptab.active { color: #fff; border-bottom-color: #007acc; }
.cs-ptab span {
    background: #3c3c3c;
    color: #aaa;
    border-radius: 8px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 700;
}
.cs-ptab.active span { background: #007acc; color: #fff; }

/* Copy button, always pinned to the right, never scrolls away */
.cs-ptab-copy {
    flex-shrink: 0;
    background: none;
    border: none;
    border-left: 1px solid #3c3c3c;
    color: #ccc;
    cursor: pointer;
    font-size: 11px;
    font-family: inherit;
    padding: 4px 12px;
    white-space: nowrap;
    align-self: stretch;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background .15s, color .15s;
}
.cs-ptab-copy:hover { background: #3c3c3c; color: #fff; }

/* ── Filter bar ──────────────────────────────────────────────────────────── */
#cs-perf-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    background: #252526;
    border-bottom: 1px solid #3c3c3c;
    flex-shrink: 0;
    flex-wrap: wrap;
}
#cs-pf-search {
    background: #3c3c3c;
    border: 1px solid #555;
    border-radius: 4px;
    color: #d4d4d4;
    font-size: 11px;
    font-family: inherit;
    padding: 3px 8px;
    width: 160px;
    outline: none;
}
#cs-pf-search:focus { border-color: #007acc; }
#cs-pf-search::-webkit-search-cancel-button { filter: invert(.6); cursor: pointer; }
#cs-pf-plugin,
#cs-pf-speed {
    background: #3c3c3c;
    border: 1px solid #555;
    border-radius: 4px;
    color: #d4d4d4;
    font-size: 11px;
    font-family: inherit;
    padding: 3px 6px;
    cursor: pointer;
    outline: none;
}
#cs-pf-plugin:focus, #cs-pf-speed:focus { border-color: #007acc; }
.cs-pf-dupe-lbl {
    color: #aaa;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}
.cs-pf-dupe-lbl input { cursor: pointer; accent-color: #007acc; }

/* ── Tab panes ───────────────────────────────────────────────────────────── */
.cs-ppane {
    display: none;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.cs-ppane.active { display: flex; flex-direction: column; }

/* ── Table wrapper (scrollable) ──────────────────────────────────────────── */
.cs-tbl-wrap {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}
.cs-tbl-wrap::-webkit-scrollbar { width: 6px; height: 6px; }
.cs-tbl-wrap::-webkit-scrollbar-track { background: #1e1e1e; }
.cs-tbl-wrap::-webkit-scrollbar-thumb { background: #555; border-radius: 3px; }

/* ── Data table ──────────────────────────────────────────────────────────── */
.cs-ptable {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.cs-ptable thead tr {
    background: #2d2d30;
    position: sticky;
    top: 0;
    z-index: 1;
}
.cs-ptable th {
    padding: 5px 8px;
    font-size: 11px;
    font-weight: 600;
    color: #aaa;
    text-align: left;
    border-bottom: 1px solid #3c3c3c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cs-ptable th.cs-sortable { cursor: pointer; }
.cs-ptable th.cs-sortable:hover { color: #fff; }
.cs-ptable th.cs-sort-active { color: #fff; border-bottom: 2px solid #007acc; }
.cs-ptable tbody tr {
    border-bottom: 1px solid #2a2a2a;
    transition: background .1s;
}
.cs-ptable tbody tr:hover { background: #2a2d2e; }
/* Row accent: visible left border + tinted background */
.cs-ptable tbody tr.cs-row-slow > td:first-child     { border-left: 3px solid #ce9178; }
.cs-ptable tbody tr.cs-row-critical > td:first-child { border-left: 3px solid #f44747; }
.cs-ptable tbody tr.cs-row-dupe > td:first-child     { border-left: 3px solid #dcdcaa; }
.cs-ptable tbody tr.cs-row-slow     { background: rgba(206,145,120,.12); }
.cs-ptable tbody tr.cs-row-critical { background: rgba(244,71,71,.14); }
.cs-ptable tbody tr.cs-row-dupe     { background: rgba(220,220,170,.10); }
.cs-ptable td {
    padding: 4px 8px;
    vertical-align: top;
    font-size: 11px;
    color: #d4d4d4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Expandable row: click to toggle full SQL */
.cs-ptable tbody tr.cs-expandable { cursor: pointer; }
.cs-ptable td.c-q { white-space: nowrap; }
.cs-row-detail td {
    background: #141414;
    padding: 6px 8px 8px 24px;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: "Cascadia Code", "Fira Code", Consolas, "Courier New", monospace;
    font-size: 11px;
    color: #c8c8c8;
    border-bottom: 1px solid #333;
}

/* ── Column widths ───────────────────────────────────────────────────────── */
/* DB table */
#cs-perf-body .c-n   { width: 30px;  min-width: 30px;  }
#cs-perf-body .c-q   { width: auto;  }
#cs-perf-body .c-p   { width: 160px; min-width: 100px; }
#cs-perf-body .c-r   { width: 50px;  min-width: 40px;  text-align: right; }
#cs-perf-body .c-t   { width: 120px; min-width: 90px;  }
/* HTTP table */
#cs-perf-body .c-m   { width: 60px;  min-width: 50px;  }
#cs-perf-body .c-u   { width: auto;  }
#cs-perf-body .c-s   { width: 55px;  min-width: 45px;  text-align: center; }

/* ── Latency bar ─────────────────────────────────────────────────────────── */
.cs-time-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.cs-lat-bar {
    display: inline-block;
    height: 8px;
    min-width: 2px;
    border-radius: 2px;
    flex-shrink: 0;
    transition: width .2s;
}
.cs-lat-fast     { background: #4ec9b0; }
.cs-lat-medium   { background: #dcdcaa; }
.cs-lat-slow     { background: #ce9178; }
.cs-lat-critical { background: #f44747; animation: cs-pulse 1.4s ease-in-out infinite; }
@keyframes cs-pulse {
    0%,100% { opacity: 1; }
    50%      { opacity: .5; }
}
/* Toolbar flash, 10 red pulses over 10s when a browser error is captured */
@keyframes cs-flash-err {
    0%,100% { background: transparent; box-shadow: none; }
    4%,14%,24%,34%,44%,54%,64%,74%,84%,94% { background: rgba(244,71,71,.35); box-shadow: 0 0 0 3px #f44747; }
    9%,19%,29%,39%,49%,59%,69%,79%,89%,99% { background: transparent; box-shadow: none; }
}
.cs-monitor-flash {
    animation: cs-flash-err 10s ease-in-out;
    animation-fill-mode: none;
    border-radius: 6px;
}
.cs-time-val { font-size: 11px; font-variant-numeric: tabular-nums; }
.cs-time-val.cs-tv-fast     { color: #4ec9b0; }
.cs-time-val.cs-tv-medium   { color: #dcdcaa; }
.cs-time-val.cs-tv-slow     { color: #ce9178; }
.cs-time-val.cs-tv-critical { color: #f44747; font-weight: 700; }

/* ── Badges on rows ──────────────────────────────────────────────────────── */
.cs-tag {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: .03em;
    vertical-align: middle;
    line-height: 1.5;
}
.cs-tag-slow     { background: #5a2c1a; color: #ce9178; }
.cs-tag-critical { background: #5a1a1a; color: #f44747; }
.cs-tag-dupe     { background: #3a3a00; color: #dcdcaa; }
.cs-tag-cached   { background: #1a3a1a; color: #4ec9b0; }
.cs-tag-error    { background: #5a1a1a; color: #f44747; }
.cs-tag-insecure { background: #4a2800; color: #ffaa00; }
.cs-tag-external { background: #1a2a3a; color: #9cdcfe; }
.cs-tag-warn     { background: #3a2a00; color: #dcdcaa; }
.cs-tag-blocking { background: #5a1a1a; color: #f44747; }
.cs-tag-defer    { background: #1a3a1a; color: #4ec9b0; }
.cs-tag-footer   { background: #1a2a1a; color: #888;    }

/* ── Plugin chip ─────────────────────────────────────────────────────────── */
.cs-plugin-chip {
    display: inline-block;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #9cdcfe;
    font-size: 11px;
    vertical-align: middle;
}
.cs-plugin-core { color: #888; }

/* ── SQL keyword colouring ───────────────────────────────────────────────── */
.cs-kw-select { color: #569cd6; font-weight: 600; }
.cs-kw-insert { color: #4ec9b0; font-weight: 600; }
.cs-kw-update { color: #dcdcaa; font-weight: 600; }
.cs-kw-delete { color: #f44747; font-weight: 600; }
.cs-kw-other  { color: #c586c0; font-weight: 600; }

/* ── HTTP status colours ─────────────────────────────────────────────────── */
.cs-status-2xx { color: #4ec9b0; font-weight: 600; }
.cs-status-3xx { color: #9cdcfe; font-weight: 600; }
.cs-status-4xx { color: #dcdcaa; font-weight: 600; }
.cs-status-5xx { color: #f44747; font-weight: 600; }
.cs-status-err { color: #f44747; font-weight: 600; }

/* ── Method badge ────────────────────────────────────────────────────────── */
.cs-method {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    font-family: inherit;
}
.cs-method-get    { background: #1a3a5c; color: #5aa8e8; }
.cs-method-post   { background: #1a3a1a; color: #4ec9b0; }
.cs-method-put    { background: #3a2a00; color: #dcdcaa; }
.cs-method-patch  { background: #2a1a3a; color: #c586c0; }
.cs-method-delete { background: #5c1a1a; color: #f44747; }
.cs-method-other  { background: #3c3c3c; color: #aaa; }

/* ── Error list ──────────────────────────────────────────────────────────── */
#cs-err-list {
    padding: 8px 10px;
    overflow-y: auto;
    overscroll-behavior: contain;
    flex: 1;
}
/* ── Debug toggle bar ───────────────────────────────────────────────────── */
#cs-debug-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background: #1e1e1e;
    border-bottom: 1px solid #3c3c3c;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.cs-debug-status {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.cs-debug-on  { color: #4ec9b0; }
.cs-debug-off { color: #666; }
.cs-debug-toggle-btn {
    border: 1px solid #555;
    border-radius: 4px;
    padding: 3px 10px;
    font-size: 11px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    white-space: nowrap;
}
.cs-debug-btn-on  { background: #1a3a2a; color: #4ec9b0; border-color: #4ec9b0; }
.cs-debug-btn-on:hover  { background: #25503a; }
.cs-debug-btn-off { background: #3a1a1a; color: #e87a7a; border-color: #e87a7a; }
.cs-debug-btn-off:hover { background: #4a2020; }
.cs-debug-toggle-btn:disabled { opacity: .5; cursor: default; }
.cs-debug-msg {
    font-size: 11px;
    color: #4ec9b0;
    flex: 1;
}

/* ── Log filters bar ─────────────────────────────────────────────────────── */
.cs-log-filters {
    display: flex;
    gap: 6px;
    padding: 6px 8px;
    background: #252526;
    border-bottom: 1px solid #3c3c3c;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.cs-log-filters input,
.cs-log-filters select {
    background: #3c3c3c;
    border: 1px solid #555;
    color: #d4d4d4;
    padding: 3px 7px;
    border-radius: 4px;
    font-size: 11px;
    height: 26px;
}
.cs-log-filters input { flex: 1; min-width: 120px; }

/* ── Log list ────────────────────────────────────────────────────────────── */
.cs-log-list {
    overflow-y: auto;
    overscroll-behavior: contain;
    flex: 1;
    padding: 4px 6px;
}
.cs-log-entry {
    padding: 5px 8px;
    margin-bottom: 3px;
    border-left: 3px solid #3c3c3c;
    border-radius: 0 4px 4px 0;
    background: #252526;
    font-size: 11px;
    line-height: 1.4;
}
.cs-log-fatal    { border-left-color: #f44747; background: rgba(244,71,71,.08); }
.cs-log-error    { border-left-color: #f44747; background: rgba(244,71,71,.05); }
.cs-log-warning  { border-left-color: #dcdcaa; background: rgba(220,220,170,.06); }
.cs-log-notice   { border-left-color: #5aa8e8; }
.cs-log-deprecated { border-left-color: #c586c0; }
.cs-log-info     { border-left-color: #3c3c3c; }
.cs-log-level {
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    margin-right: 6px;
    color: #aaa;
}
.cs-log-fatal .cs-log-level,
.cs-log-error .cs-log-level    { color: #f44747; }
.cs-log-warning .cs-log-level  { color: #dcdcaa; }
.cs-log-notice .cs-log-level   { color: #5aa8e8; }
.cs-log-deprecated .cs-log-level { color: #c586c0; }
.cs-log-ts {
    font-size: 10px;
    color: #555;
    margin-right: 8px;
}
.cs-log-src-tag {
    font-size: 9px;
    background: #007acc;
    color: #fff;
    padding: 1px 5px;
    border-radius: 3px;
    margin-right: 6px;
    font-weight: 600;
    text-transform: uppercase;
}
.cs-log-msg {
    color: #d4d4d4;
    word-break: break-word;
    margin-top: 2px;
    font-family: "Cascadia Code", "Fira Code", Consolas, "Courier New", monospace;
    font-size: 10px;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.cs-empty {
    text-align: center;
    padding: 24px 10px;
    color: #555;
    font-size: 12px;
}
.cs-empty-icon { font-size: 24px; display: block; margin-bottom: 6px; opacity: .4; }

/* ── Footer stats bar ────────────────────────────────────────────────────── */
#cs-perf-foot {
    background: #252526;
    border-top: 1px solid #3c3c3c;
    padding: 3px 10px;
    font-size: 10px;
    color: #666;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#cs-perf-foot .cs-foot-warn { color: #ce9178; }
#cs-perf-foot .cs-foot-crit { color: #f44747; font-weight: 700; }

/* ── No data / SAVEQUERIES notice ────────────────────────────────────────── */
.cs-notice {
    padding: 10px 14px;
    background: #2d2d30;
    border-left: 3px solid #007acc;
    margin: 8px;
    border-radius: 0 4px 4px 0;
    font-size: 11px;
    color: #aaa;
}

/* ==========================================================================
   CALL STACK TRACE
   ========================================================================== */

.cs-stack-trace {
    margin-top: 8px;
    border-top: 1px solid #333;
    padding-top: 6px;
}
.cs-stack-hdr {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #555;
    margin-bottom: 4px;
}
.cs-stack-frames { display: flex; flex-direction: column; gap: 1px; }

.cs-sf {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 2px 4px;
    border-radius: 2px;
    font-family: "Cascadia Code", "Fira Code", Consolas, "Courier New", monospace;
    font-size: 10px;
    line-height: 1.5;
}
.cs-sf-indent { padding-left: 12px; }

/* Connector line */
.cs-sf::before {
    content: '↳';
    color: #444;
    font-size: 9px;
    flex-shrink: 0;
    width: 12px;
}
.cs-sf:first-child::before { content: '●'; color: #666; }

/* Frame name */
.cs-sf-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Frame type badge */
.cs-sf-type {
    font-size: 9px;
    font-family: -apple-system, sans-serif;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: .04em;
    flex-shrink: 0;
    opacity: .85;
}

/* Type-specific colours */
.cs-sf-hook   .cs-sf-name { color: #4ec9b0; }
.cs-sf-hook   .cs-sf-type { background: #0e2e28; color: #4ec9b0; }

.cs-sf-code   .cs-sf-name { color: #d4d4d4; }
.cs-sf-code   .cs-sf-type { background: #2d2d30; color: #9cdcfe; }

.cs-sf-plugin .cs-sf-name { color: #9cdcfe; }
.cs-sf-plugin .cs-sf-type { background: #0e1e30; color: #5aa8e8; }

.cs-sf-theme  .cs-sf-name { color: #c586c0; }
.cs-sf-theme  .cs-sf-type { background: #20102e; color: #c586c0; }

.cs-sf-file   .cs-sf-name { color: #555; }
.cs-sf-file   .cs-sf-type { background: #222; color: #555; }

.cs-sf-wp     .cs-sf-name { color: #555; }
.cs-sf-wp     .cs-sf-type { background: #222; color: #555; }

.cs-sf-db     .cs-sf-name { color: #444; }
.cs-sf-db     .cs-sf-type { display: none; }  /* wpdb is implied, skip badge */

/* ── Page context strip (below header) ──────────────────────────────────── */
#cs-perf-ctx {
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    padding: 3px 10px;
    font-size: 10px;
    color: #555;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}
#cs-perf-ctx .cs-ctx-url  { color: #888; }
#cs-perf-ctx .cs-ctx-sep  { color: #333; }
#cs-perf-ctx .cs-ctx-page { color: #666; }
#cs-perf-ctx .cs-ctx-tmpl { color: #555; font-family: monospace; }

/* ── Scrollbar (Firefox) ─────────────────────────────────────────────────── */
.cs-tbl-wrap, #cs-err-list, #cs-summary-wrap {
    scrollbar-width: thin;
    scrollbar-color: #555 #1e1e1e;
}
#cs-summary-wrap::-webkit-scrollbar { width: 6px; }
#cs-summary-wrap::-webkit-scrollbar-track { background: #1e1e1e; }
#cs-summary-wrap::-webkit-scrollbar-thumb { background: #555; border-radius: 3px; }

/* ── Row number ──────────────────────────────────────────────────────────── */
td.c-n { color: #555; font-size: 10px; text-align: right; padding-right: 6px; }

/* ==========================================================================
   SUMMARY TAB
   ========================================================================== */

#cs-summary-wrap {
    overflow-y: auto;
    overscroll-behavior: contain;
    flex: 1;
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ── Summary toolbar (PDF button) ──────────────────────────────────────── */
.cs-sum-toolbar {
    display: flex;
    justify-content: flex-end;
    padding: 8px 12px 4px;
}
.cs-sum-pdf-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #0e639c;
    border: none;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    transition: background .15s;
}
.cs-sum-pdf-btn:hover { background: #1177bb; }

/* ── Stat cards row ─────────────────────────────────────────────────────── */
.cs-sum-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
@media (max-width: 640px) {
    .cs-sum-cards { grid-template-columns: 1fr; }
}
.cs-sum-card {
    background: #252526;
    border: 1px solid #3c3c3c;
    border-radius: 6px;
    padding: 10px 12px;
}
.cs-sum-card-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #666;
    margin-bottom: 6px;
}
.cs-sum-card-stat {
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}
.cs-sum-card-sub {
    font-size: 11px;
    color: #777;
    line-height: 1.6;
}
.cs-sum-card-sub span { display: block; }
.cs-sum-card-sub .cs-s-warn { color: #ce9178; }
.cs-sum-card-sub .cs-s-crit { color: #f44747; font-weight: 700; }
.cs-sum-card-sub .cs-s-ok   { color: #4ec9b0; }

/* Card accent colours */
.cs-sum-card-db   .cs-sum-card-stat { color: #5aa8e8; }
.cs-sum-card-http .cs-sum-card-stat { color: #b07ae8; }
.cs-sum-card-log  .cs-sum-card-stat { color: #4ec9b0; }
.cs-sum-card-page .cs-sum-card-stat { color: #4ec9b0; }

/* ── Section headings ───────────────────────────────────────────────────── */
.cs-sum-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #555;
    padding-bottom: 4px;
    border-bottom: 1px solid #333;
    margin-bottom: 6px;
}

/* ── Leaderboard rows (plugin offenders) ────────────────────────────────── */
.cs-sum-lb-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid #2a2a2a;
    font-size: 11px;
}
.cs-sum-lb-row:last-child { border-bottom: none; }
.cs-sum-lb-rank {
    color: #555;
    width: 18px;
    text-align: right;
    flex-shrink: 0;
    font-size: 10px;
}
.cs-sum-lb-name {
    color: #9cdcfe;
    min-width: 120px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
}
.cs-sum-lb-bar-wrap {
    flex: 1;
    height: 6px;
    background: #333;
    border-radius: 3px;
    overflow: hidden;
    min-width: 40px;
}
.cs-sum-lb-bar {
    height: 100%;
    border-radius: 3px;
    background: #5aa8e8;
    transition: width .3s ease;
}
.cs-sum-lb-val {
    color: #888;
    white-space: nowrap;
    font-size: 10px;
    min-width: 60px;
    text-align: right;
}

/* ── Slowest queries / HTTP list ────────────────────────────────────────── */
.cs-sum-top-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid #2a2a2a;
    font-size: 11px;
    cursor: default;
}
.cs-sum-top-row:last-child { border-bottom: none; }
.cs-sum-top-time {
    flex-shrink: 0;
    min-width: 52px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.cs-sum-top-sql {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #d4d4d4;
    font-family: "Cascadia Code", "Fira Code", Consolas, "Courier New", monospace;
    font-size: 10px;
}
.cs-sum-top-plugin {
    color: #9cdcfe;
    font-size: 10px;
    min-width: 80px;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
    flex-shrink: 0;
}

/* ── N+1 tag ────────────────────────────────────────────────────────────── */
.cs-tag-n1 { background: #2a1a3a; color: #c586c0; }

/* ── EXPLAIN button (inside expanded detail row) ────────────────────────── */
.cs-explain-btn {
    background: #1a3a5c;
    border: 1px solid #2a5a8c;
    color: #5aa8e8;
    cursor: pointer;
    font-size: 10px;
    font-family: inherit;
    font-weight: 700;
    letter-spacing: .04em;
    padding: 2px 8px;
    border-radius: 3px;
    margin-top: 6px;
    display: inline-block;
    transition: background .15s;
}
.cs-explain-btn:hover  { background: #1e4a70; }
.cs-explain-btn:disabled { opacity: .5; cursor: default; }

/* ── EXPLAIN result table ────────────────────────────────────────────────── */
.cs-explain-result { margin-top: 8px; }
.cs-explain-loading { color: #666; font-size: 11px; padding: 4px 0; }
.cs-explain-error   { color: #f44747; font-size: 11px; padding: 4px 0; }
.cs-explain-empty   { color: #555; font-size: 11px; padding: 4px 0; }

.cs-explain-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    font-family: "Cascadia Code", "Fira Code", Consolas, "Courier New", monospace;
    margin-top: 4px;
}
.cs-explain-table th {
    background: #2d2d30;
    color: #888;
    font-weight: 600;
    padding: 3px 6px;
    text-align: left;
    border: 1px solid #3c3c3c;
    font-size: 10px;
    white-space: nowrap;
}
.cs-explain-table td {
    padding: 3px 6px;
    border: 1px solid #2a2a2a;
    color: #d4d4d4;
    white-space: nowrap;
}
/* Colour coding for type column and row counts */
.cs-exp-good { color: #4ec9b0; font-weight: 700; }
.cs-exp-warn { color: #dcdcaa; font-weight: 700; }
.cs-exp-bad  { color: #f44747; font-weight: 700; background: rgba(244,71,71,.08); }

/* ── SAVEQUERIES disabled notice ─────────────────────────────────────────── */
.cs-sq-warning {
    margin: 10px;
    padding: 10px 14px;
    background: #2d2d30;
    border-left: 3px solid #dcdcaa;
    border-radius: 0 4px 4px 0;
    font-size: 11px;
    color: #aaa;
    line-height: 1.6;
}
.cs-sq-warning strong { color: #dcdcaa; }

/* ── N+1 patterns section in Summary ────────────────────────────────────── */
.cs-sum-n1-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid #2a2a2a;
    font-size: 11px;
}
.cs-sum-n1-row:last-child { border-bottom: none; }
.cs-sum-n1-count {
    flex-shrink: 0;
    min-width: 36px;
    text-align: center;
    background: #2a1a3a;
    color: #c586c0;
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 700;
}
.cs-sum-n1-sql {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #aaa;
    font-family: "Cascadia Code", "Fira Code", Consolas, "Courier New", monospace;
    font-size: 10px;
}
.cs-sum-n1-plugin {
    color: #9cdcfe;
    font-size: 10px;
    min-width: 80px;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
    flex-shrink: 0;
}

/* ── Duplicate queries section ──────────────────────────────────────────── */
.cs-sum-dupe-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid #2a2a2a;
    font-size: 11px;
}
.cs-sum-dupe-row:last-child { border-bottom: none; }
.cs-sum-dupe-count {
    flex-shrink: 0;
    min-width: 30px;
    text-align: center;
    background: #3a3a00;
    color: #dcdcaa;
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 700;
}
.cs-sum-dupe-sql {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #aaa;
    font-family: "Cascadia Code", "Fira Code", Consolas, "Courier New", monospace;
    font-size: 10px;
}
.cs-sum-dupe-avg {
    color: #888;
    font-size: 10px;
    min-width: 50px;
    text-align: right;
    flex-shrink: 0;
}

/* ── Assets tab ──────────────────────────────────────────────────────────── */
.cs-assets-filters,
.cs-hooks-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    background: #1e1e1e;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}
.cs-assets-filters input,
.cs-assets-filters select,
.cs-hooks-filters input {
    background: #2a2a2a;
    color: #ccc;
    border: 1px solid #444;
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 11px;
    outline: none;
}
.cs-assets-filters input { flex: 1; min-width: 120px; }
.cs-hooks-filters  input { flex: 1; min-width: 160px; }
.cs-asset-type-js  { background: #264f78; color: #9cdcfe; padding: 1px 5px; border-radius: 3px; font-size: 9px; font-weight: 700; }
.cs-asset-type-css { background: #3a2a00; color: #ce9178; padding: 1px 5px; border-radius: 3px; font-size: 9px; font-weight: 700; }
.cs-asset-ver  { color: #888; font-size: 9px; margin-left: 4px; }
.cs-asset-src  { color: #888; font-size: 10px; font-family: "Cascadia Code", "Fira Code", Consolas, "Courier New", monospace; }
.c-at { width: 36px; flex-shrink: 0; }
.c-ah { flex: 1; min-width: 120px; }
.c-ap { width: 130px; }
.c-au { flex: 2; min-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Hooks tab ────────────────────────────────────────────────────────────── */
.c-hk  { flex: 1; min-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-hc  { width: 55px; text-align: right; }
.c-ht  { width: 110px; }
.c-hm  { width: 75px; text-align: right; }
.cs-sum-lb-bar-hook { background: #4ec9b0; }

/* ── Summary: cache + assets cards ───────────────────────────────────────── */
.cs-sum-card-cache  { border-left: 3px solid #4ec9b0; }
.cs-sum-card-assets { border-left: 3px solid #9cdcfe; }

/* ── Help cards: new types ────────────────────────────────────────────────── */
.cs-help-assets { color: #9cdcfe; }
.cs-help-hooks  { color: #4ec9b0; }

/* ── Mobile / narrow viewport ────────────────────────────────────────────── */
/* ── Undo any JS-applied sidebar constraints on mobile/tablet ────────────── */
/* JS setPadding() sets inline max-height/overflow-y on #adminmenuwrap to stop
   the sidebar extending behind the panel. On narrow viewports WP uses a flyout
   sidebar and those inline styles make the menu blank. !important beats inline. */
@media (max-width: 782px) {
    #adminmenuwrap {
        max-height: none !important;
        overflow-y: visible !important;
    }
}

@media (max-width: 600px) {
    /* Header: hide total time and full label; show short "CS" label instead */
    .cs-perf-total      { display: none; }
    .cs-perf-name       { display: none; }
    .cs-perf-name-short { display: inline; }

    /* Tighten up the toggle button on mobile */
    .cs-perf-monitor-btn { padding: 6px 14px; gap: 4px; min-width: 90px; justify-content: center; }

    /* DB table: hide Plugin & Rows columns, keep Query + Time */
    .cs-ptable th.c-p,
    .cs-ptable td.c-p { display: none; }
    .cs-ptable th.c-r,
    .cs-ptable td.c-r { display: none; }
}

/* ── Issues tab count badge colours ─────────────────────────────────────── */
.cs-issues-cnt-critical { background: rgba(244,71,71,.25) !important; color: #f44747 !important; }
.cs-issues-cnt-warning  { background: rgba(206,145,120,.25) !important; color: #ce9178 !important; }

/* ── Issues list ─────────────────────────────────────────────────────────── */
.cs-issues-wrap { padding: 0; }

.cs-issues-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px 6px;
    border-bottom: 1px solid #2a2d2e;
    background: #1e1e1e;
    position: sticky;
    top: 0;
    z-index: 2;
}
.cs-issues-summary {
    font-size: 11px;
    color: #777;
}
.cs-issues-copy-btn {
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 3px;
    border: 1px solid #3c3f41;
    background: #2d2d30;
    color: #ccc;
    cursor: pointer;
    line-height: 1.5;
    transition: background .12s, color .12s;
}
.cs-issues-copy-btn:hover { background: #3a3d3e; color: #fff; }

.cs-issues-group { }
.cs-issues-group-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: #666;
    padding: 8px 10px 4px;
    position: sticky;
    top: 0;
    background: #1e1e1e;
    z-index: 1;
}

.cs-issue-row {
    padding: 6px 10px 5px;
    border-left: 3px solid transparent;
    border-bottom: 1px solid #252525;
    cursor: pointer;
    transition: background .1s;
}
.cs-issue-row:hover { background: #2a2d2e; }

.cs-issue-critical { border-left-color: #f44747; background: rgba(244,71,71,.05); }
.cs-issue-warning  { border-left-color: #ce9178; }
.cs-issue-info     { border-left-color: #4ec9b0; }

.cs-issue-top {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.cs-issue-title {
    flex: 1;
    font-size: 12px;
    color: #d4d4d4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cs-issue-arrow { color: #666; font-size: 11px; flex-shrink: 0; transition: color .1s; }
.cs-issue-row:hover .cs-issue-arrow { color: #aaa; }
.cs-issue-detail {
    font-size: 12px;
    color: #ccc;
    font-family: 'Consolas', 'Monaco', monospace;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Explain / fix panel ─────────────────────────────────────────────────── */

.cs-fix-wrap {
    display: none;
    margin: 6px 0 2px;
}
.cs-fix-wrap.cs-fix-open { display: block; }

.cs-fix-panel {
    background: #161616;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    padding: 10px 12px;
    font-size: 11px;
}
.cs-fix-why {
    color: #9e9e9e;
    font-style: italic;
    margin-bottom: 8px;
    line-height: 1.5;
    border-left: 2px solid #3a3d3e;
    padding-left: 8px;
}
.cs-fix-steps {
    margin: 0;
    padding-left: 20px;
    counter-reset: fix-step;
}
.cs-fix-steps li {
    color: #d4d4d4;
    line-height: 1.55;
    margin-bottom: 5px;
    list-style-type: decimal;
}
.cs-fix-steps li:last-child { margin-bottom: 0; }
.cs-fix-steps code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 10.5px;
    background: #252526;
    color: #ce9178;
    padding: 1px 4px;
    border-radius: 2px;
    white-space: nowrap;
}
.cs-fix-steps b { color: #e6c949; font-weight: 600; }
.cs-fix-note {
    margin-top: 8px;
    padding: 5px 8px;
    background: #1e2a1e;
    border-left: 2px solid #4ec9b0;
    color: #888;
    font-size: 10px;
    line-height: 1.5;
    border-radius: 0 3px 3px 0;
}

/* ── Request tab ─────────────────────────────────────────────────────────── */
.cs-request-wrap { padding: 0; }
.cs-req-body { padding: 8px 10px 16px; }

.cs-req-section { margin-bottom: 14px; }
.cs-req-section-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: #555;
    padding-bottom: 4px;
    border-bottom: 1px solid #2a2a2a;
    margin-bottom: 4px;
}

.cs-req-kv {
    display: flex;
    gap: 10px;
    padding: 3px 0;
    border-bottom: 1px solid #1c1c1c;
    align-items: baseline;
}
.cs-req-kv:last-child { border-bottom: none; }
.cs-req-k {
    font-size: 11px;
    color: #9cdcfe;
    width: 110px;
    flex-shrink: 0;
}
.cs-req-v {
    font-size: 11px;
    color: #d4d4d4;
    flex: 1;
    word-break: break-all;
}
.cs-req-mono {
    font-family: 'Consolas', 'Monaco', monospace;
    color: #ce9178;
    font-size: 11px;
}
.cs-req-empty {
    font-size: 11px;
    color: #444;
    font-style: italic;
    padding: 3px 0;
}
.cs-req-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px 0;
}
.cs-req-tag {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 10px;
    background: #2a2a2a;
    color: #9cdcfe;
    padding: 1px 6px;
    border-radius: 3px;
    border: 1px solid #3c3c3c;
}

/* ── Environment card ────────────────────────────────────────────────────── */
.cs-sum-card-env .cs-sum-card-title { color: #dcdcaa; }
.cs-sum-card-env .cs-sum-card-stat  { color: #dcdcaa; font-size: 13px; }

/* ── Template hierarchy tab ──────────────────────────────────────────────── */
.cs-template-wrap { padding: 0; }

.cs-tmpl-group { margin-bottom: 6px; }
.cs-tmpl-type-hdr {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: #555;
    padding: 7px 10px 4px;
    background: #1e1e1e;
    position: sticky;
    top: 0;
    z-index: 1;
    border-bottom: 1px solid #2a2a2a;
}

.cs-tmpl-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-bottom: 1px solid #1c1c1c;
    font-size: 11px;
}
.cs-tmpl-icon { width: 14px; flex-shrink: 0; text-align: center; }
.cs-tmpl-file { flex: 1; font-family: 'Consolas', 'Monaco', monospace; font-size: 11px; }

.cs-tmpl-active  .cs-tmpl-icon { color: #4ec9b0; }
.cs-tmpl-active  .cs-tmpl-file { color: #4ec9b0; font-weight: 600; }
.cs-tmpl-found   .cs-tmpl-icon { color: #555; }
.cs-tmpl-found   .cs-tmpl-file { color: #888; }
.cs-tmpl-miss    .cs-tmpl-icon { color: #3c3c3c; }
.cs-tmpl-miss    .cs-tmpl-file { color: #3c3c3c; text-decoration: line-through; }

.cs-tmpl-loc {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    padding: 1px 5px;
    border-radius: 3px;
    flex-shrink: 0;
}
.cs-tmpl-loc-child  { background: rgba(78,201,176,.15); color: #4ec9b0; }
.cs-tmpl-loc-parent { background: rgba(156,220,254,.12); color: #9cdcfe; }

/* ── Transients tab ──────────────────────────────────────────────────────── */
.c-tk { flex: 1; min-width: 180px; font-family: 'Consolas','Monaco',monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-tg, .c-th, .c-tm, .c-ts, .c-td, .c-tr { width: 52px; text-align: right; }
.cs-trans-miss { color: #ce9178; font-weight: 700; }

/* ── Request waterfall (Summary tab) ────────────────────────────────────── */
.cs-waterfall {
    margin: 6px 0 16px;
}
.cs-wf-row {
    display: grid;
    grid-template-columns: 120px 1fr 52px 52px;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
    font-size: 11px;
}
.cs-wf-label {
    color: #ccc;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 10px;
}
.cs-wf-track {
    position: relative;
    height: 10px;
    background: #2d2d30;
    border-radius: 2px;
    overflow: hidden;
}
.cs-wf-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    min-width: 2px;
    border-radius: 2px;
    transition: width .4s ease;
}
.cs-wf-time {
    color: #888;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-size: 10px;
}
.cs-wf-dur {
    color: #4ec9b0;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-size: 10px;
}
/* Phase colours */
.cs-wf-c0 { background: #444;     } /* Request start  */
.cs-wf-c1 { background: #5aa8e8; } /* Plugins loaded */
.cs-wf-c2 { background: #4ec9b0; } /* WP init        */
.cs-wf-c3 { background: #9cdcfe; } /* Admin init / WP loaded */
.cs-wf-c4 { background: #b5cea8; } /* WP loaded / Query setup */
.cs-wf-c5 { background: #ce9178; } /* Query / Template */
.cs-wf-c6 { background: #c586c0; } /* Panel output   */

/* ── Site Health rows (Summary tab) ─────────────────────────────────── */
.cs-health-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 3px 0;
    font-size: 11px;
    border-bottom: 1px solid #2a2a2a;
}
.cs-health-row:last-child { border-bottom: none; }
.cs-health-icon {
    flex-shrink: 0;
    width: 14px;
    text-align: center;
    font-weight: 700;
    font-size: 11px;
}
.cs-health-ok   { color: #4ec9b0; }
.cs-health-warn { color: #e6c949; }
.cs-health-crit { color: #f14c4c; }
.cs-health-label {
    flex-shrink: 0;
    width: 170px;
    color: #9cdcfe;
    font-weight: 600;
}
.cs-health-detail {
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
