/* ========== 移动端全局样式 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    background: #f5f7fa;
    color: #333;
    -webkit-font-smoothing: antialiased;
}

#app {
    max-width: 640px;
    margin: 0 auto;
    min-height: 100vh;
    background: #f5f7fa;
    padding-bottom: 80px;
}

/* 顶部状态栏 */
.top-bar {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.top-bar .back-btn {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    color: #fff; text-decoration: none; font-size: 18px;
}
.top-bar .title { flex: 1; font-size: 17px; font-weight: 600; text-align: center; margin-right: 32px; }
.top-bar .title.left { text-align: left; margin-right: 0; }

/* 家庭身份卡片 */
.family-card {
    margin: 12px;
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    border-radius: 16px;
    padding: 18px;
    color: #fff;
    box-shadow: 0 4px 16px rgba(59,130,246,0.3);
}
.family-card .fc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.family-card .fc-name { font-size: 18px; font-weight: bold; }
.family-card .fc-code { font-size: 12px; opacity: 0.8; background: rgba(255,255,255,0.2); padding: 2px 8px; border-radius: 10px; }
.family-card .fc-info { font-size: 13px; opacity: 0.9; line-height: 1.6; }
.family-card .fc-change {
    margin-top: 12px; display: inline-block;
    padding: 6px 14px; background: rgba(255,255,255,0.2);
    border-radius: 20px; font-size: 12px; color: #fff; text-decoration: none;
}

/* 搜索/选择家庭 */
.family-pick {
    margin: 12px;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.family-pick h3 { font-size: 16px; margin-bottom: 14px; color: #1e3a8a; }
.family-pick input {
    width: 100%; padding: 12px 14px;
    border: 1px solid #e5e7eb; border-radius: 10px;
    font-size: 15px; margin-bottom: 10px;
}
.family-pick input:focus { outline: none; border-color: #3b82f6; }
.family-pick .btn-pick {
    width: 100%; padding: 12px;
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    color: #fff; border: none; border-radius: 10px;
    font-size: 15px; font-weight: 600; cursor: pointer;
}
.family-pick .pick-tip { font-size: 12px; color: #999; margin-top: 10px; text-align: center; }

/* 模块入口 */
.section-title {
    padding: 14px 16px 8px;
    font-size: 14px;
    color: #6b7280;
    display: flex; align-items: center; gap: 6px;
}
.section-title::before {
    content: ''; width: 3px; height: 14px;
    background: #3b82f6; border-radius: 2px;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 0 12px;
}
.module-item {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    text-decoration: none;
    color: #333;
    display: flex; flex-direction: column;
    transition: transform .15s;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.module-item:active { transform: scale(0.96); }
.module-item .mi-icon {
    font-size: 28px; margin-bottom: 8px;
}
.module-item .mi-title {
    font-size: 15px; font-weight: 600;
}
.module-item .mi-desc {
    font-size: 11px; color: #999; margin-top: 4px;
    line-height: 1.5;
}
.module-item .mi-level {
    position: absolute; top: 10px; right: 10px;
    font-size: 10px; padding: 2px 6px; border-radius: 8px;
}
.mi-level.L1 { background: #dbeafe; color: #1e40af; }
.mi-level.L2 { background: #fef3c7; color: #92400e; }
.mi-level.L3 { background: #fee2e2; color: #991b1b; }

/* 页面卡片 */
.card {
    background: #fff;
    margin: 12px;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 14px; padding-bottom: 10px;
    border-bottom: 1px solid #f3f4f6;
}
.card-header h3 { font-size: 16px; color: #1e3a8a; }
.card-header .badge {
    font-size: 11px; padding: 2px 8px; border-radius: 10px;
    background: #fee2e2; color: #991b1b;
}

/* 表单 */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 6px;
}
.form-group label .req { color: #ef4444; margin-left: 2px; }
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    background: #f9fafb;
    transition: all .2s;
    -webkit-appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.form-textarea { min-height: 80px; resize: none; }
.form-row-2 {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}

/* 单选/多选组 */
.radio-group, .checkbox-group {
    display: flex; flex-wrap: wrap; gap: 8px;
}
.radio-group label, .checkbox-group label {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; background: #f3f4f6;
    border-radius: 20px; font-size: 14px; color: #555;
    cursor: pointer; margin-bottom: 0; border: 1px solid transparent;
}
.radio-group label.active, .checkbox-group label.active {
    background: #dbeafe; color: #1e40af; border-color: #3b82f6;
}
.radio-group input, .checkbox-group input { display: none; }

/* 同意提示 */
.consent-box {
    background: #fef3c7;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 14px;
    font-size: 13px;
    line-height: 1.6;
    color: #92400e;
}
.consent-box label {
    display: flex; align-items: flex-start; gap: 8px; cursor: pointer; color: inherit; font-size: inherit; margin: 0;
}
.consent-box input { margin-top: 3px; }

/* 按钮 */
.btn-submit {
    width: calc(100% - 24px);
    margin: 12px;
    padding: 14px;
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(59,130,246,0.3);
}
.btn-submit:active { transform: scale(0.98); }
.btn-secondary {
    display: block;
    width: calc(100% - 24px);
    margin: 6px 12px;
    padding: 12px;
    background: #fff;
    color: #3b82f6;
    border: 1px solid #3b82f6;
    border-radius: 12px;
    font-size: 15px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
}

/* 成功/失败提示 */
.toast {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8); color: #fff;
    padding: 20px 30px; border-radius: 12px;
    font-size: 15px; z-index: 9999; text-align: center;
}
.toast.success { background: rgba(34,197,94,0.95); }
.toast.error { background: rgba(239,68,68,0.95); }

/* 历史记录 */
.history-item {
    background: #fff;
    margin: 8px 12px;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.history-item .hi-head { display: flex; justify-content: space-between; margin-bottom: 6px; }
.history-item .hi-title { font-size: 15px; font-weight: 600; color: #1e3a8a; }
.history-item .hi-time { font-size: 12px; color: #999; }
.history-item .hi-content { font-size: 13px; color: #666; line-height: 1.5; }
.history-item .hi-status {
    display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 8px;
}
.hi-status.pending { background: #fef3c7; color: #92400e; }
.hi-status.done { background: #dcfce7; color: #16a34a; }
.hi-status.processing { background: #dbeafe; color: #1e40af; }

/* 底部Tab栏 */
.bottom-tab {
    position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: 640px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    display: flex; padding: 8px 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 50;
}
.bottom-tab a {
    flex: 1; text-align: center; text-decoration: none;
    color: #9ca3af; font-size: 11px; padding: 4px 0;
}
.bottom-tab a.active { color: #3b82f6; }
.bottom-tab a .icon { font-size: 22px; display: block; margin-bottom: 2px; }

/* 空状态 */
.empty-state {
    text-align: center; padding: 40px 20px; color: #9ca3af;
}
.empty-state .es-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state .es-text { font-size: 14px; }

/* 标签 */
.tag {
    display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 8px;
}
.tag-blue { background: #dbeafe; color: #1e40af; }
.tag-green { background: #dcfce7; color: #16a34a; }
.tag-red { background: #fee2e2; color: #991b1b; }
.tag-orange { background: #fef3c7; color: #92400e; }
.tag-purple { background: #ede9fe; color: #5b21b6; }
.tag-gray { background: #f3f4f6; color: #6b7280; }
