:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --border: #e2e5ea;
    --text: #1c2430;
    --muted: #68727f;
    --accent: #4453c4;
    --accent-soft: #eef0fb;
    --pass: #178a44;
    --pass-soft: #e5f5ec;
    --fail: #cc2f36;
    --fail-soft: #fbe9ea;
    --skip: #5b6b7d;
    --skip-soft: #eceff3;
    --untested: #d4d9e0;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

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

a:hover {
    text-decoration: underline;
}

h1 {
    font-size: 1.5rem;
    margin: 0;
}

h2 {
    font-size: 1.1rem;
    margin: 0 0 0.75rem;
}

h3 {
    font-size: 1rem;
    margin: 0 0 0.5rem;
}

/* ---- Chrome ---- */

.topbar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.65rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    font-weight: 700;
    color: var(--text);
}

.brand:hover {
    text-decoration: none;
}

.topnav {
    display: flex;
    gap: 1rem;
}

.topnav a {
    color: var(--muted);
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
}

.topnav a.active {
    color: var(--text);
    border-bottom-color: var(--accent);
}

.topnav a:hover {
    text-decoration: none;
    color: var(--text);
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.run-switcher {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.run-switcher select {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    font-size: 0.85rem;
    max-width: 14rem;
}

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 1.5rem;
}

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.muted {
    color: var(--muted);
    font-size: 0.85rem;
    margin: 0.25rem 0 0;
}

.flash {
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
}

.flash a {
    font-weight: 600;
}

.flash-success {
    background: var(--pass-soft);
    color: var(--pass);
}

.flash-error {
    background: var(--fail-soft);
    color: var(--fail);
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.empty-state {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 10px;
    padding: 2.5rem;
    text-align: center;
    color: var(--muted);
}

.empty-state h2 {
    color: var(--text);
}

/* ---- Buttons & forms ---- */

.btn {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.btn:hover {
    border-color: var(--muted);
    text-decoration: none;
}

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

.btn-primary:hover {
    filter: brightness(1.08);
    border-color: var(--accent);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
}

.btn-block {
    display: block;
    width: 100%;
    padding: 0.7rem 1rem;
    border-radius: 9px;
    font-size: 0.95rem;
}

.btn-pass.active {
    background: var(--pass);
    border-color: var(--pass);
    color: #fff;
}

.btn-fail.active {
    background: var(--fail);
    border-color: var(--fail);
    color: #fff;
}

.btn-skip.active {
    background: var(--skip);
    border-color: var(--skip);
    color: #fff;
}

.inline-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.card .inline-form {
    justify-content: flex-start;
}

.inline-form input[type="text"] {
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 0.9rem;
    min-width: 16rem;
}

/* ---- Chips & badges ---- */

.chip-row {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.6rem;
}

.chip {
    padding: 0.1rem 0.55rem;
    border-radius: 99px;
    font-size: 0.78rem;
    font-weight: 600;
}

.chip-pass {
    background: var(--pass-soft);
    color: var(--pass);
}

.chip-fail {
    background: var(--fail-soft);
    color: var(--fail);
}

.chip-skip {
    background: var(--skip-soft);
    color: var(--skip);
}

.chip-untested {
    background: var(--bg);
    color: var(--muted);
}

.chip-current {
    background: var(--accent-soft);
    color: var(--accent);
}

.prio {
    padding: 0.05rem 0.45rem;
    border-radius: 5px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.prio-p0 {
    background: var(--fail-soft);
    color: var(--fail);
}

.prio-p1 {
    background: #fdf3e3;
    color: #b3690b;
}

.prio-p2 {
    background: var(--skip-soft);
    color: var(--skip);
}

.tag {
    padding: 0.05rem 0.45rem;
    border-radius: 5px;
    font-size: 0.72rem;
    background: var(--accent-soft);
    color: var(--accent);
    white-space: nowrap;
}

.code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 0.05rem 0.4rem;
    white-space: nowrap;
}

/* ---- Progress bar ---- */

.progress {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 220px;
}

.progress-track {
    display: flex;
    flex: 1;
    height: 10px;
    background: var(--untested);
    border-radius: 99px;
    overflow: hidden;
}

.seg {
    display: block;
    height: 100%;
}

.seg-pass {
    background: var(--pass);
}

.seg-fail {
    background: var(--fail);
}

.seg-skip {
    background: var(--skip);
}

.progress-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
}

/* ---- Dashboard ---- */

.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 1rem;
}

.plan-card {
    color: var(--text);
    display: block;
}

.plan-card:hover {
    text-decoration: none;
    border-color: var(--accent);
}

.prio-row {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 0.6rem;
}

.prio-stat {
    font-size: 0.75rem;
    color: var(--muted);
}

.prio-stat.has-fail {
    color: var(--fail);
    font-weight: 600;
}

/* ---- Plan page ---- */

.filters {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.25rem 0.5rem;
}

.filter-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-right: 0.25rem;
}

.filter-group a {
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.83rem;
    color: var(--muted);
}

.filter-group a:hover {
    text-decoration: none;
    color: var(--text);
}

.filter-group a.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.plan-section {
    margin-bottom: 1.75rem;
}

.plan-section > h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.section-num {
    color: var(--muted);
    font-weight: 400;
}

.section-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.75rem;
    color: var(--muted);
}

.scenario {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--untested);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.scenario.status-pass {
    border-left-color: var(--pass);
}

.scenario.status-fail {
    border-left-color: var(--fail);
    background: #fffafa;
}

.scenario.status-skip {
    border-left-color: var(--skip);
}

.scenario > summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.85rem;
    cursor: pointer;
    list-style: none;
    flex-wrap: wrap;
}

.scenario > summary::-webkit-details-marker {
    display: none;
}

.scenario-title {
    flex: 1;
    min-width: 12rem;
}

.note-dot {
    color: var(--accent);
    font-size: 0.9rem;
}

.status-chip {
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.1rem 0.55rem;
    border-radius: 99px;
    margin-left: auto;
}

.status-chip-pass {
    background: var(--pass-soft);
    color: var(--pass);
}

.status-chip-fail {
    background: var(--fail-soft);
    color: var(--fail);
}

.status-chip-skip {
    background: var(--skip-soft);
    color: var(--skip);
}

.status-chip-untested {
    background: var(--bg);
    color: var(--muted);
}

.scenario-body {
    border-top: 1px solid var(--border);
    padding: 0.75rem 0.85rem;
}

.scenario-md {
    font-size: 0.9rem;
}

.scenario-md ul {
    margin: 0;
    padding-left: 1.2rem;
}

.scenario-md li {
    margin-bottom: 0.25rem;
}

.scenario-md blockquote {
    margin: 0.5rem 0;
    padding: 0.25rem 0.75rem;
    border-left: 3px solid var(--border);
    color: var(--muted);
}

.result-form {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.result-form textarea {
    width: 100%;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-family: inherit;
    font-size: 0.88rem;
    resize: vertical;
}

.result-buttons {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

/* ---- Tables ---- */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th {
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr.current-run td {
    background: var(--accent-soft);
}

.c-pass {
    color: var(--pass);
    font-weight: 600;
}

.c-fail {
    color: var(--fail);
    font-weight: 600;
}

.c-skip {
    color: var(--skip);
    font-weight: 600;
}

.row-actions {
    display: flex;
    gap: 0.4rem;
    justify-content: flex-end;
}

/* ---- Report ---- */

.report-item {
    border: 1px solid var(--border);
    border-left: 4px solid var(--untested);
    border-radius: 8px;
    padding: 0.6rem 0.85rem;
    margin-bottom: 0.5rem;
}

.report-fail {
    border-left-color: var(--fail);
}

.report-skip {
    border-left-color: var(--skip);
}

.report-item-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.report-note {
    margin: 0.4rem 0 0;
    font-size: 0.88rem;
    color: var(--muted);
    white-space: pre-wrap;
}

/* ---- Markdown reference doc ---- */

.markdown-doc {
    font-size: 0.92rem;
    overflow-x: auto;
}

.markdown-doc h1,
.markdown-doc h2,
.markdown-doc h3 {
    margin: 1.25rem 0 0.5rem;
}

.markdown-doc h1:first-child {
    margin-top: 0;
}

.markdown-doc table {
    border-collapse: collapse;
    margin: 0.75rem 0;
}

.markdown-doc th,
.markdown-doc td {
    border: 1px solid var(--border);
    padding: 0.35rem 0.6rem;
    text-align: left;
}

.markdown-doc code {
    background: var(--bg);
    border-radius: 4px;
    padding: 0.05rem 0.3rem;
    font-size: 0.85em;
}

.markdown-doc blockquote {
    margin: 0.75rem 0;
    padding: 0.25rem 0.75rem;
    border-left: 3px solid var(--border);
    color: var(--muted);
}

/* ---- Auth & account ---- */

.auth-shell {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 2.5rem 1.5rem;
}

.auth-panel {
    width: 100%;
    max-width: 24rem;
}

.auth-mark {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    margin: 0 auto 1.5rem;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
}

.auth-mark svg {
    width: 1.35rem;
    height: 1.35rem;
}

.auth-eyebrow {
    margin: 0 0 0.45rem;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--muted);
}

.auth-title {
    margin: 0 0 1.75rem;
    text-align: center;
    font-size: 1.6rem;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.auth-card {
    width: 100%;
    margin: 0;
    padding: 2.25rem 2rem;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgb(28 36 48 / 0.05);
}

.auth-card .flash {
    padding: 0.6rem 0.75rem;
    border-radius: 7px;
    margin-bottom: 1.25rem;
}

.auth-footnote {
    margin: 1.5rem 0 0;
    text-align: center;
    font-size: 0.82rem;
    color: var(--muted);
}

.narrow-card {
    max-width: 26rem;
}

.stacked-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.field label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"] {
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-family: inherit;
    font-size: 0.9rem;
    width: 100%;
}

.field input:focus {
    outline: 2px solid var(--accent-soft);
    border-color: var(--accent);
}

.field-hint {
    font-size: 0.78rem;
    color: var(--muted);
}

.check-inline {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text);
}

.auth-card .stacked-form {
    gap: 1.15rem;
}

.auth-card .field {
    gap: 0.45rem;
}

.auth-card .field label {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text);
}

.auth-card .field input[type="email"],
.auth-card .field input[type="password"] {
    padding: 0.7rem 0.85rem;
    border-radius: 9px;
    font-size: 0.95rem;
}

.auth-card .check-inline {
    gap: 0.55rem;
    font-size: 0.875rem;
    color: var(--muted);
}

.auth-card .check-inline input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--accent);
}

.auth-card .btn-block {
    margin-top: 0.4rem;
}

.check-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.6rem;
    margin-bottom: 1.1rem;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
}

.topbar-user {
    color: var(--muted);
    font-size: 0.85rem;
}

.topbar-user:hover {
    color: var(--text);
}

.chip-admin {
    background: var(--accent-soft);
    color: var(--accent);
}

/* ---- Print ---- */

@media print {
    .no-print {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .card {
        border: none;
        padding: 0;
        margin-bottom: 1.5rem;
    }

    .container {
        padding: 0;
        max-width: none;
    }
}
