:root {
    --navy: #114329;
    --blue: #175a35;
    --blue-bright: #2f754d;
    --yellow: #aca316;
    --green: #1a6039;
    --green-dark: #0d3f25;
    --ink: #173a31;
    --muted: #66736f;
    --mist: #f0f3f2;
    --line: #d4ddda;
    --white: #fff;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
    margin: 0;
    min-width: 320px;
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        linear-gradient(rgba(12, 57, 33, .9), rgba(11, 48, 29, .93)),
        url('/assets/img/fundo-campanha.png') center top / cover fixed,
        #0d3f25;
    min-height: 100vh;
}

button, input { font: inherit; }
button { touch-action: manipulation; }
.page-shell { width: min(850px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 36px; }
.ballot { overflow: hidden; background: var(--white); border-radius: 28px; box-shadow: 0 28px 80px rgba(0, 20, 45, .34); }
.ballot-header { display: grid; grid-template-columns: 180px 1fr; gap: 28px; align-items: center; padding: 34px 38px 28px; border-bottom: 5px solid var(--yellow); }
.campaign-seal { display: grid; justify-items: center; gap: 7px; color: var(--navy); text-align: center; font-size: .7rem; font-weight: 850; line-height: 1.2; text-transform: uppercase; letter-spacing: .06em; }
.campaign-seal img { display:block; width:100%; max-height:92px; object-fit:contain; }
.heading-group .kicker { margin: 0 0 4px; color: var(--blue); font-size: .77rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.heading-group h1 { margin: 0; color: var(--navy); font-size: clamp(2.35rem, 7vw, 4rem); line-height: .95; letter-spacing: -.055em; }
.heading-group > p:last-child { margin: 10px 0 0; color: var(--muted); font-size: 1rem; }
.progress-wrap { padding: 18px 28px 8px; }
.progress-copy { display: flex; justify-content: space-between; gap: 20px; color: var(--muted); font-size: .86rem; }
.progress-copy strong { color: var(--navy); }
.progress-track { height: 7px; margin-top: 9px; overflow: hidden; background: #dfeaf1; border-radius: 999px; }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--blue-bright), var(--green)); border-radius: inherit; transition: width .3s ease; }
.choices { display: grid; gap: 13px; padding: 16px 28px 28px; }
.choice { position: relative; min-height: 104px; border: 1px solid var(--line); border-radius: 20px; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.choice:focus-within { border-color: var(--blue-bright); box-shadow: 0 0 0 4px rgba(45, 122, 97, .14); }
.choice.confirmed { border-color: #70c39f; box-shadow: 0 7px 20px rgba(13, 95, 145, .08); }
.choice-input { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(180px, 235px) 118px; gap: 12px; align-items: center; padding: 18px; background: var(--mist); }
.lookup-candidate { grid-column:1 / -1; display:grid; grid-template-columns:46px 1fr; gap:10px; align-items:center; margin-top:0; padding:10px 0 0; color:var(--green-dark); border-top:1px dashed #c4d4dd; }
.lookup-candidate[hidden] { display:none; }
.lookup-candidate img { width:46px; height:46px; object-fit:cover; object-position:center top; border:2px solid var(--yellow); border-radius:50%; background:#fff; }
.lookup-candidate strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.lookup-candidate > div { display:grid; gap:1px; }
.lookup-candidate .lookup-party { color:#4d68a0; font-size:.72rem; font-weight:900; letter-spacing:.05em; }
.lookup-candidate p { grid-column:1 / -1; margin:0; color:#546b7a; font-size:.82rem; }
.choice-copy, .candidate-copy { display: grid; gap: 3px; }
.role { font-size: .76rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.choice small { color: var(--muted); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.choice-input input { width: 100%; min-width: 0; height: 64px; border: 2px solid #cedce7; border-radius: 14px; outline: none; color: var(--navy); background: var(--white); text-align: center; font-size: 2.2rem; font-weight: 900; letter-spacing: .18em; }
.choice-input input::placeholder { color: #b6c8d8; }
.choice.confirmed input { color: var(--green-dark); border-color: #70c39f; background: #f4fff9; }
.confirm-button { min-height: 52px; padding: 0 14px; border: 0; border-radius: 12px; color: var(--white); background: var(--green); font-size: .78rem; font-weight: 900; text-transform: uppercase; cursor: pointer; transition: background .18s ease, transform .18s ease; }
.confirm-button:hover { background: var(--green-dark); transform: translateY(-1px); }
.confirm-button:focus-visible, .action:focus-visible, input:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.choice.confirmed .confirm-button { color: var(--green-dark); background: #dff6eb; }
.field-error { position: absolute; right: 152px; bottom: 4px; color: #b42318; font-size: .75rem; font-weight: 700; }
.choice-fixed { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto 118px; gap: 16px; align-items: center; padding: 15px 18px; color: var(--white); border-color: transparent; background: linear-gradient(115deg, var(--blue) 0%, var(--navy) 100%); }
.choice-fixed.confirmed { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(246, 196, 69, .23); }
.candidate-avatar { display: grid; place-items: center; width: 62px; height: 62px; border: 3px solid var(--yellow); border-radius: 50%; color: var(--navy); background: linear-gradient(145deg, #fff, #d7e7f2); font-weight: 950; }
.candidate-avatar.has-photo { width: 78px; height: 78px; overflow: hidden; background: #fff; }
.candidate-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.choice-fixed:has(.candidate-avatar.has-photo) { grid-template-columns: 86px minmax(0, 1fr) auto 118px; }
.candidate-copy strong { overflow: hidden; font-size: clamp(1.15rem, 3vw, 1.55rem); line-height: 1.05; text-overflow: ellipsis; white-space: nowrap; }
.candidate-copy small { color: #cbded7; }
.candidate-number { color: var(--yellow); font-size: clamp(2.3rem, 7vw, 3.7rem); line-height: 1; font-weight: 950; letter-spacing: -.06em; }
.ballot-actions { display: grid; grid-template-columns: 1.25fr 1fr; gap: 12px; padding: 26px 28px 28px; background: #f5f8fb; border-top: 1px solid var(--line); }
.action { min-height: 54px; border-radius: 14px; border: 0; font-weight: 900; cursor: pointer; }
.action[hidden] { display:none; }
.action:disabled { opacity: .48; cursor: not-allowed; }
.action-primary { color: var(--navy); background: var(--yellow); }
.action-share { color: var(--white); background: var(--green); }
.action-print { color:var(--white); background:var(--navy); }
.action-quiet { grid-column: 1 / -1; min-height: 38px; color: var(--muted); background: transparent; }
.ballot-actions p { grid-column: 1 / -1; margin: 0; color: var(--muted); text-align: center; font-size: .83rem; }
.trust-note { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 18px auto 0; color: #e1eee9; font-size: .88rem; text-align: center; }
.trust-note p { margin: 0; }
.campaign-legal { display:grid; width:min(850px,calc(100% - 32px)); gap:5px; margin:18px auto 28px; padding:17px 20px; color:#e1eee9; border:1px solid rgba(255,255,255,.2); border-radius:15px; background:rgba(5,42,23,.55); text-align:center; font-size:.72rem; line-height:1.35; }
.campaign-legal strong { color:var(--yellow); letter-spacing:.035em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.card-preview { position:fixed; z-index:1000; inset:50% auto auto 50%; transform:translate(-50%,-50%); width:min(610px,calc(100% - 24px)); max-height:94vh; padding:18px; overflow:auto; border:0; border-radius:24px; color:var(--ink); background:#fff; box-shadow:0 0 0 100vmax rgba(3,28,16,.82),0 28px 90px rgba(0,0,0,.42); }
.card-preview[hidden] { display:none; }
.preview-close { position:absolute; top:12px; right:14px; width:38px; height:38px; border:0; border-radius:50%; color:#fff; background:var(--navy); font-size:1.7rem; cursor:pointer; }
.preview-copy { padding:4px 42px 12px 4px; }
.preview-copy span { color:var(--blue); font-size:.75rem; font-weight:900; letter-spacing:.1em; text-transform:uppercase; }
.preview-copy h2 { margin:4px 0; color:var(--navy); }
.preview-copy p { margin:0; color:var(--muted); font-size:.9rem; }
.card-preview > img { display:block; width:auto; max-width:100%; height:min(62vh,650px); margin:0 auto; border-radius:12px; box-shadow:0 8px 28px rgba(17,67,41,.2); }
.preview-actions { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; padding-top:14px; }

@media (max-width: 700px) {
    .page-shell { width: min(100% - 20px, 560px); padding-top: 10px; }
    .ballot { border-radius: 20px; }
    .ballot-header { grid-template-columns: 78px 1fr; gap: 16px; padding: 24px 18px 21px; }
    .campaign-seal span:last-child { display: none; }
    .campaign-seal img { max-height:64px; }
    .heading-group h1 { font-size: clamp(2rem, 11vw, 3rem); }
    .heading-group > p:last-child { font-size: .88rem; }
    .progress-wrap { padding-inline: 14px; }
    .choices { gap: 10px; padding: 12px 12px 18px; }
    .choice-input { grid-template-columns: 1fr 102px; gap: 9px; padding: 14px; }
    .choice-copy { grid-column: 1 / -1; }
    .choice-input input { height: 55px; font-size: 1.65rem; }
    .field-error { position: static; grid-column: 1 / -1; }
    .choice-fixed { grid-template-columns: 50px minmax(0, 1fr) auto; gap: 10px; padding: 13px 12px; }
    .candidate-avatar { width: 48px; height: 48px; font-size: .8rem; }
    .candidate-avatar.has-photo { width: 58px; height:58px; }
    .choice-fixed:has(.candidate-avatar.has-photo) { grid-template-columns: 58px minmax(0, 1fr) auto; }
    .candidate-number { font-size: 2.15rem; }
    .choice-fixed .confirm-button { grid-column: 1 / -1; min-height: 42px; }
    .ballot-actions { grid-template-columns: 1fr; padding: 20px 14px; }
    .action-quiet, .ballot-actions p { grid-column: 1; }
    .preview-actions { grid-template-columns:1fr; }
    .campaign-legal { padding-inline:12px; font-size:.66rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
