/* Global palette */
:root {
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-accent: #f97316;
    --color-success: #10b981;
    --color-danger: #ef4444;
    --color-text: #1f2937;
    --color-muted: #6b7280;
    --color-surface: #ffffff;
    --color-surface-muted: #f3f4f6;
    --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.12);
    --radius-lg: 24px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --max-width: 1100px;
}

* {
    box-sizing: border-box;
}

html, body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: radial-gradient(circle at top, rgba(37, 99, 235, 0.12), transparent),
                linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    color: var(--color-text);
    line-height: 1.6;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--color-primary-dark);
}

.page {
    width: 100%;
    padding: 48px 16px 64px;
    display: flex;
    justify-content: center;
}

.page__container {
    width: min(100%, var(--max-width));
    display: grid;
    gap: 48px;
}

.hero {
    display: grid;
    gap: 16px;
    text-align: center;
}

.hero__badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: center;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(37, 99, 235, 0.25);
    background: rgba(37, 99, 235, 0.08);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-primary-dark);
}

.hero__title {
    margin: 0;
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 700;
    color: #0f172a;
}

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


.hero--with-logo {
    text-align: left;
}

.hero__layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: center;
    justify-content: center;
}

.hero__logo {
    width: clamp(140px, 22vw, 220px);
    aspect-ratio: 1 / 1;
    border-radius: 32px;
    background: radial-gradient(circle at top, rgba(37, 99, 235, 0.18), rgba(37, 99, 235, 0));
    display: grid;
    place-items: center;
    padding: 18px;
    box-shadow: 0 18px 35px rgba(15, 23, 42, 0.18);
}

.hero__logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.hero__content {
    display: grid;
    gap: 12px;
    text-align: center;
}

@media (min-width: 768px) {
    .hero__layout {
        flex-direction: row;
        justify-content: center;
        gap: 48px;
    }

    .hero__content {
        text-align: left;
        align-items: flex-start;
    }

    .hero__badge {
        align-self: flex-start;
    }
}

.grid {
    display: grid;
    gap: 32px;
}

@media (min-width: 960px) {
    .grid--two {
        grid-template-columns: 3fr 2fr;
        align-items: start;
    }
}

.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: clamp(24px, 3vw, 36px);
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.card__title {
    margin: 0 0 16px;
    font-size: 1.25rem;
    font-weight: 600;
    color: #0f172a;
}

.steps {
    display: grid;
    gap: 20px;
}

.step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 20px;
    background: var(--color-surface-muted);
    border-radius: var(--radius-md);
    border: 1px solid rgba(148, 163, 184, 0.24);
}

.step__number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.1);
    color: var(--color-primary-dark);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step__body h3 {
    margin: 0 0 6px;
    font-size: 1rem;
    color: #111827;
}

.step__body p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--color-muted);
}

.form {
    display: grid;
    gap: 20px;
}

.field {
    display: grid;
    gap: 8px;
}

.field label {
    font-weight: 600;
    color: #111827;
    font-size: 0.95rem;
}

.field input {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: var(--color-surface);
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

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

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    padding: 12px 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.button--primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: #ffffff;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.25);
}

.button--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgba(37, 99, 235, 0.3);
}

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

.alert {
    max-width: 520px;
    margin: 80px auto;
    padding: 32px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: linear-gradient(135deg, rgba(254, 226, 226, 0.8), rgba(255, 255, 255, 0.9));
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.alert--success {
    border-color: rgba(16, 185, 129, 0.3);
    background: linear-gradient(135deg, rgba(209, 250, 229, 0.85), rgba(255, 255, 255, 0.95));
}

.alert__icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 1.8rem;
    color: #ffffff;
}

.alert__icon--danger {
    background: var(--color-danger);
}

.alert__icon--success {
    background: var(--color-success);
}

.alert h1 {
    margin: 0 0 10px;
    font-size: 1.35rem;
}

.alert p {
    margin: 0;
    color: var(--color-muted);
}

.alert a {
    display: inline-flex;
    margin-top: 20px;
    text-decoration: none;
    font-weight: 600;
}

/* Ballot specific */
.ballot-page {
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.16), transparent 30%),
        radial-gradient(circle at top right, rgba(249, 115, 22, 0.14), transparent 24%),
        linear-gradient(180deg, #f7faff 0%, #eef4ff 100%);
}

.ballot-page .page {
    min-height: 100vh;
    padding: 8px 8px 12px;
}

.ballot-page .page__container {
    width: min(calc(100vw - 16px), 1720px);
    max-width: none;
    gap: 8px;
}

.ballot-header {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) auto;
    align-items: center;
    gap: 8px 14px;
    padding: 10px 14px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.1);
}

.ballot-header__identity {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    justify-items: start;
    gap: 8px 10px;
}

.ballot-header__titles {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
}

.ballot-header h2 {
    margin: 0;
    font-size: clamp(1.05rem, 1.5vw, 1.35rem);
    color: #0f172a;
    line-height: 1.1;
}

.ballot-header__subtitle {
    margin: 0;
    font-size: 0.84rem;
    color: var(--color-muted);
}

.ballot-header__meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.ballot-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.14);
    text-align: left;
}

.ballot-pill__label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-primary-dark);
}

.ballot-pill strong {
    font-size: 0.83rem;
    line-height: 1.2;
    color: #0f172a;
    white-space: nowrap;
}

.ballot-form {
    display: grid;
    gap: 12px;
    padding: 14px;
    grid-template-rows: minmax(0, 1fr) auto;
}

.ballot-categories {
    display: grid;
    gap: 12px;
    align-content: start;
}

.ballot-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 32px;
}

.ballot-table thead th {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: #fff;
    padding: 14px 16px;
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ballot-table td {
    padding: 20px;
    background: var(--color-surface);
    border-bottom: 1px solid rgba(148, 163, 184, 0.24);
    text-align: center;
}

.notice {
    padding: 18px 20px;
    border-radius: var(--radius-md);
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.2);
    color: var(--color-primary-dark);
    font-weight: 600;
    text-align: center;
}

.category {
    --category-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(244, 247, 255, 0.92));
    --category-border: rgba(148, 163, 184, 0.18);
    --category-title-surface: rgba(255, 255, 255, 0.7);
    --category-title-color: #0f172a;
    display: grid;
    gap: 10px;
    padding: 12px;
    border-radius: 20px;
    background: var(--category-surface);
    border: 1px solid var(--category-border);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.category--personeria {
    --category-surface: linear-gradient(180deg, #60a5fa 0%, #93c5fd 18%, #dbeafe 62%, #eff6ff 100%);
    --category-border: rgba(29, 78, 216, 0.55);
    --category-title-surface: rgba(255, 255, 255, 0.82);
    --category-title-color: #1e40af;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.52), 0 14px 28px rgba(37, 99, 235, 0.16);
}

.category--contraloria {
    --category-surface: linear-gradient(180deg, #f87171 0%, #fca5a5 18%, #fee2e2 62%, #fff1f2 100%);
    --category-border: rgba(220, 38, 38, 0.5);
    --category-title-surface: rgba(255, 255, 255, 0.82);
    --category-title-color: #b91c1c;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.52), 0 14px 28px rgba(220, 38, 38, 0.14);
}

.category__title {
    margin: 0;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--category-title-color);
    background: var(--category-title-surface);
    text-align: center;
}

.category__grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
}

.candidate-card {
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 8px;
    width: min(100%, 188px);
    padding: 14px 12px 12px;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(255, 255, 255, 0.92);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    text-align: center;
    justify-self: center;
}

.candidate-card img {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 14px;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.14);
}

.candidate-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.16);
}

.candidate-card strong {
    font-size: 0.94rem;
    line-height: 1.25;
    color: #0f172a;
}

.candidate-card input[type="radio"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--color-primary);
}

.form__actions--center {
    justify-content: center;
    margin-top: 0;
    align-self: end;
}

@media (min-width: 960px) {
    .ballot-page .page {
        padding: 6px 8px 10px;
    }

    .ballot-page .page__container {
        width: min(calc(100vw - 12px), 1780px);
        gap: 8px;
    }

    .ballot-form {
        gap: 12px;
        padding: 12px;
    }

    .ballot-page--multi-category .ballot-categories {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: stretch;
        gap: 12px;
    }

    .ballot-page--multi-category .category {
        flex: 1 1 520px;
        width: min(100%, 720px);
        max-width: 720px;
    }

    .ballot-page--multi-category .category--wide {
        flex-basis: 820px;
        width: min(100%, 920px);
        max-width: 920px;
    }

    .ballot-page--multi-category .category--compact {
        flex: 0 1 360px;
        width: min(100%, 420px);
        max-width: 420px;
    }

    .category__grid {
        grid-template-columns: repeat(auto-fit, minmax(156px, 180px));
        justify-content: center;
    }

    .category--wide .category__grid {
        grid-template-columns: repeat(auto-fit, minmax(164px, 190px));
    }

    .category--compact .category__grid {
        grid-template-columns: minmax(180px, 220px);
        justify-content: center;
    }

    .ballot-page--dense .category__grid {
        gap: 10px;
        grid-template-columns: repeat(auto-fit, minmax(142px, 168px));
    }

    .ballot-page--dense .candidate-card {
        width: min(100%, 168px);
        padding: 10px 8px 8px;
        gap: 6px;
    }

    .ballot-page--dense .candidate-card img {
        width: 74px;
        height: 74px;
    }

    .ballot-page--dense .hero__subtitle {
        font-size: 0.92rem;
    }
}

@media (max-width: 959px) {
    .ballot-header {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
        padding: 12px 14px;
    }

    .ballot-header__identity {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .ballot-header__titles {
        display: grid;
        justify-items: center;
    }

    .ballot-header__meta {
        justify-content: center;
    }

    .ballot-pill {
        text-align: center;
    }
}


.hero__footer {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}

.admin-entry {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
    border: 1px solid rgba(37, 99, 235, 0.24);
    font-weight: 600;
    color: var(--color-primary-dark);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.admin-entry:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.25);
    background: rgba(37, 99, 235, 0.18);
}

.admin-entry__icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.admin-entry__icon svg {
    width: 100%;
    height: 100%;
}

@media (min-width: 768px) {
    .hero__footer {
        justify-content: flex-start;
    }
}
