/* 电子存钱罐 · 共用样式 */
:root {
    --bg: #fff8f2;
    --card: #fffdfb;
    --line: #f1e1d5;
    --ink: #2b2320;
    --muted: #92847c;
    --brand: #ef6f52;
    --brand-d: #d9553b;
    --brand-soft: #ffe7dd;
    --gold: #f6b73c;
    --ok: #2fa47a;
    --warn: #cf3f31;
    --radius: 18px;
    --shadow: 0 14px 34px rgba(190, 112, 82, .12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(120% 60% at 50% -10%, #ffe6d8 0%, rgba(255, 230, 216, 0) 60%),
        linear-gradient(180deg, #fff8f2 0%, #fffdfb 45%, #fff8f2 100%);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: 480px; margin: 0 auto; padding: 26px 16px 46px; }
/* 桌面端放宽，后台表格不会被挤成横向滚动条 */
@media (min-width: 760px) {
    .wrap { max-width: 720px; }
    .hero h1 { font-size: 24px; }
}

/* ---------- 头部 ---------- */
.hero { text-align: center; padding: 6px 0 16px; }
.hero h1 { font-size: 22px; letter-spacing: .5px; margin: 2px 0 4px; font-weight: 700; }
.hero p { margin: 0; color: var(--muted); font-size: 12.5px; }

/* ---------- 标签切换 ---------- */
.tabs {
    display: flex; gap: 6px; padding: 5px;
    background: #fff; border: 1px solid var(--line);
    border-radius: 15px; box-shadow: 0 8px 20px rgba(190, 112, 82, .06);
}
.tab {
    flex: 1; text-align: center; padding: 11px 8px; border-radius: 11px;
    font-size: 14px; color: var(--muted); cursor: pointer; border: 0;
    background: transparent; font-weight: 600; transition: background .18s, color .18s;
}
.tab.active { color: #fff; background: linear-gradient(180deg, var(--brand), var(--brand-d)); box-shadow: 0 8px 18px rgba(239, 111, 82, .26); }

/* ---------- 卡片 ---------- */
.card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px; box-shadow: var(--shadow); margin-top: 14px;
}
.card + .card { margin-top: 12px; }
.card-title { font-size: 15px; font-weight: 700; margin: 0 0 4px; display: flex; align-items: center; gap: 6px; }
.card-sub { font-size: 12px; color: var(--muted); margin: 0 0 14px; line-height: 1.6; }

/* ---------- 表单 ---------- */
label { display: block; font-size: 12.5px; color: var(--muted); margin: 0 0 6px; }
textarea, input[type="text"], input[type="password"], input[type="number"] {
    width: 100%; padding: 12px 13px; font-size: 15px; color: var(--ink);
    background: #fffaf6; border: 1px solid var(--line); border-radius: 12px;
    outline: none; font-family: inherit; transition: border-color .16s, box-shadow .16s;
}
textarea { min-height: 88px; resize: vertical; line-height: 1.5; font-size: 13px; word-break: break-all; }
textarea::placeholder, input::placeholder { color: #bdb0a8; }
textarea:focus, input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(239, 111, 82, .12); }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

.btn {
    width: 100%; padding: 14px; border: 0; border-radius: 13px;
    background: linear-gradient(180deg, var(--brand), var(--brand-d));
    color: #fff; font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit;
    box-shadow: 0 12px 24px rgba(239, 111, 82, .26); transition: transform .12s, box-shadow .12s;
}
.btn:active { transform: translateY(1px); box-shadow: 0 6px 14px rgba(239, 111, 82, .22); }
.btn[disabled] { opacity: .6; cursor: not-allowed; box-shadow: none; }
.btn.ghost {
    background: #fff; color: var(--brand-d); border: 1px solid #f7cfc3;
    box-shadow: none; font-weight: 600;
}
.btn.danger { background: linear-gradient(180deg, #e8574a, #c8382a); box-shadow: 0 12px 24px rgba(200, 56, 42, .24); }
.btn.danger:active { box-shadow: 0 6px 14px rgba(200, 56, 42, .2); }
.btn.small { padding: 9px 14px; font-size: 13px; width: auto; }

/* ---------- 金额展示 ---------- */
.amount-big {
    font-size: 34px; font-weight: 800; letter-spacing: -.5px;
    background: linear-gradient(180deg, #ff8b63, #d9553b);
    -webkit-background-clip: text; background-clip: text; color: transparent;
    line-height: 1.15;
}
.amount-big small { font-size: 15px; margin-right: 2px; font-weight: 700; }

/* ---------- 存钱罐信息 ---------- */
.bank-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.bank-name { font-size: 16px; font-weight: 700; }
.bank-owner { font-size: 12px; color: var(--muted); margin-top: 3px; }
.bank-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px; color: var(--muted); letter-spacing: .5px;
    background: #fff5ef; border: 1px dashed #eed6c8; border-radius: 9px;
    padding: 7px 9px; word-break: break-all; margin-top: 10px; cursor: pointer;
}
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; color: var(--muted); padding: 5px 0; }
.kv b { color: var(--ink); font-weight: 600; }

/* ---------- 内嵌面板 ---------- */
.panel {
    background: #fffaf6; border: 1px solid #f3e3d7; border-radius: 14px;
    padding: 14px; margin-top: 12px;
}
.panel .field:last-of-type { margin-bottom: 0; }

/* ---------- 进度条 ---------- */
.progress { height: 8px; background: #f4e6dd; border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #ffb27a, var(--brand)); border-radius: 999px; }
.progress-text { font-size: 11.5px; color: var(--muted); }

/* ---------- 提示 ---------- */
.msg { font-size: 12.5px; line-height: 1.6; border-radius: 11px; padding: 10px 12px; margin-top: 12px; }
.msg.err { background: #ffecea; border: 1px solid #ffc9c2; color: #b53a2c; }
.msg.ok { background: #e9f8f1; border: 1px solid #bfe9d7; color: #1d7a56; }
.msg.info { background: #fff6e8; border: 1px solid #ffe2b8; color: #8a6120; }

/* ---------- 明细列表 ---------- */
.list { margin: 8px 0 0; padding: 0; list-style: none; max-height: 260px; overflow: auto; }
.list li {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 9px 0; border-bottom: 1px dashed #f2e4da; font-size: 12.5px;
}
.list li:last-child { border-bottom: 0; }
.list .li-main { color: var(--muted); }
.list .li-amt { font-weight: 700; color: #c9502f; white-space: nowrap; }

/* ---------- 结算回执 ---------- */
.receipt { text-align: center; }
.receipt .stamp {
    display: inline-block; margin: 6px 0 2px; padding: 6px 14px; border-radius: 999px;
    font-size: 12px; color: #1d7a56; background: #e9f8f1; border: 1px solid #bfe9d7;
}

/* ---------- 徽标 ---------- */
.badge {
    display: inline-block; font-size: 11.5px; padding: 3px 8px; border-radius: 999px;
    background: var(--brand-soft); color: #b85036; border: 1px solid #ffd2c3;
}
.badge.gray { background: #f5efe9; color: var(--muted); border-color: #ede1d7; }

.foot { text-align: center; color: #b7a79d; font-size: 11.5px; margin-top: 26px; line-height: 1.7; }
.foot a { color: #b7a79d; }

/* ---------- 下拉框 ---------- */
select {
    width: 100%; padding: 12px 13px; font-size: 14px; color: var(--ink);
    background: #fffaf6; border: 1px solid var(--line); border-radius: 12px;
    outline: none; font-family: inherit; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2392847c' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center;
}

/* ---------- 统计卡 ---------- */
.stats { display: flex; gap: 9px; margin-top: 14px; }
.stat {
    flex: 1; background: #fff; border: 1px solid var(--line); border-radius: 14px;
    padding: 12px 8px; text-align: center; box-shadow: 0 8px 20px rgba(190, 112, 82, .06);
}
.stat .v { font-size: 18px; font-weight: 800; color: var(--brand-d); letter-spacing: -.3px; }
.stat .k { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; margin-top: 10px; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { padding: 9px 8px; text-align: left; border-bottom: 1px dashed #f2e4da; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; }
td.amt { color: #c9502f; font-weight: 700; }
.link { color: var(--brand-d); cursor: pointer; font-size: 12.5px; background: none; border: 0; padding: 0; font-family: inherit; }
.link.danger { color: var(--warn); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

/* ---------- 弹层（后台明细 / 短码二维码） ---------- */
.modal {
    position: fixed; inset: 0; z-index: 50;
    display: flex; align-items: flex-end; justify-content: center;
    background: rgba(43, 35, 32, .48);
    -webkit-backdrop-filter: blur(4px) saturate(.92);
    backdrop-filter: blur(4px) saturate(.92);
}
.modal[hidden] { display: none; }
.modal-body {
    width: 100%; max-width: 560px; max-height: 88vh; overflow: auto;
    padding: 0 16px 26px;
    background: linear-gradient(180deg, #fffdfb 0%, #fff9f4 62%, #fffaf6 100%);
    border: 1px solid #f7e3d7; border-bottom: 0;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -18px 48px rgba(150, 80, 55, .2);
    overscroll-behavior: contain;
}
.modal-grip { width: 38px; height: 4px; border-radius: 999px; background: #efd7c9; margin: 9px auto 2px; }
.modal-body { scrollbar-width: thin; scrollbar-color: #ecd3c5 transparent; }
.modal-body::-webkit-scrollbar { width: 8px; }
.modal-body::-webkit-scrollbar-thumb { background: #ecd3c5; border-radius: 999px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-head {
    position: sticky; top: 0; z-index: 3;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 0 11px; margin: 0 0 6px;
    background: #fffdfb; border-bottom: 1px solid #f7e8dd;
}
.modal-head h3 { margin: 0; font-size: 16px; letter-spacing: .2px; }
.close {
    width: 30px; height: 30px; flex: 0 0 30px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; border: 1px solid #f3ded1; background: #fff5ef;
    color: var(--muted); font-size: 17px; line-height: 1; cursor: pointer;
    transition: color .16s, border-color .16s, background .16s, transform .16s;
}
.close:hover { color: var(--brand-d); border-color: #f2c2b2; background: #fff0e8; }
.close:active { transform: scale(.94); }
@media (min-width: 760px) {
    .modal { align-items: center; padding: 30px; }
    .modal-body {
        max-height: 84vh; border-bottom: 1px solid #f7e3d7;
        border-radius: 22px; padding: 0 20px 24px;
        box-shadow: 0 24px 60px rgba(150, 80, 55, .22);
    }
    .modal-head { top: -1px; }
}

/* ---------- 统一弹窗（alert / confirm / toast） ---------- */
.pk-layer { position: fixed; inset: 0; z-index: 90; pointer-events: none; }
.pk-dialog { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 26px; pointer-events: auto; }
.pk-mask {
    position: absolute; inset: 0; background: rgba(43, 35, 32, .46);
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
    opacity: 0; transition: opacity .22s ease;
}
.pk-box {
    position: relative; z-index: 1; width: 100%; max-width: 322px;
    padding: 22px 20px 18px; text-align: center;
    background: linear-gradient(180deg, #fffdfb, #fff7f1);
    border: 1px solid #f6e0d3; border-radius: 20px;
    box-shadow: 0 24px 56px rgba(150, 80, 55, .24), inset 0 1px 0 rgba(255, 255, 255, .95);
    opacity: 0; transform: translateY(10px) scale(.94);
    transition: opacity .24s ease, transform .32s cubic-bezier(.2, 1.16, .4, 1);
}
.pk-dialog.is-on .pk-mask { opacity: 1; }
.pk-dialog.is-on .pk-box { opacity: 1; transform: none; }
.pk-icon {
    width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 800; font-style: normal;
}
.pk-icon.is-info { background: linear-gradient(180deg, #ffe7dd, #ffd4c3); color: #c8502f; border: 1px solid #ffc8b5; }
.pk-icon.is-warn { background: linear-gradient(180deg, #ffead6, #ffd6b3); color: #b8761e; border: 1px solid #ffd0a4; }
.pk-icon.is-danger { background: linear-gradient(180deg, #ffe1dc, #ffc6bd); color: #b8362a; border: 1px solid #ffb9ad; }
.pk-title { margin: 0 0 6px; font-size: 16px; font-weight: 700; letter-spacing: .2px; }
.pk-msg { margin: 0; font-size: 13px; line-height: 1.68; color: var(--muted); white-space: pre-line; }
.pk-actions { display: flex; gap: 10px; margin-top: 18px; }
.pk-actions .btn { padding: 12px; font-size: 14px; }
.pk-toast {
    position: absolute; left: 50%; top: 18px; max-width: 84vw;
    padding: 9px 15px; border-radius: 999px;
    font-size: 12.5px; font-weight: 600; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
    background: rgba(43, 35, 32, .88); color: #fff;
    box-shadow: 0 12px 28px rgba(43, 35, 32, .24);
    opacity: 0; transform: translate(-50%, -12px); pointer-events: none;
    transition: opacity .2s ease, transform .24s cubic-bezier(.2, 1.1, .4, 1);
}
.pk-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.pk-toast.is-ok { background: rgba(37, 120, 91, .94); }
.pk-toast.is-err { background: rgba(178, 58, 44, .94); }
.pk-locked { overflow: hidden; }

/* ---------- 工具条 ---------- */
.toolbar { display: flex; gap: 9px; margin-top: 12px; flex-wrap: wrap; }
.toolbar .btn { width: auto; flex: 1; min-width: 120px; padding: 11px 14px; font-size: 13.5px; }

/* ---------- 动效层 ---------- */
.piggy-stage {
    position: relative; width: 176px; margin: 0 auto 2px;
    perspective: 1000px; perspective-origin: 50% 42%;
}
.pig-scene {
    transform-style: preserve-3d;
    transform: rotateY(var(--pig-ry, 0deg));
    transition: transform .32s cubic-bezier(.2, .8, .3, 1);
}
.pig-bob { animation: piggyFloat 4.4s ease-in-out infinite; }
@keyframes piggyFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.piggy-img {
    width: 176px; height: auto; display: block; margin: 0 auto;
    transition: opacity .3s ease, transform .3s ease, filter .3s ease;
    filter: drop-shadow(0 12px 16px rgba(190, 140, 110, .18));
}
.fx-layer { position: absolute; inset: 0; pointer-events: none; }
.fx-coin {
    position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%;
    background: radial-gradient(circle at 34% 28%, #fff5cc 0%, #ffd166 40%, #edb13c 72%, #c2820f 100%);
    border: 2px solid #ffefc2;
    box-shadow: 0 6px 12px rgba(190, 120, 20, .32), inset 0 1px 2px rgba(255, 255, 255, .7);
    display: flex; align-items: center; justify-content: center;
    color: #8a5a00; font-weight: 800; font-size: 12px;
    will-change: transform, opacity;
}
.fx-coin span { display: inline-block; transform: scaleY(1.1); }
.fx-pile { z-index: 2; }
.fx-spark { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #ffd166; }
.fx-float { position: absolute; font-size: 14px; font-weight: 800; color: #c9502f; text-shadow: 0 2px 6px rgba(255, 255, 255, .9); white-space: nowrap; }
/* 陶瓷碎片：奶油/粉/深粉，砸碎时才出现 */
.fx-shard {
    position: absolute; border-radius: 4px; z-index: 3; will-change: transform, opacity;
    border: 1px solid rgba(255, 255, 255, .5);
    box-shadow: inset 0 0 4px rgba(255, 255, 255, .55), 0 5px 10px rgba(150, 90, 70, .28);
}
.fx-ring { position: absolute; width: 120px; height: 120px; border-radius: 50%; border: 3px solid rgba(235, 155, 130, .6); }
.piggy-img.fx-crack { filter: drop-shadow(0 0 12px rgba(255, 196, 172, .95)) brightness(1.07) saturate(1.05); }
.piggy-img.fx-gone { opacity: 0; transform: scale(.94); transition: opacity .1s ease, transform .1s ease; }
.fx-gone { opacity: 0; transform: scale(.94); }
@keyframes piggyShake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-7px); }
    30% { transform: translateX(6px); }
    45% { transform: translateX(-5px); }
    60% { transform: translateX(4px); }
    80% { transform: translateX(-2px); }
}
.fx-shake { animation: piggyShake .5s ease-in-out; }
@keyframes fxPop {
    from { transform: scale(.97); opacity: .55; }
    to { transform: scale(1); opacity: 1; }
}
.fx-pop { animation: fxPop .38s cubic-bezier(.2, 1.2, .5, 1); }

/* 卡片与弹层的入场 */
@keyframes cardIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.card { animation: cardIn .4s ease-out both; }
@keyframes sheetIn { from { transform: translateY(22px); opacity: .9; } to { transform: none; opacity: 1; } }
@keyframes modalCardIn { from { transform: translateY(10px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-body { animation: sheetIn .32s cubic-bezier(.2, .9, .3, 1) both; }
@media (min-width: 760px) { .modal-body { animation: modalCardIn .34s cubic-bezier(.2, 1.12, .4, 1) both; } }

/* ---------- 搜索条 / 分页 ---------- */
.list-bar { display: flex; gap: 8px; align-items: center; margin: 10px 0 0; flex-wrap: wrap; }
.list-bar input {
    flex: 1; min-width: 130px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px;
    background: #fffaf6; font-size: 13px; outline: none; font-family: inherit; color: var(--ink);
}
.list-bar input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(239, 111, 82, .1); }
.list-bar .count { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 12px 0 2px; font-size: 12px; color: var(--muted); }
.pager button {
    padding: 6px 12px; border: 1px solid var(--line); background: #fff; border-radius: 9px;
    color: var(--brand-d); font-size: 12px; font-family: inherit; cursor: pointer;
}
.pager button[disabled] { opacity: .4; cursor: not-allowed; }
.pager .pg-info { min-width: 62px; text-align: center; }

/* ---------- 短码 / 二维码 ---------- */
.dim { color: #b8a99f; }
.qr-panel {
    text-align: center; padding: 16px 14px 18px;
    background: linear-gradient(180deg, #fffaf6, #fff4ec);
    border: 1px solid #f6e2d5; border-radius: 16px;
    box-shadow: inset 0 1px 0 #fff;
}
.qr-code {
    display: inline-block; margin-bottom: 12px; padding: 5px 14px;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 22px; letter-spacing: 3px; font-weight: 800; color: var(--brand-d);
    background: #fff5ef; border: 1px dashed #efcdbd; border-radius: 11px;
}
.qr-box {
    display: inline-flex; padding: 10px; background: #fff;
    border: 1px solid var(--line); border-radius: 12px;
    box-shadow: 0 6px 16px rgba(190, 140, 110, .12);
}
.qr-box canvas, .qr-box img { display: block; border-radius: 6px; }
.qr-meta { margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.qr-link { margin-top: 8px; font-size: 11.5px; color: var(--muted); word-break: break-all; line-height: 1.5; }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
