:root {
    --bg: #eef4ff;
    --card: #ffffff;
    --text: #14213d;
    --muted: #667085;
    --primary: #0f46c7;
    --primary-dark: #0b3290;
    --border: #d9e2ef;
    --success: #067647;
    --error: #b42318;
    --shadow: 0 18px 48px rgba(15, 35, 80, 0.12);
    --soft: #f7faff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(15, 70, 199, 0.12), transparent 32%),
        linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
}

a {
    color: var(--primary);
    text-decoration: none;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    margin-top: 6px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--text);
    font: inherit;
    background: #fff;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(15, 70, 199, 0.55);
    box-shadow: 0 0 0 4px rgba(15, 70, 199, 0.10);
    background: #fbfdff;
}

label {
    color: #1f2a44;
    font-size: 13px;
    font-weight: 800;
}

.login-body {
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(29, 78, 216, 0.18), transparent 36%),
        linear-gradient(135deg, #eef4ff 0%, #f8fbff 100%);
}

.login-card,
.panel {
    background: var(--card);
    border: 1px solid rgba(217, 226, 239, 0.8);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.login-card {
    width: min(430px, 100%);
    padding: 34px;
    text-align: center;
}

.brand-mark {
    display: inline-grid;
    width: 62px;
    height: 62px;
    place-items: center;
    border-radius: 18px;
    background: var(--primary);
    color: white;
    font-weight: 800;
    letter-spacing: 1px;
}

.stack {
    display: grid;
    gap: 16px;
    text-align: left;
}

.hint,
.muted {
    color: var(--muted);
}

.hint {
    margin-bottom: 0;
    font-size: 13px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px min(5vw, 58px);
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.topbar h1 {
    margin: 6px 0 0;
    font-size: clamp(24px, 2.5vw, 34px);
    letter-spacing: -0.04em;
}

.topbar nav {
    display: flex;
    gap: 14px;
    font-weight: 700;
    align-items: center;
}

.topbar nav a {
    padding: 10px 14px;
    border-radius: 999px;
    background: #edf4ff;
}

.container {
    width: min(1260px, calc(100% - 34px));
    margin: 28px auto;
}

.grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 24px;
    align-items: start;
}

.panel {
    padding: 26px;
}

.form-panel {
    max-width: 900px;
    margin-left: auto;
}

.section-title h2,
.manual-box h3 {
    margin: 0 0 8px;
    font-size: 24px;
    letter-spacing: -0.035em;
}

.section-title p {
    margin: 0 0 24px;
    color: var(--muted);
    line-height: 1.55;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.wide {
    grid-column: 1 / -1;
}

.manual-box {
    margin: 24px 0;
    padding: 20px;
    border: 1px dashed #b9c7dc;
    border-radius: 18px;
    background: #f9fbff;
}

.voter-detail-rows {
    display: grid;
    gap: 12px;
}

.voter-row {
    display: grid;
    gap: 12px;
    align-items: end;
    margin-bottom: 0;
}

.voter-row-hero {
    grid-template-columns: minmax(170px, 1fr) minmax(140px, .72fr) minmax(190px, .95fr) 96px;
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid #e3ebf8;
    border-radius: 18px;
    background: var(--soft);
}

.voter-row-pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.voter-row-triple {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.voter-row-relation {
    grid-template-columns: minmax(150px, 0.85fr) minmax(0, 1fr) minmax(0, 1fr);
}

.voter-photo-box {
    width: 96px;
    height: 96px;
    display: grid;
    place-items: center;
    align-self: end;
    border: 1px dashed var(--border);
    border-radius: 12px;
    color: var(--muted);
    background: #f8fbff;
    font-size: 12px;
    font-weight: 800;
    overflow: hidden;
    text-align: center;
}

.voter-photo-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.voter-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    justify-content: space-between;
}

.voter-actions-inline {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    align-self: end;
    min-height: 42px;
}

.inline-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    padding: 11px 18px;
    cursor: pointer;
    font-weight: 800;
    font-size: 15px;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #2563eb);
    box-shadow: 0 10px 22px rgba(15, 70, 199, 0.22);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary,
.btn-small {
    color: var(--primary);
    background: #eaf1ff;
    border: 1px solid #d6e5ff;
}

.btn-small {
    padding: 8px 12px;
    font-size: 13px;
}

.full {
    width: 100%;
    margin-top: 18px;
}

.badge {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    color: #0f46c7;
    background: #eaf1ff;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.alert {
    margin-bottom: 18px;
    padding: 13px 15px;
    border-radius: 14px;
    font-weight: 700;
}

.alert-success {
    color: var(--success);
    background: #ecfdf3;
}

.alert-error {
    color: var(--error);
    background: #fef3f2;
}

.fetch-status {
    margin-top: 16px;
    padding: 13px 15px;
    border-radius: 14px;
    font-weight: 700;
}

.fetch-status-info {
    color: #175cd3;
    background: #eaf1ff;
}

.fetch-status-success {
    color: var(--success);
    background: #ecfdf3;
}

.fetch-status-error {
    color: var(--error);
    background: #fef3f2;
}

.report-list {
    display: grid;
    gap: 12px;
}

.grid > aside.panel {
    position: sticky;
    top: 18px;
}

.report-item {
    display: grid;
    gap: 8px;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fbfdff;
}

.report-item strong {
    font-size: 15px;
}

.report-item span,
.empty {
    color: var(--muted);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

th {
    color: #475467;
    background: #f8fbff;
}

@media (max-width: 920px) {
    .grid,
    .form-grid,
    .voter-row-hero,
    .voter-row-pair,
    .voter-row-triple,
    .voter-row-relation {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (min-width: 1280px) {
    .container {
        width: min(1320px, calc(100% - 48px));
    }
}

@media (max-width: 1180px) {
    .grid {
        grid-template-columns: 1fr;
    }

    .form-panel {
        max-width: none;
        margin-left: 0;
    }

    .grid > aside.panel {
        position: static;
    }
}

@media (max-width: 720px) {
    body {
        font-size: 13px;
    }

    .topbar {
        padding: 14px 16px;
    }

    .topbar nav {
        width: 100%;
        gap: 8px;
        flex-wrap: wrap;
    }

    .topbar nav a {
        flex: 1;
        text-align: center;
        padding: 9px 10px;
    }

    .container {
        width: min(100% - 20px, 520px);
        margin: 16px auto;
    }

    .panel {
        padding: 18px;
        border-radius: 18px;
    }

    .section-title h2,
    .manual-box h3 {
        font-size: 21px;
    }

    .section-title p {
        margin-bottom: 18px;
    }

    input,
    select,
    textarea {
        min-height: 46px;
        font-size: 15px;
    }

    .voter-row-hero {
        padding: 14px;
        border-radius: 16px;
    }

    .voter-photo-box {
        width: 100%;
        height: 150px;
    }

    .voter-actions,
    .voter-actions-inline {
        align-items: stretch;
        flex-direction: column;
    }

    .voter-actions .btn,
    .voter-actions-inline .btn {
        width: 100%;
    }

    .muted {
        line-height: 1.45;
    }
}

@media (max-width: 420px) {
    .container {
        width: calc(100% - 14px);
    }

    .panel {
        padding: 14px;
        border-radius: 16px;
    }

    .topbar h1 {
        font-size: 22px;
    }

    .badge {
        font-size: 10px;
    }
}
