:root {
    color-scheme: light;
    --background: #f6f7f9;
    --surface: #ffffff;
    --text: #1d2433;
    --muted: #637083;
    --line: #d9dee7;
    --accent: #0f766e;
    --accent-strong: #115e59;
    --danger: #c2410c;
    --success-bg: #e8f7f3;
    --success-line: #91d6c9;
    --error-bg: #fff0f0;
    --error-line: #f0a8a8;
    --shadow: 0 24px 80px rgba(26, 35, 50, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        linear-gradient(120deg, rgba(15, 118, 110, 0.12), transparent 38%),
        var(--background);
}

.app-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 32px 16px;
}

.app-shell-wide {
    place-items: start center;
}

.workspace {
    width: min(720px, 100%);
    padding: clamp(24px, 5vw, 48px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.workspace-wide {
    width: min(1160px, 100%);
}

.intro {
    margin-bottom: 32px;
}

.admin-intro {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 12px;
    font-size: clamp(2rem, 7vw, 4rem);
    line-height: 1;
    letter-spacing: 0;
}

.summary {
    max-width: 58ch;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.6;
}

.cpf-form {
    display: grid;
    gap: 10px;
}

label {
    font-weight: 700;
}

.input-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

input {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    font-size: 1.1rem;
}

select {
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    background: #ffffff;
    font-size: 1rem;
}

input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.14);
    outline: none;
}

button {
    min-height: 48px;
    padding: 0 20px;
    border: 0;
    border-radius: 6px;
    color: #ffffff;
    background: var(--accent);
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
}

button:hover {
    background: var(--accent-strong);
}

.button-danger {
    min-height: 36px;
    padding: 0 12px;
    background: var(--danger);
    font-size: 0.9rem;
}

.button-danger:hover {
    background: #9a3412;
}

.text-link {
    color: var(--accent-strong);
    font-weight: 800;
    text-decoration: none;
}

.text-link:hover {
    text-decoration: underline;
}

.notice,
.result-card {
    margin-top: 18px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.notice h2 {
    margin-bottom: 6px;
    font-size: 1rem;
}

.notice p,
.result-card p {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.5;
}

.notice-success {
    border-color: var(--success-line);
    background: var(--success-bg);
}

.notice-error {
    border-color: var(--error-line);
    background: var(--error-bg);
}

.results {
    display: grid;
    gap: 12px;
    margin-top: 20px;
}

.result-card {
    display: grid;
    gap: 14px;
}

.result-label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.cpf-value {
    display: block;
    font-size: clamp(1.55rem, 6vw, 2.25rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: 0;
}

.cpf-value-invalid {
    color: #7f1d1d;
}

.cpf-comparison {
    display: grid;
    gap: 18px;
}

.wrong-digit {
    color: var(--danger);
    font-weight: 900;
    text-decoration-color: var(--danger);
    text-decoration-thickness: 3px;
}

.explanation {
    padding-top: 2px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.stat-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
}

.stat-card span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.stat-card strong {
    font-size: 1.8rem;
    line-height: 1;
}

.admin-filter {
    display: grid;
    grid-template-columns: auto minmax(180px, 1fr) auto minmax(160px, 220px) auto;
    align-items: end;
    gap: 10px;
    margin-top: 24px;
}

.table-wrap {
    overflow-x: auto;
    margin-top: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
    background: #ffffff;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

th {
    color: var(--muted);
    background: #f9fafb;
    font-size: 0.78rem;
    text-transform: uppercase;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    color: var(--accent-strong);
    background: var(--success-bg);
    font-size: 0.86rem;
    font-weight: 800;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    margin-top: 18px;
    color: var(--muted);
}

.pagination a {
    color: var(--accent-strong);
    font-weight: 800;
    text-decoration: none;
}

.pagination a:hover {
    text-decoration: underline;
}

@media (max-width: 560px) {
    .input-row {
        grid-template-columns: 1fr;
    }

    .admin-intro {
        display: grid;
    }

    .admin-filter {
        grid-template-columns: 1fr;
    }

    button {
        width: 100%;
    }
}
