/* 养老食堂预约 · 老年人友好增强（基于 WeUI 2.5.16） */
:root {
    --st-orange: #fa9d3b;
    --st-orange-dark: #e8892a;
    --st-green: #07c160;
    --st-red: #fa5151;
}

body {
    font-size: 17px;
    line-height: 1.7;
    background: #f2f4f7;
    -webkit-text-size-adjust: 100%;
}

.page {
    padding-bottom: 20px;
}

/* ---------- 标题：居中 ---------- */
.page__hd {
    padding: 20px 20px 12px;
    text-align: center;
}

.page__title {
    font-size: 24px;
    font-weight: 600;
    text-align: center;
}

.page__desc {
    font-size: 15px;
    color: #8a8f99;
    margin-top: 6px;
    text-align: center;
}

/* ---------- 按钮：文字垂直居中（WeUI 默认 padding 会导致文字偏下） ---------- */
.weui-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 50px;
    padding: 0 12px;
    margin-left: 0;
    margin-right: 0;
    line-height: 1.2;
    font-size: 18px;
    font-weight: 500;
    border-radius: 10px;
    box-sizing: border-box;
}

.weui-btn_primary { background: var(--st-green); }
.weui-btn_primary:active { background: #06ad56; }
.weui-btn_warn { background: var(--st-red); }
.weui-btn_default { background: #fff; color: #353535; border: 1px solid #e2e4e8; }

.btn-huge {
    height: 58px;
    font-size: 21px;
    font-weight: 600;
    letter-spacing: 1px;
}

.btn-orange { background: var(--st-orange); color: #fff; }
.btn-orange:active { background: var(--st-orange-dark); }

/* ---------- 首页整屏：不滚动 ---------- */
.st-full {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    padding: 0 0 calc(62px + env(safe-area-inset-bottom));
    box-sizing: border-box;
}

.st-full .page__hd {
    flex: none;
    padding-top: 24px;
}

.st-full .page__bd {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
    padding-bottom: 8px;
}

.st-full .page__ft {
    flex: none;
    padding: 0 16px 15px;
}

@media (max-height: 720px) {
    .st-full .page__hd { padding-top: 14px; padding-bottom: 6px; }
    .page__title { font-size: 2rem; }
    .people-picker { padding: 12px 0 4px; }
    .people-picker .num { font-size: 46px; min-width: 108px; }
    .people-picker .btn-round { width: 54px; height: 54px; line-height: 50px; font-size: 30px; }
    .amount-box { padding: 2px 0 10px; }
    .amount-box .amount { font-size: 28px; }
}

/* ---------- 人数选择器 ---------- */
.people-picker {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 0 6px;
}

.people-picker .btn-round {
    width: 62px;
    height: 62px;
    line-height: 58px;
    border-radius: 50%;
    border: 2px solid #dcdfe4;
    background: #fff;
    font-size: 34px;
    color: #333;
    text-align: center;
    user-select: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

.people-picker .btn-round:active { background: #eef0f3; }
.people-picker .num {
    font-size: 58px;
    font-weight: 700;
    color: var(--st-orange);
    min-width: 128px;
    text-align: center;
}

/* ---------- 金额 ---------- */
.amount-box {
    text-align: center;
    padding: 4px 0px;
    font-size: 17px;
    color: #6b7078;
}

.amount-box .amount {
    font-size: 32px;
    color: var(--st-red);
    font-weight: 700;
    margin: 0 2px;
}

/* ---------- 日期选择（不跳转） ---------- */
.date-tab {
    display: flex;
    gap: 10px;
    padding: 0 16px 12px;
}

.date-tab .item {
    flex: 1;
    text-align: center;
    padding: 11px 4px;
    background: #fff;
    border: 2px solid #e5e8ec;
    border-radius: 12px;
    font-size: 17px;
    color: #5a6068;
    cursor: pointer;
    transition: all .15s;
}

.date-tab .item.on {
    border-color: var(--st-green);
    background: #eaf9f0;
    color: var(--st-green);
    font-weight: 600;
}

.date-tab .item .sub {
    display: block;
    font-size: 12px;
    color: #9aa0a6;
    font-weight: 400;
}

.date-tab .item.on .sub { color: #4fb87c; }

/* ---------- 核销码 ---------- */
.code-box { text-align: center; padding: 14px 0; }
.code-box .code {
    font-size: 32px;
    letter-spacing: 5px;
    font-weight: 700;
    color: #222;
}
.code-box .qr {
    width: 226px;
    height: 226px;
    margin: 0 auto;
    padding: 10px;
    background: #fff;
    border: 1px solid #eceef1;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
}
.code-box .qr img { width: 100%; height: 100%; display: block; }

/* ---------- 状态标签 ---------- */
.st-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.8;
}
.st-tag.wait { background: #fff3e3; color: #e8892a; }
.st-tag.done { background: #e7f8ee; color: #07a04d; }
.st-tag.gray { background: #eef0f3; color: #8a8f99; }
.st-tag.red  { background: #fdecec; color: #fa5151; }

/* ---------- 卡片 ---------- */
.st-card {
    background: #fff;
    border-radius: 14px;
    margin: 12px;
    padding: 16px;
    box-shadow: 0 2px 10px rgba(20, 30, 50, .05);
}
.st-card .t { font-size: 18px; font-weight: 600; }
.st-card .d { font-size: 14px; color: #9298a1; margin-top: 4px; }
.st-card .r { float: right; font-size: 18px; color: var(--st-red); font-weight: 600; }
a.st-card { display: block; text-decoration: none; color: inherit; }
a.st-card:active { background: #fafbfc; }

/* ---------- 底部导航 ---------- */
.st-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    background: #fff;
    border-top: 1px solid #e8eaee;
    z-index: 99;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -1px 6px rgba(0, 0, 0, .04);
}
.st-tabbar a {
    flex: 1;
    text-align: center;
    padding: 7px 0 6px;
    color: #8a8f99;
    font-size: 13px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.st-tabbar a.on { color: var(--st-green); }
.st-tabbar .ico { font-size: 20px; line-height: 1.3; }

body.has-tabbar { padding-bottom: 62px; }

/* 首页整屏时由 .st-full 自己给 tabbar 留位，避免 100dvh + 62px 溢出 */
body.st-full-body { padding-bottom: 0; }

/* ---------- 统计 ---------- */
.stat-row {
    display: flex;
    background: #fff;
    border-radius: 14px;
    margin: 12px;
    padding: 16px 0;
    box-shadow: 0 2px 10px rgba(20, 30, 50, .05);
}
.stat-row .c { flex: 1; text-align: center; border-right: 1px solid #f1f3f6; }
.stat-row .c:last-child { border-right: none; }
.stat-row .n { font-size: 26px; font-weight: 700; color: var(--st-green); }
.stat-row .l { font-size: 13px; color: #9298a1; }

/* ---------- 表单 ---------- */
.weui-cells { border-radius: 12px; overflow: hidden; }
.weui-cell { font-size: 17px; padding: 15px 16px; }
.weui-input, .weui-textarea { font-size: 17px; }
.weui-label { font-size: 17px; width: 92px; }

/* ---------- 弹窗组件兜底（WeUI 2.5） ---------- */
.weui-mask {
    position: fixed;
    z-index: 1000;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, .6);
}
.weui-mask_visible { opacity: 1; visibility: visible; }

.weui-dialog .weui-dialog__hd { padding: 26px 24px 12px; }
.weui-dialog__title { font-size: 19px; }
.weui-dialog__bd { font-size: 16px; color: #5a6068; }
.weui-dialog__ft { padding-bottom: 14px; }
.weui-dialog__btn { font-size: 17px; }
.weui-dialog__btn_primary { color: var(--st-green); font-weight: 700; }

.weui-toast__content { font-size: 15px; margin-top: 8px; }
.weui-toptips { border-radius: 10px; font-size: 15px; }

/* 弹窗里的信息行 */
.dlg-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 16px;
    color: #353535;
}
.dlg-row .k { color: #8a8f99; }
.dlg-amount {
    text-align: center;
    font-size: 30px;
    color: var(--st-red);
    font-weight: 700;
    padding: 8px 0 4px;
}
.dlg-tip {
    background: #fff8ec;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    color: #a2661c;
    line-height: 1.6;
    margin-top: 10px;
    text-align: left;
}

/* ---------- 后台 ---------- */
.admin-wrap { max-width: 900px; margin: 0 auto; }
.muted { color: #9298a1; font-size: 14px; }
.text-center { text-align: center; }
.mt10 { margin-top: 10px; }
.mt16 { margin-top: 16px; }
.mb12 { margin-bottom: 12px; }

/* ---------- 订单卡片（我的预约列表：行1 日期·人数·价格 / 行2 下单时间 / 行3 状态） ---------- */
.order-card { display: block; text-decoration: none; color: inherit; }
.order-card .oc-l1 {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 17px;
    font-weight: 600;
    color: #222;
}
.order-card .oc-main { color: #222; }
.order-card .oc-price {
    color: var(--st-red);
    font-weight: 700;
    margin-left: 12px;
    white-space: nowrap;
    flex: none;
}
.order-card .oc-l2 { font-size: 13px; color: #9298a1; margin-top: 4px; }
.order-card .oc-l3 {
    font-size: 14px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---------- 退出按钮（我的预约右上角） ---------- */
.btn-exit {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 15px;
    color: var(--st-green);
    text-decoration: none;
    padding: 4px 12px;
    border: 1px solid var(--st-green);
    border-radius: 18px;
    background: #fff;
    line-height: 1.6;
}
.btn-exit:active { background: #eaf9f0; }

/* ---------- 支付页：微信付款步骤引导 ---------- */
.st-pay-guide {
    margin: 14px 0 6px;
    padding: 14px 14px 12px;
    background: #f7f8fa;
    border-radius: 10px;
    text-align: left;
}
.st-pay-guide .t {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 8px;
}
.st-pay-guide .step {
    display: flex;
    align-items: flex-start;
    font-size: 16px;
    line-height: 1.7;
    margin: 4px 0;
}
.st-pay-guide .step b {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    background: var(--st-orange);
    color: #fff;
    border-radius: 50%;
    font-size: 14px;
    margin-right: 8px;
    margin-top: 4px;
}
.st-pay-guide .tip {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #dcdfe4;
    font-size: 14px;
    color: #8a8f99;
    line-height: 1.65;
}

/* ---------- 自适应：底部安全区 + 小屏收敛（防错位） ---------- */
body.has-tabbar { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }

@media (max-width: 360px) {
    .page__title { font-size: 21px; }
    .people-picker .num { font-size: 50px; min-width: 104px; }
    .people-picker .btn-round { width: 54px; height: 54px; line-height: 50px; font-size: 30px; }
    .date-tab { gap: 6px; }
    .date-tab .item { padding: 9px 2px; font-size: 15px; }
    .stat-row .n { font-size: 22px; }
    .order-card .oc-l1 { font-size: 16px; }
    .code-box .qr { width: 200px; height: 200px; }
}

@media (max-width: 320px) {
    .people-picker .num { font-size: 42px; min-width: 84px; }
    .people-picker .btn-round { width: 48px; height: 48px; line-height: 44px; font-size: 26px; }
    .amount-box .amount { font-size: 26px; }
}

/* 极矮屏：首页内容改为可滚动，避免被裁切 */
@media (max-height: 640px) {
    .st-full .page__bd { overflow-y: auto; justify-content: flex-start; padding-top: 8px; }
}

/* ---------- 后台移动端适配（微信内浏览） ---------- */
.tbl-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.st-datebar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

@media (max-width: 640px) {
    /* 宽表在卡片内横向滚动，避免整页被撑开导致错位/遮挡 */
    .tbl-scroll table td,
    .tbl-scroll table th { white-space: nowrap; }

    /* 后台顶部导航：窄屏缩小间距，便于单手点按 */
    .admin-nav { padding: 0 4px; }
    .admin-nav a { padding: 11px 9px; font-size: 15px; }

    /* 统计页日期选择行：窄屏整行换行，避免按钮被挤出 */
    .st-datebar > input[type="date"] { flex: 1 1 100%; max-width: none; }
    .st-datebar .weui-btn { flex: 1 1 auto; }

    /* 后台卡片在小屏减少内边距，内容更舒展 */
    .st-card { padding: 12px; margin: 10px; }
}

/* 今日/明日 切换按钮选中态（后台统计 · 核销员备餐统计共用） */
.st-toggle.on { background: #eaf9f0; color: #07c160; border-color: #07c160; }

/* 用户管理列表：移动端改为堆叠卡片，避免长 openid 撑宽导致表头错位/超页面 */
@media (max-width: 640px) {
    .tbl-scroll table.tbl-users,
    .tbl-scroll table.tbl-users tbody,
    .tbl-scroll table.tbl-users tr,
    .tbl-scroll table.tbl-users td { display: block; width: 100%; box-sizing: border-box; }
    .tbl-scroll table.tbl-users thead { display: none; }
    .tbl-scroll table.tbl-users tr {
        border: 1px solid #eee; border-radius: 8px; margin: 0 2px 12px;
        padding: 4px 12px; background: #fff;
    }
    .tbl-scroll table.tbl-users td {
        display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
        padding: 8px 0; border-top: 1px solid #f3f3f3; white-space: normal; text-align: right;
    }
    .tbl-scroll table.tbl-users td:first-child { border-top: none; }
    .tbl-scroll table.tbl-users td::before {
        content: attr(data-label); flex: 0 0 auto; color: #999; font-size: 13px;
        text-align: left; line-height: 1.5;
    }
    .tbl-scroll table.tbl-users .st-openid { word-break: break-all; word-wrap: break-word; }
}
