:root {
    --navy: #1b4f8a;
    --navy-dark: #143d6b;
    --bg: #f4f6f9;
    --card: #ffffff;
    --line: #dfe4ea;
    --ink: #1f2933;
    --muted: #64748b;
    --red: #c0392b;
    --red-bg: #fdf2f1;
    --amber: #b7791f;
    --amber-bg: #fdf8ec;
    --green: #1d7a45;
    --green-bg: #eef8f2;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 15px;
    line-height: 1.65;
}

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }

.site-header {
    background: var(--navy);
    color: #fff;
    border-bottom: 3px solid var(--navy-dark);
}

.header-inner {
    display: flex; align-items: center; justify-content: space-between;
    gap: 24px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }

.brand-mark {
    width: 38px; height: 38px; border-radius: 8px; background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.35);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 15px; letter-spacing: .5px;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 16px; font-weight: 600; }
.brand-text em { font-style: normal; font-size: 11px; opacity: .7; letter-spacing: .8px; text-transform: uppercase; }

.site-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.site-nav a, .link-btn {
    color: rgba(255,255,255,.86); text-decoration: none; font-size: 14px;
    padding: 6px 12px; border-radius: 6px; background: none; border: 0; cursor: pointer;
    font-family: inherit;
}
.site-nav a:hover, .link-btn:hover { background: rgba(255,255,255,.14); color: #fff; }
.inline-form { display: inline; margin: 0; }

.main { padding-top: 28px; padding-bottom: 48px; min-height: 60vh; }

.site-footer { border-top: 1px solid var(--line); background: #fff; padding: 16px 0; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer span { color: var(--muted); font-size: 12.5px; }

h1 { font-size: 22px; font-weight: 600; margin: 0 0 6px; }
h2 { font-size: 17px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 8px; }
p { margin: 0 0 12px; }
.sub { color: var(--muted); font-size: 13.5px; }

.card {
    background: var(--card); border: 1px solid var(--line); border-radius: 10px;
    padding: 22px 24px; margin-bottom: 18px;
}

.card-narrow { max-width: 620px; margin-left: auto; margin-right: auto; }

.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 500; margin-bottom: 6px; }
.field .req { color: var(--red); margin-left: 2px; }
.field .hint { color: var(--muted); font-size: 12.5px; margin-top: 5px; }

input[type=text], input[type=password], input[type=tel], select {
    width: 100%; padding: 10px 12px; font-size: 15px; font-family: inherit;
    border: 1px solid #c8d0da; border-radius: 7px; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(27,79,138,.12); }
input[readonly] { background: #f7f8fa; }

.tel-row { display: flex; gap: 10px; }
.tel-row input { flex: 1; }

.btn {
    display: inline-block; padding: 9px 18px; border-radius: 7px; font-size: 14.5px;
    font-family: inherit; cursor: pointer; border: 1px solid transparent; text-decoration: none;
    text-align: center;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-dark); }
.btn-ghost { background: #fff; color: var(--navy); border-color: #b9c9dc; }
.btn-ghost:hover { background: #f0f5fb; }
.btn-danger { background: #fff; color: var(--red); border-color: #e2b3ae; }
.btn-danger:hover { background: var(--red-bg); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-block { display: block; width: 100%; }

.alert { border-radius: 8px; padding: 14px 16px; margin-bottom: 18px; font-size: 14px; border: 1px solid; }
.alert-danger { background: var(--red-bg); border-color: #e8bdb8; color: #8c2b21; }
.alert-warn { background: var(--amber-bg); border-color: #ecd9ae; color: #7a5511; }
.alert-info { background: #eef4fb; border-color: #c9dcf0; color: #1b4f8a; }
.alert-ok { background: var(--green-bg); border-color: #b7ddc6; color: #145c34; }
.alert strong { font-weight: 600; }

.warn-title { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 8px; color: var(--red); }
.warn-list { margin: 8px 0 0; padding-left: 20px; }
.warn-list li { margin-bottom: 4px; }

.checkbox-row {
    display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px;
    border: 1px solid #e8bdb8; border-radius: 8px; background: var(--red-bg); margin-bottom: 18px;
}
.checkbox-row input { margin-top: 4px; width: 16px; height: 16px; flex: none; }
.checkbox-row label { font-size: 13.5px; color: #8c2b21; }

table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid th, table.grid td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; }
table.grid th { background: #f7f9fb; font-weight: 500; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
table.grid tbody tr:hover { background: #fafbfd; }
.table-scroll { overflow-x: auto; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 12px; line-height: 1.7; }
.badge-gray { background: #eef1f5; color: #4a5568; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-blue { background: #eaf1f9; color: var(--navy); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 720px) { .stats { grid-template-columns: 1fr 1fr; } }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.stat .k { color: var(--muted); font-size: 12.5px; }
.stat .v { font-size: 26px; font-weight: 600; line-height: 1.3; }

.credential {
    border: 1px solid #b7ddc6; background: var(--green-bg); border-radius: 10px;
    padding: 20px; margin-bottom: 16px;
}
.cred-box { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 10px; }
.cred-item .k { font-size: 12.5px; color: #3d6b52; margin-bottom: 4px; }
.cred-item .v {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 24px; letter-spacing: 1.5px; font-weight: 600; color: #145c34;
    word-break: break-all;
}

/* 账号 / 密码后的单字段复制图标 */
.cred-item .v.cred-line { display: flex; align-items: center; gap: 10px; line-height: 1.2; }
.copy-icon {
    flex: none;
    border: 1px solid #b7ddc6;
    border-radius: 6px;
    background: #fff;
    color: #2f8f5b;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    vertical-align: middle;
}
.copy-icon svg { width: 16px; height: 16px; display: block; }
.copy-icon:hover { border-color: #2f8f5b; background: #f4fbf6; }
.copy-icon:focus-visible { outline: 2px solid #2f8f5b; outline-offset: 1px; }
/* 复制成功：整钮变实心绿，对比明显 */
.copy-icon.copy-done {
    color: #fff;
    background: #2f8f5b;
    border-color: #2f8f5b;
    transform: scale(1.08);
    transition: all .15s ease-out;
}

/* 复制成功提示条：页面顶部居中弹出，1.5 秒后淡出 */
.copy-toast {
    position: fixed;
    left: 50%;
    top: 20px;
    transform: translateX(-50%);
    background: #145c34;
    color: #fff;
    font-size: 13.5px;
    padding: 10px 20px;
    border-radius: 999px;
    box-shadow: 0 6px 18px rgba(20, 92, 52, .35);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: copyToastIn .18s ease-out;
    pointer-events: none;
}
.copy-toast svg { width: 16px; height: 16px; }
.copy-toast.hide { opacity: 0; transition: opacity .3s; }
@keyframes copyToastIn {
    from { opacity: 0; transform: translate(-50%, -8px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.small { font-size: 12.5px; color: var(--muted); }
.mt0 { margin-top: 0; } .mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb0 { margin-bottom: 0; } .mb8 { margin-bottom: 8px; } .mb16 { margin-bottom: 16px; }
.right { text-align: right; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }

.steps { display: flex; gap: 8px; margin-bottom: 20px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.steps span { padding: 4px 10px; border-radius: 20px; background: #eef1f5; }
.steps span.on { background: var(--navy); color: #fff; }

.issue-error { color: var(--red); }
.issue-warning { color: var(--amber); }

/* 表单校验提示：字段级红字 + 紧邻提交按钮的补全汇总 */
.field-validation-error { display: block; color: var(--red); font-size: 12.5px; margin-top: 5px; }
.field-validation-valid { display: none; }
.input-validation-error { border-color: var(--red) !important; background: #fffafa; }
.input-validation-error:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(192,57,43,.12); }
.validation-summary-valid { display: none; }
.validation-summary-errors {
    background: var(--red-bg); border: 1px solid #e8bdb8; color: #8c2b21;
    border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: 13.5px;
}
.validation-summary-errors ul { margin: 0; padding-left: 20px; }
.validation-summary-errors li { margin: 2px 0; }
.agree-error.field-validation-error { margin: -10px 0 14px; }
.checkbox-row-error { border-color: var(--red); box-shadow: 0 0 0 3px rgba(192,57,43,.10); }

/* ---------- 嵌入模式（iframe） ----------
   群众页（首页 / 领取账号 / 换绑手机）会被嵌到门户网站里，因此：
   不带头部导航与页脚、不用灰底，总宽 640px、总高 700px，窄屏自动收成整宽。
   所有群众页统一高度 700px：父页面 iframe 写死一个高度即可，页面之间切换不再忽高忽低。
   与 embed-resize.js 的 EMBED_MIN_HEIGHT 保持一致；内容超高时仍自然增长，不截断。 */

body.embed { background: #fff; }

.embed-main {
    width: 100%;
    max-width: 640px;     /* 总宽 640（含内边距） */
    min-height: 700px;    /* 总高 700（含内边距），与 embed-resize.js 的 EMBED_MIN_HEIGHT 同步 */
    margin: 0 auto;
    padding: 4px 16px 16px;
    display: flex;
    flex-direction: column;
}

/* 嵌入后卡片只是「一组字段」，不再是独立的一张卡：去掉边框与底色，免得和父页面的视觉打架 */
body.embed .card,
body.embed .card-narrow {
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
    margin-left: 0;
    margin-right: 0;
    max-width: none;
    margin-bottom: 14px;
    /* 内容框跟随 .embed-main 的 700px 基线撑满，切换页面不再忽高忽低 */
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

body.embed h1 { font-size: 19px; }

/* 统一的“铺满”容器：
   - Index 的告警说明框靠 space-between 均匀铺开；
   - Claim 的领取成功卡片、Rebind 的表单同理。
   内容真的超高时容器自然增长，不截断。 */
.index-fill,
.embed-fill {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
}
.index-fill .alert,
.embed-fill .alert {
    margin-bottom: 0;
    padding: 9px 12px;
    font-size: 13px;
    line-height: 1.5;
}

.index-cta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}
.index-logout { margin: 0; }

/* 领取 / 换绑表单：固定行距，两个页面的输入框纵向间距完全一致；
   错误提示统一收进顶部告警框，出错时行距不变、页面不会忽高忽低。
   嵌入页没有头尾导航，表单本身就是页面的“内容主体”。 */
body.embed form.embed-form {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 18px;
}
body.embed form.embed-form .field { margin-bottom: 0; }
body.embed form.embed-form input[type=text],
body.embed form.embed-form input[type=tel] {
    padding: 10px 12px;
    font-size: 15px;
}
body.embed form.embed-form .hint { line-height: 1.5; margin-top: 4px; }
body.embed form.embed-form .checkbox-row { padding: 11px 12px; margin-bottom: 0; }
body.embed form.embed-form .btn-block { padding: 12px; font-size: 15px; }
body.embed form.embed-form .validation-summary-errors { margin-bottom: 0; }

@media (max-width: 480px) {
    .embed-main { padding: 0 12px 18px; }
}

/* 本机已验证卡片：和下面的短信表单明显区分，但不要又变成一张「独立卡片」 */
.saved-box {
    border: 1px solid #cfe3d5;
    border-radius: 10px;
    background: #f4fbf6;
    padding: 16px;
    margin-bottom: 16px;
}

body.embed .saved-box {
    border: 0;
    border-top: 2px solid #2f8f5b;
    border-radius: 0;
    background: #f4fbf6;
    padding: 10px 16px 12px;
    margin-bottom: 8px;
}

@media (max-width: 480px) {
    body.embed .saved-box { padding: 12px 10px 14px; }
}
