/* ============ 基础 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: #f5f6f8;
    color: #333;
    -webkit-font-smoothing: antialiased;
}
#app { min-height: 100vh; }
button, input, select { font-family: inherit; font-size: 14px; }
.u-flex-1 { flex: 1; }
.u-flex-y-center { display: flex; align-items: center; }

/* ============ 头部 ============ */
.index-page { min-height: 100vh; }
.header {
    position: fixed; top: 0; left: 0; right: 0; height: 44px;
    background: linear-gradient(180deg, #1a2a3a 0%, #2c3e50 100%);
    z-index: 100; display: flex; align-items: center; justify-content: space-between;
    padding: 0 10px;
}
.header .title { font-size: 17px; color: #fff; }
.header-side { width: 44px; height: 30px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 24px; }
.header-side.back-btn { cursor: pointer; line-height: 1; }
.header-side.logout-btn { width: auto; padding: 0 6px; font-size: 13px; cursor: pointer; color: #fff; }
.header-side.login-user { width: auto; max-width: 90px; font-size: 12px; color: rgba(255,255,255,.75); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ 登录页 ============ */
.login-page {
    min-height: 100vh; background: linear-gradient(160deg, #1a2a3a 0%, #2c3e50 100%);
    display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px;
}
.login-hero { text-align: center; margin-bottom: 28px; }
.login-hero-title { font-size: 26px; font-weight: 700; color: #fff; letter-spacing: 2px; }
.login-hero-sub { margin-top: 8px; font-size: 13px; color: rgba(255,255,255,.65); }
.login-box { width: 100%; max-width: 340px; background: #fff; border-radius: 14px; padding: 28px 22px; box-shadow: 0 12px 32px rgba(0,0,0,.25); }
.login-title { font-size: 18px; font-weight: 600; color: #1a2a3a; text-align: center; }
.login-tip { margin: 8px 0 18px; font-size: 12px; color: #9ca3af; text-align: center; line-height: 1.5; }
.login-input { width: 100%; margin-bottom: 12px; padding: 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 15px; box-sizing: border-box; outline: none; }
.login-input:focus { border-color: #0051A1; }
.login-error { color: #dc2626; font-size: 13px; margin-bottom: 10px; text-align: center; }
.login-btn { width: 100%; padding: 12px; border-radius: 8px; background: #0051A1; color: #fff; text-align: center; font-size: 16px; margin-top: 4px; }
.login-btn.disabled { opacity: .6; }
.login-footer { margin-top: 24px; font-size: 12px; color: rgba(255,255,255,.4); }

.content { height: 100vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.content-form {
    padding-top: calc(44px + 15px);
    background: linear-gradient(180deg, #eef3f8 0%, #f5f6f8 260px);
}
.content-result { padding-top: 44px; padding-bottom: 50px; background: #fff; }

/* ============ Toast ============ */
.toast {
    position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, .72); color: #fff; font-size: 14px;
    padding: 10px 20px; border-radius: 8px; z-index: 99999; max-width: 70vw; text-align: center;
}
.fade-enter-active, .fade-leave-active { transition: opacity .25s; }
.fade-enter-from, .fade-leave-to { opacity: 0; }

/* ============ 表单 ============ */
.form-box { margin: 5px 15px 15px; }
.form-title {
    height: 44px; background: #001224; border-radius: 5px 5px 0 0;
    display: flex; align-items: center; justify-content: center;
    font-weight: 500; font-size: 16px; color: #fff;
    box-shadow: 0 6px 14px -5px rgba(47, 114, 224, .1);
}
.form-main {
    background: #fff; border-radius: 0 0 5px 5px;
    box-shadow: 0 6px 14px -5px rgba(47, 114, 224, .1);
}
.form-line {
    min-height: 50px; margin: 0 15px; border-bottom: 1px solid #D8D8D8;
    display: flex; align-items: center;
}
.form-line:last-of-type { border-bottom: 0; }
.icon-1 { width: 16px; text-align: center; font-size: 15px; flex-shrink: 0; }
.form-line .name {
    width: 60px; font-size: 15px; color: #333; margin-left: 7px;
    display: flex; justify-content: space-between; flex-shrink: 0;
}
.select-box {
    text-align: right; font-size: 15px; color: #999; background: transparent;
    border: none; outline: none; padding: 12px 0; min-width: 0; cursor: pointer;
}
.select-box.active { color: #333; }
input.select-box { cursor: text; }
.arrow { color: #c1c8d0; font-size: 20px; margin-left: 6px; font-weight: 300; }

.gender-group { flex: 1; display: flex; gap: 8px; justify-content: flex-end; }
.gender-btn {
    padding: 6px 10px; border-radius: 5px; font-size: 13px;
    background: #f4f6f8; color: #666; border: 1px solid #e3e6ea; cursor: pointer;
}
.gender-btn.active { background: #0051A1; color: #fff; border-color: #0051A1; }

.location-detail { flex-direction: column; align-items: flex-start; height: auto; padding: 8px 0; }
.lnglat-row { width: 100%; display: flex; justify-content: space-between; font-size: 12px; color: #999; }
.switch-row { width: 100%; display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.switch-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #333; }
.switch {
    width: 42px; height: 24px; border-radius: 12px; background: #d9dee3; position: relative;
    transition: background .2s; cursor: pointer; flex-shrink: 0;
}
.switch i {
    position: absolute; left: 2px; top: 2px; width: 20px; height: 20px;
    background: #fff; border-radius: 50%; transition: left .2s;
}
.switch.on { background: #0051A1; }
.switch.on i { left: 20px; }
.manual-lnglat-link {
    display: inline-flex; align-items: center; gap: 4px; margin-top: 6px;
    font-size: 12px; color: #94a3b8; cursor: pointer;
}

.save-checkbox-line { min-height: 40px; margin: 0 15px; border-bottom: 1px solid #D8D8D8; display: flex; align-items: center; }
.checkbox-wrapper { display: flex; align-items: center; cursor: pointer; }
.checkbox {
    width: 18px; height: 18px; border: 1px solid #999; border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 12px; transition: all .2s;
}
.checkbox.active { background: #0051A1; border-color: #0051A1; }
.checkbox-text { font-size: 14px; color: #333; margin-left: 8px; }

.btns { display: flex; justify-content: space-between; margin: 20px 15px 0; padding-bottom: 15px; }
.btn-1, .btn {
    width: 48%; height: 44px; border-radius: 5px; font-weight: 400; font-size: 16px;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.btn-1 { background: #fff; border: 1px solid #0051A1; color: #0051A1; }
.btn { background: #0051A1; color: #fff; }
.btn.disabled { background: #ccc; border-color: #ccc; cursor: not-allowed; }

/* ============ 案例 ============ */
.history-section { margin: 15px; }
.history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; padding: 0 5px; }
.history-title { font-size: 14px; font-weight: 600; color: #333; }
.history-more { font-size: 12px; color: #0051A1; cursor: pointer; }

.history-card {
    background: #fff; border-radius: 6px; padding: 8px 10px; margin-bottom: 8px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, .06); border: 1px solid transparent; transition: all .2s; cursor: pointer;
}
.history-card.active { border-color: #0051A1; box-shadow: 0 1px 8px rgba(0, 81, 161, .12); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.card-title { display: flex; align-items: center; min-width: 0; }
.record-index {
    font-size: 11px; color: #0051A1; font-weight: 600; margin-right: 5px;
    background: rgba(0, 81, 161, .1); padding: 1px 5px; border-radius: 3px; flex-shrink: 0;
}
.record-name { font-size: 14px; font-weight: 600; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-name.default { color: #999; font-weight: 400; }
.card-actions-inline { display: flex; gap: 4px; flex-shrink: 0; }
.action-icon {
    width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
    border-radius: 4px; background: #f5f5f5; font-size: 13px; color: #666;
}
.action-icon:active { opacity: .7; transform: scale(.95); }
.action-icon.delete { background: rgba(255, 77, 79, .1); color: #ff4d4f; }
.card-content .info-row { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.info-tag { font-size: 12px; color: #666; background: #f8f8f8; padding: 2px 6px; border-radius: 3px; }
.info-tag.small { font-size: 11px; color: #999; background: transparent; margin-left: auto; }
.info-row.time-row { margin-top: 4px; padding-top: 4px; border-top: 1px solid #f0f0f0; }

.empty-state { display: flex; flex-direction: column; align-items: center; padding: 40px 20px; }
.empty-text { font-size: 15px; color: #666; }
.empty-tip { font-size: 12px; color: #999; margin-top: 8px; }
.back-home-btn { width: 160px; margin-top: 20px; }

/* ============ 弹窗通用 ============ */
.modal-mask {
    position: fixed; inset: 0; background: rgba(0, 0, 0, .5);
    display: flex; align-items: flex-end; justify-content: center; z-index: 1000;
}
.modal-mask.top-layer { z-index: 99999; align-items: center; }
.modal-sheet {
    background: #fff; width: 100%; max-width: 640px; border-radius: 12px 12px 0 0;
    padding: 16px 15px 22px; position: relative; max-height: 88vh; overflow-y: auto;
}
.modal-close {
    position: absolute; right: 14px; top: 12px; width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    color: #999; font-size: 15px; cursor: pointer;
}
.modal-center {
    background: #fff; width: 300px; border-radius: 10px; padding: 22px;
    display: flex; flex-direction: column;
}
.dialog-title { font-size: 16px; font-weight: 600; color: #333; text-align: center; margin-bottom: 16px; }
.dialog-content { font-size: 14px; color: #666; text-align: center; margin-bottom: 18px; }
.dialog-btns { display: flex; gap: 10px; }
.dialog-btn {
    flex: 1; height: 38px; display: flex; align-items: center; justify-content: center;
    border-radius: 5px; font-size: 14px; cursor: pointer;
}
.dialog-btn.cancel { background: #f5f5f5; color: #666; }
.dialog-btn.confirm { background: #0051A1; color: #fff; }
.dialog-btn.danger { background: #ff4d4f; color: #fff; }

/* ============ 时间选择弹窗 ============ */
.mode-tabs { display: flex; padding: 10px 15px; background: #f8f9fa; border-radius: 12px; margin: 10px 15px 12px; }
.mode-tab {
    flex: 1; display: flex; align-items: center; justify-content: center; padding: 8px 0;
    border-radius: 8px; font-size: 14px; color: #666; background: #fff; margin: 0 4px; cursor: pointer;
}
.mode-tab.active { background: #0051A1; color: #fff; }
.mode-icon { margin-right: 4px; }
.date-box { padding: 10px 15px; }
.input-item { margin-bottom: 10px; }
.input-label { font-size: 13px; color: #666; margin-bottom: 8px; display: block; }

/* picker-value 卡片（覆盖在原生 input/select 上方） */
.picker-value {
    position: relative; height: 36px; background: #f5f5f5; border-radius: 8px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 10px; font-size: 14px; color: #333; cursor: pointer;
}
.picker-value.empty { color: #999; }
.picker-value > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-arrow { font-size: 12px; color: #999; margin-left: 6px; }
.picker-arrow.sm { font-size: 10px; }
.picker-cover {
    position: absolute; inset: 0; width: 100%; height: 100%;
    opacity: 0; border: 0; background: transparent; padding: 0;
    cursor: pointer; color: transparent; font-size: 0;
}
.picker-cover::-webkit-calendar-picker-indicator { cursor: pointer; }

.sheet-title { font-size: 15px; font-weight: 600; color: #333; margin-bottom: 14px; text-align: center; }
.sizhu-title { font-size: 15px; color: #999; margin: 8px 0 14px; }
.date-line { display: flex; padding-top: 12px; }
.date-line .name { width: 25%; font-size: 14px; text-align: center; padding-bottom: 14px; color: #666; }
.date-value { display: flex; }
.date-item { width: 25%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.date-item .item {
    width: 70px; height: 32px; background: #f0f0f0; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; gap: 4px;
    font-size: 14px; color: #333; cursor: pointer;
}
.date-item .item:hover { background: #e8e8e8; }
.sheet-btn {
    height: 42px; background: #0051A1; border-radius: 6px; color: #fff;
    font-size: 15px; display: flex; align-items: center; justify-content: center; margin: 16px 0 4px; cursor: pointer;
}

/* 农历/地点 三列联动卡片 */
.lunar-cols, .loc-cols {
    display: flex; gap: 8px; margin: 8px 0 18px;
}
.lunar-col, .loc-col {
    flex: 1; background: #f5f5f5; border-radius: 8px; padding: 8px 10px;
    display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; min-height: 50px;
}
.lunar-col:hover, .loc-col:hover { background: #ebebeb; }
.lc-label { font-size: 12px; color: #999; }
.lc-value { font-size: 14px; color: #333; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 通用单列选择弹层 */
.col-list {
    max-height: 50vh; overflow-y: auto; border-top: 1px solid #f0f0f0;
    padding: 4px 0;
}
.col-item {
    padding: 10px 14px; font-size: 15px; color: #333; cursor: pointer; border-bottom: 1px solid #f5f5f5;
}
.col-item:hover { background: #f5f8fb; }
.col-item.active { background: #0051A1; color: #fff; }

/* 天干/地支网格弹层（原版 list-item1 红底白字 → 选中蓝底白字） */
.gz-grid {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px;
    padding: 12px 4px 4px; max-height: 50vh; overflow-y: auto;
}
.gz-cell {
    width: 100%; aspect-ratio: 1; max-width: 56px; max-height: 56px;
    background: rgba(255, 0, 0, .72); color: #fff; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 500; margin: 0 auto; cursor: pointer; line-height: 1;
}
.gz-cell.active { background: #0051A1; }
.gz-cell:hover { opacity: .9; }
.gz-sel { width: 62px; flex: none; text-align: center; }
.lnglat-inputs { display: flex; gap: 10px; margin-bottom: 18px; }

/* ============ 全部案例抽屉 ============ */
.drawer-mask { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 1500; }
.drawer {
    position: absolute; right: 0; top: 0; bottom: 0; width: min(680px, 92vw);
    background: #f5f5f5; display: flex; flex-direction: column;
    animation: slide-in .25s ease;
}
@keyframes slide-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
.all-records-header {
    height: 44px; background: #fff; border-bottom: 1px solid #eee;
    display: flex; align-items: center; padding: 0 10px; position: relative; flex-shrink: 0;
}
.all-records-header .back-btn { width: 34px; height: 34px; font-size: 24px; color: #333; cursor: pointer; }
.all-records-header .header-title { flex: 1; text-align: center; font-size: 16px; font-weight: 600; color: #333; }
.all-records-header .header-count { position: absolute; right: 14px; font-size: 12px; color: #999; }
.search-box-sticky { background: #fff; padding: 10px 14px; border-bottom: 1px solid #eee; flex-shrink: 0; }
.search-input-wrapper {
    background: #f5f5f5; border-radius: 16px; padding: 0 10px; height: 32px;
    display: flex; align-items: center; gap: 6px;
}
.search-input { flex: 1; font-size: 13px; color: #333; border: none; background: transparent; outline: none; height: 32px; }
.search-clear { padding: 4px; color: #ccc; cursor: pointer; font-size: 13px; }
.all-records-list { flex: 1; overflow-y: auto; padding: 10px; }
.search-empty { display: flex; flex-direction: column; align-items: center; padding: 60px 20px; color: #999; font-size: 14px; gap: 10px; }

/* ============ 结果页 ============ */
.result-container { padding: 15px; }
.frozen-area { position: sticky; z-index: 90; background-color: #fff; transform: translateZ(0); }
.section-gap { height: 20px; }

.info-line {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 0; flex-wrap: wrap; gap: 4px;
}
.info-line .label { font-size: 15px; color: #1E40AF; font-weight: 600; flex-shrink: 0; }
.info-line .value { font-size: 15px; color: #333; font-weight: 500; text-align: right; flex: 1; }

.bazi-section .bazi-line {
    display: flex; align-items: center; padding: 8px 0; flex-wrap: wrap; gap: 6px;
}
.shen-blue { font-size: 15px; color: #1E40AF; font-weight: 600; }
.gz-red { font-size: 19px; color: #DC2626; font-weight: 700; }
.nayin-green { font-size: 14px; color: #16A34A; font-weight: 600; }
.canggan-text { display: flex; gap: 8px; }
.cg-gan { font-size: 16px; color: #DC2626; font-weight: 700; }

.sangong-section .info-line .label { min-width: 50px; }
.sg-content { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; flex: 1; }

.shensha-section .shensha-header { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; cursor: pointer; }
.shensha-title { font-size: 15px; color: #1E40AF; font-weight: 600; }
.fold-icon { color: #1E40AF; font-size: 11px; }
.shensha-line { display: flex; align-items: flex-start; padding: 6px 0; flex-wrap: wrap; }
.shensha-line .label { font-size: 15px; color: #1E40AF; font-weight: 600; margin-right: 8px; min-width: 50px; flex-shrink: 0; }
.shensha-value { font-size: 15px; color: #1E40AF; font-weight: 500; flex: 1; line-height: 1.6; }
.shensha-value.empty { color: #999; }

.dayun-info-section .info-line .label { min-width: 100px; }

.dayun-list-section .dayun-block { margin-bottom: 15px; }
.dayun-header-wrap { display: flex; align-items: center; border-bottom: 1px solid #C8E6C9; margin-bottom: 6px; }
.dayun-header-line { flex: 1; min-width: 0; padding: 8px 0; border-radius: 4px; transition: background .2s; }
.dayun-header-line.dayun-active { background: #FFF3CD; }
.dayun-main-info { display: flex; align-items: center; flex-wrap: nowrap; gap: 4px; white-space: nowrap; min-width: max-content; overflow-x: auto; }
.dayun-main-info .label { font-size: 15px; color: #1E40AF; font-weight: 700; }
.kongwang-sm { font-size: 11px; }
.dayun-fold-btn {
    flex-shrink: 0; width: 28px; height: 28px; margin-left: 4px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; color: #999; font-size: 11px; cursor: pointer;
}
.liunian-grid { display: flex; flex-wrap: wrap; gap: 8px; padding-left: 8px; }
.liunian-item {
    display: flex; flex-direction: column; gap: 2px; padding: 4px 5px;
    min-width: 46%; flex: 1; cursor: pointer; border-radius: 4px;
}
.liunian-item.current { background: #C8E6C9; }
.liunian-item.active { background: #FFF3CD; border: 1px solid #FFC107; }
.ln-text { font-size: 14px; color: #333; font-weight: 500; }
.ln-text .gz-red-sm { color: #DC2626; font-weight: 700; margin: 0 2px; }
.ln-text .shen-blue-sm { color: #1E40AF; font-weight: 600; font-size: 12px; }
.ln-text.xiaoyun-text { font-size: 13px; color: #555; }

/* ============ 底部 Tab ============ */
.tab-bar-bottom {
    position: fixed; left: 0; right: 0; bottom: 0; height: 50px;
    background: #fff; display: flex; z-index: 99;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, .1);
    padding-bottom: env(safe-area-inset-bottom);
}
.tab-item {
    flex: 1; display: flex; align-items: center; justify-content: center;
    font-size: 15px; color: #666; font-weight: 500; position: relative; cursor: pointer;
}
.tab-item.active { color: #1E40AF; font-weight: 700; }
.tab-item.active::after {
    content: ''; position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%);
    width: 30px; height: 3px; background: #1E40AF; border-radius: 2px;
}
