/* ==========================================================================
   青理 · Qingliu — 记账与消费洞察
   清浅冷调 · 细线 · 轻字重 · 移动优先 + 桌面侧栏布局
   断点：≤768 手机 / 769-1024 平板 / ≥1025 桌面
   ========================================================================== */

:root {
    --ql-bg: #f4f6f8;
    --ql-bg-2: #ffffff;
    --ql-card: #ffffff;
    --ql-soft: #f1f4f7;
    --ql-soft-2: #e9eef2;
    --ql-ink: #1e2935;
    --ql-ink-2: #5a6877;
    --ql-ink-3: #9ba6b2;
    --ql-line: #edf0f3;
    --ql-line-2: #dfe4ea;

    --ql-accent: #3a7d98;
    --ql-accent-2: #2f6a82;
    --ql-accent-soft: #e8f2f5;

    --ql-blue: var(--ql-accent);
    --ql-expense: #1e2935;
    --ql-income: #3a9a8a;
    --ql-need: #4f8fb0;
    --ql-want: #8b8fc4;
    --ql-impulse: #cf6f7e;
    --ql-danger: #c4566a;

    --ql-shadow: 0 1px 2px rgba(20, 35, 50, .035), 0 2px 8px rgba(20, 35, 50, .025);
    --ql-shadow-pop: 0 10px 40px rgba(20, 35, 50, .14);

    --ql-num-font: -apple-system, "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;

    --ql-r: 14px;
    --ql-r-sm: 10px;
    --ql-nav-h: 54px;
    --ql-side-w: 216px;
    --ql-content-w: 1060px;
}

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

html, body { margin: 0; padding: 0; min-height: 100%; }

body.ql-app,
body.ql-auth-body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
    color: var(--ql-ink);
    background: var(--ql-bg) linear-gradient(180deg, #eaf2f5 0, rgba(244, 246, 248, 0) 280px) no-repeat;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button { font-family: inherit; }

/* ---------- App shell ---------- */
body.ql-app { padding-bottom: calc(var(--ql-nav-h) + 20px + env(safe-area-inset-bottom, 0px)); }

.ql-main {
    max-width: 560px;
    margin: 0 auto;
    padding: 14px 16px 8px;
    min-height: 60vh;
}

/* ---------- Side nav (desktop only) ---------- */
.ql-side { display: none; }
.ql-side-brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 22px; }
.ql-side-logo {
    width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%;
    background: var(--ql-accent-soft); color: var(--ql-accent);
    display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.ql-side-brand .bt { font-size: 15px; font-weight: 600; letter-spacing: .5px; }
.ql-side-brand .bs { font-size: 11px; color: var(--ql-ink-3); }
.ql-side-nav { display: flex; flex-direction: column; gap: 2px; }
.ql-side-btn {
    display: flex; align-items: center; gap: 10px;
    height: 36px; padding: 0 10px;
    border: 0; border-radius: 9px;
    background: transparent; color: var(--ql-ink-2);
    font-size: 13.5px; font-weight: 400;
    text-align: left; cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.ql-side-btn i { width: 16px; text-align: center; font-size: 13px; color: var(--ql-ink-3); }
.ql-side-btn:hover { background: var(--ql-soft); }
.ql-side-btn.active { background: var(--ql-accent-soft); color: var(--ql-accent-2); font-weight: 500; }
.ql-side-btn.active i { color: var(--ql-accent); }
.ql-side-sep { height: 1px; margin: 16px 8px; background: var(--ql-line); }
.ql-side-foot {
    margin-top: auto;
    display: flex; align-items: center; gap: 9px;
    padding: 9px 10px;
    background: var(--ql-soft);
    border-radius: 11px;
}
.ql-side-foot .av {
    width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%;
    background: #fff; color: var(--ql-accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 12.5px; font-weight: 500;
}
.ql-side-foot .nm { font-size: 12.5px; font-weight: 500; line-height: 1.3; }
.ql-side-foot .em { font-size: 10.5px; color: var(--ql-ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 110px; }
.ql-side-foot .main { min-width: 0; flex: 1; }

/* ---------- Bottom nav (mobile / tablet) ---------- */
.ql-nav {
    position: fixed; left: 0; right: 0; bottom: 0;
    height: calc(var(--ql-nav-h) + env(safe-area-inset-bottom, 0px));
    padding: 0 max(6px, calc(50% - 270px)) env(safe-area-inset-bottom, 0px);
    display: flex; align-items: center;
    background: rgba(255, 255, 255, .9);
    -webkit-backdrop-filter: saturate(160%) blur(18px);
    backdrop-filter: saturate(160%) blur(18px);
    border-top: 1px solid rgba(20, 35, 50, .06);
    z-index: 60;
}
.ql-nav-btn {
    flex: 1; height: 100%;
    border: 0; background: none;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px;
    color: var(--ql-ink-3);
    font-size: 10px; letter-spacing: .5px;
    cursor: pointer;
    transition: color .15s ease;
}
.ql-nav-btn i { font-size: 16px; transition: transform .2s ease; }
.ql-nav-btn.active { color: var(--ql-accent); }
.ql-nav-btn:active i { transform: scale(.88); }

.ql-nav-add {
    flex: 0 0 40px; width: 40px; height: 40px; margin: 0 12px;
    border: 0; border-radius: 50%;
    background: var(--ql-accent); color: #fff; font-size: 15px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(58, 125, 152, .32);
    transition: transform .22s cubic-bezier(.34, 1.56, .64, 1);
}
.ql-nav-add:active { transform: scale(.9); }

/* ---------- Layout blocks ---------- */
.ql-block { margin-bottom: 18px; }
.ql-cols { display: block; }
.ql-block:last-child { margin-bottom: 0; }

/* ---------- Generic ---------- */
.ql-card {
    background: var(--ql-card);
    border-radius: var(--ql-r);
    box-shadow: var(--ql-shadow);
}
.ql-card-pad { padding: 14px; }

.ql-page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 2px 14px; flex-wrap: wrap; }
.ql-page-title { font-size: 18px; font-weight: 600; letter-spacing: .5px; }
.ql-page-sub { font-size: 11.5px; color: var(--ql-ink-3); margin-top: 1px; }

.ql-sec { margin: 0 4px 8px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ql-sec h3 { margin: 0; font-size: 12.5px; font-weight: 500; color: var(--ql-ink-2); letter-spacing: .5px; }
.ql-sec h3 i { display: none; }
.ql-sec-more { font-size: 12px; color: var(--ql-accent); background: none; border: 0; cursor: pointer; padding: 4px 0; }
.ql-sec-more i { font-size: 9px; margin-left: 2px; }

.ql-muted { color: var(--ql-ink-3); }
.ql-num { font-family: var(--ql-num-font); font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ---------- Month switcher ---------- */
.ql-monthbar { display: flex; align-items: center; gap: 0; }
.ql-month-pill {
    display: inline-flex; align-items: center;
    height: 28px; padding: 0 11px;
    border: 0; border-radius: 999px;
    background: #fff; box-shadow: var(--ql-shadow);
    font-size: 12.5px; font-weight: 500; color: var(--ql-ink);
    cursor: pointer;
}
.ql-month-pill i { display: none; }
.ql-month-nav {
    width: 28px; height: 28px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 50%; background: transparent;
    color: var(--ql-ink-3); cursor: pointer; font-size: 11px;
}
.ql-month-nav:hover:not([disabled]) { color: var(--ql-accent); }
.ql-month-nav:active:not([disabled]) { transform: scale(.9); }
.ql-month-nav[disabled] { opacity: .3; cursor: default; }

/* ---------- Hero（不再是色块，只是一行安静的大数字） ---------- */
.ql-hero { padding: 4px 4px 20px; }
.ql-hero-main { min-width: 0; }
.ql-hero-label { font-size: 12px; color: var(--ql-ink-3); letter-spacing: 1px; }
.ql-hero-label i { display: none; }
.ql-hero-amount {
    font-size: 38px; font-weight: 300; letter-spacing: -.5px;
    line-height: 1.15; margin: 4px 0 0; color: var(--ql-ink);
}
.ql-hero-amount small { font-size: 18px; font-weight: 400; color: var(--ql-ink-3); margin-right: 4px; letter-spacing: 0; }
.ql-hero-foot { display: flex; gap: 0; margin-top: 12px; }
.ql-hero-chip { padding: 0 18px; border-left: 1px solid var(--ql-line-2); }
.ql-hero-chip:first-child { padding-left: 0; border-left: 0; }
.ql-hero-chip span { font-size: 11px; color: var(--ql-ink-3); display: block; }
.ql-hero-chip b { font-size: 14px; font-weight: 500; color: var(--ql-ink-2); }

/* ---------- Necessity bar ---------- */
.ql-necbar { height: 6px; border-radius: 999px; overflow: hidden; display: flex; gap: 2px; background: var(--ql-soft); }
.ql-necbar i { display: block; height: 100%; border-radius: 999px; transition: width .5s cubic-bezier(.22, .68, .32, 1); }
.ql-nec-legend { display: flex; margin-top: 12px; }
.ql-nec-item { flex: 1; }
.ql-nec-item .dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.ql-nec-item .t { font-size: 11px; color: var(--ql-ink-3); display: flex; align-items: center; }
.ql-nec-item .v { font-family: var(--ql-num-font); font-size: 14px; font-weight: 500; margin-top: 2px; }
.ql-nec-item .p { font-size: 10.5px; color: var(--ql-ink-3); }

/* ---------- Spark (daily bars) ---------- */
.ql-spark { display: flex; align-items: flex-end; gap: 2px; height: 56px; }
.ql-spark i {
    flex: 1; min-width: 2px; border-radius: 2px;
    background: #d3e3ea;
    transform-origin: bottom;
    animation: ql-grow .5s cubic-bezier(.22, .68, .32, 1) both;
}
.ql-spark i:hover { background: #a9c9d6; }
.ql-spark i.today { background: var(--ql-accent); }
.ql-spark i.zero { background: var(--ql-line); }
@keyframes ql-grow { from { transform: scaleY(.05); } to { transform: scaleY(1); } }
.ql-spark-axis { display: flex; justify-content: space-between; font-size: 10px; color: var(--ql-ink-3); margin-top: 6px; }

/* ---------- Transaction rows ---------- */
.ql-rows { display: flex; flex-direction: column; }
.ql-row {
    position: relative;
    display: flex; align-items: center; gap: 11px;
    padding: 10px 0;
    cursor: pointer;
    transition: opacity .15s ease;
}
.ql-row + .ql-row::before {
    content: ""; position: absolute; left: 43px; right: 0; top: 0;
    height: 1px; background: var(--ql-line);
}
.ql-row:active { opacity: .6; }
.ql-ico {
    flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 12.5px;
}
.ql-row-main { flex: 1; min-width: 0; }
.ql-row-title { font-size: 14px; display: flex; align-items: center; gap: 6px; }
.ql-row-note { font-size: 11.5px; color: var(--ql-ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ql-row-note:empty { display: none; }
.ql-row-right { text-align: right; }
.ql-amt { font-family: var(--ql-num-font); font-size: 14.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.ql-amt.expense { color: var(--ql-ink); }
.ql-amt.income { color: var(--ql-income); }
.ql-row-time { font-size: 10.5px; color: var(--ql-ink-3); margin-top: 1px; }

.ql-tag {
    display: inline-flex; align-items: center;
    font-size: 10px; font-weight: 400;
    padding: 0 6px; border-radius: 999px; line-height: 16px;
}
.ql-tag-need { color: var(--ql-need); background: rgba(79, 143, 176, .1); }
.ql-tag-want { color: #6f73ad; background: rgba(139, 143, 196, .13); }
.ql-tag-impulse { color: var(--ql-impulse); background: rgba(207, 111, 126, .1); }

/* ---------- Day groups ---------- */
.ql-day { margin-bottom: 14px; }
.ql-day-head {
    display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
    padding: 0 4px 6px;
    font-size: 11.5px; color: var(--ql-ink-3);
}
.ql-day-head .d { font-size: 12.5px; color: var(--ql-ink-2); font-weight: 500; }
.ql-day-head .d small { font-size: 11px; color: var(--ql-ink-3); font-weight: 400; margin-left: 6px; }
.ql-day-head .s { font-family: var(--ql-num-font); font-variant-numeric: tabular-nums; }

/* ---------- Chips ---------- */
.ql-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.ql-chip {
    height: 28px; padding: 0 11px;
    display: inline-flex; align-items: center; gap: 5px;
    border-radius: 999px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--ql-ink-2);
    font-size: 12.5px;
    cursor: pointer; white-space: nowrap;
    transition: background .15s ease, color .15s ease;
}
.ql-chip i { font-size: 10.5px; }
.ql-chip:hover { color: var(--ql-accent); }
.ql-chip.active { background: #fff; color: var(--ql-accent-2); border-color: var(--ql-line-2); }
.ql-scroll-x { display: flex; gap: 2px; overflow-x: auto; padding: 1px 0 4px; scrollbar-width: none; margin: 0 -16px; padding-left: 12px; padding-right: 12px; }
.ql-scroll-x::-webkit-scrollbar { display: none; }

/* ---------- Summary strip（一张卡片里的三栏） ---------- */
.ql-strip {
    display: flex; padding: 12px 0;
    background: #fff; border-radius: var(--ql-r); box-shadow: var(--ql-shadow);
}
.ql-strip-item { flex: 1; padding: 0 14px; min-width: 0; }
.ql-strip-item + .ql-strip-item { border-left: 1px solid var(--ql-line); }
.ql-strip-item span { font-size: 11px; color: var(--ql-ink-3); display: block; }
.ql-strip-item b { font-family: var(--ql-num-font); font-size: 15px; font-weight: 500; display: block; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ql-strip-item.income b { color: var(--ql-income); }

/* ---------- Stats ---------- */
.ql-tile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.ql-tile { background: #fff; border-radius: 12px; padding: 11px 13px; box-shadow: var(--ql-shadow); }
.ql-tile span { font-size: 11px; color: var(--ql-ink-3); }
.ql-tile b { display: block; font-family: var(--ql-num-font); font-size: 16px; font-weight: 500; margin-top: 2px; }
.ql-tile b i { font-size: 11px; color: var(--ql-ink-3); font-weight: 400; font-style: normal; }

.ql-legend { display: flex; gap: 12px; font-size: 11px; color: var(--ql-ink-3); }
.ql-legend span { display: inline-flex; align-items: center; gap: 5px; }
.ql-legend i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

.ql-rank { display: flex; flex-direction: column; }
.ql-rank-row { display: flex; align-items: center; gap: 11px; padding: 8px 0; }
.ql-rank-ico { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.ql-rank-main { flex: 1; min-width: 0; }
.ql-rank-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.ql-rank-top .amt { font-family: var(--ql-num-font); font-weight: 500; font-variant-numeric: tabular-nums; }
.ql-rank-bar { height: 3px; border-radius: 999px; background: var(--ql-soft); margin-top: 6px; overflow: hidden; }
.ql-rank-bar i { display: block; height: 100%; border-radius: 999px; transition: width .5s ease; opacity: .85; }
.ql-rank-meta { font-size: 10.5px; color: var(--ql-ink-3); margin-top: 3px; }

.ql-chart-center { display: flex; flex-direction: column; align-items: center; }
.ql-donut-wrap { position: relative; display: inline-flex; width: 100%; max-width: 148px; margin: 0 auto; }
.ql-donut-wrap svg { width: 100%; height: auto; display: block; }
.ql-donut-center {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; pointer-events: none;
}
.ql-donut-center b { font-family: var(--ql-num-font); font-size: 16px; font-weight: 500; }
.ql-donut-center span { font-size: 10.5px; color: var(--ql-ink-3); }

.ql-nec-tiles { display: grid; grid-template-columns: repeat(3, 1fr); }
.ql-nec-tile { padding: 2px 0 0 12px; border-left: 1px solid var(--ql-line); }
.ql-nec-tile:first-child { padding-left: 0; border-left: 0; }
.ql-nec-tile .t { font-size: 11.5px; display: flex; align-items: center; gap: 5px; }
.ql-nec-tile .t i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.ql-nec-tile .v { font-family: var(--ql-num-font); font-size: 15px; font-weight: 500; margin-top: 3px; color: var(--ql-ink); }
.ql-nec-tile .p { font-size: 10.5px; margin-top: 1px; color: var(--ql-ink-3); }

/* ---------- Buttons ---------- */
.ql-btn {
    height: 42px;
    padding: 0 18px;
    border: 0; border-radius: 11px;
    font-size: 14px; font-weight: 500;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    transition: transform .15s ease, background .15s ease, opacity .15s ease;
}
.ql-btn:active { transform: scale(.98); opacity: .9; }
.ql-btn-block { width: 100%; }
.ql-btn-primary { background: var(--ql-accent); color: #fff; }
.ql-btn-primary:hover { background: var(--ql-accent-2); }
.ql-btn-ghost { background: var(--ql-soft); color: var(--ql-ink-2); }
.ql-btn-danger { background: #fbf1f3; color: var(--ql-danger); }
.ql-btn-sm { height: 32px; font-size: 13px; padding: 0 12px; border-radius: 9px; }

.ql-link-danger {
    display: block; margin: 14px auto 0; padding: 4px 8px;
    border: 0; background: none; cursor: pointer;
    color: var(--ql-ink-3); font-size: 12px;
}
.ql-link-danger:hover { color: var(--ql-danger); }

/* ---------- Inputs ---------- */
.ql-input, .ql-select, .ql-textarea {
    width: 100%;
    height: 42px;
    padding: 0 13px;
    border: 1px solid var(--ql-line-2);
    border-radius: 10px;
    background: #fff;
    font-size: 14px; color: var(--ql-ink); font-family: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.ql-textarea { height: auto; padding: 10px 13px; resize: vertical; min-height: 64px; }
.ql-input:focus, .ql-select:focus, .ql-textarea:focus {
    outline: none; border-color: var(--ql-accent);
    box-shadow: 0 0 0 3px rgba(58, 125, 152, .1);
}
.ql-input::placeholder { color: #b8c0c9; }
.ql-field { margin-bottom: 14px; }
.ql-label { font-size: 11.5px; color: var(--ql-ink-3); margin-bottom: 6px; display: block; letter-spacing: .5px; }

/* ---------- Sheet / Dialog ---------- */
.ql-sheet-wrap { position: fixed; inset: 0; z-index: 200; pointer-events: none; }
.ql-sheet-wrap.open { pointer-events: auto; }
.ql-sheet-mask {
    position: absolute; inset: 0;
    background: rgba(20, 32, 44, .32);
    opacity: 0; transition: opacity .25s ease;
}
.ql-sheet-wrap.open .ql-sheet-mask { opacity: 1; }
.ql-sheet {
    position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 100%);
    width: 100%; max-width: 520px;
    max-height: 94vh;
    background: #fff;
    border-radius: 18px 18px 0 0;
    box-shadow: var(--ql-shadow-pop);
    transition: transform .32s cubic-bezier(.22, .68, .32, 1);
    display: flex; flex-direction: column;
    overflow: hidden;
}
.ql-sheet-wrap.open .ql-sheet { transform: translate(-50%, 0); }
.ql-sheet-grip { padding: 7px 0 0; display: flex; justify-content: center; }
.ql-sheet-grip i { width: 34px; height: 4px; border-radius: 999px; background: #e3e7ec; }
.ql-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px 6px 18px; }
.ql-sheet-title { font-size: 15px; font-weight: 600; letter-spacing: .5px; }
.ql-sheet-close {
    width: 30px; height: 30px; border-radius: 50%;
    border: 0; background: transparent; color: var(--ql-ink-3);
    cursor: pointer; font-size: 15px;
}
.ql-sheet-close:hover { background: var(--ql-soft); color: var(--ql-ink-2); }
.ql-sheet-body { padding: 4px 18px 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.ql-sheet-foot {
    padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--ql-line);
}
.ql-sheet-foot.keys { background: #f5f7f9; padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)); border-top: 0; }

/* ---------- 记一笔：金额 + 键盘 ---------- */
.ql-tx-top { display: flex; justify-content: center; margin-bottom: 4px; }
.ql-amt-display {
    display: flex; align-items: baseline; gap: 6px;
    padding: 10px 2px 12px;
    border-bottom: 1px solid var(--ql-line);
    margin-bottom: 14px;
}
.ql-amt-display .cur { font-size: 17px; color: var(--ql-ink-3); }
.ql-amt-display .val {
    font-family: var(--ql-num-font); font-size: 32px; font-weight: 300;
    letter-spacing: -.3px; line-height: 1.1; color: var(--ql-ink);
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ql-amt-display .val.ph { color: #c9d0d7; }
.ql-amt-display .val::after {
    content: ""; display: inline-block; width: 1.5px; height: .85em;
    margin-left: 3px; vertical-align: -2px;
    background: var(--ql-accent); animation: ql-caret 1.1s steps(1) infinite;
}
.ql-amt-display.income .val { color: var(--ql-income); }
.ql-amt-display .calc { margin-left: auto; font-family: var(--ql-num-font); font-size: 12.5px; color: var(--ql-ink-3); white-space: nowrap; }
@keyframes ql-caret { 50% { opacity: 0; } }

.ql-keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ql-key {
    height: 46px; border: 0; border-radius: 10px;
    background: #fff; color: var(--ql-ink);
    font-family: var(--ql-num-font); font-size: 20px; font-weight: 400;
    box-shadow: 0 1px 0 rgba(20, 35, 50, .07);
    cursor: pointer; user-select: none;
    transition: background .1s ease, transform .1s ease;
}
.ql-key:active { background: var(--ql-soft-2); transform: scale(.97); }
.ql-key.op { color: var(--ql-accent); font-size: 21px; }
.ql-key.fn { font-family: inherit; font-size: 14px; color: var(--ql-ink-2); }
.ql-key.fn i { font-size: 17px; }
.ql-key.save { font-family: inherit; background: var(--ql-accent); color: #fff; font-size: 15px; font-weight: 500; box-shadow: none; }
.ql-key.save:active { background: var(--ql-accent-2); }
.ql-key.span2 { grid-column: span 2; }

/* segmented control */
.ql-seg { display: inline-flex; background: var(--ql-soft); border-radius: 9px; padding: 2px; gap: 2px; }
.ql-seg button {
    height: 28px; padding: 0 16px; border: 0; background: none; border-radius: 7px;
    font-size: 13px; color: var(--ql-ink-2);
    cursor: pointer; transition: background .15s ease, color .15s ease;
}
.ql-seg button.active { background: #fff; color: var(--ql-ink); font-weight: 500; box-shadow: 0 1px 2px rgba(20, 35, 50, .08); }
.ql-seg-sm button { height: 26px; padding: 0 13px; font-size: 12.5px; }

/* category picker grid */
.ql-cat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px 4px; }
.ql-cat-cell {
    border: 0; background: none; padding: 0;
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    cursor: pointer;
}
.ql-cat-cell .ico {
    width: 38px; height: 38px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 14px;
    background: var(--ql-soft); color: var(--ql-ink-2);
    transition: background .18s ease, color .18s ease, transform .2s cubic-bezier(.34, 1.56, .64, 1);
}
.ql-cat-cell .nm { font-size: 11px; color: var(--ql-ink-3); }
.ql-cat-cell.active .ico { transform: scale(1.06); }
.ql-cat-cell.active .nm { color: var(--ql-ink); font-weight: 500; }
.ql-cat-cell:active .ico { transform: scale(.92); }
.ql-cat-cell.add .ico { background: transparent; border: 1px dashed var(--ql-line-2); color: var(--ql-ink-3); font-size: 12px; }

/* necessity pills */
.ql-pills { display: flex; gap: 6px; margin-top: 16px; }
.ql-pill {
    display: inline-flex; align-items: center; gap: 5px;
    height: 28px; padding: 0 12px;
    border: 1px solid var(--ql-line-2); border-radius: 999px;
    background: #fff; color: var(--ql-ink-2);
    font-size: 12px; cursor: pointer;
    transition: all .15s ease;
}
.ql-pill i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }

/* time + note */
.ql-tx-meta { display: flex; gap: 8px; margin-top: 12px; }
.ql-meta {
    display: flex; align-items: center; gap: 7px;
    height: 34px; padding: 0 11px;
    background: var(--ql-soft); border-radius: 9px;
    color: var(--ql-ink-3); font-size: 11px;
    flex: 0 0 auto; min-width: 0;
}
.ql-meta.grow { flex: 1; }
.ql-meta input {
    border: 0; background: transparent; padding: 0;
    font-family: inherit; font-size: 12.5px; color: var(--ql-ink-2);
    min-width: 0; width: 100%;
}
.ql-meta input:focus { outline: none; }
.ql-meta input::placeholder { color: #b8c0c9; }
.ql-meta input[type="datetime-local"] { width: 148px; }

/* ---------- Empty ---------- */
.ql-empty { text-align: center; padding: 26px 16px; color: var(--ql-ink-3); }
.ql-empty-ico {
    width: 42px; height: 42px; margin: 0 auto 10px;
    border-radius: 50%; background: var(--ql-accent-soft);
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; color: var(--ql-accent);
}
.ql-empty b { display: block; color: var(--ql-ink-2); font-size: 13px; font-weight: 500; margin-bottom: 3px; }
.ql-empty p { margin: 0; font-size: 11.5px; }

/* ---------- Profile ---------- */
.ql-profile-hero {
    display: flex; align-items: center; gap: 12px;
    padding: 16px; border-radius: var(--ql-r);
    background: #fff; box-shadow: var(--ql-shadow);
    margin-bottom: 18px;
}
.ql-avatar {
    width: 44px; height: 44px; border-radius: 50%; flex: 0 0 44px;
    background: var(--ql-accent-soft);
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; font-weight: 500; color: var(--ql-accent);
}
.ql-profile-hero .nm { font-size: 15.5px; font-weight: 600; }
.ql-profile-hero .em { font-size: 11.5px; color: var(--ql-ink-3); margin-top: 1px; }

.ql-list { display: flex; flex-direction: column; border-radius: var(--ql-r); overflow: hidden; box-shadow: var(--ql-shadow); background: #fff; }
.ql-list-item {
    position: relative;
    display: flex; align-items: center; gap: 11px;
    padding: 12px 14px; background: #fff;
    cursor: pointer; color: var(--ql-ink); text-decoration: none;
    transition: background .15s ease;
}
.ql-list-item + .ql-list-item::before {
    content: ""; position: absolute; left: 53px; right: 0; top: 0; height: 1px; background: var(--ql-line);
}
.ql-list-item:active { background: var(--ql-soft); }
.ql-list-item .ico {
    width: 28px; height: 28px; border-radius: 8px; flex: 0 0 28px;
    display: flex; align-items: center; justify-content: center;
    background: var(--ql-accent-soft); color: var(--ql-accent); font-size: 12px;
}
.ql-list-item .tx { flex: 1; font-size: 14px; }
.ql-list-item .tx small { display: block; font-size: 11px; color: var(--ql-ink-3); }
.ql-list-item .ar { color: #c4cbd3; font-size: 10px; }

.ql-product-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.ql-product {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; background: #fff;
    border-radius: 12px; box-shadow: var(--ql-shadow);
    text-decoration: none; color: var(--ql-ink);
    transition: transform .15s ease;
}
.ql-product:active { transform: scale(.98); }
.ql-product .ico { width: 28px; height: 28px; border-radius: 50%; flex: 0 0 28px; display: flex; align-items: center; justify-content: center; font-size: 11.5px; }
.ql-product .nm { font-size: 13px; font-weight: 500; }
.ql-product .ds { font-size: 10.5px; color: var(--ql-ink-3); }

/* ---------- Category manager ---------- */
.ql-cat-manage-row { position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 0; }
.ql-cat-manage-row + .ql-cat-manage-row::before { content: ""; position: absolute; left: 43px; right: 0; top: 0; height: 1px; background: var(--ql-line); }
.ql-cat-manage-row .nm { flex: 1; font-size: 14px; }
.ql-icon-btn {
    width: 30px; height: 30px; border-radius: 8px; border: 0; cursor: pointer;
    background: transparent; color: var(--ql-ink-3); font-size: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .15s ease, color .15s ease;
}
.ql-icon-btn:hover { background: var(--ql-soft); color: var(--ql-accent); }
.ql-icon-btn.danger:hover { background: #fbf1f3; color: var(--ql-danger); }

.ql-swatches { display: flex; flex-wrap: wrap; gap: 12px; }
.ql-swatch { width: 24px; height: 24px; border-radius: 50%; cursor: pointer; transition: transform .15s ease; }
.ql-swatch:hover { transform: scale(1.1); }
.ql-swatch.active { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--ql-ink-2); }
.ql-icon-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.ql-icon-grid button {
    aspect-ratio: 1; border: 0; background: var(--ql-soft); border-radius: 50%;
    color: var(--ql-ink-2); font-size: 13px; cursor: pointer; transition: all .15s ease;
}
.ql-icon-grid button:hover { color: var(--ql-accent); }
.ql-icon-grid button.active { background: var(--ql-accent); color: #fff; }

/* ---------- Login ---------- */
body.ql-auth-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 24px 18px;
}
.ql-auth-glow { display: none; }
.ql-auth-card {
    width: 100%; max-width: 360px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(20, 35, 50, .04), 0 12px 40px rgba(20, 35, 50, .07);
    padding: 30px 24px 22px;
}
.ql-auth-brand { text-align: center; margin-bottom: 20px; }
.ql-auth-icon {
    width: 46px; height: 46px; margin: 0 auto 10px;
    border-radius: 50%; background: var(--ql-accent-soft); color: var(--ql-accent);
    display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.ql-auth-brand h1 { margin: 0; font-size: 21px; font-weight: 600; letter-spacing: 2px; }
.ql-auth-brand p { margin: 4px 0 0; font-size: 12px; color: var(--ql-ink-3); }
.ql-auth-title { margin: 0 0 3px; font-size: 14.5px; font-weight: 500; text-align: center; }
.ql-auth-sub { margin: 0 0 16px; font-size: 11.5px; color: var(--ql-ink-3); text-align: center; }
.ql-auth-form { display: flex; flex-direction: column; gap: 10px; }
.ql-auth-form .ql-btn { margin-top: 4px; }
.ql-auth-switch { text-align: center; font-size: 12.5px; color: var(--ql-ink-3); margin: 16px 0 0; }
.ql-auth-switch a { color: var(--ql-accent); text-decoration: none; }

/* ==========================================================================
   平板 769-1024
   ========================================================================== */
@media (min-width: 769px) {
    .ql-main { max-width: 760px; padding: 24px 24px 10px; }
    .ql-hero-amount { font-size: 44px; }
    .ql-cat-grid { grid-template-columns: repeat(6, 1fr); }
    .ql-tile-grid { grid-template-columns: repeat(4, 1fr); }
    .ql-icon-grid { grid-template-columns: repeat(8, 1fr); }
    .ql-donut-wrap { max-width: 168px; }
    .ql-scroll-x { margin: 0; padding-left: 0; padding-right: 0; }

    /* 弹层改为居中对话框 */
    .ql-sheet {
        top: 50%; bottom: auto; left: 50%;
        width: min(460px, calc(100% - 64px));
        max-height: min(90vh, 820px);
        border-radius: 16px;
        transform: translate(-50%, -47%) scale(.98);
        opacity: 0;
        transition: transform .28s cubic-bezier(.22, .68, .32, 1), opacity .22s ease;
    }
    .ql-sheet-wrap.open .ql-sheet { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    .ql-sheet-grip { display: none; }
    .ql-sheet-head { padding: 14px 14px 6px 22px; }
    .ql-sheet-body { padding: 4px 22px 18px; }
    .ql-sheet-foot { padding: 12px 22px 16px; }
    .ql-sheet-foot.keys { padding: 10px; }
    .ql-key { height: 42px; }
}

/* ==========================================================================
   桌面 ≥1025
   ========================================================================== */
@media (min-width: 1025px) {
    body.ql-app { padding-left: var(--ql-side-w); padding-bottom: 36px; }

    .ql-nav { display: none; }

    .ql-side {
        display: flex; flex-direction: column;
        position: fixed; top: 0; left: 0; bottom: 0;
        width: var(--ql-side-w);
        padding: 24px 14px 16px;
        background: rgba(255, 255, 255, .8);
        -webkit-backdrop-filter: blur(16px);
        backdrop-filter: blur(16px);
        border-right: 1px solid var(--ql-line);
        z-index: 70;
    }
    .ql-side-add { margin-top: 16px; height: 36px; font-size: 13px; border-radius: 9px; }

    .ql-main { max-width: var(--ql-content-w); padding: 30px 34px 10px; }
    .ql-main[data-page="ledger"] { max-width: 780px; }

    .ql-page-title { font-size: 20px; }

    .ql-hero { display: flex; align-items: flex-end; gap: 40px; padding: 4px 4px 24px; }
    .ql-hero-amount { font-size: 48px; }
    .ql-hero-foot { margin: 0 0 6px; }

    .ql-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; align-items: start; }
    .ql-cols.ql-cols-l { grid-template-columns: 1.1fr .9fr; }
    .ql-block { margin-bottom: 22px; }
    .ql-block-wide { grid-column: 1 / -1; }

    .ql-card-pad { padding: 16px 18px; }
    .ql-spark { height: 72px; }
    .ql-row:hover { opacity: .75; }
    .ql-list-item:hover { background: var(--ql-soft); }
    .ql-product:hover { box-shadow: 0 2px 12px rgba(20, 35, 50, .07); }
}

@media (max-width: 360px) {
    .ql-hero-amount { font-size: 32px; }
    .ql-cat-grid { grid-template-columns: repeat(4, 1fr); }
    .ql-key { height: 42px; }
    .ql-meta input[type="datetime-local"] { width: 128px; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
