/* 제38대 LA 한인회장 선거 유권자 등록 - 공식 선거 스타일 */
:root {
    --navy: #0b2a4a;
    --navy-2: #133b66;
    --navy-soft: #e8eef6;
    --red: #c8102e;
    --red-soft: #fdecef;
    --green: #127a3e;
    --green-soft: #e7f5ec;
    --bg: #f3f5f8;
    --card: #ffffff;
    --text: #1a2230;
    --muted: #5b6676;
    --line: #d9dee6;
    --focus: #2f6fd6;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(11, 42, 74, .06), 0 4px 16px rgba(11, 42, 74, .06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Noto Sans KR', -apple-system, 'Malgun Gothic', '맑은 고딕', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--navy-2); }

h1, h2, h3 { margin: 0; line-height: 1.3; }

.container {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------- 헤더 ---------- */
.site-header { background: #fff; border-top: 5px solid var(--red); }
.site-header .container {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-top: 14px;
    padding-bottom: 14px;
}
.site-header .logo img { display: block; height: 52px; width: auto; }
.site-header .title { border-left: 1px solid var(--line); padding-left: 20px; }
.site-header .title strong { display: block; font-size: 19px; color: var(--navy); font-weight: 700; }
.site-header .title span { font-size: 14px; color: var(--muted); }

.site-nav { background: var(--navy); }
.site-nav .container { display: flex; align-items: stretch; justify-content: space-between; flex-wrap: wrap; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; }
.site-nav a.menu {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 22px;
    color: #cfdbea;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 3px solid transparent;
}
.site-nav a.menu:hover { color: #fff; background: var(--navy-2); }
.site-nav a.menu.active { color: #fff; border-bottom-color: var(--red); background: var(--navy-2); }
.site-nav .user { display: flex; align-items: center; gap: 14px; color: #cfdbea; font-size: 14px; }
.site-nav .user a { color: #fff; text-decoration: none; border: 1px solid rgba(255,255,255,.35); border-radius: 6px; padding: 5px 12px; }
.site-nav .user a:hover { background: rgba(255,255,255,.12); }

/* ---------- 본문 ---------- */
main { flex: 1; padding: 36px 0 60px; }

.page-head { margin-bottom: 28px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; color: var(--navy); font-weight: 700; }
.page-head h1::after { content: ''; display: block; width: 48px; height: 4px; background: var(--red); margin-top: 12px; border-radius: 2px; }
.page-head p { margin: 10px 0 0; color: var(--muted); }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ---------- 알림 ---------- */
.alert {
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 20px;
    border: 1px solid;
    white-space: pre-line;
}
.alert-error { background: var(--red-soft); border-color: #f3b8c2; color: #8f0b21; }
.alert-ok { background: var(--green-soft); border-color: #a9d8b9; color: #0d5a2d; }
.alert-info { background: var(--navy-soft); border-color: #c3d3e8; color: var(--navy); }
.alert[hidden] { display: none; }

/* ---------- 버튼 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 52px;
    padding: 0 28px;
    font: inherit;
    font-size: 17px;
    font-weight: 700;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, box-shadow .15s;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-outline { background: #fff; color: var(--navy); border-color: var(--navy); }
.btn-outline:hover { background: var(--navy-soft); }
.btn-sm { height: 42px; padding: 0 18px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn:focus-visible, .field input:focus-visible, .field select:focus-visible, .id-type input:focus-visible + span {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.spinner {
    width: 18px; height: 18px;
    border: 3px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 폼 ---------- */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }

.step { padding: 28px 30px; margin-bottom: 20px; }
.step-title { display: flex; align-items: center; gap: 12px; font-size: 19px; color: var(--navy); font-weight: 700; margin-bottom: 22px; }
.step-title .num {
    flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--navy); color: #fff; font-size: 16px;
}
.step-title small { font-size: 14px; color: var(--muted); font-weight: 400; }

.grid { display: grid; gap: 18px 20px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: 1 / -1; }

.field label, .field .label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 15px; }
.field .req { color: var(--red); margin-left: 2px; }
.field input, .field select {
    width: 100%;
    height: 50px;
    padding: 0 14px;
    font: inherit;
    font-size: 17px;
    color: var(--text);
    background: #fff;
    border: 1px solid #b9c2cf;
    border-radius: 8px;
}
.field input[readonly] { background: #f1f3f6; color: var(--muted); }
.field input::placeholder { color: #9aa4b2; }
.field .hint { margin-top: 6px; font-size: 14px; color: var(--muted); }
.field .msg { margin-top: 6px; font-size: 14px; font-weight: 500; }
.field .msg.bad { color: var(--red); }
.field .msg.good { color: var(--green); }
.field.invalid input, .field.invalid select, .id-types.invalid .id-type span { border-color: var(--red); background: #fffafa; }

.dob { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; }

.id-types { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.id-type { position: relative; cursor: pointer; }
.id-type input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.id-type span {
    display: flex; align-items: center; gap: 12px;
    height: 64px; padding: 0 18px;
    border: 2px solid var(--line); border-radius: 10px;
    background: #fff; font-weight: 500; font-size: 17px;
    transition: border-color .15s, background .15s;
}
.id-type span::before {
    content: ''; flex: none;
    width: 22px; height: 22px; border-radius: 50%;
    border: 2px solid #9aa4b2; background: #fff;
}
.id-type:hover span { border-color: #9fb3cc; }
.id-type input:checked + span { border-color: var(--navy); background: var(--navy-soft); color: var(--navy); }
.id-type input:checked + span::before { border: 7px solid var(--navy); }

.notice-red { color: var(--red); font-size: 14px; font-weight: 500; margin: 0 0 16px; }

.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 8px; }

/* 우측 안내 패널 */
.side { position: sticky; top: 20px; }
.side .card { padding: 22px 24px; margin-bottom: 16px; }
.side h3 { font-size: 16px; color: var(--navy); margin-bottom: 14px; }
.side dl { margin: 0; }
.side dt { font-size: 13px; color: var(--muted); }
.side dd { margin: 0 0 12px; font-weight: 500; }
.side dd:last-child { margin-bottom: 0; }
.side ol { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.side ol li { margin-bottom: 6px; }

/* ---------- 등록 완료 ---------- */
.receipt { max-width: 720px; margin: 0 auto; overflow: hidden; }
.receipt-top { background: var(--navy); color: #fff; text-align: center; padding: 34px 24px 30px; }
.receipt-top .check {
    width: 60px; height: 60px; border-radius: 50%;
    background: #fff; color: var(--green);
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
}
.receipt-top h1 { font-size: 24px; }
.receipt-top .no { margin-top: 16px; font-size: 15px; color: #cfdbea; }
.receipt-top .no strong { display: block; font-size: 44px; color: #fff; letter-spacing: 2px; line-height: 1.2; }
.receipt-body { padding: 10px 32px 30px; }
.receipt-body table { width: 100%; border-collapse: collapse; }
.receipt-body th, .receipt-body td { padding: 14px 4px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.receipt-body th { width: 140px; color: var(--muted); font-weight: 500; }
.receipt-body td { font-weight: 500; }
.receipt-info { margin: 24px 0 0; padding: 18px 20px; background: var(--bg); border-radius: 8px; font-size: 15px; }
.receipt-info p { margin: 0 0 6px; }
.receipt-info p:last-child { margin: 0; }
.receipt-actions { display: flex; gap: 12px; margin-top: 26px; }
.receipt-actions .btn { flex: 1; }

/* ---------- 리스트 ---------- */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { padding: 20px 24px; border-left: 5px solid var(--navy); }
.stat.red { border-left-color: var(--red); }
.stat .label { font-size: 14px; color: var(--muted); }
.stat .value { font-size: 32px; font-weight: 700; color: var(--navy); line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }

.search { padding: 20px 24px; margin-bottom: 20px; }
.search form { display: grid; grid-template-columns: 1.1fr 1fr 1.7fr .8fr auto; gap: 14px; align-items: end; }
.search .field input, .search .field select { height: 46px; font-size: 16px; }
.search .dates { display: flex; align-items: center; gap: 8px; }
.search .dates span { color: var(--muted); }
.search .buttons { display: flex; gap: 8px; }
.search .btn { height: 46px; }

.table-card { overflow: hidden; }
.table-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.table-head .count { font-weight: 500; }
.table-head .count strong { color: var(--red); }
.table-scroll { overflow-x: auto; }
.list-table { width: 100%; border-collapse: collapse; font-size: 15px; white-space: nowrap; }
.list-table th {
    background: #f6f8fb; color: var(--muted); font-weight: 500; font-size: 14px;
    text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.list-table td { padding: 14px 16px; border-bottom: 1px solid #eceff4; }
.list-table tbody tr:hover { background: #f8fafd; }
.list-table .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.list-table .regno { font-weight: 700; color: var(--navy); }
.list-table .name { font-weight: 500; }
.list-table .sub { display: block; color: var(--muted); font-size: 13px; }
.list-table .empty { text-align: center; padding: 60px 16px; color: var(--muted); white-space: normal; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--navy-soft); color: var(--navy); font-size: 13px; font-weight: 500; }

.pager { display: flex; justify-content: center; gap: 6px; padding: 20px; flex-wrap: wrap; }
.pager a, .pager span {
    min-width: 40px; height: 40px; padding: 0 12px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); border-radius: 8px;
    text-decoration: none; color: var(--text); background: #fff; font-size: 15px;
}
.pager a:hover { border-color: var(--navy); color: var(--navy); }
.pager .current { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 700; }
.pager .disabled { color: #b5bdc8; }

/* ---------- 로그인 ---------- */
.login-page { background: linear-gradient(180deg, var(--navy) 0, var(--navy) 46%, var(--bg) 46%); }
.login-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 48px 20px; }
.login-card { width: 100%; max-width: 440px; overflow: hidden; }
.login-card .top { text-align: center; padding: 34px 32px 26px; border-top: 6px solid var(--red); }
.login-card .top img { height: 64px; width: auto; max-width: 100%; }
.login-card .top h1 { font-size: 22px; color: var(--navy); margin-top: 20px; }
.login-card .top p { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.login-card form { padding: 0 32px 30px; }
.login-card .field { margin-bottom: 16px; }
.login-card .btn { margin-top: 6px; }
.login-info { border-top: 1px solid var(--line); background: #f8fafc; padding: 20px 32px; font-size: 14px; }
.login-info dl { display: grid; grid-template-columns: 80px 1fr; gap: 6px 10px; margin: 0; }
.login-info dt { color: var(--muted); }
.login-info dd { margin: 0; font-weight: 500; }
.login-foot { text-align: center; color: var(--muted); font-size: 13px; padding: 0 20px 28px; }

/* ---------- 푸터 ---------- */
.site-footer { background: #0a1f36; color: #9fb0c5; font-size: 14px; padding: 26px 0; }
.site-footer .container { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.site-footer strong { color: #fff; font-weight: 500; }

/* ---------- 모바일 ---------- */
@media (max-width: 960px) {
    .form-layout { grid-template-columns: 1fr; }
    .side { position: static; }
    .search form { grid-template-columns: 1fr 1fr; }
    .search .field-dates, .search .buttons { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
    body { font-size: 15px; }
    main { padding: 24px 0 40px; }
    .container { padding: 0 16px; }
    .site-header .container { gap: 12px; }
    .site-header .logo img { height: 40px; }
    .site-header .title { padding-left: 12px; }
    .site-header .title strong { font-size: 16px; }
    .site-header .title span { display: none; }
    .site-nav a.menu { padding: 12px 14px; }
    .site-nav .user { width: 100%; justify-content: space-between; padding: 8px 0 12px; border-top: 1px solid rgba(255,255,255,.12); }
    .page-head h1 { font-size: 23px; }
    .step { padding: 22px 18px; }
    .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .id-types { grid-template-columns: 1fr; }
    .form-actions .btn { flex: 1; }
    .stats { grid-template-columns: 1fr 1fr; }
    .stats .stat:first-child { grid-column: 1 / -1; }
    .search form { grid-template-columns: 1fr; }
    .receipt-body { padding: 4px 18px 22px; }
    .receipt-body th { width: 100px; }
    .receipt-actions { flex-direction: column; }
    .login-card form, .login-info { padding-left: 22px; padding-right: 22px; }
}

/* 그리드/플렉스 안의 입력칸이 화면 밖으로 밀려나지 않도록 */
.search form > *, .grid > *, .dob > * { min-width: 0; }
.search .dates input { flex: 1; min-width: 0; }
@media (max-width: 640px) {
    .search form { grid-template-columns: minmax(0, 1fr); }
    .search .buttons .btn { flex: 1; }
}
