/* =====================================================================
   家记 · 自定义样式（在 Bootstrap 5 之上做视觉层）
   ===================================================================== */

:root {
    --brand: #2563eb;
    --brand-600: #1d4ed8;
    --brand-soft: #eff6ff;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e6ebf2;
    --bg: #f4f6fb;
    --ok: #16a34a;
    --ok-soft: #ecfdf3;
    --warn: #f59e0b;
    --warn-soft: #fffbeb;
    --danger: #ef4444;
    --danger-soft: #fef2f2;
    --radius: 14px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 10px 26px -20px rgba(15, 23, 42, .38);
    --shadow: 0 12px 32px -20px rgba(15, 23, 42, .45);
}

* { -webkit-tap-highlight-color: transparent; }

/* 键盘可达性：统一焦点环 */
a:focus-visible, button:focus-visible, .btn:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible,
.nav-item:focus-visible, .nav-group-head:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
    font-size: 14.5px;
}

.sidebar-backdrop { display: none; }

/* ---------------- 布局 ---------------- */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    flex: 0 0 236px;
    width: 236px;
    background: #fff;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, .85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}

.topbar-title { font-weight: 600; color: var(--ink); letter-spacing: .2px; }
.crumb-group { display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; color: #64748b; }
.crumb-sep { font-size: 11px; color: #cbd5e1; }
.crumb-page { font-weight: 700; color: var(--ink); }

/* 内容区：大屏上放宽并居中，避免 1080p/2K 屏右侧空出一大片（原来固定 1280 且靠左） */
.app-content {
    padding: 20px;
    width: 100%;
    max-width: 1560px;
    margin-left: auto;
    margin-right: auto;
}

/* ---------------- 品牌区 ---------------- */
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px 14px;
    text-decoration: none;
    color: var(--ink);
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    font-size: 19px;
    box-shadow: 0 6px 14px -6px rgba(37, 99, 235, .7);
}

.brand-mark img { width: 62%; height: auto; display: block; }

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 14px; }
.brand-text small { color: var(--muted); font-size: 11px; }

/* ---------------- 侧边导航 ---------------- */
.side-nav { padding: 6px 10px 16px; display: flex; flex-direction: column; gap: 6px; }

/* 一级目录：分组标题（点一下折叠/展开） */
.nav-group-head {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    background: transparent;
    border-radius: 10px;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .6px;
    text-align: left;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.nav-group-head > i.bi:first-child { font-size: 14.5px; width: 16px; text-align: center; color: #8fa0b4; }
.nav-group-head > span { flex: 1 1 auto; }
.nav-group-head:hover { background: #f6f8fc; color: var(--ink); }
.nav-group-head:hover > i.bi:first-child { color: var(--brand); }
.nav-caret { font-size: 11px; color: #b3c0d1; transition: transform .2s ease; }
.nav-group.open .nav-caret { transform: rotate(180deg); }

/* 该分组里有当前页面时，一级标题也高亮 */
.nav-group.has-active .nav-group-head { color: var(--brand-600); background: var(--brand-soft); }
.nav-group.has-active .nav-group-head > i.bi:first-child { color: var(--brand); }

/* 二级目录：缩进 + 淡竖线，形成层级感 */
.nav-group-body { position: relative; padding-left: 9px; margin-left: 9px; display: none; }
.nav-group.open .nav-group-body { display: block; }
.nav-group-body::before {
    content: "";
    position: absolute;
    left: 0;
    top: 3px;
    bottom: 5px;
    width: 2px;
    border-radius: 2px;
    background: #eef2f8;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    color: #475569;
    text-decoration: none;
    font-size: 14px;
    transition: background .15s, color .15s;
    position: relative;
}

.nav-item i { font-size: 16px; width: 18px; text-align: center; color: #94a3b8; }
.nav-item:hover { background: #f6f8fc; color: var(--ink); }
.nav-item:hover i { color: var(--brand); }

.nav-item.active {
    background: var(--brand-soft);
    color: var(--brand-600);
    font-weight: 600;
}
.nav-item.active i { color: var(--brand); }
.nav-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 3px;
    background: var(--brand);
}

.side-foot { margin-top: auto; padding: 12px 14px 18px; }
.side-tip {
    display: flex;
    gap: 8px;
    font-size: 11.5px;
    line-height: 1.6;
    color: var(--muted);
    background: #f8fafc;
    border: 1px dashed var(--line);
    border-radius: 10px;
    padding: 10px;
}
.side-tip i { color: var(--warn); font-size: 14px; margin-top: 2px; }

/* ---------------- 卡片与通用块 ---------------- */
.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-body { padding: 18px; }

.section-card { background: #fff; }

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.page-title { font-size: 23px; font-weight: 700; margin: 0; letter-spacing: -.3px; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 5px; }

/* ---------------- 统计卡 ---------------- */
.stat-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    height: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
}
.stat-icon {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 20px;
}
.stat-body { min-width: 0; }
.stat-label { color: var(--muted); font-size: 12.5px; margin-bottom: 2px; }
.stat-value {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.5px;
}
.stat-hint { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.tone-blue   { background: var(--brand-soft); color: var(--brand); }
.tone-green  { background: var(--ok-soft); color: var(--ok); }
.tone-amber  { background: var(--warn-soft); color: var(--warn); }
.tone-red    { background: var(--danger-soft); color: var(--danger); }
.tone-slate  { background: #f1f5f9; color: #475569; }

/* ---------------- 孩子卡片 ---------------- */
.kid-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    height: 100%;
    transition: transform .15s, box-shadow .15s;
}
.kid-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 700;
    font-size: 17px;
    flex: 0 0 42px;
}
.avatar-sm { width: 28px; height: 28px; font-size: 12px; flex-basis: 28px; }
.avatar-xs { width: 20px; height: 20px; font-size: 10px; flex-basis: 20px; vertical-align: middle; }

/* 孩子只读页的圆形头像：正圆 + 顶部高光 + 白色描边，避免在 flex 行里被压成椭圆 */
.kid-avatar {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 700;
    font-size: 21px;
    line-height: 1;
    letter-spacing: 0;
    border: 2px solid rgba(255, 255, 255, .92);
    box-shadow: 0 6px 16px rgba(15, 23, 42, .18);
    background-image: radial-gradient(circle at 32% 24%,
        rgba(255, 255, 255, .46) 0%, rgba(255, 255, 255, .14) 45%, rgba(255, 255, 255, 0) 72%);
    overflow: hidden;
}

.kid-name { font-weight: 600; font-size: 15px; }
.kid-meta { color: var(--muted); font-size: 12px; }
.kid-balance { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.6px; }

.mini-bar { height: 6px; border-radius: 4px; background: #eef2f7; overflow: hidden; }
.mini-bar > span { display: block; height: 100%; border-radius: 4px; }

/* ---------------- 表格 ---------------- */
.table { font-size: 13.5px; margin-bottom: 0; }
.table > thead > tr > th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 12.5px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    padding: 10px 12px;
}
.table > tbody > tr > td { padding: 7px 10px; vertical-align: middle; border-color: #f1f5f9; }
.table-hover > tbody > tr:hover > td { background: #fafcff; }

.num { font-variant-numeric: tabular-nums; }
.money-out { color: var(--danger); font-weight: 600; }
.money-in  { color: var(--ok); font-weight: 600; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.7;
    background: #f1f5f9;
    color: #475569;
    white-space: nowrap;
}
.chip-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

.btn-icon {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: #fff;
    color: #475569;
}
.btn-icon:hover { background: #f6f8fc; }

.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-600); border-color: var(--brand-600); }
.btn-light { border: 1px solid var(--line); }

.user-chip { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 3px 10px 3px 4px; }
.user-dot {
    width: 26px; height: 26px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: var(--brand-soft); color: var(--brand);
}
.user-avatar {
    width: 26px; height: 26px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
}

/* ---------------- 账号管理 ---------------- */
.acct-avatar-lg {
    width: 72px; height: 72px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
}
.acct-avatar-sm {
    width: 38px; height: 38px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
}
.acct-avatar-fallback {
    display: grid; place-items: center;
    background: var(--brand-soft); color: var(--brand);
    font-weight: 700;
}
.acct-avatar-lg.acct-avatar-fallback { font-size: 24px; }
.acct-avatar-sm.acct-avatar-fallback { font-size: 15px; }

.acct-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 2px;
    border-bottom: 1px solid var(--line);
}
.acct-row:first-child { padding-top: 4px; }
.acct-row:last-child { border-bottom: none; padding-bottom: 2px; }
.acct-name { font-weight: 600; display: flex; align-items: center; gap: 6px; font-size: 14px; flex-wrap: wrap; }
.acct-sub { font-size: 12px; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
/* 一行的文字区可收缩，右侧按钮组固定不被压缩 */
.acct-meta { flex: 1 1 auto; min-width: 0; }
.acct-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: 0 0 auto; }

/* ---------------- 资金账户 ---------------- */
.fund-icon {
    width: 40px; height: 40px;
    border-radius: 11px;
    display: grid; place-items: center;
    font-size: 18px;
    flex: 0 0 auto;
}
.fund-amount { min-width: 96px; }
.fund-color { cursor: pointer; margin: 0; }
.fund-color input { position: absolute; opacity: 0; width: 0; height: 0; }
.fund-color span {
    display: block;
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #e2e8f0;
}
.fund-color input:checked + span { box-shadow: 0 0 0 2px var(--brand); }
.fund-tips li { line-height: 1.7; }

/* ---------------- 表单 ---------------- */
.form-label { font-weight: 600; font-size: 13px; color: #334155; margin-bottom: 5px; }
.form-control, .form-select {
    border-color: #e2e8f0;
    border-radius: 10px;
    padding: 9px 12px;
    min-height: 40px;
    font-size: 13.5px;
    color: var(--ink);
    background-color: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control::placeholder { color: #9aa8bb; }
.form-control:hover, .form-select:hover { border-color: #cbd5e1; }
.form-control:focus, .form-select:focus {
    border-color: #93b4f7;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}
.form-control:disabled, .form-control[readonly], .form-select:disabled {
    background-color: #f6f8fc;
    color: #7b8798;
    border-color: #e9edf4;
}

/* 下拉框：自绘细箭头，替代浏览器默认那块黑三角 */
.form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 34px;
    padding-left: 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 11px 11px;
    cursor: pointer;
    text-overflow: ellipsis;
}
.form-select:hover {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
.form-select:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
.form-select-sm {
    min-height: 34px;
    padding: 6px 30px 6px 10px;
    font-size: 13px;
    border-radius: 9px;
    background-position: right 9px center;
    background-size: 10px 10px;
}
.form-select[multiple],
.form-select[size]:not([size="1"]) {
    background-image: none;
    padding-right: 12px;
    min-height: 110px;
}
.input-group .form-select { border-radius: 0 10px 10px 0; }
.input-group .form-control { border-radius: 10px; }
.input-group > .form-control:first-child,
.input-group > .form-select:first-child { border-radius: 10px 0 0 10px; }
.input-group .form-control:last-child,
.input-group .form-select:last-child { border-radius: 0 10px 10px 0; }
.form-text { font-size: 12px; color: var(--muted); }
.input-group-text { background: #f8fafc; border-color: #e2e8f0; color: var(--muted); }

/* 勾选框 / 单选框：与下拉框同一套描边和焦点样式 */
.form-check-input {
    width: 16px;
    height: 16px;
    margin-top: .3rem;
    border-color: #cbd5e1;
    box-shadow: none;
    cursor: pointer;
}
.form-check-input:checked,
.form-check-input:indeterminate {
    background-color: var(--brand);
    border-color: var(--brand);
}
.form-check-input:hover { border-color: #93b4f7; }
.form-check-input:focus {
    border-color: #93b4f7;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.form-check-label { font-size: 13.5px; }

.seg-group .btn { flex: 1; }
.seg-group .btn-check:checked + .btn-outline-danger { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.seg-group .btn-check:checked + .btn-outline-success { background: var(--ok-soft); color: var(--ok); border-color: #bbf7d0; }

/* ---------------- 进度条 ---------------- */
.progress-thin { height: 8px; border-radius: 6px; background: #eef2f7; }
.progress-thin .progress-bar { border-radius: 6px; }

/* ---------------- 空状态 ---------------- */
.empty {
    text-align: center;
    padding: 40px 16px;
    color: var(--muted);
}
.empty i { font-size: 40px; color: #cbd5e1; display: block; margin-bottom: 10px; }

/* ---------------- 图表容器 ---------------- */
.chart-box { position: relative; height: 260px; }
.chart-box-tall { height: 300px; }
.chart-box-sm { position: relative; height: 220px; }

/* ---------------- 流水列表：宽屏表格 / 窄屏卡片 ---------------- */
.tx-cards { display: none; }

/* 表格里的备注列：固定宽度内自动换行，不再截断 */
/* 流水表：固定列宽，避免事项列被挤成三行 */
.tx-table table { table-layout: fixed; }
.tx-table .tx-item-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tx-remark {
    max-width: 100%;
    min-width: 0;
    font-size: 12.5px;
    line-height: 1.45;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tx-item {
    padding: 14px 2px;
    border-bottom: 1px solid var(--line);
}
.tx-item:first-child { padding-top: 4px; }
.tx-item:last-child { border-bottom: none; }

.tx-item-top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12.5px;
    color: var(--muted);
}
.tx-item-date { font-variant-numeric: tabular-nums; }
.tx-item-child { color: var(--ink); font-weight: 600; }
.tx-item-amount {
    margin-left: auto;
    font-size: 17px;
    font-weight: 700;
    white-space: nowrap;
}
.tx-item-name {
    margin-top: 7px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
    word-break: break-word;
}
.tx-item-meta {
    margin-top: 4px;
    font-size: 12.5px;
    color: var(--muted);
}
.tx-dot { margin: 0 5px; color: #cbd5e1; }
.tx-item-remark {
    margin-top: 5px;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.5;
    word-break: break-word;
}
.tx-item-actions { display: flex; gap: 8px; margin-top: 10px; }
.tx-item-sum {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding: 12px 2px 2px;
    border-top: 2px solid var(--line);
    font-weight: 700;
}

/* ---------------- 自定义确认弹窗 ---------------- */
.kw-confirm-dialog {
    max-width: 340px;
    width: calc(100% - 36px);
    margin-left: auto;
    margin-right: auto;
}
.kw-confirm {
    border: 0;
    border-radius: 18px;
    padding: 24px 20px 18px;
    text-align: center;
    box-shadow: 0 30px 70px -30px rgba(15, 23, 42, .55);
}
.kw-confirm-icon {
    width: 54px;
    height: 54px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 25px;
    background: var(--danger-soft);
    color: var(--danger);
}
.kw-confirm-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 8px;
}
.kw-confirm-text {
    font-size: 13.5px;
    color: var(--muted);
    line-height: 1.62;
    margin-bottom: 20px;
    word-break: break-word;
}
.kw-confirm-actions { display: flex; gap: 10px; }
.kw-confirm-actions .btn {
    flex: 1;
    padding: 10px 0;
    border-radius: 10px;
    font-weight: 600;
}
.kw-confirm-actions .btn-danger {
    background: var(--danger);
    border-color: var(--danger);
}
.kw-confirm-actions .btn-danger:hover,
.kw-confirm-actions .btn-danger:focus {
    background: #dc2626;
    border-color: #dc2626;
}

/* ---------------- 移动端 ---------------- */
@media (max-width: 991.98px) {
    .tx-table { display: none; }
    .tx-cards { display: block; padding: 4px 14px 6px; }
    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1045;
        transform: translateX(-100%);
        transition: transform .18s cubic-bezier(.4, 0, .2, 1);
        box-shadow: 8px 0 30px -18px rgba(15, 23, 42, .6);
    }
    .app-sidebar.show { transform: translateX(0); }
    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, .45);
        z-index: 1040;
        opacity: 0;
        pointer-events: none;
        transition: opacity .18s;
    }
    .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
    .app-content { padding: 14px; }
    .app-topbar { padding: 10px 14px; }
    .stat-value { font-size: 19px; }
}

/* 窄屏（手机）：账户/账号行改成两行，余额和按钮不再挤出卡片 */
@media (max-width: 575.98px) {
    .acct-row {
        flex-wrap: wrap;
        row-gap: 8px;
        gap: 10px;
    }
    .acct-row .acct-meta { flex: 1 1 calc(100% - 54px); min-width: 0; }
    .acct-row .fund-amount {
        min-width: 0 !important;
        margin-left: 0 !important;
        text-align: left;
    }
    .acct-row .fund-amount .acct-sub { margin-top: 0; }
    .acct-actions { margin-left: auto; }

    /* 定期项目行：操作按钮换到下一行、右对齐 */
    .rec-row { flex-wrap: wrap; row-gap: 8px; }
    .rec-actions { width: 100%; justify-content: flex-end; }

    /* 三列金额概览在 360px 屏里会撑出横向滚动，缩小字号 */
    .fund-stat-row > .col-4 > .fw-bold { font-size: 15px !important; }
    .fund-stat-row > .col-4 > .text-muted { font-size: 12px !important; }

    /* 页头按钮不挤压标题 */
    .page-actions { flex-wrap: wrap; }
    .page-actions .btn { padding: .25rem .55rem; }

    /* 触控目标放大到 40px（图标按钮） */
    .form-control, .form-select { min-height: 44px; font-size: 14px; }
    .form-select-sm, .tx-size { min-height: 38px; font-size: 13px; }
    .table .btn-sm, .acct-actions .btn, .btn-icon, .cat-quick { min-height: 40px; }
    .table .btn-sm, .acct-actions .btn, .btn-icon { min-width: 40px; }

    /* 首页预算行：金额换行到进度条下方，避免把进度条压成细线 */
    .budget-row { flex-wrap: wrap; row-gap: 4px; align-items: center; }
    .budget-row .budget-amount { min-width: 0 !important; text-align: left !important; order: 3; margin-left: auto; }
    .budget-row .progress { flex: 1 1 100% !important; min-width: 0; order: 4; margin-top: 2px; }

    /* 首页统计卡：手机两列较窄，收小图标、数值单行，隐藏次要提示 */
    .stat-card { padding: 11px 12px; gap: 8px; align-items: center; }
    .stat-icon { flex: 0 0 28px; width: 28px; height: 28px; border-radius: 9px; font-size: 13px; }
    .stat-label { font-size: 11.5px; line-height: 1.25; margin-bottom: 1px; }
    .stat-value { font-size: 16px; line-height: 1.25; white-space: nowrap; letter-spacing: -.2px; }
    .stat-hint { display: none; }

    /* 每页条数等次要控件不换行挤爆 */
    .table-pager { flex-wrap: wrap; }
}

/* ---------------- 自绘下拉：替代浏览器原生 option 列表 ---------------- */
.kw-select-wrap { position: relative; display: block; }
.kw-select-hidden {
    position: absolute !important;
    width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
    clip: rect(0 0 0 0); clip-path: inset(50%);
    overflow: hidden; white-space: nowrap;
}
.kw-select-btn {
    width: 100%;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 12px;
    font-size: 13.5px;
    line-height: 1.4;
    text-align: left;
    color: var(--ink);
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.kw-select-btn:hover { border-color: #cbd5e1; }
.kw-select-btn:focus-visible,
.kw-select-btn[aria-expanded="true"] {
    border-color: #93b4f7;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
    outline: none;
}
.kw-select-btn.is-empty .kw-select-label { color: #9aa8bb; }
.kw-select-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kw-select-caret {
    flex: 0 0 auto;
    font-size: 11px;
    color: #8b95a6;
    transition: transform .16s ease, color .16s ease;
}
.kw-select-btn[aria-expanded="true"] .kw-select-caret { transform: rotate(180deg); color: var(--brand); }
/* 原生 select 被禁用（如批量栏「收入/支出混着改」）时，按钮同步置灰 */
.kw-select-btn:disabled,
.kw-select-btn.is-disabled {
    opacity: .62;
    cursor: not-allowed;
    background: #f8fafc;
    border-color: #e6ebf2;
}
.kw-select-sm .kw-select-btn {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 9px;
}
/* 组合框（金额 + 单位）里的下拉：贴住左侧输入框，右侧保留圆角 */
.input-group .kw-select-wrap { flex: 1 1 auto; width: 1%; min-width: 0; }
.input-group .kw-select-wrap .kw-select-btn {
    margin-left: -1px;
    border-radius: 0 10px 10px 0;
}
.kw-select-panel {
    position: fixed;
    z-index: 6000;
    display: none;
    padding: 5px;
    background: #fff;
    border: 1px solid #e6ebf2;
    border-radius: 12px;
    box-shadow: 0 20px 40px -24px rgba(15, 23, 42, .38), 0 2px 8px rgba(15, 23, 42, .06);
    max-height: 264px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.kw-select-panel.open { display: block; }
.kw-select-list { list-style: none; margin: 0; padding: 0; }
.kw-select-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--ink);
    cursor: pointer;
    white-space: nowrap;
}
.kw-select-item:hover, .kw-select-item.is-focus { background: #f4f7fc; }
.kw-select-item[aria-selected="true"] { background: #eff6ff; color: #1d4ed8; font-weight: 600; }
.kw-select-item .bi-check2 { font-size: 12px; color: #2563eb; }

@media (max-width: 575.98px) {
    .kw-select-btn { min-height: 44px; font-size: 14px; }
    .kw-select-sm .kw-select-btn { min-height: 38px; font-size: 13px; }
    .kw-select-panel { max-height: 46vh; }
}

@media print {
    .app-sidebar, .app-topbar, .page-actions, .no-print { display: none !important; }
    .app-content { max-width: 100%; padding: 0; }
}

/* 空状态：图标 + 说明 + 主行动 */
.empty-state {
    text-align: center;
    padding: 30px 12px;
    color: var(--muted);
    font-size: 13px;
}
.empty-state > i {
    display: block;
    font-size: 34px;
    line-height: 1;
    opacity: .38;
    margin-bottom: 10px;
}
.empty-state .btn { margin-top: 12px; }

/* 流水筛选：手机折叠成「筛选」按钮，平板以上常显 */
@media (max-width: 991.98px) {
    .tx-filter { display: none; }
    .tx-filter.show { display: block; }
}

/* 分类快捷按钮：只显示当前方向的常用几个，其余收进「更多」 */
.cat-quick { display: inline-flex; align-items: center; gap: 5px; }
.cat-quick.is-on {
    color: var(--brand);
    border-color: var(--brand);
    background: var(--brand-soft);
}
.cat-quick.cat-extra { display: none; }
.cat-chip-list.more-open .cat-quick.cat-extra { display: inline-flex; }
.cat-quick.cat-chip-hide { display: none !important; }
.cat-more { border-style: dashed; color: var(--muted); }
.cat-more[hidden] { display: none !important; }

/* 分段切换（分类管理：支出 / 收入） */
.seg {
    display: inline-flex;
    gap: 3px;
    padding: 3px;
    background: #f1f5f9;
    border-radius: 10px;
}
.seg > button {
    border: 0;
    background: transparent;
    padding: 7px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}
.seg > button.on {
    background: #fff;
    color: var(--brand-600);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
}
.cat-pane { display: none; }
.cat-pane.on { display: block; }

/* 登录页验证码 */
.login-logo {
    display: block;
    width: 64px;
    height: 64px;
    filter: drop-shadow(0 8px 18px rgba(37, 99, 235, .28));
}

.cap-img {
    flex: 0 0 auto;
    width: 132px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f1f5f9;
    cursor: pointer;
    user-select: none;
    transition: box-shadow .15s ease, transform .15s ease;
}
.cap-img:hover { box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.cap-img:active { transform: scale(.98); }

/* 流水页「每页 N 条」下拉：整体收窄，数字靠左留小边距、右侧贴着箭头 */
.tx-size {
    width: 82px;                   /* 要能放下三位数「100」，62px 时会被省略号截成「1…」 */
    min-width: 82px;
    min-height: 32px;
    padding: 5px 24px 5px 8px;
    font-size: 12.5px;
    background-position: right 8px center;
    background-size: 10px 10px;
}
.tx-size:focus { box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }

/* 「每页」选择器靠右；窄屏时独占一行贴左——贴着右边缘时，原生下拉展开会顶出屏幕右边 */
.tx-size-wrap { margin-left: auto; }
@media (max-width: 767.98px) {
    .tx-size-wrap {
        margin-left: 0;
        flex-basis: 100%;          /* 单独占一行，从卡片左侧开始，右侧留出展开空间 */
    }
}

/* ---------- 账户性质选择 ---------- */
.kind-option {
    display: block;
    padding: .6rem .75rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    height: 100%;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
    position: relative;
}
.kind-option:hover { border-color: #bfdbfe; }
.kind-option input { position: absolute; opacity: 0; pointer-events: none; }
.kind-option i { display: block; font-size: 18px; color: #64748b; margin-bottom: 2px; }
.kind-option strong { display: block; font-size: 14px; }
.kind-option small { display: block; color: #94a3b8; font-size: 11.5px; line-height: 1.35; }
.kind-option.checked {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}
.kind-option.checked i, .kind-option.checked strong { color: #2563eb; }

/* ---------- 转账 / 定期收支 ---------- */
.arrow-box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 999px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 18px;
}
.transfer-list .tx-row {
    border-radius: 12px;
}
.rec-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem .2rem;
    border-bottom: 1px dashed var(--line);
}
.rec-row:last-child { border-bottom: 0; }
.rec-day {
    flex: 0 0 44px;
    text-align: center;
    line-height: 1.1;
}
.rec-day strong { display: block; font-size: 16px; }
.rec-day small { color: #94a3b8; font-size: 11px; }
.rec-badge {
    font-size: 11px;
    padding: .1rem .4rem;
    border-radius: 6px;
}
/* 定期项目行右侧操作按钮：固定方格、不被挤压 */
.rec-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}
.rec-actions form { margin: 0; display: flex; }
.rec-actions .btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 13px;
}
.btn-icon.text-danger { color: #dc3545; border-color: #f3cfd3; }
.btn-icon.text-danger:hover { background: #fef2f2; color: #b91c1c; border-color: #f3cfd3; }

/* ---------- 快速记账面板 ---------- */
.quick-fab {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 1040;
    width: 54px;
    height: 54px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    box-shadow: 0 10px 24px rgba(37, 99, 235, .38);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* 可拖动：按在按钮上不会带动页面滚动，也不会选中文字 */
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    cursor: grab;
    transition: transform .14s ease, box-shadow .14s ease;
}
.quick-fab.pressing { transform: scale(.95); }
.quick-fab.dragging {
    transition: none;               /* 拖动时要跟手，不能有过渡 */
    transform: scale(1.06);
    box-shadow: 0 16px 32px rgba(37, 99, 235, .46);
    cursor: grabbing;
}

/* 拖动按钮后的小提示 */
.fab-toast {
    position: fixed;
    left: 50%;
    bottom: calc(96px + env(safe-area-inset-bottom, 0px));
    transform: translate(-50%, 8px);
    z-index: 1080;
    padding: 9px 18px;
    border-radius: 999px;
    background: rgba(15, 23, 42, .9);
    color: #fff;
    font-size: 13px;
    line-height: 1.4;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}
.fab-toast.show { opacity: 1; transform: translate(-50%, 0); }

.quick-sheet .modal-dialog {
    max-width: 460px;
}
.quick-sheet .modal-content {
    border-radius: 18px;
    border: 0;
    box-shadow: 0 18px 46px rgba(15, 23, 42, .22);
}
.quick-amount {
    font-size: 22px;
    font-weight: 700;
    height: 52px;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.quick-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    text-align: left;
    min-width: 0;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.quick-chip i { font-size: 16px; }
.quick-chip span {
    font-size: 12.5px;
    font-weight: 600;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.quick-chip small { color: #94a3b8; font-size: 10.5px; }
.quick-chip.active {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}
@media (max-width: 380px) {
    .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- 流水页：小票入口胶囊（手机上也要好点） ---------- */
.tx-receipt {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-decoration: none;
    vertical-align: middle;
    white-space: nowrap;
}
.tx-receipt i { font-size: 11px; }
.tx-receipt:hover, .tx-receipt:active { background: #dbeafe; color: #1e40af; }

/* ---------- 小票页：缩略图 / 大图弹层 / 文件缺失 ---------- */
.rc-thumb { position: relative; overflow: hidden; cursor: zoom-in; }
.rc-thumb .rc-zoom {
    position: absolute;
    left: 8px;
    bottom: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, .72);
    color: #fff;
    font-size: 11px;
    opacity: 0;
    transition: opacity .15s;
}
.rc-thumb:hover .rc-zoom { opacity: 1; }
@media (hover: none) { .rc-thumb .rc-zoom { opacity: 1; } }
.rc-missing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 160px;
    background: repeating-linear-gradient(45deg, #f8fafc, #f8fafc 10px, #f1f5f9 10px, #f1f5f9 20px);
    color: #94a3b8;
    font-size: 12px;
}
.rc-missing i { font-size: 24px; }

/* ---------- 导航角标（待处理数量） ---------- */
.nav-badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--warn);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
}
.nav-item.active .nav-badge { background: var(--brand-600); }

/* ---------- 月报 / 待处理的小零件 ---------- */
.chart-box-sm { position: relative; height: 200px; }
.ins-list { list-style: none; margin: 0; padding: 0; }
.ins-list li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.ins-list li:last-child { border-bottom: 0; }
.ins-dot { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; }
.ins-dot.tone-ok { background: var(--ok-soft); color: var(--ok); }
.ins-dot.tone-warn { background: var(--warn-soft); color: var(--warn); }
.ins-dot.tone-danger { background: var(--danger-soft); color: var(--danger); }
.ins-dot.tone-info { background: var(--brand-soft); color: var(--brand); }
.mbar-track { height: 6px; border-radius: 3px; background: #eef2f7; overflow: hidden; }
.mbar-fill { display: block; height: 100%; border-radius: 3px; }

/* ---------- 流水批量改分类 ---------- */
.tx-pickbar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 1045;
    display: none;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .18);
}
.tx-pickbar.show { display: block; }
body.has-pickbar { padding-bottom: 96px; }
.tx-pickbar-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tx-pick-count { font-size: 13px; color: #334155; white-space: nowrap; }
.tx-pick-count b { color: var(--brand); }
.tx-pickbar .form-select { max-width: 190px; min-height: 34px; }
.tx-pickbar .btn { white-space: nowrap; }
.tx-pickbar .btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.tx-pick-group { display: flex; align-items: center; gap: 6px; }
.tx-pick-tag {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
    padding-left: 10px;
    border-left: 1px solid var(--line);
}
.tx-pick-count + .tx-pick-group .tx-pick-tag { padding-left: 0; border-left: 0; }
.tx-pick-hint { margin-top: 6px; font-size: 12px; color: var(--danger); }
/* 批量操作栏里的下拉改用统一的自绘面板：宽度跟随栏内其它控件，不随选项文字跳动 */
.tx-pick-group .kw-select-wrap { width: 176px; flex: 0 0 auto; }
.tx-pick-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: auto;
    font-size: 13px;
    color: #64748b;
}
.tx-pick-label .form-check-input { margin: 0; }
@media (max-width: 991.98px) {
    .tx-pickbar { left: 10px; right: 78px; bottom: 10px; }
    .tx-pickbar .form-select { flex: 1 1 120px; max-width: none; }
    .tx-pick-tag { border-left: 0; padding-left: 0; }
    .tx-pick-group { order: 2; flex: 1 1 100%; }
    .tx-pick-group .form-select { flex: 1 1 auto; }
    .tx-pick-group .kw-select-wrap { width: auto; flex: 1 1 auto; }
    #txPickClear, #txPickAllBtn { order: 1; }
    body.has-pickbar { padding-bottom: 168px; }
}

/* ---------- 日期框：没选值时保持空白，不显示浏览器自带的 yyyy/mm/dd ---------- */
input[type="date"].date-blank::-webkit-datetime-edit {
    color: transparent;
}
input[type="date"].date-blank:focus::-webkit-datetime-edit {
    color: inherit;
}
/* Firefox 无法单独选中日期框里的提示文字：空值时整体透明，一选日期 class 移除就恢复 */
input[type="date"].date-blank {
    color: transparent;
}
input[type="date"].date-blank:focus {
    color: inherit;
}

/* ---------- 页面顶部操作提示（flash）：轻量卡片，不再铺满整屏 ---------- */
.kw-alert {
    --kw-a-bg: #eefbf3;
    --kw-a-line: #22c55e;
    --kw-a-ink: #0f5132;
    --kw-a-icon: #15803d;
    --kw-a-chip: rgba(22, 163, 74, .13);
    --kw-a-bd: rgba(22, 163, 74, .26);
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 720px;
    margin: 0 0 14px;
    padding: 9px 10px 9px 12px;
    background: var(--kw-a-bg);
    border: 1px solid var(--kw-a-bd);
    border-left: 3px solid var(--kw-a-line);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    font-size: 13.5px;
    line-height: 1.45;
    color: var(--kw-a-ink);
    animation: kwAlertIn .22s ease-out both;
}
.kw-alert-icon {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--kw-a-chip);
    color: var(--kw-a-icon);
    font-size: 14px;
}
.kw-alert-text {
    flex: 1 1 auto;
    min-width: 0;
    word-break: break-word;
}
.kw-alert-close {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    opacity: .45;
    cursor: pointer;
    transition: opacity .15s ease, background-color .15s ease;
}
.kw-alert-close:hover { opacity: 1; background: rgba(15, 23, 42, .06); }
.kw-alert-close:focus-visible { outline: 2px solid var(--kw-a-line); outline-offset: 1px; opacity: 1; }
.kw-alert-close .bi { font-size: 12px; }

.kw-alert--warning {
    --kw-a-bg: #fff7e8;
    --kw-a-line: #f59e0b;
    --kw-a-ink: #7c2d12;
    --kw-a-icon: #b45309;
    --kw-a-chip: rgba(245, 158, 11, .15);
    --kw-a-bd: rgba(217, 119, 6, .28);
}
.kw-alert--danger {
    --kw-a-bg: #fef2f2;
    --kw-a-line: #ef4444;
    --kw-a-ink: #7f1d1d;
    --kw-a-icon: #b91c1c;
    --kw-a-chip: rgba(239, 68, 68, .14);
    --kw-a-bd: rgba(220, 38, 38, .28);
}
.kw-alert--info {
    --kw-a-bg: #eff6ff;
    --kw-a-line: #3b82f6;
    --kw-a-ink: #1e3a8a;
    --kw-a-icon: #1d4ed8;
    --kw-a-chip: rgba(59, 130, 246, .13);
    --kw-a-bd: rgba(37, 99, 235, .26);
}

@keyframes kwAlertIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}
.kw-alert.is-leaving {
    animation: kwAlertOut .2s ease-in both;
}
@keyframes kwAlertOut {
    to { opacity: 0; transform: translateY(-4px); }
}

@media (max-width: 575.98px) {
    .kw-alert { max-width: none; font-size: 13px; padding: 9px 8px 9px 10px; gap: 8px; }
}

@media print {
    .app-sidebar, .app-topbar, .page-actions, .no-print, .quick-fab { display: none !important; }
    .app-main { margin: 0 !important; }
    .app-content { padding: 0 !important; }
    .card { border: 1px solid #ddd !important; box-shadow: none !important; break-inside: avoid; }
    body { background: #fff !important; }
    .tx-pickbar { display: none !important; }
}
