/* ============================================================
   Master Health Scanner v3 — Soft Light Theme
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Soft warm-white backgrounds */
    --phs-bg:        #f5f6fa;
    --phs-surface:   #ffffff;
    --phs-surface2:  #f0f1f7;
    --phs-border:    #e2e4ed;
    --phs-border-soft: #eceef6;

    /* Text */
    --phs-text:      #1e2035;
    --phs-text-2:    #4b5068;
    --phs-muted:     #8b90a8;

    /* Accent */
    --phs-accent:    #5b5cf6;
    --phs-accent-soft: #ededff;

    /* Semantic colours — softer tints */
    --phs-green:     #16a34a;
    --phs-green-bg:  #f0fdf4;
    --phs-green-border: #bbf7d0;

    --phs-yellow:    #b45309;
    --phs-yellow-bg: #fffbeb;
    --phs-yellow-border: #fde68a;

    --phs-orange:    #c2410c;
    --phs-orange-bg: #fff7ed;
    --phs-orange-border: #fed7aa;

    --phs-red:       #dc2626;
    --phs-red-bg:    #fef2f2;
    --phs-red-border: #fecaca;

    --phs-blue:      #1d4ed8;
    --phs-blue-bg:   #eff6ff;
    --phs-blue-border: #bfdbfe;

    --phs-pink:      #be185d;
    --phs-pink-bg:   #fdf2f8;
    --phs-pink-border: #fbcfe8;

    /* Layout */
    --phs-radius:    12px;
    --phs-radius-sm: 8px;
    --phs-radius-xs: 5px;
    --phs-shadow:    0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
    --phs-shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 12px 32px rgba(0,0,0,.06);
}

/* ── Base ───────────────────────────────────────────────────── */
.phs-wrap {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--phs-bg);
    min-height: 100vh;
    margin: -10px -20px 0;
    padding: 32px 36px 60px;
    color: var(--phs-text);
    box-sizing: border-box;
    font-size: 14px;
    line-height: 1.5;
}
.phs-wrap * { box-sizing: border-box; }

/* ── Header ─────────────────────────────────────────────────── */
.phs-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 22px; padding-bottom: 22px;
    border-bottom: 1px solid var(--phs-border);
    flex-wrap: wrap; gap: 16px;
}
.phs-header-inner { display: flex; align-items: center; gap: 14px; }
.phs-logo {
    font-size: 38px; line-height: 1;
    filter: drop-shadow(0 2px 6px rgba(91,92,246,.25));
}
.phs-header h1 {
    font-size: 22px; font-weight: 700; color: var(--phs-text);
    margin: 0 0 3px; letter-spacing: -0.4px;
}
.phs-subtitle { margin: 0; color: var(--phs-muted); font-size: 12.5px; }
.phs-header-actions { display: flex; gap: 10px; align-items: center; }

/* ── Buttons ─────────────────────────────────────────────────── */
.phs-btn-primary {
    background: var(--phs-accent);
    color: #fff; border: none; padding: 10px 22px;
    border-radius: 50px; font-family: inherit; font-size: 13.5px; font-weight: 600;
    cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
    box-shadow: 0 2px 8px rgba(91,92,246,.30);
    transition: transform .15s, box-shadow .15s, background .15s;
    text-decoration: none;
}
.phs-btn-primary:hover {
    background: #4a4be0; transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(91,92,246,.35); color: #fff;
}
.phs-btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.phs-btn-ghost {
    background: var(--phs-surface); color: var(--phs-text-2);
    border: 1px solid var(--phs-border); padding: 10px 18px;
    border-radius: 50px; font-family: inherit; font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all .15s;
}
.phs-btn-ghost:hover { border-color: var(--phs-accent); color: var(--phs-accent); background: var(--phs-accent-soft); }

@keyframes spin { to { transform: rotate(360deg); } }
.phs-spin { display: inline-block; animation: spin 0.7s linear infinite; }

/* ── Info banner ────────────────────────────────────────────── */
.phs-info-banner {
    background: var(--phs-accent-soft);
    border: 1px solid #c7c8fd;
    border-left: 3px solid var(--phs-accent);
    border-radius: var(--phs-radius);
    padding: 13px 16px; font-size: 13px;
    color: var(--phs-text-2); margin-bottom: 24px; line-height: 1.6;
}
.phs-info-banner strong { color: var(--phs-accent); }
.phs-info-banner a { color: var(--phs-accent); text-decoration: underline; }

/* ── Scan label row ─────────────────────────────────────────── */
.phs-scan-label-row {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 22px; flex-wrap: wrap;
}
.phs-scan-label-row label {
    font-size: 13px; color: var(--phs-text-2); font-weight: 600; white-space: nowrap;
}
.phs-scan-label-row label span { font-weight: 400; color: var(--phs-muted); }
.phs-scan-label-row input[type=text] {
    flex: 1; min-width: 240px; max-width: 460px;
    background: var(--phs-surface); border: 1px solid var(--phs-border);
    color: var(--phs-text); border-radius: var(--phs-radius-sm);
    padding: 9px 14px; font-family: inherit; font-size: 13px;
    box-shadow: var(--phs-shadow); transition: border-color .15s, box-shadow .15s;
}
.phs-scan-label-row input:focus {
    outline: none; border-color: var(--phs-accent);
    box-shadow: 0 0 0 3px rgba(91,92,246,.12);
}

/* ── Snap saved banner ──────────────────────────────────────── */
.phs-snap-saved {
    background: var(--phs-green-bg); border: 1px solid var(--phs-green-border);
    border-radius: var(--phs-radius-sm); padding: 10px 16px;
    font-size: 13px; color: var(--phs-green); margin-bottom: 16px;
}
.phs-snap-saved a { color: var(--phs-green); font-weight: 600; }

/* ── Loading ─────────────────────────────────────────────────── */
.phs-loading {
    display: flex; flex-direction: column; align-items: center;
    padding: 80px 0; color: var(--phs-muted); gap: 18px;
}
.phs-loading p { font-size: 14px; }
.phs-spinner {
    width: 42px; height: 42px;
    border: 3px solid var(--phs-border); border-top-color: var(--phs-accent);
    border-radius: 50%; animation: spin 0.75s linear infinite;
}
.phs-loading-inline { color: var(--phs-muted); font-size: 13px; padding: 16px 0; }

/* ── Summary bar ─────────────────────────────────────────────── */
.phs-summary-bar {
    display: flex; gap: 12px; margin-bottom: 22px; flex-wrap: wrap;
}
.phs-stat {
    background: var(--phs-surface); border: 1px solid var(--phs-border);
    border-radius: var(--phs-radius); padding: 14px 18px;
    display: flex; flex-direction: column; gap: 3px;
    flex: 1; min-width: 95px; font-size: 12px; color: var(--phs-muted);
    font-weight: 500; box-shadow: var(--phs-shadow);
    transition: border-color .2s, box-shadow .2s;
}
.phs-stat:hover { border-color: var(--phs-accent); box-shadow: 0 0 0 3px rgba(91,92,246,.07); }
.phs-stat-num {
    font-size: 28px; font-weight: 700; line-height: 1;
    color: var(--phs-text); font-family: 'JetBrains Mono', monospace;
}
.phs-stat-ok   { border-top: 3px solid var(--phs-green);  } .phs-stat-ok   .phs-stat-num { color: var(--phs-green);  }
.phs-stat-warn { border-top: 3px solid var(--phs-yellow); } .phs-stat-warn .phs-stat-num { color: var(--phs-yellow); }
.phs-stat-crit { border-top: 3px solid var(--phs-red);    } .phs-stat-crit .phs-stat-num { color: var(--phs-red);    }
.phs-stat-err  { border-top: 3px solid var(--phs-pink);   } .phs-stat-err  .phs-stat-num { color: var(--phs-pink);   }
.phs-stat-meta { font-size: 11px; gap: 4px; justify-content: center; border-top: 3px solid var(--phs-border); }

/* ── Filter bar ──────────────────────────────────────────────── */
.phs-filter-bar {
    display: flex; gap: 7px; align-items: center;
    margin-bottom: 18px; flex-wrap: wrap;
}
.phs-filter-label { font-size: 12px; color: var(--phs-muted); font-weight: 600; margin-right: 2px; }
.phs-filter-btn {
    background: var(--phs-surface); border: 1px solid var(--phs-border);
    color: var(--phs-text-2); padding: 6px 14px; border-radius: 50px;
    font-family: inherit; font-size: 12.5px; font-weight: 500;
    cursor: pointer; transition: all .15s; box-shadow: var(--phs-shadow);
}
.phs-filter-btn:hover { border-color: var(--phs-accent); color: var(--phs-accent); }
.phs-filter-btn.active {
    background: var(--phs-accent); border-color: var(--phs-accent);
    color: #fff; box-shadow: 0 2px 8px rgba(91,92,246,.25);
}

/* ── Cards grid ──────────────────────────────────────────────── */
.phs-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 16px;
}
.phs-empty {
    color: var(--phs-muted); font-size: 14px;
    text-align: center; padding: 60px 0; grid-column: 1/-1;
}

/* ── Card ────────────────────────────────────────────────────── */
.phs-card {
    background: var(--phs-surface); border: 1px solid var(--phs-border);
    border-radius: var(--phs-radius); overflow: hidden;
    box-shadow: var(--phs-shadow);
    transition: transform .18s, box-shadow .18s;
}
.phs-card:hover { transform: translateY(-2px); box-shadow: var(--phs-shadow-md); }
.phs-card.score-great    { border-left: 3px solid var(--phs-green); }
.phs-card.score-ok       { border-left: 3px solid var(--phs-yellow); }
.phs-card.score-bad      { border-left: 3px solid var(--phs-orange); }
.phs-card.score-critical { border-left: 3px solid var(--phs-red); }

/* Pulsing ring on cards with live runtime errors */
.phs-card.has-errors {
    border-top: 2px solid var(--phs-pink);
}
@keyframes error-glow {
    0%,100% { box-shadow: var(--phs-shadow); }
    50%      { box-shadow: 0 0 0 3px rgba(190,24,93,.10), var(--phs-shadow); }
}
.phs-card.has-errors { animation: error-glow 3s ease-in-out infinite; }

/* ── Card header ─────────────────────────────────────────────── */
.phs-card-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 16px 16px 0; gap: 10px; cursor: pointer; user-select: none;
}
.phs-card-title { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.phs-card-title strong {
    font-size: 14px; font-weight: 700; color: var(--phs-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.phs-badges { display: flex; flex-wrap: wrap; gap: 5px; }

/* ── Score ring ──────────────────────────────────────────────── */
.phs-score-ring {
    width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 700;
    border: 2.5px solid;
}
.phs-score-ring.score-great    { border-color: var(--phs-green);  color: var(--phs-green);  background: var(--phs-green-bg); }
.phs-score-ring.score-ok       { border-color: var(--phs-yellow); color: var(--phs-yellow); background: var(--phs-yellow-bg); }
.phs-score-ring.score-bad      { border-color: var(--phs-orange); color: var(--phs-orange); background: var(--phs-orange-bg); }
.phs-score-ring.score-critical { border-color: var(--phs-red);    color: var(--phs-red);    background: var(--phs-red-bg); }

/* ── Badges ──────────────────────────────────────────────────── */
.phs-badge {
    font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 50px;
    letter-spacing: .3px; text-transform: uppercase; white-space: nowrap; border: 1px solid;
}
.phs-badge-active   { background: var(--phs-green-bg);  color: var(--phs-green);  border-color: var(--phs-green-border); }
.phs-badge-inactive { background: var(--phs-surface2);  color: var(--phs-muted);  border-color: var(--phs-border); }
.phs-badge-error    { background: var(--phs-pink-bg);   color: var(--phs-pink);   border-color: var(--phs-pink-border); }
.phs-badge-logentry { background: var(--phs-blue-bg);   color: var(--phs-blue);   border-color: var(--phs-blue-border); }
.phs-badge-warn     { background: var(--phs-yellow-bg); color: var(--phs-yellow); border-color: var(--phs-yellow-border); }

/* ── Card meta ───────────────────────────────────────────────── */
.phs-card-meta {
    display: flex; flex-wrap: wrap; gap: 10px; padding: 9px 16px 12px;
    font-size: 11.5px; color: var(--phs-muted);
    font-family: 'JetBrains Mono', monospace;
    border-bottom: 1px solid var(--phs-border-soft);
}
.phs-expand-hint {
    margin-left: auto; color: #c0c4d8; font-size: 10.5px; font-family: 'Inter', sans-serif;
}

/* ── Card body (collapsed by default) ───────────────────────── */
.phs-card-body { max-height: 0; overflow: hidden; transition: max-height .3s ease, padding .3s ease; }
.phs-card.expanded .phs-card-body { max-height: 3000px; padding: 14px 16px 16px; }

/* ── Issues list ─────────────────────────────────────────────── */
.phs-issues-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }

.phs-issue {
    border-radius: var(--phs-radius-sm); overflow: hidden; border: 1px solid;
}
.phs-issue-critical { background: var(--phs-red-bg);    border-color: var(--phs-red-border);    }
.phs-issue-error    { background: var(--phs-orange-bg); border-color: var(--phs-orange-border); }
.phs-issue-warning  { background: var(--phs-yellow-bg); border-color: var(--phs-yellow-border); }
.phs-issue-info     { background: var(--phs-blue-bg);   border-color: var(--phs-blue-border);   }

/* Issue header row */
.phs-issue-head {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 9px 12px;
}
.phs-issue-tag {
    font-size: 10px; font-weight: 700; white-space: nowrap; padding: 2px 7px;
    border-radius: var(--phs-radius-xs); flex-shrink: 0; margin-top: 1px;
    border: 1px solid;
}
.phs-issue-critical .phs-issue-tag { background: var(--phs-red-bg);    color: var(--phs-red);    border-color: var(--phs-red-border); }
.phs-issue-error    .phs-issue-tag { background: var(--phs-orange-bg); color: var(--phs-orange); border-color: var(--phs-orange-border); }
.phs-issue-warning  .phs-issue-tag { background: var(--phs-yellow-bg); color: var(--phs-yellow); border-color: var(--phs-yellow-border); }
.phs-issue-info     .phs-issue-tag { background: var(--phs-blue-bg);   color: var(--phs-blue);   border-color: var(--phs-blue-border); }

.phs-issue-body {
    flex: 1; font-size: 12.5px; word-break: break-word; line-height: 1.5;
}
.phs-issue-critical .phs-issue-body { color: #991b1b; }
.phs-issue-error    .phs-issue-body { color: #9a3412; }
.phs-issue-warning  .phs-issue-body { color: #92400e; }
.phs-issue-info     .phs-issue-body { color: #1e40af; }

/* Fix guidance panel — hidden by default */
.phs-issue-fix {
    border-top: 1px dashed;
    padding: 10px 12px; font-size: 12px; line-height: 1.6;
    display: none;
}
.phs-issue-critical .phs-issue-fix { border-color: var(--phs-red-border);    color: #7f1d1d; background: #fff5f5; }
.phs-issue-error    .phs-issue-fix { border-color: var(--phs-orange-border); color: #7c2d12; background: #fff8f5; }
.phs-issue-warning  .phs-issue-fix { border-color: var(--phs-yellow-border); color: #78350f; background: #fffdf0; }
.phs-issue-info     .phs-issue-fix { border-color: var(--phs-blue-border);   color: #1e3a8a; background: #f8faff; }

.phs-issue-fix strong { display: block; font-weight: 700; margin-bottom: 4px; }
.phs-issue-fix code {
    font-family: 'JetBrains Mono', monospace; font-size: 11px;
    background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 3px;
}
.phs-issue-fix a { color: inherit; font-weight: 600; }

/* Toggle fix button */
.phs-fix-toggle {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; font-weight: 600; cursor: pointer;
    background: none; border: none; font-family: inherit;
    padding: 0 12px 9px; opacity: .7; transition: opacity .15s;
}
.phs-fix-toggle:hover { opacity: 1; }
.phs-issue-critical .phs-fix-toggle { color: var(--phs-red);    }
.phs-issue-error    .phs-fix-toggle { color: var(--phs-orange); }
.phs-issue-warning  .phs-fix-toggle { color: var(--phs-yellow); }
.phs-issue-info     .phs-fix-toggle { color: var(--phs-blue);   }

.phs-issue.fix-open .phs-issue-fix { display: block; }
.phs-issue.fix-open .phs-fix-toggle { opacity: 1; }

.phs-no-issues {
    font-size: 13px; color: var(--phs-green); margin: 0;
    padding: 6px 4px; display: flex; align-items: center; gap: 6px;
}

/* ── Colour helpers ──────────────────────────────────────────── */
.phs-col-ok   { color: var(--phs-green)  !important; font-weight: 700; }
.phs-col-warn { color: var(--phs-yellow) !important; font-weight: 700; }
.phs-col-crit { color: var(--phs-red)    !important; font-weight: 700; }
.phs-col-err  { color: var(--phs-pink)   !important; font-weight: 700; }
.phs-muted    { color: var(--phs-muted) !important; }
.phs-float-right { margin-left: auto; }

/* ── History table ──────────────────────────────────────────── */
.phs-history-table {
    background: var(--phs-surface); border: 1px solid var(--phs-border);
    border-radius: var(--phs-radius); overflow: hidden; box-shadow: var(--phs-shadow);
}
.phs-history-header, .phs-history-row {
    display: grid;
    grid-template-columns: 2fr 1.6fr .6fr .6fr .7fr .6fr 1.6fr;
    gap: 0; align-items: center; padding: 11px 18px; font-size: 12.5px;
}
.phs-history-header {
    background: var(--phs-surface2); color: var(--phs-muted);
    font-weight: 600; text-transform: uppercase; letter-spacing: .5px; font-size: 11px;
    border-bottom: 1px solid var(--phs-border);
}
.phs-history-row { border-bottom: 1px solid var(--phs-border-soft); color: var(--phs-text); }
.phs-history-row:last-child { border-bottom: none; }
.phs-history-row:hover { background: var(--phs-surface2); }
.phs-snap-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phs-snap-date { color: var(--phs-muted); font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.phs-snap-actions { display: flex; gap: 5px; flex-wrap: wrap; }

/* XS buttons */
.phs-btn-xs {
    font-family: inherit; font-size: 11px; font-weight: 600;
    padding: 4px 10px; border-radius: 50px; cursor: pointer;
    background: var(--phs-surface); border: 1px solid var(--phs-border);
    color: var(--phs-text-2); transition: all .15s; white-space: nowrap;
    text-decoration: none; display: inline-block;
}
.phs-btn-xs:hover { border-color: var(--phs-accent); color: var(--phs-accent); }
.phs-btn-danger { border-color: var(--phs-red-border); color: var(--phs-red); }
.phs-btn-danger:hover { background: var(--phs-red-bg); border-color: var(--phs-red); }

/* ── Snapshot detail panel ──────────────────────────────────── */
.phs-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 0 14px; border-bottom: 1px solid var(--phs-border); margin-bottom: 16px;
}
.phs-panel-header h2 { margin: 0; font-size: 16px; color: var(--phs-text); }
.phs-plugin-rows { display: flex; flex-direction: column; gap: 4px; }
.phs-history-plugin-row {
    display: grid; grid-template-columns: 2fr .6fr 1fr .5fr;
    align-items: center; gap: 10px; padding: 9px 14px;
    background: var(--phs-surface); border: 1px solid var(--phs-border);
    border-radius: var(--phs-radius-sm); font-size: 12.5px; color: var(--phs-text);
}
.phs-history-plugin-row.has-err { border-left: 3px solid var(--phs-pink); }
.phs-history-plugin-row.is-crit { border-left: 3px solid var(--phs-red); }

/* ── Compare page ───────────────────────────────────────────── */
.phs-compare-selectors {
    display: flex; align-items: flex-end; gap: 16px;
    margin-bottom: 28px; flex-wrap: wrap;
}
.phs-compare-slot { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 220px; }
.phs-compare-slot label { font-size: 12px; font-weight: 600; color: var(--phs-muted); }
.phs-compare-slot select {
    background: var(--phs-surface); border: 1px solid var(--phs-border);
    color: var(--phs-text); border-radius: var(--phs-radius-sm);
    padding: 9px 12px; font-family: inherit; font-size: 13px;
    width: 100%; box-shadow: var(--phs-shadow);
}
.phs-compare-arrow { font-size: 22px; color: var(--phs-muted); padding-bottom: 4px; }

/* Diff */
.phs-diff-header { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.phs-diff-label {
    flex: 1; background: var(--phs-surface); border: 1px solid var(--phs-border);
    border-radius: var(--phs-radius); padding: 13px 16px;
    font-size: 13.5px; font-weight: 700; display: flex; flex-direction: column; gap: 3px;
    box-shadow: var(--phs-shadow);
}
.phs-diff-label small { font-size: 11px; font-weight: 400; color: var(--phs-muted); }
.phs-diff-old { border-top: 3px solid var(--phs-blue); }
.phs-diff-new { border-top: 3px solid var(--phs-green); }
.phs-diff-vs { font-size: 18px; color: var(--phs-muted); font-weight: 700; }

.phs-diff-summary { display: flex; gap: 12px; margin-bottom: 26px; flex-wrap: wrap; }
.phs-diff-summary .phs-stat small { font-size: 10px; color: var(--phs-muted); }

.phs-diff-section { margin-bottom: 26px; }
.phs-diff-section h3 {
    font-size: 14px; font-weight: 700; color: var(--phs-text);
    margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--phs-border);
}
.phs-diff-row {
    background: var(--phs-surface); border: 1px solid var(--phs-border);
    border-radius: var(--phs-radius-sm); padding: 12px 16px;
    margin-bottom: 8px; font-size: 13px; box-shadow: var(--phs-shadow);
}
.phs-diff-row-header { display: flex; align-items: center; margin-bottom: 8px; }
.phs-diff-added   { border-left: 3px solid var(--phs-green); }
.phs-diff-removed { border-left: 3px solid var(--phs-red); opacity: .75; }
.phs-diff-detail  { font-size: 12px; margin-top: 6px; padding: 7px 10px; border-radius: var(--phs-radius-xs); }
.phs-diff-detail ul { margin: 5px 0 0 16px; padding: 0; }
.phs-diff-detail ul li { margin-bottom: 3px; word-break: break-word; }
.phs-diff-worse   { background: var(--phs-red-bg);   color: #7f1d1d; border-left: 2px solid var(--phs-red);   }
.phs-diff-better  { background: var(--phs-green-bg); color: #14532d; border-left: 2px solid var(--phs-green); }
.phs-diff-upgrade { background: var(--phs-blue-bg);  color: #1e3a8a; border-left: 2px solid var(--phs-blue);  }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    .phs-wrap { padding: 16px 14px 40px; margin: 0; }
    .phs-header { flex-direction: column; align-items: flex-start; }
    .phs-cards-grid { grid-template-columns: 1fr; }
    .phs-summary-bar { gap: 8px; }
    .phs-stat { min-width: 80px; padding: 11px 13px; }
    .phs-history-header, .phs-history-row { grid-template-columns: 1fr; }
}

/* ============================================================
   v4 additions — Card previews, Report Modal, Issues & Fixes
   ============================================================ */

/* ── Card preview strip ─────────────────────────────────────── */
.phs-card-preview {
    padding: 10px 16px 0;
    display: flex; flex-direction: column; gap: 5px;
}
.phs-card-issue-preview {
    font-size: 12px; padding: 6px 10px; border-radius: var(--phs-radius-xs);
    line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    border-left: 3px solid;
}
.phs-preview-critical { background: var(--phs-red-bg);    color: #991b1b; border-color: var(--phs-red);    }
.phs-preview-error    { background: var(--phs-orange-bg); color: #9a3412; border-color: var(--phs-orange); }
.phs-preview-warning  { background: var(--phs-yellow-bg); color: #92400e; border-color: var(--phs-yellow); }
.phs-preview-info     { background: var(--phs-blue-bg);   color: #1e40af; border-color: var(--phs-blue);   }
.phs-preview-ok       { background: var(--phs-green-bg);  color: var(--phs-green); border-color: var(--phs-green); }
.phs-preview-more     { font-size: 11px; color: var(--phs-muted); padding: 2px 10px; }

.phs-card-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; margin-top: 10px;
    border-top: 1px solid var(--phs-border-soft);
}
.phs-report-btn {
    font-family: inherit; font-size: 12.5px; font-weight: 600;
    padding: 7px 16px; border-radius: 50px; cursor: pointer;
    background: var(--phs-accent-soft); border: 1px solid #c7c8fd;
    color: var(--phs-accent); transition: all .15s;
}
.phs-report-btn:hover { background: var(--phs-accent); color: #fff; border-color: var(--phs-accent); }
.phs-issue-count {
    font-size: 11.5px; color: var(--phs-muted); font-weight: 500;
}

/* ── Modal overlay ──────────────────────────────────────────── */
.phs-modal-overlay {
    position: fixed; inset: 0; z-index: 999999;
    background: rgba(15,17,25,.55);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
body.phs-modal-open { overflow: hidden; }

/* ── Modal container ────────────────────────────────────────── */
.phs-modal {
    background: var(--phs-surface);
    border: 1px solid var(--phs-border);
    border-radius: 16px;
    width: 100%; max-width: 780px;
    max-height: 88vh;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,.18), 0 4px 16px rgba(0,0,0,.08);
    overflow: hidden;
    animation: modal-in .18s ease;
}
@keyframes modal-in {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to   { opacity: 1; transform: translateY(0)    scale(1);   }
}

/* ── Modal header ───────────────────────────────────────────── */
.phs-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--phs-border);
    flex-wrap: wrap; gap: 12px; flex-shrink: 0;
    background: var(--phs-surface2);
}
.phs-modal-header-inner { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.phs-modal-header-actions { display: flex; align-items: center; gap: 10px; }

.phs-modal-header h2 {
    font-size: 17px; font-weight: 700; color: var(--phs-text); margin: 0 0 5px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 400px;
}
.phs-modal-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.phs-meta-pill {
    font-size: 11px; padding: 2px 8px; border-radius: 50px;
    background: var(--phs-surface); border: 1px solid var(--phs-border);
    color: var(--phs-text-2); font-family: 'JetBrains Mono', monospace;
}

.phs-modal-score-ring {
    width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: 'JetBrains Mono', monospace; font-size: 15px; font-weight: 700;
    border: 3px solid;
}
.phs-modal-score-ring.score-great    { border-color: var(--phs-green);  color: var(--phs-green);  background: var(--phs-green-bg); }
.phs-modal-score-ring.score-ok       { border-color: var(--phs-yellow); color: var(--phs-yellow); background: var(--phs-yellow-bg); }
.phs-modal-score-ring.score-bad      { border-color: var(--phs-orange); color: var(--phs-orange); background: var(--phs-orange-bg); }
.phs-modal-score-ring.score-critical { border-color: var(--phs-red);    color: var(--phs-red);    background: var(--phs-red-bg); }

.phs-modal-close {
    background: none; border: none; font-size: 18px; cursor: pointer;
    color: var(--phs-muted); width: 32px; height: 32px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    transition: background .15s, color .15s;
}
.phs-modal-close:hover { background: var(--phs-red-bg); color: var(--phs-red); }
.phs-modal-print { font-size: 12px; padding: 7px 14px; }

/* ── Modal tabs ─────────────────────────────────────────────── */
.phs-modal-tabs {
    display: flex; gap: 2px; padding: 10px 22px 0;
    border-bottom: 1px solid var(--phs-border); flex-shrink: 0;
    background: var(--phs-surface);
}
.phs-tab {
    font-family: inherit; font-size: 13px; font-weight: 500;
    padding: 8px 16px 10px; background: none; border: none; cursor: pointer;
    color: var(--phs-muted); border-bottom: 2px solid transparent;
    margin-bottom: -1px; transition: color .15s, border-color .15s;
    border-radius: var(--phs-radius-sm) var(--phs-radius-sm) 0 0;
}
.phs-tab:hover { color: var(--phs-text); }
.phs-tab.active { color: var(--phs-accent); border-bottom-color: var(--phs-accent); font-weight: 600; }

/* ── Tab panels ─────────────────────────────────────────────── */
.phs-tab-panel { padding: 20px 22px; overflow-y: auto; flex: 1; }

/* ── Overview tab ───────────────────────────────────────────── */
.phs-modal-overview-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px;
}
.phs-overview-card {
    background: var(--phs-surface2); border: 1px solid var(--phs-border);
    border-radius: var(--phs-radius-sm); padding: 14px;
    display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
}
.phs-ov-icon { font-size: 22px; line-height: 1; margin-bottom: 2px; }
.phs-ov-label { font-size: 11px; font-weight: 600; color: var(--phs-muted); text-transform: uppercase; letter-spacing: .4px; }
.phs-ov-value { font-size: 28px; font-weight: 700; font-family: 'JetBrains Mono', monospace; line-height: 1.1; }
.phs-ov-value span { font-size: 13px; font-weight: 400; color: var(--phs-muted); }
.phs-ov-sub { font-size: 11px; color: var(--phs-muted); }

.phs-ov-green  { color: var(--phs-green); }
.phs-ov-yellow { color: var(--phs-yellow); }
.phs-ov-orange { color: var(--phs-orange); }
.phs-ov-red    { color: var(--phs-red); }
.phs-ov-icon-green  { filter: none; }
.phs-ov-icon-yellow { filter: none; }
.phs-ov-icon-orange { filter: none; }
.phs-ov-icon-red    { filter: none; }

.phs-ov-summary {
    background: var(--phs-surface2); border: 1px solid var(--phs-border);
    border-radius: var(--phs-radius-sm); padding: 13px 16px;
    font-size: 13.5px; line-height: 1.6; color: var(--phs-text-2);
}
.phs-ov-summary a { color: var(--phs-accent); font-weight: 600; }
.phs-summary-ok { color: var(--phs-green); font-weight: 600; }
.phs-no-issues-lg { font-size: 15px; color: var(--phs-green); padding: 30px 0; text-align: center; }

/* ── Issues tab ─────────────────────────────────────────────── */
.phs-issue-group { margin-bottom: 24px; }
.phs-issue-group-title {
    font-size: 13.5px; font-weight: 700; color: var(--phs-text);
    margin: 0 0 10px; padding-bottom: 8px;
    border-bottom: 1px solid var(--phs-border);
    display: flex; align-items: center; gap: 8px;
}
.phs-issue-group-count {
    background: var(--phs-surface2); border: 1px solid var(--phs-border);
    font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 50px;
    color: var(--phs-muted);
}

/* Full issue row */
.phs-full-issue {
    border: 1px solid; border-radius: var(--phs-radius-sm);
    margin-bottom: 10px; overflow: hidden;
}
.phs-full-issue-critical { border-color: var(--phs-red-border);    background: var(--phs-red-bg);    border-left: 4px solid var(--phs-red);    }
.phs-full-issue-error    { border-color: var(--phs-orange-border); background: var(--phs-orange-bg); border-left: 4px solid var(--phs-orange); }
.phs-full-issue-warning  { border-color: var(--phs-yellow-border); background: var(--phs-yellow-bg); border-left: 4px solid var(--phs-yellow); }
.phs-full-issue-info     { border-color: var(--phs-blue-border);   background: var(--phs-blue-bg);   border-left: 4px solid var(--phs-blue);   }

.phs-full-issue-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 10px; padding: 11px 14px;
}
.phs-full-issue-left { display: flex; align-items: flex-start; gap: 8px; flex: 1; min-width: 0; }
.phs-full-issue-type {
    font-size: 10px; font-weight: 700; white-space: nowrap; padding: 2px 7px;
    border-radius: var(--phs-radius-xs); flex-shrink: 0;
    background: rgba(255,255,255,.6); border: 1px solid rgba(0,0,0,.08);
    color: var(--phs-text-2); margin-top: 1px;
}
.phs-full-issue-msg {
    font-size: 13px; line-height: 1.5; word-break: break-word; flex: 1;
}
.phs-full-issue-critical .phs-full-issue-msg { color: #7f1d1d; }
.phs-full-issue-error    .phs-full-issue-msg { color: #7c2d12; }
.phs-full-issue-warning  .phs-full-issue-msg { color: #78350f; }
.phs-full-issue-info     .phs-full-issue-msg { color: #1e3a8a; }

/* Fix button */
.phs-fix-btn {
    font-family: inherit; font-size: 11.5px; font-weight: 600; white-space: nowrap;
    padding: 5px 12px; border-radius: 50px; cursor: pointer; flex-shrink: 0;
    background: rgba(255,255,255,.7); border: 1px solid rgba(0,0,0,.12);
    color: var(--phs-text-2); transition: all .15s;
}
.phs-fix-btn:hover, .phs-fix-btn.active {
    background: var(--phs-surface); border-color: var(--phs-accent); color: var(--phs-accent);
}

/* Fix guidance panel */
.phs-fix-panel {
    border-top: 1px dashed rgba(0,0,0,.12);
    background: rgba(255,255,255,.65); backdrop-filter: blur(2px);
}
.phs-fix-inner { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.phs-fix-section h4 {
    font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
    color: var(--phs-text-2); margin: 0 0 6px;
}
.phs-fix-section p { font-size: 13px; line-height: 1.6; color: var(--phs-text-2); margin: 0; }
.phs-fix-section p code, .phs-fix-section li code {
    font-family: 'JetBrains Mono', monospace; font-size: 11.5px;
    background: rgba(0,0,0,.07); padding: 1px 5px; border-radius: 3px; color: var(--phs-text);
}

.phs-fix-steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 7px; }
.phs-fix-steps li { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; line-height: 1.55; color: var(--phs-text-2); }
.phs-step-num {
    flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%;
    background: var(--phs-accent); color: #fff;
    font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
    margin-top: 1px;
}

.phs-fix-code { border-radius: var(--phs-radius-sm); overflow: hidden; }
.phs-fix-code pre {
    margin: 0; background: #1e2035; color: #e8eaf0;
    padding: 14px 16px; font-family: 'JetBrains Mono', monospace;
    font-size: 12px; line-height: 1.6; overflow-x: auto;
}

.phs-fix-links h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--phs-text-2); margin: 0 0 8px; }
.phs-fix-link-list { display: flex; gap: 8px; flex-wrap: wrap; }
.phs-fix-link-list a {
    font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 50px;
    background: var(--phs-surface); border: 1px solid var(--phs-border);
    color: var(--phs-accent); text-decoration: none; transition: all .15s;
}
.phs-fix-link-list a:hover { background: var(--phs-accent); color: #fff; border-color: var(--phs-accent); }

/* ── Info tab ───────────────────────────────────────────────── */
.phs-info-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-bottom: 20px; }
.phs-info-table th, .phs-info-table td { padding: 10px 14px; border-bottom: 1px solid var(--phs-border-soft); text-align: left; }
.phs-info-table th { width: 180px; font-weight: 600; color: var(--phs-muted); background: var(--phs-surface2); }
.phs-info-table td { color: var(--phs-text); font-family: 'JetBrains Mono', monospace; font-size: 12.5px; }
.phs-info-table tr:last-child th, .phs-info-table tr:last-child td { border-bottom: none; }
.phs-info-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Responsive modal ───────────────────────────────────────── */
@media (max-width: 700px) {
    .phs-modal { max-height: 95vh; border-radius: 12px; }
    .phs-modal-overview-grid { grid-template-columns: repeat(2,1fr); }
    .phs-modal-header h2 { font-size: 15px; max-width: 200px; }
    .phs-modal-print { display: none; }
}

/* ============================================================
   v4.2 — Per-plugin log management buttons
   ============================================================ */

/* Log action row inside card footer */
.phs-log-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--phs-border);
    width: 100%;
}

.phs-log-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--phs-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-right: 2px;
}

.phs-log-btn {
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 600;
    padding: 5px 11px;
    border-radius: 50px;
    cursor: pointer;
    border: 1px solid;
    transition: all .15s;
    white-space: nowrap;
}

.phs-log-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* 7 days — blue tint */
.phs-log-7d {
    background: var(--phs-blue-bg);
    border-color: var(--phs-blue-border);
    color: var(--phs-blue);
}
.phs-log-7d:hover:not(:disabled) {
    background: var(--phs-blue);
    color: #fff;
    border-color: var(--phs-blue);
}

/* 1 day — yellow tint */
.phs-log-1d {
    background: var(--phs-yellow-bg);
    border-color: var(--phs-yellow-border);
    color: var(--phs-yellow);
}
.phs-log-1d:hover:not(:disabled) {
    background: var(--phs-yellow);
    color: #fff;
    border-color: var(--phs-yellow);
}

/* Clear — red tint */
.phs-log-clear {
    background: var(--phs-red-bg);
    border-color: var(--phs-red-border);
    color: var(--phs-red);
}
.phs-log-clear:hover:not(:disabled) {
    background: var(--phs-red);
    color: #fff;
    border-color: var(--phs-red);
}

/* Toast confirmation message */
.phs-log-toast {
    width: 100%;
    margin-top: 6px;
    padding: 7px 12px;
    border-radius: var(--phs-radius-xs);
    font-size: 12px;
    line-height: 1.5;
    background: var(--phs-green-bg);
    border: 1px solid var(--phs-green-border);
    color: var(--phs-green);
}

/* Card footer layout tweak — allow log actions to wrap below report btn */
.phs-card-footer {
    flex-wrap: wrap;
}

/* ============================================================
   v4.3 — Mark as Fixed, clear-and-rescan, stale error warnings
   ============================================================ */

/* ── "Mark as Fixed" modal button ───────────────────────────── */
.phs-btn-fixed {
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 50px;
    cursor: pointer;
    border: 1.5px solid var(--phs-green-border);
    background: var(--phs-green-bg);
    color: var(--phs-green);
    transition: all .15s;
    white-space: nowrap;
}
.phs-btn-fixed:hover {
    background: var(--phs-green);
    color: #fff;
    border-color: var(--phs-green);
    box-shadow: 0 2px 8px rgba(22,163,74,.25);
}

/* ── Card clearing animation ────────────────────────────────── */
.phs-card-clearing {
    opacity: .6;
    pointer-events: none;
    transition: opacity .2s;
}

/* Flash green after successful clear + rescan */
@keyframes cleared-flash {
    0%   { box-shadow: 0 0 0 0 rgba(22,163,74,.4); }
    50%  { box-shadow: 0 0 0 8px rgba(22,163,74,.15); }
    100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); }
}
.phs-card-just-cleared {
    animation: cleared-flash 1.8s ease;
    border-color: var(--phs-green-border) !important;
}

/* ── Stale error warning in overview ────────────────────────── */
.phs-ov-stale {
    font-size: 10.5px;
    color: var(--phs-yellow);
    background: var(--phs-yellow-bg);
    border: 1px solid var(--phs-yellow-border);
    border-radius: var(--phs-radius-xs);
    padding: 3px 8px;
    margin-top: 4px;
    line-height: 1.4;
    text-align: center;
}

/* ── Log action button label update ────────────────────────── */
/* "I fixed it" button gets a distinctly green look */
.phs-log-clear {
    background: var(--phs-green-bg) !important;
    border-color: var(--phs-green-border) !important;
    color: var(--phs-green) !important;
}
.phs-log-clear:hover:not(:disabled) {
    background: var(--phs-green) !important;
    color: #fff !important;
    border-color: var(--phs-green) !important;
}

/* ── Extended toast for rescan result ───────────────────────── */
.phs-log-toast {
    animation: toast-in .25s ease;
}
@keyframes toast-in {
    from { opacity:0; transform: translateY(-4px); }
    to   { opacity:1; transform: translateY(0); }
}

/* ============================================================
   v4.4 — Performance Monitor page
   ============================================================ */

/* ── Legend ──────────────────────────────────────────────────── */
.phs-perf-legend {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    background: var(--phs-surface); border: 1px solid var(--phs-border);
    border-radius: var(--phs-radius-sm); padding: 10px 16px;
    font-size: 12.5px; margin-bottom: 20px; box-shadow: var(--phs-shadow);
}
.phs-legend-title { font-weight: 700; color: var(--phs-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.phs-legend-warn  { color: var(--phs-yellow); }
.phs-legend-crit  { color: var(--phs-red); }

/* ── Performance cards grid ─────────────────────────────────── */
.phs-perf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

/* ── Performance card ───────────────────────────────────────── */
.phs-perf-card {
    background: var(--phs-surface); border: 1px solid var(--phs-border);
    border-radius: var(--phs-radius); padding: 18px;
    box-shadow: var(--phs-shadow);
    transition: transform .18s, box-shadow .18s;
}
.phs-perf-card:hover { transform: translateY(-2px); box-shadow: var(--phs-shadow-md); }
.phs-perf-card.perf-critical { border-left: 3px solid var(--phs-red);    border-top: 2px solid var(--phs-red-border); }
.phs-perf-card.perf-warning  { border-left: 3px solid var(--phs-yellow); border-top: 2px solid var(--phs-yellow-border); }
.phs-perf-card.perf-ok       { border-left: 3px solid var(--phs-green);  }

.phs-perf-card-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 14px; gap: 8px;
}
.phs-perf-name {
    font-size: 14px; font-weight: 700; color: var(--phs-text);
    display: block; margin-bottom: 5px; word-break: break-all;
}
.phs-perf-samples { font-size: 11px; color: var(--phs-muted); font-family: 'JetBrains Mono', monospace; white-space: nowrap; }

/* Spike level badge */
.phs-perf-badge {
    display: inline-block; font-size: 10.5px; font-weight: 700;
    padding: 2px 9px; border-radius: 50px; border: 1px solid;
}
.phs-perf-badge-critical { background: var(--phs-red-bg);    color: var(--phs-red);    border-color: var(--phs-red-border); }
.phs-perf-badge-warning  { background: var(--phs-yellow-bg); color: var(--phs-yellow); border-color: var(--phs-yellow-border); }
.phs-perf-badge-none     { background: var(--phs-green-bg);  color: var(--phs-green);  border-color: var(--phs-green-border); }

/* ── Metric rows ────────────────────────────────────────────── */
.phs-perf-metrics { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.phs-perf-metric  { display: flex; flex-direction: column; gap: 5px; }

.phs-perf-metric-head {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 12px; color: var(--phs-muted); font-weight: 500;
}
.phs-perf-metric-head strong { color: var(--phs-text); }
.phs-perf-metric-sub { font-size: 11px; color: var(--phs-muted); font-family: 'JetBrains Mono', monospace; }

/* Progress bar */
.phs-perf-bar-track {
    position: relative; height: 7px;
    background: var(--phs-surface2); border-radius: 50px; overflow: visible;
}
.phs-perf-bar-fill {
    height: 100%; border-radius: 50px;
    transition: width .4s ease;
    min-width: 2px;
}
/* Average marker */
.phs-perf-bar-avg {
    position: absolute; top: -3px; width: 2px; height: 13px;
    background: var(--phs-text-2); border-radius: 1px;
    transform: translateX(-50%);
    opacity: .5;
}

/* Worst URL + last seen */
.phs-perf-worst-url {
    font-size: 11.5px; color: var(--phs-muted); margin-top: 10px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.phs-perf-worst-url code {
    font-family: 'JetBrains Mono', monospace; font-size: 11px;
    background: var(--phs-surface2); padding: 1px 5px; border-radius: 3px;
}
.phs-perf-last-seen { font-size: 11px; color: var(--phs-muted); margin-top: 3px; }

/* Card footer */
.phs-perf-card-footer {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--phs-border-soft);
}
.phs-perf-drill-btn {
    font-family: inherit; font-size: 12.5px; font-weight: 600;
    padding: 6px 14px; border-radius: 50px; cursor: pointer;
    background: var(--phs-accent-soft); border: 1px solid #c7c8fd;
    color: var(--phs-accent); transition: all .15s;
}
.phs-perf-drill-btn:hover { background: var(--phs-accent); color: #fff; border-color: var(--phs-accent); }

/* ── Request log table (modal) ──────────────────────────────── */
.phs-perf-log-table { display: flex; flex-direction: column; gap: 3px; }
.phs-perf-log-header, .phs-perf-log-row {
    display: grid;
    grid-template-columns: 80px 1fr 80px 80px 100px 70px;
    gap: 8px; align-items: center; padding: 8px 12px; font-size: 12px;
}
.phs-perf-log-header {
    background: var(--phs-surface2); border-radius: var(--phs-radius-sm);
    color: var(--phs-muted); font-weight: 700; font-size: 11px;
    text-transform: uppercase; letter-spacing: .4px;
}
.phs-perf-log-row {
    background: var(--phs-surface); border: 1px solid var(--phs-border-soft);
    border-radius: var(--phs-radius-sm); color: var(--phs-text);
}
.phs-perf-log-row:hover { background: var(--phs-surface2); }
.phs-perf-log-url { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--phs-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    .phs-perf-grid { grid-template-columns: 1fr; }
    .phs-perf-log-header, .phs-perf-log-row { grid-template-columns: 70px 1fr 60px 60px; }
    .phs-perf-log-row span:nth-child(5),
    .phs-perf-log-header span:nth-child(5) { display: none; }
}

/* ============================================================
   v4.5 — SAVEQUERIES toggle card
   ============================================================ */

.phs-sq-card {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 20px; padding: 18px 22px;
    background: var(--phs-surface); border: 1px solid var(--phs-border);
    border-radius: var(--phs-radius); box-shadow: var(--phs-shadow);
    margin-bottom: 22px; flex-wrap: wrap;
    transition: border-color .3s, box-shadow .3s;
}
.phs-sq-card.phs-sq-active {
    border-color: var(--phs-green-border);
    box-shadow: 0 0 0 3px rgba(22,163,74,.08), var(--phs-shadow);
}

.phs-sq-left  { display: flex; align-items: flex-start; gap: 14px; flex: 1; min-width: 0; }
.phs-sq-icon  { font-size: 26px; line-height: 1; flex-shrink: 0; margin-top: 2px; }
.phs-sq-right { display: flex; align-items: center; flex-shrink: 0; }

.phs-sq-title {
    font-size: 14.5px; font-weight: 700; color: var(--phs-text);
    margin-bottom: 5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

.phs-sq-status-badge {
    font-size: 11px; font-weight: 700; padding: 2px 9px;
    border-radius: 50px; border: 1px solid;
}
.phs-sq-on  { background: var(--phs-green-bg);  color: var(--phs-green);  border-color: var(--phs-green-border)  !important; }
.phs-sq-off { background: var(--phs-surface2);  color: var(--phs-muted);  border-color: var(--phs-border)        !important; }

.phs-sq-desc {
    font-size: 13px; color: var(--phs-text-2); line-height: 1.6;
}
.phs-sq-desc code {
    font-family: 'JetBrains Mono', monospace; font-size: 11.5px;
    background: var(--phs-surface2); padding: 1px 5px;
    border-radius: 3px; color: var(--phs-accent);
}

.phs-sq-manual {
    margin-top: 8px; font-size: 12.5px;
    background: var(--phs-yellow-bg); border: 1px solid var(--phs-yellow-border);
    border-radius: var(--phs-radius-sm); padding: 8px 12px; color: var(--phs-yellow);
}
.phs-sq-manual code {
    font-family: 'JetBrains Mono', monospace; font-size: 11.5px;
    background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 3px;
}

/* Toggle button */
.phs-sq-btn {
    font-family: inherit; font-size: 13px; font-weight: 600;
    padding: 10px 22px; border-radius: 50px; cursor: pointer;
    border: 1.5px solid; transition: all .18s; white-space: nowrap;
}
.phs-sq-btn:disabled { opacity: .5; cursor: not-allowed; }

.phs-sq-btn-add {
    background: var(--phs-green-bg); border-color: var(--phs-green-border);
    color: var(--phs-green);
}
.phs-sq-btn-add:hover:not(:disabled) {
    background: var(--phs-green); color: #fff; border-color: var(--phs-green);
    box-shadow: 0 2px 10px rgba(22,163,74,.3);
}

.phs-sq-btn-remove {
    background: var(--phs-red-bg); border-color: var(--phs-red-border);
    color: var(--phs-red);
}
.phs-sq-btn-remove:hover:not(:disabled) {
    background: var(--phs-red); color: #fff; border-color: var(--phs-red);
    box-shadow: 0 2px 10px rgba(220,38,38,.25);
}

/* Toast after toggle */
.phs-sq-toast {
    background: var(--phs-green-bg); border: 1px solid var(--phs-green-border);
    border-radius: var(--phs-radius-sm); padding: 10px 16px;
    font-size: 13px; color: var(--phs-green); margin-bottom: 16px;
    animation: toast-in .25s ease;
}

/* ============================================================
   v4.5.2 — Diagnostic panel
   ============================================================ */

.phs-diag-panel {
    background: var(--phs-surface);
    border: 1px solid var(--phs-border);
    border-left: 3px solid var(--phs-accent);
    border-radius: var(--phs-radius);
    margin-bottom: 22px;
    box-shadow: var(--phs-shadow);
    overflow: hidden;
}

.phs-diag-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 18px;
    background: var(--phs-surface2);
    border-bottom: 1px solid var(--phs-border);
    font-weight: 700; font-size: 14px; color: var(--phs-text);
}

.phs-diag-close {
    background: none; border: none; font-size: 16px;
    cursor: pointer; color: var(--phs-muted); line-height: 1;
    padding: 2px 6px; border-radius: 4px; transition: all .15s;
}
.phs-diag-close:hover { background: var(--phs-red-bg); color: var(--phs-red); }

.phs-diag-body { padding: 16px 18px; }

.phs-diag-steps {
    display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px;
}

.phs-diag-step {
    display: grid;
    grid-template-columns: 24px 180px 1fr;
    gap: 8px; align-items: start;
    padding: 8px 12px;
    background: var(--phs-surface2);
    border: 1px solid var(--phs-border-soft);
    border-radius: var(--phs-radius-sm);
    font-size: 13px;
}
.phs-diag-step.phs-diag-fail {
    background: var(--phs-red-bg);
    border-color: var(--phs-red-border);
}

.phs-diag-icon  { font-size: 15px; line-height: 1.4; }
.phs-diag-label { font-weight: 600; color: var(--phs-text); }
.phs-diag-value {
    font-family: 'JetBrains Mono', monospace; font-size: 12px;
    color: var(--phs-text-2); word-break: break-all;
}
.phs-diag-note {
    grid-column: 2 / -1;
    font-size: 12px; color: var(--phs-yellow);
    background: var(--phs-yellow-bg);
    border: 1px solid var(--phs-yellow-border);
    border-radius: var(--phs-radius-xs);
    padding: 4px 8px; margin-top: 3px;
}
.phs-diag-step.phs-diag-fail .phs-diag-note {
    color: var(--phs-red); background: none; border: none; padding: 0;
}

.phs-diag-result {
    padding: 12px 16px; border-radius: var(--phs-radius-sm);
    font-size: 13.5px; font-weight: 500; line-height: 1.5;
}
.phs-diag-ok  { background: var(--phs-green-bg); border: 1px solid var(--phs-green-border); color: var(--phs-green); }
.phs-diag-err { background: var(--phs-red-bg);   border: 1px solid var(--phs-red-border);   color: var(--phs-red); }
