:root {
    --bg-1: #0c2a67;
    --bg-2: #12397e;
    --bg-3: #edf3ff;
    --card: rgba(255, 255, 255, 0.96);
    --card-strong: #ffffff;
    --border: rgba(148, 163, 184, 0.24);
    --text: #0f172a;
    --muted: #5b6b84;
    --primary: #1d4ed8;
    --primary-dark: #133caa;
    --primary-soft: #eaf1ff;
    --success: #15803d;
    --success-soft: rgba(22, 163, 74, 0.12);
    --danger: #b91c1c;
    --danger-soft: rgba(220, 38, 38, 0.12);
    --shadow: 0 28px 60px rgba(15, 23, 42, 0.16);
    --shadow-soft: 0 18px 38px rgba(15, 23, 42, 0.08);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    min-height: 100vh;
    padding: 18px;
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(255,255,255,0.16) 0, transparent 24%),
        linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 48%, #0e2b62 100%);
    overflow: hidden;
    position: relative;
}

.background-shape {
    position: fixed;
    border-radius: 999px;
    filter: blur(14px);
    opacity: 0.3;
    pointer-events: none;
}
.shape-1 {
    width: 420px;
    height: 420px;
    background: rgba(147, 197, 253, 0.28);
    top: -120px;
    left: -70px;
}
.shape-2 {
    width: 360px;
    height: 360px;
    background: rgba(191, 219, 254, 0.18);
    right: -80px;
    bottom: -80px;
}

.container {
    position: relative;
    z-index: 1;
    max-width: 1440px;
    height: calc(100vh - 36px);
    margin: 0 auto;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 16px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 84px;
    padding: 16px 22px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(255,255,255,0.55);
    box-shadow: var(--shadow-soft);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.brand-emblem {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: linear-gradient(135deg, #143caa 0%, #2b67f6 100%);
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
    letter-spacing: 1px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
    flex: 0 0 auto;
}

.topbar-site {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    margin-bottom: 4px;
}

.topbar-title {
    font-size: clamp(22px, 2vw, 30px);
    font-weight: 800;
    line-height: 1.05;
    color: #0f172a;
}

.topbar-tools {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 0 0 auto;
}

.topbar-pill {
    padding: 10px 14px;
    border-radius: 999px;
    background: #f8fbff;
    border: 1px solid #dbeafe;
    font-size: 12px;
    font-weight: 700;
    color: #1e3a8a;
    white-space: nowrap;
}

.lang-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
}

.lang-link {
    min-width: 42px;
    padding: 9px 12px;
    border-radius: 999px;
    color: #64748b;
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
    transition: all .2s ease;
}
.lang-link:hover { color: var(--text); background: #eef2ff; }
.lang-link.active { background: linear-gradient(135deg, #1d4ed8, #2563eb); color: #fff; box-shadow: 0 10px 20px rgba(37,99,235,.18); }

.cards-layout {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.34fr) minmax(360px, 0.84fr);
    gap: 16px;
}

.panel-card {
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-xl);
    background: var(--card);
    border: 1px solid rgba(255,255,255,0.55);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.consulta-card { padding: 24px; }
.info-adicional { padding: 24px; }

.consulta-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 180px;
    gap: 18px;
    align-items: center;
    padding: 0 0 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid #e2e8f0;
}

.panel-eyebrow {
    display: inline-block;
    margin-bottom: 10px;
    font-size: 11px;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: .12em;
}

.hero-copy h1 {
    margin: 0 0 10px;
    font-size: clamp(32px, 3vw, 46px);
    line-height: 0.98;
    letter-spacing: -0.03em;
}

.hero-copy p {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.55;
    max-width: 760px;
}

.hero-visual {
    height: 146px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(219,234,254,0.95), rgba(239,246,255,0.75));
    border: 1px solid #dbeafe;
    display: grid;
    place-items: center;
}

.imagen-urna {
    width: 104px;
    height: 104px;
    object-fit: contain;
    filter: drop-shadow(0 16px 24px rgba(29, 78, 216, 0.15));
}

.alert {
    margin: 0 0 16px;
    padding: 14px 16px;
    border-radius: 18px;
    font-weight: 600;
}
.alert-title { font-size: 14px; font-weight: 800; margin-bottom: 4px; }
.alert-text { font-size: 13px; line-height: 1.45; }
.alert.error { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(220,38,38,.14); }
.alert.success { background: var(--success-soft); color: var(--success); border: 1px solid rgba(22,163,74,.14); }
.block-note { margin-top: 6px; font-size: 12px; font-weight: 700; }

.consult-shell {
    flex: 1;
    min-height: 0;
    display: block;
}


.form-surface {
    border-radius: 24px;
    background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
    border: 1px solid #dbe7fb;
    padding: 22px;
    display: flex;
    flex-direction: column;
}

.form-surface-expanded {
    max-width: 100%;
    min-height: 100%;
    padding: 26px;
}

.surface-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}
.surface-heading h2 {
    margin: 0 0 6px;
    font-size: 21px;
    line-height: 1.1;
}
.surface-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}
.surface-step {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 16px;
    font-weight: 800;
    box-shadow: 0 14px 24px rgba(37,99,235,0.2);
    flex: 0 0 auto;
}

.formulario {
    display: grid;
    gap: 16px;
}
.field { display: flex; flex-direction: column; gap: 7px; }
.field-full { grid-column: 1 / -1; }
label {
    font-size: 13px;
    font-weight: 800;
    color: #0f172a;
}
input {
    width: 100%;
    min-height: 50px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid #d5deea;
    background: #fff;
    font-size: 15px;
    color: #0f172a;
    outline: none;
    transition: all .2s ease;
}
input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.11);
}
small {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.35;
}

.captcha-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.captcha-box {
    min-width: 190px;
    min-height: 50px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    background: #fff;
    border: 1px solid #d5deea;
    border-radius: 16px;
}
.captcha-box img {
    display: block;
    width: 132px;
    height: 36px;
    object-fit: contain;
    background: #f8fafc;
    border-radius: 10px;
}
.refresh-btn {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 12px;
    background: #edf2ff;
    color: #1e293b;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    transition: all .2s ease;
}
.refresh-btn:hover { background: #dbeafe; transform: rotate(25deg); }

.btn-primary, .btn-secondary, .btn-print {
    border: none;
    border-radius: 16px;
    min-height: 50px;
    padding: 13px 18px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: all .2s ease;
}
.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 18px 28px rgba(37, 99, 235, 0.22);
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-secondary {
    background: #fff;
    color: #0f172a;
    border: 1px solid #d0d9e8;
}
.btn-print {
    background: #0f172a;
    color: #fff;
}


.resultado-destacado {
    flex: 1;
    min-height: 0;
    padding: 20px;
    border-radius: 24px;
    background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
    border: 1px solid #cddfff;
    box-shadow: var(--shadow-soft);
}
.resultado-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
}
.resultado-badge {
    display: inline-block;
    margin-bottom: 7px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.resultado-destacado h2 { margin: 0 0 4px; font-size: 26px; line-height: 1.1; }
.resultado-subtitle { margin: 0; font-size: 13px; color: var(--muted); }
.resultado-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.resultado-grid-featured {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.resultado-item {
    min-width: 0;
    padding: 14px;
    background: #fff;
    border: 1px solid #dbe7fb;
    border-radius: 18px;
}
.resultado-item-wide { grid-column: span 2; }
.result-label {
    display: block;
    margin-bottom: 5px;
    color: #64748b;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .09em;
}
.resultado-item strong {
    display: block;
    font-size: 14px;
    line-height: 1.35;
    color: #0f172a;
    word-break: break-word;
}

.info-heading {
    padding-bottom: 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid #e2e8f0;
}
.info-heading h2 {
    margin: 0 0 6px;
    font-size: 30px;
    line-height: 1.02;
}
.info-heading p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--muted);
}

.info-box {
    flex: 1;
    min-height: 0;
    display: grid;
    gap: 12px;
    align-content: start;
}

.info-item {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding: 16px;
    border-radius: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid #e2e8f3;
}
.info-item-accent {
    background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
    border-color: #dbeafe;
}
.info-number {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: #e6efff;
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 800;
}
.info-item h3 {
    margin: 2px 0 6px;
    font-size: 16px;
    line-height: 1.2;
}
.info-item p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #334155;
}

.info-legal-box {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 18px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}
.info-legal-box p {
    margin: 0;
    font-size: 11.8px;
    line-height: 1.45;
    color: #64748b;
}

@media (max-height: 840px) and (min-width: 961px) {
    body { padding: 12px; }
    .container { height: calc(100vh - 24px); gap: 12px; }
    .topbar { min-height: 72px; padding: 12px 18px; }
    .consulta-card, .info-adicional { padding: 18px; }
    .consulta-hero { grid-template-columns: minmax(0, 1fr) 144px; margin-bottom: 14px; padding-bottom: 14px; }
    .hero-copy h1 { font-size: 33px; }
    .hero-copy p, .info-heading p { font-size: 13px; }
    .hero-visual { height: 116px; }
    .imagen-urna { width: 86px; height: 86px; }
    .form-surface { padding: 18px; }
    .surface-heading { margin-bottom: 14px; }
    .surface-heading h2 { font-size: 18px; }
    .surface-heading p { font-size: 12px; }
    .formulario { gap: 12px; }
    input, .btn-primary, .btn-secondary, .btn-print, .captcha-box { min-height: 44px; }
    input { padding: 11px 14px; }
    .captcha-box img { width: 118px; height: 32px; }
    .refresh-btn { width: 34px; height: 34px; }
    .info-item { padding: 14px; border-radius: 18px; }
    .info-item p { font-size: 12px; }
    .resultado-destacado { padding: 16px; }
    .resultado-top { margin-bottom: 14px; }
    .resultado-grid-featured { gap: 10px; }
    .resultado-item { padding: 11px 12px; }
    .info-heading { padding-bottom: 14px; margin-bottom: 14px; }
    .info-heading h2 { font-size: 26px; }
    .info-legal-box { margin-top: 10px; padding: 12px 14px; }
}

@media (max-width: 1180px) {
    body { overflow: auto; }
    .container { height: auto; min-height: calc(100vh - 36px); }
    .cards-layout { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
    body { padding: 14px; }
    .container { min-height: calc(100vh - 28px); height: auto; }
    .topbar { flex-direction: column; align-items: stretch; }
    .topbar-tools { justify-content: space-between; }
    .consulta-hero { grid-template-columns: 1fr; }
    .hero-visual { display: none; }
    .resultado-top { flex-direction: column; }
    .resultado-actions { justify-content: flex-start; }
    .resultado-grid-featured { grid-template-columns: 1fr 1fr; }
    .resultado-item-wide { grid-column: span 2; }
}

@media (max-width: 640px) {
    .consulta-card, .info-adicional { padding: 16px; }
    .topbar { padding: 14px; border-radius: 20px; }
    .topbar-site { font-size: 10px; }
    .topbar-title { font-size: 20px; }
    .topbar-tools { flex-direction: column; align-items: stretch; }
    .topbar-pill { text-align: center; }
    .lang-switcher { justify-content: center; }
    .hero-copy h1 { font-size: 27px; }
    .surface-heading { flex-direction: column; }
    .surface-step { width: 40px; height: 40px; font-size: 14px; }
    .captcha-row { grid-template-columns: 1fr; }
    .captcha-box { min-width: 0; justify-content: space-between; }
    .resultado-grid-featured { grid-template-columns: 1fr; }
    .resultado-item-wide { grid-column: span 1; }
    .info-item { grid-template-columns: 1fr; }
    .info-number { width: 42px; height: 42px; }
}

@media print {
    body { background: #fff !important; overflow: visible; padding: 0; }
    .background-shape, .topbar, .info-adicional, .form-surface, .alert, .resultado-actions { display: none !important; }
    .container { height: auto; display: block; max-width: none; }
    .cards-layout { display: block; }
    .panel-card { box-shadow: none; border: none; padding: 0; overflow: visible; }
    .resultado-destacado { background: #fff; border: 1px solid #cbd5e1; box-shadow: none; padding: 20px; }
    .resultado-grid-featured { grid-template-columns: 1fr 1fr; }
    .resultado-item { border: 1px solid #cbd5e1; }
    .resultado-item-wide { grid-column: span 2; }
}

.form-surface-expanded .formulario {
    max-width: 920px;
}

.form-surface-expanded .field-full input {
    font-size: 16px;
}

.form-surface-expanded .captcha-row {
    max-width: 920px;
}

.form-surface-expanded .btn-primary {
    max-width: 920px;
}


/* Ajustes solicitados para la tarjeta de consulta */
.surface-step {
    display: none;
}

.form-surface-expanded .field-full {
    max-width: 780px;
}

.form-surface-expanded #dni {
    max-width: 780px;
    min-height: 46px;
    padding: 12px 16px;
}

.form-surface-expanded .captcha-row {
    max-width: 700px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.form-surface-expanded #captcha {
    min-height: 46px;
    padding: 12px 16px;
}

.form-surface-expanded .captcha-box {
    min-width: 240px;
    min-height: 58px;
    padding: 7px 8px;
    gap: 10px;
}

.form-surface-expanded .captcha-box img {
    width: 170px;
    height: 44px;
}

.form-surface-expanded .refresh-btn {
    width: 42px;
    height: 42px;
}

@media (max-width: 860px) {
    .surface-step {
        display: none;
    }

    .form-surface-expanded .field-full,
    .form-surface-expanded #dni,
    .form-surface-expanded .captcha-row,
    .form-surface-expanded .btn-primary {
        max-width: 100%;
    }

    .form-surface-expanded .captcha-box {
        min-width: 0;
    }

    .form-surface-expanded .captcha-box img {
        width: 150px;
        height: 40px;
    }
}

/* Ajuste fino: campos más compactos y captcha más legible */
.form-surface-expanded .field-full {
    width: 520px;
    max-width: 100%;
}

.form-surface-expanded #dni {
    width: 520px;
    max-width: 100%;
    min-height: 44px;
    padding: 10px 15px;
}

.form-surface-expanded .captcha-row {
    width: 660px;
    max-width: 100%;
    grid-template-columns: 380px 260px;
    gap: 14px;
    align-items: end;
}

.form-surface-expanded #captcha {
    width: 380px;
    max-width: 100%;
    min-height: 44px;
    padding: 10px 15px;
}

.form-surface-expanded .captcha-box {
    width: 260px;
    min-width: 260px;
    min-height: 62px;
    padding: 6px 8px;
}

.form-surface-expanded .captcha-box img {
    width: 195px;
    height: 50px;
    object-fit: fill;
}

.form-surface-expanded .refresh-btn {
    width: 44px;
    height: 44px;
}

@media (max-width: 760px) {
    .form-surface-expanded .field-full,
    .form-surface-expanded #dni,
    .form-surface-expanded .captcha-row,
    .form-surface-expanded #captcha {
        width: 100%;
    }

    .form-surface-expanded .captcha-row {
        grid-template-columns: 1fr;
    }

    .form-surface-expanded .captcha-box {
        width: 260px;
        min-width: 0;
    }
}


/* Ajuste del encabezado de consulta solicitado */
.consulta-hero {
    display: block;
}

.hero-copy-centered {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.hero-copy-centered h1 {
    margin-bottom: 14px;
    max-width: 760px;
}

.hero-urna-wrap {
    width: 120px;
    height: 120px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(219,234,254,0.95), rgba(239,246,255,0.75));
    border: 1px solid #dbeafe;
    display: grid;
    place-items: center;
}

.hero-urna-inline {
    width: 72px;
    height: 72px;
    filter: drop-shadow(0 10px 18px rgba(29, 78, 216, 0.14));
}

.hero-copy p,
.hero-visual {
    display: none !important;
}

@media (max-height: 840px) and (min-width: 961px) {
    .consulta-hero {
        margin-bottom: 14px;
        padding-bottom: 14px;
    }
    .hero-copy-centered h1 {
        font-size: 33px;
    }
    .hero-urna-wrap {
        width: 104px;
        height: 104px;
        border-radius: 20px;
    }
    .hero-urna-inline {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 860px) {
    .hero-copy-centered h1 {
        max-width: 100%;
    }
    .hero-urna-wrap {
        width: 96px;
        height: 96px;
    }
    .hero-urna-inline {
        width: 56px;
        height: 56px;
    }
}


/* Centrado visual del título y la urna */
.consulta-hero {
    display: flex;
    justify-content: center;
}

.hero-copy-centered {
    width: 100%;
    align-items: center;
    text-align: center;
}

.hero-copy-centered .panel-eyebrow {
    text-align: center;
}

.hero-copy-centered h1 {
    margin-left: auto;
    margin-right: auto;
}

.hero-urna-wrap {
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 860px) {
    .consulta-hero {
        display: flex;
        justify-content: center;
    }

    .hero-copy-centered {
        align-items: center;
        text-align: center;
    }
}


/* Cabecera: logo ayuntamiento e idiomas con banderas */
.brand-emblem-image {
    background: #ffffff;
    padding: 0;
    overflow: hidden;
}

.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.topbar-site {
    display: none !important;
}

.lang-link-flag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.flag-icon {
    width: 18px;
    height: 12px;
    border-radius: 2px;
    box-shadow: inset 0 0 0 1px rgba(15,23,42,0.08);
    flex: 0 0 auto;
}

.flag-es {
    background: linear-gradient(to bottom, #c81e1e 0 25%, #facc15 25% 75%, #c81e1e 75% 100%);
}

.flag-ca {
    background: repeating-linear-gradient(
        to bottom,
        #facc15 0 2px,
        #facc15 2px 4px,
        #d62828 4px 6px,
        #d62828 6px 8px
    );
}

@media (max-width: 640px) {
    .brand-emblem {
        width: 48px;
        height: 48px;
        border-radius: 14px;
    }

    .lang-link-flag {
        gap: 6px;
    }

    .flag-icon {
        width: 16px;
        height: 10px;
    }
}

/* Logo municipal: mayor tamaño y sin recorte */
.topbar {
    min-height: 96px;
    padding-top: 12px;
    padding-bottom: 12px;
}

.brand-emblem.brand-emblem-image {
    width: 76px;
    height: 76px;
    min-width: 76px;
    border-radius: 18px;
    background: #ffffff;
    padding: 5px;
    overflow: hidden;
    box-shadow: none;
}

.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

.topbar-brand {
    gap: 18px;
}

@media (max-height: 840px) and (min-width: 961px) {
    .topbar {
        min-height: 84px;
    }

    .brand-emblem.brand-emblem-image {
        width: 68px;
        height: 68px;
        min-width: 68px;
    }
}

@media (max-width: 640px) {
    .brand-emblem.brand-emblem-image {
        width: 62px;
        height: 62px;
        min-width: 62px;
        padding: 4px;
        border-radius: 15px;
    }
}

/* Ajuste final: logo municipal más visible y Senyera correcta */
.topbar {
    min-height: 102px;
}

.brand-emblem.brand-emblem-image {
    width: 102px;
    height: 78px;
    min-width: 102px;
    padding: 0;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
}

.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transform: scale(1.35);
    transform-origin: center;
}

.flag-ca {
    background: linear-gradient(
        to bottom,
        #f6c800 0% 11.111%,
        #c60b1e 11.111% 22.222%,
        #f6c800 22.222% 33.333%,
        #c60b1e 33.333% 44.444%,
        #f6c800 44.444% 55.555%,
        #c60b1e 55.555% 66.666%,
        #f6c800 66.666% 77.777%,
        #c60b1e 77.777% 88.888%,
        #f6c800 88.888% 100%
    );
}

@media (max-height: 840px) and (min-width: 961px) {
    .brand-emblem.brand-emblem-image {
        width: 92px;
        height: 70px;
        min-width: 92px;
    }
}

@media (max-width: 640px) {
    .brand-emblem.brand-emblem-image {
        width: 82px;
        height: 62px;
        min-width: 82px;
        padding: 0;
    }

    .brand-logo-img {
        transform: scale(1.3);
    }
}


/* Ajuste solicitado: contenedor del logo más ancho para que entren las letras */
.brand-emblem.brand-emblem-image {
    width: 132px;
    height: 78px;
    min-width: 132px;
    border-radius: 18px;
}

.brand-logo-img {
    transform: scale(1.18);
}

@media (max-height: 840px) and (min-width: 961px) {
    .brand-emblem.brand-emblem-image {
        width: 118px;
        height: 70px;
        min-width: 118px;
    }
}

@media (max-width: 640px) {
    .brand-emblem.brand-emblem-image {
        width: 102px;
        height: 62px;
        min-width: 102px;
    }

    .brand-logo-img {
        transform: scale(1.12);
    }
}

/* Ajuste final del logo según la proporción real de ayto.jpg (1526x965) */
.brand-emblem.brand-emblem-image {
    width: 156px;
    height: 86px;
    min-width: 156px;
    padding: 0;
    border-radius: 18px;
    overflow: hidden;
    background: #fff;
}

.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center center;
    transform: none !important;
}

.topbar-brand {
    gap: 18px;
}

@media (max-height: 840px) and (min-width: 961px) {
    .brand-emblem.brand-emblem-image {
        width: 142px;
        height: 80px;
        min-width: 142px;
    }
}

@media (max-width: 640px) {
    .brand-emblem.brand-emblem-image {
        width: 118px;
        height: 72px;
        min-width: 118px;
    }
}


/* Ajuste final: un poco más de altura para que no se corte el logo */
.topbar {
    min-height: 110px;
}

.brand-emblem.brand-emblem-image {
    width: 156px;
    height: 94px;
    min-width: 156px;
}

@media (max-height: 840px) and (min-width: 961px) {
    .topbar {
        min-height: 98px;
    }

    .brand-emblem.brand-emblem-image {
        width: 142px;
        height: 86px;
        min-width: 142px;
    }
}

@media (max-width: 640px) {
    .topbar {
        min-height: 92px;
    }

    .brand-emblem.brand-emblem-image {
        width: 118px;
        height: 78px;
        min-width: 118px;
    }
}


/* Iconos en información adicional */
.info-icon {
    font-size: 20px;
    line-height: 1;
}

.info-item:nth-child(3) .info-icon {
    font-size: 18px;
}

.info-item:nth-child(4) .info-icon {
    font-size: 22px;
    font-weight: 900;
}

@media (max-width: 640px) {
    .info-icon {
        font-size: 18px;
    }
}


/* Ajuste del logo superior: zoom para mostrar solo la urna */
.hero-urna-wrap {
    overflow: hidden;
}

.hero-urna-inline {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    transform: scale(1.9);
    transform-origin: center center;
    display: block;
    filter: drop-shadow(0 10px 18px rgba(29, 78, 216, 0.14));
}

@media (max-height: 840px) and (min-width: 961px) {
    .hero-urna-inline {
        width: 100%;
        height: 100%;
        transform: scale(1.9);
    }
}

@media (max-width: 860px) {
    .hero-urna-inline {
        width: 100%;
        height: 100%;
        transform: scale(1.85);
    }
}


/* Ajuste final: inputs y botón más compactos */
.form-surface-expanded .field-full {
    width: 420px;
    max-width: 100%;
}

.form-surface-expanded #dni {
    width: 420px;
    max-width: 100%;
}

.form-surface-expanded .captcha-row {
    width: 520px;
    max-width: 100%;
    grid-template-columns: 250px 250px;
    gap: 10px;
}

.form-surface-expanded #captcha {
    width: 250px;
    max-width: 100%;
}

.form-surface-expanded .captcha-box {
    width: 250px;
    min-width: 250px;
}

.form-surface-expanded .btn-primary {
    width: fit-content;
    max-width: 100%;
    min-width: 300px;
    justify-self: start;
    padding-left: 28px;
    padding-right: 28px;
}

@media (max-width: 760px) {
    .form-surface-expanded .field-full,
    .form-surface-expanded #dni,
    .form-surface-expanded .captcha-row,
    .form-surface-expanded #captcha,
    .form-surface-expanded .btn-primary {
        width: 100%;
        min-width: 0;
    }

    .form-surface-expanded .captcha-row {
        grid-template-columns: 1fr;
    }

    .form-surface-expanded .captcha-box {
        width: 260px;
        min-width: 0;
    }
}


/* Quinta tarjeta de información adicional */
.info-item-important {
    background: linear-gradient(180deg, #fffaf0 0%, #ffffff 100%);
    border-color: #fde7b2;
}

.info-item-important .info-number {
    background: #fff3d6;
}

/* Compactar ligeramente la columna informativa al tener cinco tarjetas */
.info-box {
    gap: 10px;
}

.info-item {
    padding: 14px 15px;
}

.info-item p {
    line-height: 1.42;
}

@media (max-height: 840px) and (min-width: 961px) {
    .info-box {
        gap: 8px;
    }

    .info-item {
        padding: 11px 12px;
    }

    .info-item p {
        font-size: 11.5px;
        line-height: 1.34;
    }

    .info-number {
        width: 40px;
        height: 40px;
    }
}


/* Ajuste fino: bloque legal inferior más compacto */
.info-legal-box {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 16px;
}

.info-legal-box p {
    font-size: 10.6px;
    line-height: 1.32;
}

@media (max-height: 840px) and (min-width: 961px) {
    .info-legal-box {
        margin-top: 8px;
        padding: 9px 11px;
    }

    .info-legal-box p {
        font-size: 10px;
        line-height: 1.28;
    }
}

@media (max-width: 640px) {
    .info-legal-box {
        padding: 10px 12px;
    }

    .info-legal-box p {
        font-size: 10.2px;
        line-height: 1.3;
    }
}


/* Ajuste específico para castellano: evitar solape en la columna informativa */
html[lang="es"] .info-box {
    gap: 8px;
}

html[lang="es"] .info-item {
    padding: 13px 14px;
}

html[lang="es"] .info-item p {
    font-size: 12px;
    line-height: 1.34;
}

html[lang="es"] .info-item-important {
    padding: 11px 13px;
}

html[lang="es"] .info-item-important .info-number {
    width: 40px;
    height: 40px;
}

html[lang="es"] .info-item-important p {
    font-size: 11.35px;
    line-height: 1.24;
}

html[lang="es"] .info-legal-box {
    margin-top: 6px;
    padding: 8px 10px;
}

html[lang="es"] .info-legal-box p {
    font-size: 9.6px;
    line-height: 1.2;
}

@media (max-height: 840px) and (min-width: 961px) {
    html[lang="es"] .info-box {
        gap: 7px;
    }

    html[lang="es"] .info-item {
        padding: 10px 11px;
    }

    html[lang="es"] .info-item p {
        font-size: 11.1px;
        line-height: 1.28;
    }

    html[lang="es"] .info-item-important p {
        font-size: 10.5px;
        line-height: 1.18;
    }

    html[lang="es"] .info-legal-box {
        margin-top: 5px;
        padding: 7px 9px;
    }

    html[lang="es"] .info-legal-box p {
        font-size: 9.2px;
        line-height: 1.16;
    }
}


/* Logos específicos de impresión */
.hero-ayto-print {
    display: none;
}

.resultado-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.print-result-logo {
    display: none;
    width: 54px;
    height: 54px;
    object-fit: contain;
    flex: 0 0 auto;
}

@media print {
    .hero-urna-wrap {
        width: 116px;
        height: 84px;
        background: #fff;
        border: none;
        box-shadow: none;
        padding: 0;
    }

    .hero-urna-inline {
        display: none !important;
    }

    .hero-ayto-print {
        display: block !important;
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: center;
        filter: none;
    }

    .resultado-title-row {
        justify-content: space-between;
        gap: 18px;
    }

    .print-result-logo {
        display: block !important;
    }

    .resultado-destacado {
        padding: 18px;
    }
}


/* Reajuste final de los logos en impresión */
.hero-ayto-print-top {
    display: none;
}

@media print {
    .hero-copy-centered {
        align-items: center;
        text-align: center;
    }

    .hero-copy-centered .panel-eyebrow {
        margin-bottom: 6px;
    }

    .hero-ayto-print-top {
        display: block !important;
        width: 118px;
        height: 72px;
        object-fit: contain;
        object-position: center;
        margin: 0 auto 6px;
    }

    .hero-copy-centered h1 {
        margin-top: 0;
        margin-bottom: 12px;
    }

    .hero-urna-wrap {
        display: none !important;
    }

    .resultado-heading-block {
        width: 100%;
        min-width: 0;
    }

    .resultado-title-row {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 24px;
    }

    .resultado-title-row h2 {
        flex: 1 1 auto;
        margin-right: 20px;
    }

    .print-result-logo {
        display: block !important;
        width: 78px;
        height: 78px;
        object-fit: contain;
        flex: 0 0 78px;
        margin-left: auto;
    }
}


/* Impresión: urna más grande y visible junto al título del resultado */
@media print {
    .resultado-title-row {
        align-items: center;
        gap: 18px;
    }

    .resultado-title-row h2 {
        margin-right: 8px;
    }

    .print-result-logo {
        width: 122px !important;
        height: 122px !important;
        flex: 0 0 122px !important;
        object-fit: contain;
        object-position: center;
        margin-left: auto;
        margin-right: 2px;
    }
}


/* Ajuste de impresión: urna proporcionada al título, manteniéndola a la derecha */
@media print {
    .resultado-top {
        align-items: flex-start;
    }

    .resultado-heading-block {
        width: 100%;
    }

    .resultado-title-row {
        width: 100%;
        display: grid;
        grid-template-columns: minmax(0, 1fr) 88px;
        align-items: center;
        column-gap: 18px;
    }

    .resultado-title-row h2 {
        margin: 0;
        line-height: 1.1;
    }

    .print-result-logo {
        width: 88px !important;
        height: 88px !important;
        flex: 0 0 88px !important;
        justify-self: end;
        align-self: center;
        margin: 0 !important;
    }
}

/* Mejoras funcionales */
.updated-badge {
    display: inline-flex;
    align-items: center;
    margin: 0 auto 10px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eef5ff;
    color: #38537a;
    border: 1px solid #dbe7fb;
    font-size: 11px;
    font-weight: 700;
}

.resultado-item-address {
    padding-top: 12px;
    padding-bottom: 12px;
}

.resultado-address-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
}

.resultado-address-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.resultado-address-text strong {
    overflow-wrap: anywhere;
}

.btn-map {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef5ff;
    color: #1d4ed8;
    border: 1px solid #cfe0ff;
    text-decoration: none;
    font-weight: 800;
    transition: background .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.btn-map-small {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 8px 12px;
    border-radius: 12px;
    gap: 6px;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
}

.btn-map-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
    flex: 0 0 16px;
}

.btn-map:hover {
    background: #dfeaff;
    border-color: #b8d0ff;
    box-shadow: 0 5px 14px rgba(29, 78, 216, .10);
    transform: translateY(-1px);
}

@media (max-width: 620px) {
    .resultado-address-content {
        align-items: flex-start;
    }

    .btn-map-small {
        min-height: 34px;
        padding: 7px 10px;
        font-size: 11px;
    }
}

@media print {
    .updated-badge, .btn-map { display: none !important; }
}


/* --- Corrección layout resultado: Aula / Ubicación --- */
.resultado-grid .resultado-item-wide {
    grid-column: span 2;
    width: 100%;
    box-sizing: border-box;
}

.resultado-grid .resultado-item-wide:last-child {
    min-width: 0;
}

@media (max-width: 760px) {
    .resultado-grid .resultado-item-wide {
        grid-column: 1 / -1;
    }
}

/* La dirección mantiene su botón integrado sin afectar a la fila siguiente */
.resultado-item-address {
    align-self: stretch;
}

.resultado-item-address .resultado-address-content {
    width: 100%;
    min-width: 0;
}



/* Si el proceso oculta toda la información adicional, la consulta ocupa el ancho disponible */
.cards-layout.solo-consulta{grid-template-columns:minmax(0,1fr)}


/* Corrección: mantener visible el botón cuando aparece un error de consulta */
.form-surface-expanded {
    min-height: 0;
    height: auto;
}

.consulta-card-con-mensaje .consulta-hero {
    padding-bottom: 12px;
    margin-bottom: 12px;
}

.consulta-card-con-mensaje .hero-copy-centered h1 {
    margin-bottom: 8px;
}

.consulta-card-con-mensaje .hero-urna-wrap {
    width: 92px;
    height: 92px;
}

.consulta-card-con-mensaje .alert {
    margin-bottom: 12px;
    padding: 11px 14px;
}

.consulta-card-con-mensaje .form-surface-expanded {
    padding: 18px 22px;
}

.consulta-card-con-mensaje .surface-heading {
    margin-bottom: 12px;
}

.consulta-card-con-mensaje .formulario {
    gap: 11px;
}

.consulta-card-con-mensaje input {
    min-height: 42px;
}

.consulta-card-con-mensaje .captcha-box {
    min-height: 54px;
}

.consulta-card-con-mensaje .btn-primary {
    min-height: 46px;
    margin-bottom: 0;
}

@media (max-height: 820px) and (min-width: 961px) {
    .consulta-card-con-mensaje .consulta-hero {
        padding-bottom: 8px;
        margin-bottom: 8px;
    }

    .consulta-card-con-mensaje .hero-copy-centered h1 {
        font-size: 30px;
    }

    .consulta-card-con-mensaje .hero-urna-wrap {
        width: 76px;
        height: 76px;
    }

    .consulta-card-con-mensaje .alert {
        margin-bottom: 8px;
        padding: 9px 12px;
    }

    .consulta-card-con-mensaje .form-surface-expanded {
        padding: 14px 18px;
    }

    .consulta-card-con-mensaje .surface-heading {
        margin-bottom: 8px;
    }

    .consulta-card-con-mensaje .formulario {
        gap: 8px;
    }
}
