:root {
    --green: #087443;
    --green-dark: #065c35;
    --green-soft: #dcefe3;
    --bg: #F1F5ED;
    --ink: #101c19;
    --muted: #5f6a66;
    --line: #e5ece7;
    --ok: #087443;     --ok-bg: #dcefe3;
    --warn: #a86500;   --warn-bg: #fdf0d8;
    --fail: #c62f2f;   --fail-bg: #fde8e8;
    --unk: #5f6a66;    --unk-bg: #eceeed;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--ink);
    background: #ffffff;
    -webkit-font-smoothing: antialiased;
}

.sr {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

/* ---------- Hero ---------- */

.audit-hero {
    background: var(--bg);
    padding: 90px 20px 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.audit-eyebrow {
    margin: 0;
    font-size: 12px;
    letter-spacing: 2px;
    font-weight: 600;
    color: var(--green);
}

.audit-title {
    margin: 18px 0 0;
    max-width: 780px;
    font-size: 46px;
    line-height: 54px;
    letter-spacing: -1.5px;
    font-weight: 600;
}

.audit-lead {
    margin: 18px 0 0;
    max-width: 560px;
    font-size: 17px;
    line-height: 26px;
    color: #3f4a46;
}

.audit-search {
    margin-top: 34px;
    width: 100%;
    max-width: 620px;
    display: flex;
    gap: 8px;
}

.audit-input {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 54px;
    padding: 0 16px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: #8a948f;
    transition: border-color .2s, box-shadow .2s;
}

.audit-input svg { width: 18px; height: 18px; flex-shrink: 0; }

.audit-input:focus-within {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(8, 116, 67, .12);
}

.audit-input input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font: inherit;
    font-size: 16px;
    color: var(--ink);
}

.audit-btn {
    position: relative;
    height: 54px;
    padding: 0 22px;
    border: none;
    border-radius: 12px;
    background: var(--green);
    color: #ffffff;
    font: inherit;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s;
}

.audit-btn:hover { background: var(--green-dark); }
.audit-btn:disabled { cursor: wait; opacity: .9; }

.spinner {
    display: none;
    position: absolute;
    inset: 0;
    margin: auto;
    width: 20px; height: 20px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.is-loading > span { visibility: hidden; }
.is-loading > .spinner { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

.audit-msg {
    min-height: 22px;
    margin: 14px 0 0;
    font-size: 14px;
    color: var(--muted);
}

.audit-msg.is-error { color: var(--fail); font-weight: 500; }

/* ---------- Kroki ---------- */

.audit-steps {
    max-width: 920px;
    margin: 0 auto;
    padding: 50px 20px 20px;
}

.audit-progress {
    display: flex;
    gap: 10px;
    margin: 0 0 28px;
    padding: 0;
    list-style: none;
}

.audit-progress li {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
}

.audit-progress b {
    width: 26px; height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #eef2ef;
    font-size: 12px;
}

.audit-progress .is-active { border-color: var(--green); color: var(--ink); }
.audit-progress .is-active b { background: var(--green); color: #ffffff; }
.audit-progress .is-done b { background: var(--green-soft); color: var(--green); }

.audit-panel-head h2 {
    margin: 0;
    font-size: 24px;
    letter-spacing: -.5px;
}

.audit-panel-head p {
    margin: 8px 0 0;
    font-size: 14px;
    line-height: 21px;
    color: var(--muted);
}

.audit-back {
    margin-bottom: 14px;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--green);
    cursor: pointer;
}

.audit-subject {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--bg);
    font-size: 14px;
    line-height: 21px;
}

.audit-list {
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 10px;
}

.audit-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 14px;
    font: inherit;
    text-align: left;
    color: inherit;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s, transform .2s;
}

.audit-option:hover,
.audit-option:focus-visible {
    border-color: var(--green);
    box-shadow: 0 10px 24px rgba(16, 28, 25, .06);
    outline: none;
}

.audit-option-main { flex: 1; min-width: 0; }

.audit-option-title {
    display: block;
    font-weight: 600;
    font-size: 15px;
    line-height: 21px;
}

.audit-option-meta {
    display: block;
    margin-top: 3px;
    font-size: 13px;
    color: var(--muted);
}

.audit-option-arrow {
    width: 32px; height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--green);
    font-size: 15px;
}

.audit-empty {
    padding: 18px;
    border: 1px dashed var(--line);
    border-radius: 14px;
    font-size: 14px;
    color: var(--muted);
}

/* ---------- Wynik ---------- */

.result-head {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 28px;
    align-items: center;
    padding: 26px;
    border-radius: 20px;
    background: var(--bg);
}

.score {
    position: relative;
    width: 128px; height: 128px;
}

.score svg { width: 100%; height: 100%; transform: rotate(-90deg); }

.score-value {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 26px;
    letter-spacing: -1px;
}

.score-value small {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--muted);
}

.result-title {
    margin: 0;
    font-size: 22px;
    line-height: 28px;
    letter-spacing: -.5px;
}

.result-meta {
    margin: 8px 0 0;
    font-size: 14px;
    line-height: 21px;
    color: #3f4a46;
}

.result-meta a { color: var(--green); }

.result-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.btn-ghost {
    height: 40px;
    padding: 0 16px;
    border: 1px solid var(--ink);
    border-radius: 10px;
    background: #ffffff;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
    cursor: pointer;
}

.btn-ghost:hover { background: var(--ink); color: #ffffff; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.chip-ok      { background: var(--ok-bg);   color: var(--ok); }
.chip-warn    { background: var(--warn-bg); color: var(--warn); }
.chip-fail    { background: var(--fail-bg); color: var(--fail); }
.chip-unknown { background: var(--unk-bg);  color: var(--unk); }

.tests {
    margin: 22px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 10px;
}

.test {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    gap: 14px;
    align-items: start;
    padding: 18px;
    border: 1px solid var(--line);
    border-left-width: 4px;
    border-radius: 14px;
    background: #ffffff;
}

.test.is-ok      { border-left-color: var(--ok); }
.test.is-warn    { border-left-color: #e3a13b; }
.test.is-fail    { border-left-color: var(--fail); }
.test.is-unknown { border-left-color: #c3c9c6; }

.test-num {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.test-name {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.test-summary {
    margin: 4px 0 0;
    font-size: 14px;
    line-height: 21px;
}

.test-details {
    margin: 4px 0 0;
    font-size: 13px;
    line-height: 19px;
    color: var(--muted);
    word-break: break-word;
}

.test-source {
    display: inline-block;
    margin-top: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--green);
    text-decoration: none;
    word-break: break-all;
}

.test-source:hover { text-decoration: underline; }

.result-foot {
    margin: 18px 0 0;
    font-size: 13px;
    line-height: 19px;
    color: var(--muted);
}

.loading-box {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px;
    border-radius: 14px;
    background: var(--bg);
    font-size: 15px;
}

.loading-box i {
    width: 22px; height: 22px;
    border: 2px solid var(--green-soft);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

/* ---------- Informacje ---------- */

.audit-info {
    max-width: 1100px;
    margin: 40px auto 80px;
    padding: 0 20px;
}

.audit-info-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 40px;
    padding: 36px;
    border: 1px solid var(--line);
    border-radius: 20px;
}

.audit-info h2 {
    margin: 0 0 16px;
    font-size: 20px;
    letter-spacing: -.4px;
}

.audit-checks,
.audit-legend {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 10px;
    font-size: 14px;
    line-height: 21px;
    color: #3f4a46;
}

.audit-checks b { color: var(--ink); }

.audit-legend li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }

.audit-note {
    margin: 18px 0 0;
    padding: 14px;
    border-radius: 12px;
    background: var(--bg);
    font-size: 13px;
    line-height: 20px;
    color: var(--muted);
}

/* ---------- Responsywność ---------- */

@media (max-width: 760px) {
    .audit-hero { padding: 60px 16px 50px; }
    .audit-title { font-size: 32px; line-height: 39px; letter-spacing: -1px; }
    .audit-lead { font-size: 16px; line-height: 24px; }
    .audit-search { flex-direction: column; }
    .audit-input { flex: none; }
    .audit-btn { width: 100%; }
    .audit-steps { padding: 36px 16px 10px; }
    .audit-progress li { flex-direction: column; gap: 6px; font-size: 12px; text-align: center; }
    .result-head { grid-template-columns: 1fr; justify-items: center; text-align: center; }
    .result-counts, .result-actions { justify-content: center; }
    .test { grid-template-columns: 1fr; gap: 8px; }
    .test-num { display: none; }
    .test .chip { justify-self: start; }
    .audit-info-grid { grid-template-columns: 1fr; padding: 24px; gap: 28px; }
}

/* ---------- Druk / PDF ---------- */

@media print {
    .audit-hero, .audit-progress, .audit-no-print, .result-actions { display: none !important; }
    .audit-steps { padding: 0; max-width: none; }
    .result-head { background: none; border: 1px solid #ccc; }
    .test { break-inside: avoid; }
    .test-source { color: #000; }
    body { font-size: 12px; }
}
