*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-root: #0c0f1a;
    --bg-header: linear-gradient(135deg, #111827 0%, #1e1b4b 100%);
    --bg-sidebar: #111827;
    --bg-card: #111827;
    --bg-input: #1e293b;
    --bg-deep: #0f172a;
    --border: #1e293b;
    --border-light: #334155;
    --text-primary: #f8fafc;
    --text-body: #e2e8f0;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --pass: #16a34a;
    --fail: #dc2626;
    --font-sans: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

html,
body {
    height: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-root);
    color: var(--text-body);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Header ── */

.header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    padding: 20px 24px;
    flex-shrink: 0;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-logo {
    display: block;
    position: relative;
    margin-top: 20px;
    height: 64px;
    width: 75px;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 46'%3e%3cg data-name='Carbon Logo'%3e%3cpath fill='%23f28c00' class='flower' d='M24.41.005a8.444 8.444 0 0 0-4.907 2.071 7.739 7.739 0 0 0-2.951 6.484c.17 3.241 3.645 5.192 6.529 7.311 1.1.8 2.034 1.387 2.034 1.387a21.652 21.652 0 0 1-5.5-1.519c-3.71-1.409-6.626-2.384-9.235-1.654-2.079.582-2.436 1.924-2.436 2.683 0 .917.867 5.442 6.641 6.529 4.517.85 11.581-1.789 11.581-1.789s.045.2-1.117.894-3.153 1.7-3.823 2.259c-.75.625-.962 1.162-.38 1.5s3.4 1.364 8.3.715c6.988-.924 7.348-2.466 5.857-3.668a5.848 5.848 0 0 1-1.861-2.009s4.188 1.449 6.848 1.157a10.905 10.905 0 0 0 6.931-3.823c1.642-1.831 2.466-3.223 2.481-4.108v-.042a1.068 1.068 0 0 0-.065-.367c-.312-.827-1.834-.695-2.863-.425s-5.042 1.936-6.484 2.459a22.134 22.134 0 0 1-3.71.939 92.479 92.479 0 0 0 7.96-5.055c2.683-2.1 3.42-4.292 2.349-6.881-.8-1.941-3.578-3.2-5.434-3.425a6.846 6.846 0 0 0-6.484 3.845c-.894 1.664-1.409 4.382-1.989 6.036a24.286 24.286 0 0 1-1.3 3 15.659 15.659 0 0 1-.222-2.3c-.015-1.162.12-3.108-.022-4.927A7.92 7.92 0 0 0 26.931.62 5.18 5.18 0 0 0 24.525 0h-.11Z' data-name='Path 1304'/%3e%3c/g%3e%3c/svg%3e ");
    background-repeat: no-repeat;
    background-size: cover;
}

.header-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.header-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

.header-controls {
    display: flex;
    gap: 8px;
    align-items: stretch;
    flex-wrap: wrap;
}

.header-input {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-body);
    font-size: 13px;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color .15s;
}

.header-input:focus {
    border-color: var(--accent);
}

.header-input[data-field="project"] {
    width: 160px;
}

.header-input[data-field="tester"] {
    width: 120px;
}

.btn {
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all .15s;
}

.btn-secondary {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    color: var(--text-body);
}

.btn-secondary.active {
    background: var(--accent);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-danger {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-muted);
}

.btn-danger:hover {
    background: #7f1d1d;
    border-color: #991b1b;
    color: #fca5a5;
}

/* ── Progress ── */

.progress-bar {
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-track {
    flex: 1;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    transition: width .4s ease;
}

.progress-fill.has-fails {
    background: linear-gradient(90deg, #16a34a, #ea580c);
}

.progress-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    font-family: var(--font-mono);
}

/* ── Stat pills ── */

.stat-pills {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
}

.stat-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

/* ── Layout ── */

.layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ── Sidebar ── */

.sidebar {
    width: 320px;
    min-width: 320px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 12px 0;
    flex-shrink: 0;
}

.sidebar-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    border-left: 3px solid transparent;
    transition: all .15s;
    font-family: var(--font-sans);
}

.sidebar-btn.active {
    background: var(--bg-input);
}

.sidebar-btn:hover:not(.active) {
    background: rgba(30, 41, 59, .5);
}

.sidebar-icon {
    font-size: 16px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
    color: #fff;
}

.sidebar-info {
    flex: 1;
    min-width: 0;
}

.sidebar-label {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-btn.active .sidebar-label {
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-stats {
    font-size: 12px;
    color: var(--text-dim);
    font-family: var(--font-mono);
    margin-top: 2px;
}

.sidebar-stats .fail-count {
    color: var(--fail);
    margin-left: 6px;
}

/* ── Progress ring ── */

.ring-wrap {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ring-inner {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 700;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.sidebar-btn.active .ring-inner {
    background: var(--bg-input);
}

.sidebar-btn:not(.active) .ring-inner {
    background: var(--bg-sidebar);
}

/* ── Main ── */

.main {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.cat-header h2 {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cat-header h2 .cat-icon {
    font-size: 24px;
}

/* ── Filters ── */

.filters {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 20px;
} 

.filters-label {
    font-size: 12px;
    color: var(--text-dim);
    font-weight: 600;
    margin-right: 4px;
}

.filter-btn {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all .15s;
}

.filter-btn.active {
    background: var(--border-light);
}

.filter-sep {
    width: 1px;
    background: var(--border-light);
    align-self: stretch;
    margin: 0 4px;
}

/* ── Check rows ── */

.check-row {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    transition: border-color .2s;
}

.check-row[data-status="fail"] {
    border-color: #7f1d1d;
}

.check-row[data-status="pass"] {
    border-color: #14532d;
}

.check-inner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.check-severity {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding-top: 2px;
    min-width: 52px;
}

.severity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.severity-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    font-family: var(--font-mono);
}

.check-text {
    flex: 1;
    font-size: 16px;
    line-height: 1.5;
    font-weight: 500;
    color: var(--text-secondary);
    padding-top: 1px;
}

.check-row[data-status="pass"] .check-text {
    color: #86efac;
}

.check-row[data-status="fail"] .check-text {
    color: #fca5a5;
}

.check-note-preview {
    display: inline-block;
    margin-left: 8px;
    font-size: 11px;
    color: var(--accent);
    font-style: italic;
}

.check-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.status-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    background: var(--bg-deep);
    color: var(--text-dim);
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
    font-family: var(--font-sans);
}

.status-btn.active {
    background: color-mix(in srgb, var(--status-colour) 13%, transparent);
    border-color: var(--status-colour);
    color: var(--status-colour);
}

.note-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    background: var(--bg-deep);
    color: var(--text-dim);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.note-btn.has-note {
    color: var(--accent);
}

.note-btn.expanded {
    background: var(--bg-input);
}

.check-note-area {
    margin-top: 10px;
    padding-left: 64px;
    display: none;
}

.check-note-area.open {
    display: block;
}

.check-note-area textarea {
    width: 100%;
    background: var(--bg-deep);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-body);
    font-size: 12px;
    font-family: var(--font-mono);
    resize: vertical;
    outline: none;
    line-height: 1.5;
}

.check-note-area textarea:focus {
    border-color: var(--accent);
}

.empty-state {
    text-align: center;
    padding: 48px;
    color: var(--text-dim);
    font-size: 16px;
}

/* ── Modal ── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--bg-input);
    border-radius: 16px;
    padding: 24px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-light);
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-head h2 {
    font-size: 16px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
}

.modal pre {
    flex: 1;
    overflow: auto;
    background: var(--bg-deep);
    border-radius: 8px;
    padding: 16px;
    font-size: 12px;
    line-height: 1.6;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    white-space: pre-wrap;
    border: 1px solid var(--border);
}

.modal-footer {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
}

/* ── Summary modal ── */

.summary-modal {
    max-width: 560px;
    overflow: auto;
}

.summary-card {
    margin-bottom: 14px;
    background: var(--bg-deep);
    border-radius: 10px;
    padding: 14px;
    border: 1px solid var(--border);
}

.summary-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.summary-card-label {
    font-weight: 600;
    font-size: 13px;
}

.summary-card-pct {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.summary-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.summary-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width .3s;
}

.summary-stats {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Page tabs ── */

.page-tabs-bar {
    display: flex;
    gap: 6px;
    margin-top: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
}

.page-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
    flex-shrink: 0;
}

.page-tab:hover {
    border-color: var(--border-light);
    color: var(--text-body);
}

.page-tab.active {
    background: var(--bg-input);
    border-color: var(--accent);
    color: var(--text-primary);
    font-weight: 600;
}

.page-tab-name {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-tab-pct {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
}

.page-tab.active .page-tab-pct {
    color: var(--text-muted);
}

.page-tab-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1;
    color: var(--text-dim);
    transition: all .15s;
}

.page-tab-remove:hover {
    background: #7f1d1d;
    color: #fca5a5;
}

.page-tab-add {
    background: transparent;
    border: 1px dashed var(--border-light);
    color: var(--text-dim);
    font-size: 16px;
    font-weight: 400;
    padding: 6px 14px;
}

.page-tab-add:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ── Light mode ── */

body.light {
    --bg-root: #f1f5f9;
    --bg-header: linear-gradient(135deg, #e2e8f0 0%, #ddd6fe 100%);
    --bg-sidebar: #e2e8f0;
    --bg-card: #ffffff;
    --bg-input: #f1f5f9;
    --bg-deep: #ffffff;
    --border: #cbd5e1;
    --border-light: #94a3b8;
    --text-primary: #0f172a;
    --text-body: #1e293b;
    --text-secondary: #334155;
    --text-muted: #475569;
    --text-dim: #64748b;
}

body.light .header-logo {
    color: #fff;
}

body.light .sidebar-icon {
    color: #1e293b;
}

body.light .check-row[data-status="pass"] .check-text {
    color: #15803d;
}

body.light .check-row[data-status="fail"] .check-text {
    color: #b91c1c;
}

body.light .check-row[data-status="pass"] {
    border-color: #86efac;
}

body.light .check-row[data-status="fail"] {
    border-color: #fca5a5;
}

body.light .progress-label {
    color: #475569;
}

body.light .ring-inner {
    color: #475569;
}

body.light .sidebar-btn.active .ring-inner {
    background: #f1f5f9;
}

body.light .sidebar-btn:not(.active) .ring-inner {
    background: #e2e8f0;
}

body.light .filter-btn {
    color: #334155;
    border-color: #94a3b8;
}

body.light .filter-btn.active {
    background: #cbd5e1;
}

/* ── Assignee ── */

.header-select {
    width: 160px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.check-assignee {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.assignee-select {
    background: var(--bg-deep);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 4px 24px 4px 8px;
    color: var(--text-muted);
    font-size: 11px;
    font-family: var(--font-sans);
    font-weight: 500;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    transition: all .15s;
    max-width: 120px;
}

.assignee-select:focus {
    border-color: var(--accent);
}

.assignee-select.assigned {
    color: var(--accent);
    border-color: var(--accent);
    background-color: color-mix(in srgb, var(--accent) 8%, transparent);
}

/* ── Note fields ── */

.note-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.note-field-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.note-field-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    font-family: var(--font-mono);
    min-width: 72px;
    flex-shrink: 0;
}

.note-field-input {
    flex: 1;
    background: var(--bg-deep);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 6px 10px;
    color: var(--text-body);
    font-size: 12px;
    font-family: var(--font-mono);
    outline: none;
    transition: border-color .15s;
}

.note-field-input:focus {
    border-color: var(--accent);
}

.note-field-input::placeholder {
    color: var(--text-dim);
}

.note-field-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    color: var(--accent);
    text-decoration: none;
    font-size: 14px;
    flex-shrink: 0;
    transition: all .15s;
}

.note-field-link:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.check-meta-tag {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    font-size: 12px;
    cursor: default;
}

.check-meta-url {
    color: var(--accent);
}

.check-meta-screenshot {
    color: #a78bfa;
}

/* ── Mobile ── */

@media (max-width: 768px) {

    .sidebar {
        display: none;
    }

    .header-input[data-field="project"],
    .header-input[data-field="tester"] {
        width: 100%;
    }

    .main {
        padding: 16px;
    }

    .check-severity {
        min-width: 40px;
    }

    .check-actions {
        flex-wrap: wrap;
    }

}
