/* =========================================================================
   LastHost QA — Vuexy-inspired (matches lasthost-admin: periwinkle #7189CC,
   rounded corners, soft layered depth, light/dark themes)
   ========================================================================= */

:root {
    --primary: #7189CC;
    --primary-600: #5f77bd;
    --primary-700: #4e66ad;
    --primary-grad: linear-gradient(118deg, #7189CC, rgba(113, 137, 204, 0.7));

    --bg: #f8f7fa;
    --surface: #ffffff;
    --surface-2: #f3f2f7;
    --text: #4b4b5a;
    --text-strong: #2f2f40;
    --muted: #a5a5b8;
    --border: #ebe9f1;

    --success: #28c76f;
    --danger: #ea5455;
    --warning: #ff9f43;
    --info: #00cfe8;

    /* Severity scale */
    --sev-critical: #9b6bdf;   /* purple */
    --sev-high:     #ea5455;   /* red */
    --sev-medium:   #f7c948;   /* yellow */
    --sev-low:      #28c76f;   /* green */

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-sm: 0 2px 6px rgba(34, 41, 47, 0.08);
    --shadow: 0 6px 18px rgba(34, 41, 47, 0.10);
    --shadow-lg: 0 12px 40px rgba(34, 41, 47, 0.18);

    --font: "Public Sans", "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

:root[data-theme="dark"] {
    --bg: #25293c;
    --surface: #2f3349;
    --surface-2: #3a3f5a;
    --text: #b4b9d6;
    --text-strong: #e7e9f5;
    --muted: #8b90ac;
    --border: #444a63;

    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.30);
    --shadow: 0 6px 18px rgba(0, 0, 0, 0.42);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

/* The hidden attribute always wins, even over display rules on components. */
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    padding: 12px 22px;
    border-radius: var(--radius-sm);
    color: #fff;
    background: var(--primary-grad);
    background-color: var(--primary);
    box-shadow: 0 6px 16px rgba(113, 137, 204, 0.40);
    transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(113, 137, 204, 0.55); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; }
.btn-sm { font-size: 13px; padding: 8px 14px; }
.btn-ghost {
    background: var(--surface);
    color: var(--text-strong);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}
.btn-ghost:hover { box-shadow: var(--shadow); }
.btn-danger {
    background: var(--danger);
    box-shadow: 0 6px 16px rgba(234, 84, 85, 0.35);
}
.btn-svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* =========================================================================
   LOGIN PAGE
   ========================================================================= */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(1000px 600px at 15% -10%, rgba(113, 137, 204, 0.35), transparent 60%),
        radial-gradient(900px 600px at 110% 110%, rgba(155, 107, 223, 0.28), transparent 60%),
        var(--bg);
}
.login-card {
    width: 400px;
    max-width: calc(100vw - 40px);
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 42px 38px 34px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: cardIn .5s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes cardIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
.login-logo { width: 54px; height: auto; margin-bottom: 12px; }
.login-brand {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-strong);
    margin: 0 0 4px;
    letter-spacing: -0.3px;
}
.login-brand span { color: var(--primary); }
.login-sub { color: var(--muted); font-size: 14px; margin: 0 0 26px; }
.login-form { text-align: left; display: flex; flex-direction: column; gap: 16px; }
.login-error {
    background: rgba(234, 84, 85, 0.12);
    color: var(--danger);
    border: 1px solid rgba(234, 84, 85, 0.3);
    border-radius: var(--radius-sm);
    font-size: 13px;
    padding: 10px 12px;
    margin-bottom: 18px;
    text-align: left;
}
.login-foot { margin-top: 20px; font-size: 12px; color: var(--muted); }

/* ---- Form fields ---------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; font-weight: 600; color: var(--text-strong); }
.field small { font-weight: 400; color: var(--muted); }
.field input {
    font-family: inherit;
    font-size: 15px;
    color: var(--text-strong);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    outline: none;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(113, 137, 204, 0.18);
}
.check-field {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; color: var(--text-strong); cursor: pointer;
}
.check-field input { accent-color: var(--primary); width: 16px; height: 16px; }

/* =========================================================================
   TOPBAR
   ========================================================================= */
.app-body { min-height: 100vh; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 15px 20px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.topbar .brand {
    display: flex; align-items: center; gap: 10px;
    font-weight: 700; color: var(--text-strong); font-size: 17px;
    white-space: nowrap;
}
.topbar .brand img { width: 26px; }
.topbar .brand span { color: var(--primary); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* ---- Overall tally (ring + text) ----------------------------------------- */
.tally { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tally-ring { position: relative; width: 46px; height: 46px; flex: none; }
.tally-ring svg { width: 46px; height: 46px; transform: rotate(-90deg); }
.tally-ring circle { fill: none; stroke-width: 3.4; }
.ring-bg { stroke: var(--surface-2); }
.ring-fg {
    stroke: var(--primary);
    stroke-linecap: round;
    transition: stroke-dasharray .45s cubic-bezier(.2,.8,.2,1);
}
.ring-label {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 10.5px; font-weight: 700; color: var(--text-strong);
    font-variant-numeric: tabular-nums;
}
.tally-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.tally-text strong { font-size: 14px; color: var(--text-strong); white-space: nowrap; }
.tally-text small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Theme toggle --------------------------------------------------------- */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-strong);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: box-shadow .12s ease, transform .12s ease;
    flex: none;
}
.theme-toggle:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.theme-toggle svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.login-toggle { position: fixed; top: 18px; right: 18px; }

/* =========================================================================
   LAYOUT: sidebar + content
   ========================================================================= */
.layout {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 22px;
    padding: 22px;
    max-width: 1400px;
    margin: 0 auto;
}

.sidebar {
    position: sticky;
    /* Offset = topbar height (46px tally ring + 15px padding top/bottom) + layout gap */
    top: 98px;
    align-self: start;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 14px;
}
.sidebar-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 4px 10px 10px;
}
.side-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 2px 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--text);
    transition: background .12s ease;
}
.side-item:hover { background: var(--surface-2); }
.side-item.complete .side-name { color: var(--success); }
.side-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-count {
    font-size: 11.5px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.side-bar {
    grid-column: 1 / -1;
    height: 4px;
    border-radius: 4px;
    background: var(--surface-2);
    overflow: hidden;
}
.side-fill {
    display: block;
    height: 100%;
    border-radius: 4px;
    background: var(--primary-grad);
    background-color: var(--primary);
    transition: width .4s cubic-bezier(.2,.8,.2,1);
}
.side-item.complete .side-fill { background: var(--success); }

.content { min-width: 0; }
.content-narrow { max-width: 900px; margin: 22px auto; padding: 0 22px; display: flex; flex-direction: column; gap: 22px; }

/* ---- Toolbar (search + hide completed) ------------------------------------ */
.toolbar {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.search-wrap {
    position: relative;
    flex: 1;
    min-width: 220px;
}
.search-wrap svg {
    position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    width: 17px; height: 17px;
    stroke: var(--muted); fill: none; stroke-width: 2; stroke-linecap: round;
    pointer-events: none;
}
.search-wrap input {
    width: 100%;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-strong);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 13px 11px 40px;
    outline: none;
    box-shadow: var(--shadow-sm);
    transition: border-color .12s ease, box-shadow .12s ease;
}
.search-wrap input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(113, 137, 204, 0.18);
}
.switch-wrap {
    display: flex; align-items: center; gap: 9px;
    font-size: 13.5px; font-weight: 600; color: var(--text-strong);
    cursor: pointer; user-select: none;
}
.switch-wrap input { display: none; }
.switch {
    width: 38px; height: 22px;
    border-radius: 22px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    position: relative;
    transition: background .18s ease;
    flex: none;
}
.switch::after {
    content: "";
    position: absolute;
    top: 2px; left: 2px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
    transition: transform .18s cubic-bezier(.2,.8,.2,1);
}
.switch-wrap input:checked + .switch { background: var(--primary); border-color: var(--primary); }
.switch-wrap input:checked + .switch::after { transform: translateX(16px); }

/* =========================================================================
   SECTIONS
   ========================================================================= */
.qa-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
    scroll-margin-top: 98px;
}
.section-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
}
.section-head:hover { background: var(--surface-2); }
.sec-chevron {
    width: 18px; height: 18px; flex: none;
    stroke: var(--muted); fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
    transition: transform .2s ease;
}
.qa-section.collapsed .sec-chevron { transform: rotate(-90deg); }
.section-headings { flex: 1; min-width: 0; }
.section-head h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-strong);
}
.section-note { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }
.section-progress {
    display: flex; flex-direction: column; align-items: flex-end; gap: 5px;
    flex: none;
}
.sec-count { font-size: 12.5px; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.sec-bar {
    width: 130px; height: 6px;
    border-radius: 6px;
    background: var(--surface-2);
    overflow: hidden;
    display: inline-block;
}
.sec-fill {
    display: block; height: 100%;
    border-radius: 6px;
    background: var(--primary-grad);
    background-color: var(--primary);
    transition: width .4s cubic-bezier(.2,.8,.2,1);
}
.section-body { border-top: 1px solid var(--border); padding: 6px 14px 14px; }
.qa-section.collapsed .section-body { display: none; }
.qa-section.filtered-out { display: none; }

/* =========================================================================
   TEST ROWS
   ========================================================================= */
.test { border-bottom: 1px solid var(--border); }
.test:last-of-type { border-bottom: none; }
.test.filtered-out { display: none; }

.test-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 6px;
    border-left: 3px solid transparent;
    border-radius: 4px;
    transition: background .3s ease;
}
.test.depth-2 .test-row { padding-left: 40px; }

/* Severity accent on the row edge */
.test.sev-critical > .test-row { border-left-color: var(--sev-critical); }
.test.sev-high     > .test-row { border-left-color: var(--sev-high); }
.test.sev-medium   > .test-row { border-left-color: var(--sev-medium); }
.test.sev-low      > .test-row { border-left-color: var(--sev-low); }

.test.just-done > .test-row { background: rgba(40, 199, 111, 0.12); }

.ref {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    background: var(--surface-2);
    border-radius: 6px;
    padding: 2.5px 7px;
    flex: none;
    font-variant-numeric: tabular-nums;
}
.test-title {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    color: var(--text-strong);
    transition: color .2s ease, opacity .2s ease;
}
.test.done > .test-row .test-title {
    color: var(--muted);
    text-decoration: line-through;
    text-decoration-color: rgba(165, 165, 184, 0.65);
}
.badge-destructive {
    flex: none;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--danger);
    background: rgba(234, 84, 85, 0.13);
    border: 1px solid rgba(234, 84, 85, 0.35);
    border-radius: 6px;
    padding: 2.5px 7px;
}
.chip-steps {
    flex: none;
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    background: rgba(113, 137, 204, 0.14);
    border-radius: 6px;
    padding: 2.5px 7px;
    font-variant-numeric: tabular-nums;
}

/* ---- Animated checkbox ----------------------------------------------------- */
.cb { flex: none; cursor: pointer; display: inline-flex; }
.cb-input { display: none; }
.cb-box {
    width: 23px; height: 23px;
    border-radius: 7px;
    border: 2px solid var(--border);
    background: var(--surface);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.cb:hover .cb-box { border-color: var(--primary); transform: scale(1.08); }
.cb-box svg { width: 15px; height: 15px; display: block; }
.cb-check {
    fill: none;
    stroke: #fff;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 24;
    stroke-dashoffset: 24;
}
.cb-input:checked + .cb-box {
    background: var(--success);
    border-color: var(--success);
    animation: cbPop .38s cubic-bezier(.2,.8,.2,1);
}
.cb-input:checked + .cb-box .cb-check {
    animation: cbDraw .3s ease-out .08s forwards;
}
@keyframes cbPop {
    0% { transform: scale(1); }
    45% { transform: scale(1.28); }
    100% { transform: scale(1); }
}
@keyframes cbDraw { to { stroke-dashoffset: 0; } }

/* Confetti particles (appended to <body>) */
.confetti {
    position: fixed;
    z-index: 999;
    border-radius: 2px;
    pointer-events: none;
    animation: confettiFly .7s cubic-bezier(.15,.8,.4,1) forwards;
}
@keyframes confettiFly {
    0%   { opacity: 1; transform: translate(0, 0) rotate(0); }
    100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); }
}

/* ---- Severity picker -------------------------------------------------------- */
.sev-wrap { position: relative; flex: none; display: inline-flex; }
.sev-dot {
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: transform .12s ease, box-shadow .12s ease;
}
.sev-dot:hover { transform: scale(1.15); }
.sev-dot[data-sev="critical"] { background: var(--sev-critical); border-color: var(--sev-critical); }
.sev-dot[data-sev="high"]     { background: var(--sev-high);     border-color: var(--sev-high); }
.sev-dot[data-sev="medium"]   { background: var(--sev-medium);   border-color: var(--sev-medium); }
.sev-dot[data-sev="low"]      { background: var(--sev-low);      border-color: var(--sev-low); }

.sev-pop[hidden] { display: none; }
.sev-pop {
    position: absolute;
    top: calc(100% + 8px);
    right: -6px;
    z-index: 40;
    display: flex;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 10px;
    box-shadow: var(--shadow-lg);
    animation: popIn .16s cubic-bezier(.2,.8,.2,1);
}
@keyframes popIn {
    from { opacity: 0; transform: translateY(-4px) scale(.92); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.sp {
    width: 20px; height: 20px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform .12s ease;
}
.sp:hover { transform: scale(1.25); }
.sp-critical { background: var(--sev-critical); }
.sp-high     { background: var(--sev-high); }
.sp-medium   { background: var(--sev-medium); }
.sp-low      { background: var(--sev-low); }
.sp-unset    { background: var(--surface-2); border: 2px dashed var(--muted); }

/* ---- Expand button + comment indicator -------------------------------------- */
.row-btn {
    position: relative;
    flex: none;
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .12s ease, color .12s ease;
}
.row-btn:hover { background: var(--surface-2); color: var(--text-strong); }
.row-btn.open { color: var(--primary); background: rgba(113, 137, 204, 0.12); }
.row-btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.comment-ind {
    display: none;
    position: absolute;
    top: 5px; right: 5px;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--warning);
}
.row-btn.has-comment .comment-ind { display: block; }

/* ---- Test body: sub-steps + notes -------------------------------------------- */
.test-body {
    padding: 4px 10px 16px 39px;
    animation: bodyIn .18s ease-out;
}
@keyframes bodyIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.test.depth-2 .test-body { padding-left: 12px; }
.substeps {
    border-left: 2px solid var(--border);
    padding-left: 4px;
    margin-bottom: 4px;
}
.substeps .test { border-bottom: none; }
.substeps .test-row { padding: 7px 6px; }
.substeps .test-title { font-size: 13.5px; }
.substeps .cb-box { width: 20px; height: 20px; border-radius: 6px; }

.comment-block { margin-top: 10px; }
.comment-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-strong);
    margin-bottom: 6px;
}
.comment-who { font-weight: 400; color: var(--muted); }
.comment-text {
    width: 100%;
    font-family: inherit;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text-strong);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    resize: vertical;
    min-height: 68px;
    outline: none;
    transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}
.comment-text:focus {
    background: var(--surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(113, 137, 204, 0.18);
}
.comment-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}
.comment-saved { font-size: 12.5px; font-weight: 700; color: var(--success); }

/* ---- Screenshots (evidence per test/step) ---------------------------------- */
.shots-block { margin-top: 16px; }
.shots-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.shot {
    position: relative;
    margin: 0;
    width: 92px;
    height: 68px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    background: var(--surface-2);
}
.shot a { display: block; width: 100%; height: 100%; }
.shot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .15s ease;
}
.shot:hover img { transform: scale(1.06); }
.shot-del {
    position: absolute;
    top: 4px; right: 4px;
    width: 20px; height: 20px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.shot:hover .shot-del { display: inline-flex; }
.shot-del:hover { background: var(--danger); }
.shot-del svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2.6; stroke-linecap: round; }
.shot-add {
    width: 92px;
    height: 68px;
    border-radius: var(--radius-sm);
    border: 1.5px dashed rgba(113, 137, 204, 0.5);
    color: var(--primary);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    transition: background .12s ease, border-color .12s ease;
}
.shot-add:hover { background: rgba(113, 137, 204, 0.10); border-color: var(--primary); }
.shot-add svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* ---- Upload progress tiles ------------------------------------------------
   A placeholder .shot enters the grid the moment a file is picked, so evidence
   appears in its final position and simply fills in. The ring tracks real
   bytes-sent from the XHR, turns green on completion, and hands over to the
   thumbnail a beat later. */
.shot-pending {
    display: flex;
    align-items: center;
    justify-content: center;
    border-style: dashed;
    border-color: rgba(113, 137, 204, 0.5);
    background: var(--surface-2);
}
.shot-progress { position: relative; width: 34px; height: 34px; }
.shot-progress .ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.shot-progress circle {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
}
.ring-track { stroke: rgba(113, 137, 204, 0.22); }
.ring-bar {
    stroke: var(--primary);
    transition: stroke-dashoffset .18s linear, stroke .2s ease;
}
.shot-mark {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 17px; height: 17px;
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0;
    transform: scale(.4);
    transition: opacity .18s ease, transform .22s cubic-bezier(.34, 1.56, .64, 1);
}
.shot-mark-ok  { stroke: var(--success, #28c76f); }
.shot-mark-bad { stroke: var(--danger, #ea5455); }

/* Completed: ring goes green and the tick springs in. */
.shot-done .ring-bar     { stroke: var(--success, #28c76f); }
.shot-done .ring         { opacity: .45; }
.shot-done .shot-mark-ok { opacity: 1; transform: scale(1); }

/* Failed: ring goes red, an X lands, then the tile clears itself. */
.shot-failed              { border-color: rgba(234, 84, 85, 0.55); }
.shot-failed .ring-bar    { stroke: var(--danger, #ea5455); }
.shot-failed .ring        { opacity: .45; }
.shot-failed .shot-mark-bad { opacity: 1; transform: scale(1); }

/* The real thumbnail fading in over the finished placeholder. */
@keyframes shotAppear {
    from { opacity: 0; transform: scale(.9); }
    to   { opacity: 1; transform: scale(1); }
}
.shot-appear { animation: shotAppear .22s ease both; }

@media (prefers-reduced-motion: reduce) {
    .ring-bar, .shot-mark { transition: none; }
    .shot-appear { animation: none; }
}

/* ---- Add-to-checklist ---------------------------------------------------------- */
.add-inline {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 10px 0 2px;
    padding: 8px 13px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    background: transparent;
    border: 1.5px dashed rgba(113, 137, 204, 0.5);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease;
}
.add-inline:hover { background: rgba(113, 137, 204, 0.10); border-color: var(--primary); }
.add-inline svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; }
.add-substep { margin-left: 4px; }
.add-section { display: flex; margin: 4px 0 10px; }

.add-form {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 10px 0;
    animation: bodyIn .18s ease-out;
}
.add-form input {
    flex: 1;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-strong);
    background: var(--surface);
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 10px 13px;
    outline: none;
    box-shadow: 0 0 0 3px rgba(113, 137, 204, 0.15);
}

.checklist-policy {
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    margin: 6px 0 30px;
}

/* =========================================================================
   USERS PAGE
   ========================================================================= */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 22px;
}
.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-strong);
    margin: 0 0 16px;
}
.flash {
    border-radius: var(--radius-sm);
    padding: 12px 15px;
    font-size: 14px;
    font-weight: 600;
}
.flash-success { background: rgba(40, 199, 111, 0.13); color: var(--success); border: 1px solid rgba(40, 199, 111, 0.35); }
.flash-error   { background: rgba(234, 84, 85, 0.12); color: var(--danger); border: 1px solid rgba(234, 84, 85, 0.35); }

.table-scroll { overflow-x: auto; }
.users-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.users-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}
.users-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.users-table tr:last-child td { border-bottom: none; }
.cell-strong { font-weight: 700; color: var(--text-strong); }
.cell-strong small { font-weight: 400; color: var(--muted); }
.cell-progress { min-width: 170px; }
.cell-progress .sec-bar { width: 100%; margin-bottom: 4px; }
.cell-progress small { color: var(--muted); font-size: 12px; }
.role-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--muted);
}
.role-badge.admin { background: rgba(113, 137, 204, 0.15); color: var(--primary); }
.cell-actions { text-align: right; }
.edit-details { position: relative; }
.edit-details summary { list-style: none; display: inline-flex; }
.edit-details summary::-webkit-details-marker { display: none; }
.edit-details[open] {
    position: relative;
}
.edit-details[open] > *:not(summary) {
    margin-top: 10px;
}
.edit-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    min-width: 240px;
}
.edit-details form:last-child { margin-top: 10px; text-align: left; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

/* =========================================================================
   RESULTS DASHBOARD (admin)
   ========================================================================= */
.content-wide {
    max-width: 1100px;
    margin: 22px auto;
    padding: 0 22px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.results-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}
.page-title {
    margin: 0;
    font-size: 21px;
    font-weight: 700;
    color: var(--text-strong);
}
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
    gap: 14px;
}
.stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-top: 3px solid var(--primary);
}
.stat-card.stat-critical { border-top-color: var(--sev-critical); }
.stat-card.stat-high     { border-top-color: var(--sev-high); }
.stat-card.stat-medium   { border-top-color: var(--sev-medium); }
.stat-card.stat-low      { border-top-color: var(--sev-low); }
.stat-num {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-strong);
    font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 12px; font-weight: 600; color: var(--muted); }

.tester-rows { display: flex; flex-direction: column; gap: 10px; }
.tester-row {
    display: grid;
    grid-template-columns: 160px 1fr auto;
    align-items: center;
    gap: 14px;
}
.tester-name { font-size: 13.5px; font-weight: 700; color: var(--text-strong); }
.tester-row .sec-bar { width: 100%; }
.tester-count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.results-filters {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.filter-select {
    font-family: inherit;
    font-size: 14px;
    color: var(--text-strong);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    outline: none;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}
.filter-select:focus { border-color: var(--primary); }

.results-section .card-title { margin-bottom: 6px; }
.result-test { border-top: 1px solid var(--border); padding: 13px 0; }
.result-test:last-child { padding-bottom: 2px; }
.result-test-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.result-title { flex: 1; min-width: 200px; font-size: 14px; color: var(--text-strong); }
.result-done-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    background: var(--surface-2);
    border-radius: 6px;
    padding: 3px 8px;
    font-variant-numeric: tabular-nums;
}
.feedback-rows {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.feedback-row {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 11px 14px;
}
.feedback-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.feedback-user { font-size: 13px; font-weight: 700; color: var(--text-strong); }
.feedback-check { font-size: 12px; font-weight: 600; }
.feedback-check.yes { color: var(--success); }
.feedback-check.no  { color: var(--muted); }
.sev-pill {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    color: #fff;
    border-radius: 999px;
    padding: 3px 10px;
}
.sev-pill-critical { background: var(--sev-critical); }
.sev-pill-high     { background: var(--sev-high); }
.sev-pill-medium   { background: var(--sev-medium); color: #5d4a00; }
.sev-pill-low      { background: var(--sev-low); }
.feedback-note {
    margin: 9px 0 0;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}
.feedback-row .shots-grid { margin-top: 10px; }
.results-empty { text-align: center; color: var(--muted); }
.results-empty p { margin: 8px 0; }

@media (max-width: 720px) {
    .tester-row { grid-template-columns: 1fr; gap: 5px; }
    .tester-count { text-align: right; }
}

/* =========================================================================
   TOASTS
   ========================================================================= */
.toast-wrap {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.toast {
    min-width: 260px;
    max-width: 360px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 4px solid var(--info);
    animation: toastIn .3s cubic-bezier(.2,.8,.2,1) both;
}
.toast.leaving { animation: toastOut .25s ease forwards; }
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.info    { border-left-color: var(--info); }
.toast .t-icon { width: 34px; height: 34px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; }
.toast.success .t-icon { background: rgba(40,199,111,.15); color: var(--success); }
.toast.error   .t-icon { background: rgba(234,84,85,.15);  color: var(--danger); }
.toast.info    .t-icon { background: rgba(0,207,232,.15);  color: var(--info); }
.toast .t-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.toast .t-body { flex: 1; min-width: 0; }
.toast .t-title { font-weight: 700; font-size: 14px; color: var(--text-strong); }
.toast .t-msg { font-size: 12px; color: var(--muted); margin-top: 2px; word-break: break-word; }
@keyframes toastIn  { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 1100px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { display: none; }
}
@media (max-width: 720px) {
    .hide-sm { display: none; }
    .topbar { padding: 0 12px; gap: 8px; }
    .topbar .brand { font-size: 15px; }
    .tally-text strong { font-size: 12.5px; }
    .tally-text small { font-size: 11px; }
    .layout { padding: 12px; gap: 12px; }
    .section-head { padding: 14px; flex-wrap: wrap; }
    .section-progress { flex-direction: row; align-items: center; gap: 10px; width: 100%; }
    .sec-bar { flex: 1; width: auto; }
    .section-body { padding: 4px 10px 12px; }
    .test-row { flex-wrap: wrap; }
    .test-title { flex-basis: calc(100% - 80px); }
    .test-body { padding-left: 12px; }
    .test.depth-2 .test-row { padding-left: 18px; }
    .toolbar { gap: 12px; }
    .content-narrow { padding: 0 12px; }
}

/* Reduced motion: keep state changes, drop the theatrics */
@media (prefers-reduced-motion: reduce) {
    .confetti { display: none; }
    .cb-input:checked + .cb-box { animation: none; }
    * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
