/* UO 后台管理 · 移动端样式 */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
    margin: 0; padding: 0;
    font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f2f4f8; color: #1f2933;
    font-size: 15px; line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}
.hidden { display: none !important; }
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ---------- 登录 ---------- */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 24px 18px;
    background: linear-gradient(160deg, #2563eb 0%, #1e40af 60%, #1e3a8a 100%);
}
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 18px; padding: 28px 22px; box-shadow: 0 18px 50px rgba(0,0,0,.25); }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-logo { width: 56px; height: 56px; line-height: 56px; margin: 0 auto 12px; border-radius: 14px; background: #2563eb; color: #fff; font-weight: 800; font-size: 22px; letter-spacing: 1px; }
.login-brand h1 { font-size: 20px; margin: 0 0 6px; }
.login-sub { font-size: 13px; color: #8a94a6; margin: 0; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; color: #5b6676; margin-bottom: 6px; }
.field input {
    width: 100%; height: 46px; padding: 0 14px; font-size: 15px;
    border: 1px solid #dde2ea; border-radius: 10px; background: #fafbfc; outline: none;
}
.field input:focus { border-color: #2563eb; background: #fff; }
.code-row { display: flex; gap: 10px; }
.code-row input { flex: 1; }
.code-row .btn-ghost { flex: 0 0 auto; white-space: nowrap; }
.btn-ghost { height: 46px; padding: 0 14px; border-radius: 10px; background: #eff4ff; color: #2563eb; font-size: 14px; font-weight: 600; }
.btn-ghost:disabled { background: #eef1f5; color: #9aa4b2; }
.btn-primary { width: 100%; height: 48px; border-radius: 12px; background: #2563eb; color: #fff; font-size: 16px; font-weight: 700; margin-top: 6px; }
.btn-primary:active { background: #1d4ed8; }
.login-tip { min-height: 20px; margin-top: 12px; font-size: 13px; color: #d33; text-align: center; }
.login-tip.ok { color: #16a34a; }

/* ---------- 应用骨架 ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.app-header {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    height: 54px; padding: 0 16px; background: #2563eb; color: #fff;
    padding-top: env(safe-area-inset-top);
}
.app-header-title { font-size: 17px; font-weight: 700; }
.app-header-user { display: flex; align-items: center; gap: 10px; }
.header-email { font-size: 12px; opacity: .9; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-link { color: #fff; font-size: 13px; opacity: .95; }
.app-main { flex: 1; padding: 14px 12px 84px; }

.tabbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    display: flex; background: #fff; border-top: 1px solid #e6e9ef;
    padding-bottom: env(safe-area-inset-bottom);
}
.tab { flex: 1; text-align: center; padding: 8px 0 6px; color: #9aa4b2; font-size: 12px; }
.tab .tab-ico { display: block; font-size: 20px; line-height: 1.2; }
.tab.active { color: #2563eb; font-weight: 600; }

/* ---------- 通用卡片 ---------- */
.card { background: #fff; border-radius: 14px; padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(16,24,40,.06); }
.card-title { font-size: 14px; font-weight: 700; color: #33415a; margin: 0 0 10px; display: flex; align-items: center; justify-content: space-between; }
.card-title .sub { font-size: 12px; color: #8a94a6; font-weight: 400; }
.sec-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 10px; }
.sec-head h2 { font-size: 16px; margin: 0; }

/* KPI 网格（自适应流式） */
.kpi-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.kpi { flex: 1 1 150px; min-width: 130px; background: #fff; border-radius: 14px; padding: 14px; box-shadow: 0 1px 3px rgba(16,24,40,.06); }
.kpi .k-label { font-size: 12px; color: #8a94a6; }
.kpi .k-value { font-size: 22px; font-weight: 800; margin: 4px 0 2px; color: #1f2933; }
.kpi .k-delta { font-size: 12px; }
.k-delta.up { color: #16a34a; }
.k-delta.down { color: #dc2626; }
.k-delta.flat { color: #9aa4b2; }

/* 分段控件 */
.segmented { display: inline-flex; background: #eef1f6; border-radius: 10px; padding: 3px; }
.segmented button { padding: 6px 14px; border-radius: 8px; font-size: 13px; color: #5b6676; }
.segmented button.active { background: #fff; color: #2563eb; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg-row { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; -webkit-overflow-scrolling: touch; }
.chip { flex: 0 0 auto; padding: 7px 14px; border-radius: 999px; background: #fff; border: 1px solid #e6e9ef; font-size: 13px; color: #5b6676; white-space: nowrap; }
.chip.active { background: #2563eb; border-color: #2563eb; color: #fff; }

/* 图表 */
.chart-wrap { width: 100%; }
canvas.chart { width: 100%; height: 200px; display: block; }
.legend { display: flex; gap: 16px; margin-top: 8px; font-size: 12px; color: #5b6676; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }

/* 列表 */
.list { display: flex; flex-direction: column; gap: 10px; }
.row {
    background: #fff; border-radius: 12px; padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(16,24,40,.06);
}
.row-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.row-title { font-size: 14px; font-weight: 600; color: #1f2933; word-break: break-all; }
.row-sub { font-size: 12px; color: #8a94a6; margin-top: 3px; word-break: break-all; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge.paid { background: #e7f7ee; color: #16a34a; }
.badge.unpaid { background: #fff4e6; color: #d97706; }
.badge.closed { background: #f1f2f4; color: #8a94a6; }
.badge.on { background: #e7f7ee; color: #16a34a; }
.badge.off { background: #fde8e8; color: #dc2626; }
.amount { font-weight: 700; color: #1f2933; }

/* 热门工具条 */
.rank-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f0f2f5; }
.rank-item:last-child { border-bottom: none; }
.rank-no { width: 22px; height: 22px; line-height: 22px; text-align: center; border-radius: 6px; background: #eef2fb; color: #2563eb; font-size: 12px; font-weight: 700; flex: 0 0 auto; }
.rank-name { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-val { font-size: 13px; color: #5b6676; font-weight: 600; }

/* 工具类 */
.empty { text-align: center; color: #9aa4b2; font-size: 13px; padding: 30px 0; }
.load-more { display: block; width: 100%; text-align: center; padding: 12px; color: #2563eb; font-size: 14px; }
.loading { text-align: center; color: #9aa4b2; padding: 26px; font-size: 14px; }
.muted { color: #8a94a6; }

/* 过滤栏 */
.filter-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.filter-bar input { flex: 1; height: 40px; padding: 0 12px; border: 1px solid #e0e4ec; border-radius: 10px; background: #fff; font-size: 14px; outline: none; }
.date-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13px; color: #5b6676; }
.date-row input { flex: 1; height: 38px; padding: 0 10px; border: 1px solid #e0e4ec; border-radius: 8px; background: #fff; font-size: 13px; }

/* 配置：子标签 */
.subtabs { display: flex; background: #fff; border-radius: 12px; padding: 4px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(16,24,40,.06); }
.subtabs button { flex: 1; padding: 9px 0; border-radius: 9px; font-size: 14px; color: #5b6676; }
.subtabs button.active { background: #2563eb; color: #fff; font-weight: 600; }

/* 编辑行 */
.edit-row { display: flex; align-items: center; gap: 10px; }
.edit-row .grow { flex: 1; min-width: 0; }
.edit-row input, .edit-row select { width: 100%; height: 38px; padding: 0 10px; border: 1px solid #e0e4ec; border-radius: 8px; font-size: 14px; background: #fff; }
.mini-input { width: 90px; flex: 0 0 auto; height: 38px; padding: 0 8px; border: 1px solid #e0e4ec; border-radius: 8px; font-size: 14px; text-align: right; }
.btn-sm { padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; background: #2563eb; color: #fff; flex: 0 0 auto; }
.btn-sm.gray { background: #eef1f6; color: #5b6676; }
.btn-add { width: 100%; padding: 12px; border-radius: 12px; background: #fff; border: 1px dashed #c7d2e6; color: #2563eb; font-size: 14px; font-weight: 600; margin-bottom: 12px; }

/* 开关 */
.switch { position: relative; width: 46px; height: 26px; flex: 0 0 auto; }
.switch input { display: none; }
.switch .slider { position: absolute; inset: 0; background: #cfd6e0; border-radius: 999px; transition: .2s; }
.switch .slider:before { content: ""; position: absolute; width: 22px; height: 22px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: #22c55e; }
.switch input:checked + .slider:before { transform: translateX(20px); }

/* 详情表 */
.detail-list { display: flex; flex-direction: column; }
.detail-item { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f0f2f5; font-size: 14px; }
.detail-item:last-child { border-bottom: none; }
.detail-item .dt { color: #8a94a6; flex: 0 0 auto; }
.detail-item .dd { color: #1f2933; text-align: right; word-break: break-all; }
.copy { color: #2563eb; font-size: 12px; margin-left: 6px; }

/* 弹层 */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-mask { position: absolute; inset: 0; background: rgba(15,23,42,.45); }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 18px 18px 0 0; max-height: 82vh; display: flex; flex-direction: column; transform: translateY(100%); animation: slideup .22s ease forwards; }
@keyframes slideup { to { transform: translateY(0); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid #eef1f5; font-size: 16px; font-weight: 700; }
.sheet-head .btn-link { color: #2563eb; }
.sheet-body { padding: 8px 16px 24px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); background: rgba(31,41,55,.92); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 999; max-width: 80vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 看板累计汇总（轻量、非高亮） ---------- */
.dash-summary { display: flex; flex-wrap: wrap; gap: 10px 28px; background: #fff; border: 1px solid #eef1f5; border-radius: 12px; padding: 12px 16px; margin-bottom: 12px; }
.dash-summary .ds-item { display: flex; align-items: baseline; gap: 8px; }
.dash-summary .ds-item em { font-style: normal; font-size: 12px; color: #8a94a6; }
.dash-summary .ds-item b { font-size: 17px; font-weight: 800; color: #1f2933; }

/* ---------- 看板分区标题 ---------- */
.dash-sec-head { display: flex; align-items: baseline; gap: 8px; font-size: 15px; font-weight: 800; color: #1f2933; margin: 16px 2px 10px; }
.dash-sec-head:first-of-type { margin-top: 4px; }
.dash-sec-head .sub { font-size: 12px; color: #8a94a6; font-weight: 400; }

/* ---------- 手机端：PC 配置入口卡片 ---------- */
.pc-entry-card { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%); color: #fff; border-radius: 14px; padding: 16px 18px; margin-bottom: 14px; box-shadow: 0 2px 8px rgba(37,99,235,.25); }
.pc-entry-ico { font-size: 30px; line-height: 1; }
.pc-entry-txt { display: flex; flex-direction: column; gap: 4px; }
.pc-entry-txt b { font-size: 15px; }
.pc-entry-txt span { font-size: 12px; opacity: .9; line-height: 1.5; }
.pc-entry-btn { align-self: stretch; text-align: center; background: #fff; color: #2563eb; font-weight: 700; padding: 12px 16px; border-radius: 10px; }

/* ---------- PC 端适配 ---------- */
@media (min-width: 768px) {
    .app { max-width: 1200px; margin: 0 auto; }
    .app-header { position: sticky; top: 0; height: 56px; padding: 0 24px; padding-top: 0; }
    /* 底部 tab 转为顶部水平导航 */
    .tabbar {
        order: 2; position: sticky; top: 56px; bottom: auto; left: auto; right: auto;
        justify-content: center; gap: 6px;
        border-top: none; border-bottom: 1px solid #e6e9ef;
        padding: 8px 24px;
    }
    .tab { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: 10px; }
    .tab .tab-ico { display: inline; font-size: 16px; }
    .tab.active { background: #eff4ff; }
    .app-main { order: 3; padding: 22px 24px 60px; }
    .kpi-grid { gap: 14px; }
    /* 弹层居中对话框 */
    .sheet-panel {
        left: 50%; right: auto; top: 50%; bottom: auto;
        transform: translate(-50%, -50%);
        width: 560px; max-width: 92vw; max-height: 86vh;
        border-radius: 16px; animation: none;
    }
    .login-card { max-width: 420px; }
    .toast { bottom: 40px; }
}
