* {
    box-sizing: border-box;
}

:root {
    --background: #f5f7fa;
    --card-background: #ffffff;
    --text: #1f2937;
    --muted-text: #6b7280;
    --border: #d1d5db;

    --button: #000000;
    --button-hover: #222222;
    --button-text: #ffffff;

    --status: #166534;

    --link: #b77900;
    --link-hover: #8a5a00;
}

body.dark-mode {
    --background: #111827;
    --card-background: #1f2937;
    --text: #f9fafb;
    --muted-text: #9ca3af;
    --border: #4b5563;

    --button: #fdbb1f;
    --button-hover: #e5a900;
    --button-text: #000000;

    --status: #86efac;

    --link: #fdbb1f;
    --link-hover: #ffd166;
}

body {
    margin: 0;
    min-height: 100vh;

    font-family: Arial, Helvetica, sans-serif;

    background: var(--background);
    color: var(--text);

    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}

.container {
    min-height: 100vh;

    display: flex;
    justify-content: center;
    align-items: center;

    padding: 24px;
}

.audit-card {
    width: 100%;
    max-width: 700px;

    background: var(--card-background);

    padding: 40px;

    border-radius: 12px;

    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);

    transition:
        background-color 0.2s ease,
        box-shadow 0.2s ease;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;

    gap: 20px;

    margin-bottom: 30px;
}

h1 {
    margin-top: 0;
    margin-bottom: 10px;

    font-size: 32px;
}

.subtitle {
    margin: 0;

    color: var(--muted-text);
}

.theme-toggle {
    width: 44px;
    height: 44px;

    margin: 0;
    padding: 0;

    display: flex;
    justify-content: center;
    align-items: center;

    border: 1px solid var(--border);
    border-radius: 50%;

    background: transparent;
    color: var(--text);

    font-size: 20px;

    cursor: pointer;
}

.theme-toggle:hover {
    background: var(--background);
}

form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

label {
    font-weight: 600;
}

input {
    width: 100%;

    padding: 14px;

    font-size: 16px;

    color: var(--text);
    background: var(--card-background);

    border: 1px solid var(--border);
    border-radius: 8px;
}

input:focus {
    outline: none;

    border-color: #2563eb;
}

.audit-button {
    margin-top: 10px;

    padding: 14px;

    border: none;
    border-radius: 8px;

    background: var(--button);
    color: var(--button-text);

    font-size: 16px;
    font-weight: 600;

    cursor: pointer;

    transition: background-color 0.2s ease;
}

.audit-button:hover {
    background: var(--button-hover);
}

.status {
    margin-top: 24px;

    font-weight: 600;

    color: var(--status);
}

.results {
    margin-top: 24px;
}

.results h2 {
    margin-bottom: 20px;
}

.results h3 {
    margin-top: 28px;
}

.results p {
    line-height: 1.5;
}

.results ul {
    padding-left: 20px;
}

.results li {
    margin-bottom: 12px;
    line-height: 1.4;
}

.category-scores {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    padding: 0;
    list-style: none;
}

.category-score {
    display: grid;
    gap: 4px;
    margin: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.category-score span {
    font-size: 1.25rem;
    font-weight: 700;
}

.category-score small,
.finding-severity {
    color: var(--muted-text);
    font-size: 0.8rem;
}

.category-score-unavailable {
    opacity: 0.75;
}

.audit-finding {
    padding: 12px;
    border-left: 4px solid var(--border);
}

.audit-page {
    margin: 12px 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-background);
}

.audit-page-summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 20px;
    padding: 14px 16px;
    cursor: pointer;
    list-style-position: inside;
}

.audit-page-summary:focus-visible {
    outline: 2px solid var(--link);
    outline-offset: 2px;
    border-radius: 8px;
}

.audit-page-summary-url {
    flex: 1 1 240px;
    min-width: 0;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.audit-page-summary-score {
    display: grid;
    gap: 2px;
}

.audit-page-summary-score strong {
    font-size: 1.2rem;
}

.audit-page-summary-findings {
    color: var(--muted-text);
}

.audit-page-summary-categories {
    display: flex;
    flex: 1 0 100%;
    flex-wrap: wrap;
    gap: 6px;
}

.audit-page-summary-category {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted-text);
    font-size: 0.8rem;
}

.audit-page-summary-category strong {
    color: var(--text);
}

.audit-page-details {
    padding: 0 16px 16px;
    border-top: 1px solid var(--border);
}

.audit-page-details > :first-child {
    margin-top: 16px;
}

.finding-severity {
    display: inline-block;
    margin-left: 8px;
    font-weight: 700;
}

.finding-severity-CRITICAL,
.finding-severity-HIGH {
    color: #b91c1c;
}

body.dark-mode .finding-severity-CRITICAL,
body.dark-mode .finding-severity-HIGH {
    color: #fca5a5;
}

.app-footer {
    margin-top: 32px;
    padding-top: 16px;

    border-top: 1px solid var(--border);

    text-align: center;

    color: var(--muted-text);

    font-size: 11px;
}

.version-info {
    display: flex;
    justify-content: center;
    gap: 14px;

    flex-wrap: wrap;

    margin-bottom: 8px;
}

.copyright {
    font-weight: 500;
}

.audit-page-url {
    margin-bottom: 0.75rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.audit-page-url a {
    display: block;
    max-width: 100%;

    overflow-wrap: anywhere;
    word-break: break-word;

    color: var(--link);
    text-decoration: none;
}

.audit-page-url a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

.consent-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.consent-row input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
    flex: 0 0 auto;
}

.consent-row label {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 600;
    cursor: pointer;
}