/* ==========================================================================
   记账系统样式表
   移动优先；<640 手机 / 640–1023 平板 / >=1024 桌面
   主色、主题模式由后台配置注入，全站无外部资源引用
   ========================================================================== */

:root {
    --primary: #19a7f0;
    --primary-strong: #0d7fc0;
    --primary-soft: #e8f5fe;
    --bg: #eef4fa;
    --surface: #ffffff;
    --surface-2: #f6fafd;
    --surface-3: #eaf1f8;
    --text: #1f2d3d;
    --text-soft: #40566e;
    --muted: #6b7c93;
    --line: #e3edf7;
    --line-strong: #d2e2f0;
    --income: #1f9d6b;
    --expense: #e05563;
    --income-soft: #e6f7ef;
    --expense-soft: #fdecee;
    --warning: #c78a16;
    --warning-soft: #fdf5e3;
    --danger: #d64550;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 8px;
    --shadow-sm: 0 2px 8px rgba(24, 89, 138, 0.05);
    --shadow: 0 8px 24px rgba(24, 89, 138, 0.08);
    --header-h: 58px;
    --nav-h: 62px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    /* 前台在 app-v2 / auth-body 上统一加 2px；后台保持 0px。 */
    --font-boost: 0px;
    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #0e1721;
    --surface: #16222e;
    --surface-2: #1b2a37;
    --surface-3: #21313f;
    --text: #e8eef5;
    --text-soft: #c7d4e0;
    --muted: #8fa3b6;
    --line: #243545;
    --line-strong: #2e4356;
    --primary-soft: #173447;
    --income: #4cc796;
    --expense: #ff7b86;
    --income-soft: #16382e;
    --expense-soft: #3a2026;
    --warning: #e2b355;
    --warning-soft: #3a2f18;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    [data-theme="auto"] {
        --bg: #0e1721;
        --surface: #16222e;
        --surface-2: #1b2a37;
        --surface-3: #21313f;
        --text: #e8eef5;
        --text-soft: #c7d4e0;
        --muted: #8fa3b6;
        --line: #243545;
        --line-strong: #2e4356;
        --primary-soft: #173447;
        --income: #4cc796;
        --expense: #ff7b86;
        --income-soft: #16382e;
        --expense-soft: #3a2026;
        --warning: #e2b355;
        --warning-soft: #3a2f18;
        --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
        --shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
        color-scheme: dark;
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    /* 预留滚动条宽度，避免“记一笔”等短页面与主页/报表出现水平位移。 */
    scrollbar-gutter: stable;
}

@supports not (scrollbar-gutter: stable) {
    html {
        overflow-y: scroll;
    }
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: calc(15px + var(--font-boost, 0px));
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* 登录、注册、找回密码等前台认证页也统一加 2px。 */
body.auth-body {
    --font-boost: 2px;
}

body::before {
    content: "";
    position: fixed;
    inset: 0 0 auto 0;
    height: 220px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 16%, var(--bg)) 0%, var(--bg) 100%);
    z-index: -1;
    pointer-events: none;
}

a {
    color: var(--primary-strong);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: calc(0.86em + var(--font-boost, 0px));
    background: var(--surface-3);
    padding: 1px 5px;
    border-radius: 5px;
}

svg {
    width: 20px;
    height: 20px;
    flex: none;
}

.icon {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

h1, h2, h3, h4, p, dl, dd, ul, ol {
    margin: 0;
}

ul, ol {
    padding: 0;
    list-style: none;
}

button {
    font: inherit;
    color: inherit;
}

[hidden] {
    display: none !important;
}

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

.app-main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.sidebar {
    display: none;
    position: fixed;
    inset: 0 auto 0 0;
    width: 238px;
    padding: 20px 14px;
    background: var(--surface);
    border-right: 1px solid var(--line);
    flex-direction: column;
    gap: 18px;
    z-index: 30;
    overflow-y: auto;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px;
    font-weight: 700;
    font-size: calc(17px + var(--font-boost, 0px));
    color: var(--text);
    letter-spacing: 0.2px;
}

.sidebar__brand:hover {
    text-decoration: none;
}

.sidebar__brand img {
    border-radius: 9px;
}

.sidebar__section {
    padding: 6px 10px;
    font-size: calc(12px + var(--font-boost, 0px));
    letter-spacing: 0.12em;
    color: var(--muted);
    text-transform: uppercase;
}

.nav-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-soft);
    font-size: calc(14.5px + var(--font-boost, 0px));
    font-weight: 500;
    border: 0;
    background: none;
    width: 100%;
    cursor: pointer;
    text-align: left;
}

.sidebar:not(.sidebar--admin) .nav-item {
    justify-content: center;
}

.nav-item:hover {
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
}

.nav-item.is-active {
    background: color-mix(in srgb, var(--primary) 12%, var(--surface));
    color: var(--primary-strong);
    font-weight: 600;
}

[data-theme="dark"] .nav-item.is-active {
    color: var(--primary);
}

.nav-item--button {
    font: inherit;
}

.nav-divider {
    height: 1px;
    margin: 8px 6px;
    background: var(--line);
}

.nav-exit {
    margin-top: 4px;
}

.sidebar__foot {
    margin-top: auto;
    padding: 10px 4px 0;
    border-top: 1px solid var(--line);
}

.sidebar__copy {
    margin-top: 8px;
    font-size: calc(11.5px + var(--font-boost, 0px));
    color: var(--muted);
    text-align: center;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--header-h);
    padding: 0 14px;
    padding-top: env(safe-area-inset-top, 0px);
    background: linear-gradient(135deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 70%, #0b5f8f) 100%);
    color: #fff;
    box-shadow: 0 2px 12px rgba(13, 92, 140, 0.18);
}

.topbar__brand {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #fff;
    font-weight: 600;
    font-size: calc(14px + var(--font-boost, 0px));
    min-width: 0;
}

.topbar__brand:hover {
    text-decoration: none;
}

.topbar__brand img {
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.16);
    padding: 2px;
}

.topbar__brand span {
    display: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar__title {
    font-size: calc(17px + var(--font-boost, 0px));
    font-weight: 700;
    letter-spacing: 0.3px;
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.topbar .icon-btn,
.topbar .avatar {
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
}

.topbar .icon-btn:hover,
.topbar .avatar:hover {
    background: rgba(255, 255, 255, 0.26);
}

.avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 0;
    font-size: calc(14px + var(--font-boost, 0px));
    font-weight: 700;
    cursor: pointer;
}

.dropdown {
    position: relative;
}

.dropdown__menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 208px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    color: var(--text);
    display: none;
    z-index: 40;
}

.dropdown.is-open .dropdown__menu {
    display: block;
}

.dropdown__head {
    display: flex;
    flex-direction: column;
    padding: 8px 10px 10px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 6px;
}

.dropdown__head small {
    color: var(--muted);
}

.dropdown__menu a,
.dropdown__menu button {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    background: none;
    border-radius: 9px;
    color: var(--text-soft);
    font-size: calc(14px + var(--font-boost, 0px));
    text-align: left;
    cursor: pointer;
}

.dropdown__menu a:hover,
.dropdown__menu button:hover {
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
}

.dropdown__menu svg {
    width: 18px;
    height: 18px;
    color: var(--muted);
}

.page {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 16px 14px 110px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
}

.page-foot {
    display: none;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px 24px;
    color: var(--muted);
    font-size: calc(12px + var(--font-boost, 0px));
    gap: 6px;
    flex-wrap: wrap;
}

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 6px 4px calc(6px + var(--safe-bottom));
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
}

.bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 5px 2px;
    color: var(--muted);
    font-size: calc(10.5px + var(--font-boost, 0px));
    min-height: 48px;
    border-radius: 10px;
}

.bottom-nav__item svg {
    width: 21px;
    height: 21px;
}

.bottom-nav__item.is-active {
    color: var(--primary-strong);
}

[data-theme="dark"] .bottom-nav__item.is-active {
    color: var(--primary);
}

.bottom-nav__item:hover {
    text-decoration: none;
}

.admin-mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    padding: 6px 4px calc(6px + var(--safe-bottom));
    background: var(--surface);
    border-top: 1px solid var(--line);
}

.admin-mobile-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 5px;
    font-size: calc(10.5px + var(--font-boost, 0px));
    color: var(--muted);
}

.admin-mobile-nav__item.is-active {
    color: var(--primary-strong);
}

.admin-mobile-nav__item:hover {
    text-decoration: none;
}

/* ---------- 通用组件 ---------- */
.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 4px;
}

.page-title {
    font-size: calc(21px + var(--font-boost, 0px));
    font-weight: 700;
    letter-spacing: 0.2px;
}

.page-sub {
    margin-top: 3px;
    font-size: calc(12.5px + var(--font-boost, 0px));
    color: var(--muted);
}

.page-head__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.save-filter .input {
    width: 132px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px 10px;
    flex-wrap: wrap;
}

.card__title {
    font-size: calc(15.5px + var(--font-boost, 0px));
    font-weight: 700;
}

.card__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 15px 16px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.card__summary::-webkit-details-marker {
    display: none;
}

.card__summary::after {
    content: "＋";
    color: var(--muted);
    font-weight: 500;
}

.card--collapsible[open] .card__summary::after {
    content: "－";
}

.card__body {
    padding: 6px 16px 16px;
}

.card__body--flush {
    padding: 0;
}

.card--danger-zone {
    border-color: color-mix(in srgb, var(--danger) 26%, var(--line));
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 15px;
    min-height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: var(--surface-2);
    color: var(--text);
    font-size: calc(14px + var(--font-boost, 0px));
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
    text-decoration: none;
}

.btn svg {
    width: 17px;
    height: 17px;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn--primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 32%, transparent);
}

.btn--primary:hover {
    background: color-mix(in srgb, var(--primary) 88%, #000);
}

.btn--ghost {
    background: var(--surface);
    border-color: var(--line-strong);
    color: var(--text-soft);
}

.btn--ghost:hover {
    background: var(--surface-2);
}

.btn--danger {
    background: var(--danger);
    color: #fff;
}

.btn--success {
    background: var(--income);
    color: #fff;
}

.btn--sm {
    min-height: 34px;
    padding: 7px 12px;
    font-size: calc(13px + var(--font-boost, 0px));
}

.btn--xs {
    min-height: 28px;
    padding: 4px 9px;
    font-size: calc(12px + var(--font-boost, 0px));
    border-radius: 8px;
}

.btn--lg {
    min-height: 46px;
    font-size: calc(15.5px + var(--font-boost, 0px));
}

.btn--block {
    width: 100%;
}

.btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 0;
    background: var(--surface-2);
    color: var(--text-soft);
    cursor: pointer;
    flex: none;
    text-decoration: none;
}

.icon-btn:hover {
    background: var(--surface-3);
    text-decoration: none;
}

.icon-btn svg {
    width: 19px;
    height: 19px;
}

.icon-btn--sm {
    width: 30px;
    height: 30px;
    border-radius: 8px;
}

.icon-btn--sm svg {
    width: 16px;
    height: 16px;
}

.icon-btn--danger {
    color: var(--danger);
}

.link {
    color: var(--primary-strong);
    font-weight: 600;
    font-size: calc(13.5px + var(--font-boost, 0px));
    cursor: pointer;
}

[data-theme="dark"] .link {
    color: var(--primary);
}

.hint {
    color: var(--muted);
    font-size: calc(12px + var(--font-boost, 0px));
    line-height: 1.5;
}

.nowrap {
    white-space: nowrap;
}

.wrap {
    max-width: 360px;
    word-break: break-word;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--text-soft);
    font-size: calc(11.5px + var(--font-boost, 0px));
    font-weight: 600;
}

.badge--primary {
    background: var(--primary-soft);
    color: var(--primary-strong);
}

.badge--success {
    background: var(--income-soft);
    color: var(--income);
}

.badge--danger {
    background: var(--expense-soft);
    color: var(--expense);
}

.badge--muted {
    background: var(--bg-sunken);
    color: var(--text-soft);
}

.callout {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: calc(13px + var(--font-boost, 0px));
    line-height: 1.6;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text-soft);
}

.callout--info {
    background: var(--primary-soft);
    border-color: color-mix(in srgb, var(--primary) 22%, var(--line));
}

.callout--warning {
    background: var(--warning-soft);
    border-color: color-mix(in srgb, var(--warning) 26%, var(--line));
    color: color-mix(in srgb, var(--warning) 72%, var(--text));
}

.callout--danger {
    background: var(--expense-soft);
    border-color: color-mix(in srgb, var(--danger) 26%, var(--line));
    color: color-mix(in srgb, var(--danger) 70%, var(--text));
}

.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 34px 16px;
    text-align: center;
}

.empty__icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--primary);
    margin-bottom: 4px;
}

.empty__icon svg {
    width: 26px;
    height: 26px;
}

.empty__title {
    font-weight: 700;
    font-size: calc(15px + var(--font-boost, 0px));
}

.empty__text {
    color: var(--muted);
    font-size: calc(13px + var(--font-boost, 0px));
    max-width: 320px;
}

.empty__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 6px;
}

.empty--sm {
    padding: 22px 12px;
}

/* ---------- 表单 ---------- */
.form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.field__label {
    font-size: calc(13px + var(--font-boost, 0px));
    font-weight: 600;
    color: var(--text-soft);
}

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.field-grid--3 {
    grid-template-columns: repeat(3, 1fr);
}

.input,
.select,
.textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: calc(15px + var(--font-boost, 0px));
    outline: none;
    transition: border 0.15s ease, box-shadow 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.select {
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 17px) 19px, calc(100% - 12px) 19px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 34px;
}

.input:focus,
.select:focus,
.textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}

.input--sm,
.select--sm {
    min-height: 34px;
    padding: 5px 10px;
    font-size: calc(13px + var(--font-boost, 0px));
}

.select--sm {
    padding-right: 30px;
    background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px;
}

.input--color {
    padding: 3px;
    width: 54px;
    min-height: 40px;
    cursor: pointer;
}

.input[type="date"],
.input[type="time"] {
    min-height: 42px;
}

.input-group {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.input-group .input {
    flex: 1;
}

.input-group__btn {
    display: grid;
    place-items: center;
    width: 44px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    border-radius: var(--radius-sm);
    color: var(--muted);
    cursor: pointer;
    flex: none;
}

.input-group .btn {
    flex: none;
}

.form-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.form-row--between {
    justify-content: space-between;
}

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: calc(13px + var(--font-boost, 0px));
    color: var(--text-soft);
    cursor: pointer;
}

.check input {
    width: 17px;
    height: 17px;
    accent-color: var(--primary);
}

.form-error {
    margin: 0;
    padding: 9px 12px;
    border-radius: 9px;
    background: var(--expense-soft);
    color: var(--danger);
    font-size: calc(13px + var(--font-boost, 0px));
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 16px 16px;
}

.form--inline {
    gap: 12px;
}

.form--sheet {
    padding: 0 16px 16px;
    overflow-y: auto;
}

.form__actions {
    display: flex;
    gap: 9px;
    margin-top: 4px;
}

.form__actions .btn {
    flex: 1;
}

.form__actions .btn--ghost {
    flex: none;
    min-width: 88px;
}

.switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.switch__track {
    position: relative;
    width: 44px;
    height: 26px;
    border-radius: 999px;
    background: var(--line-strong);
    transition: background 0.18s ease;
    flex: none;
}

.switch__track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.18s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.switch input:checked + .switch__track {
    background: var(--primary);
}

.switch input:checked + .switch__track::after {
    transform: translateX(18px);
}

.switch__label {
    font-size: calc(14px + var(--font-boost, 0px));
    font-weight: 600;
}

.field--switch {
    padding: 4px 0 8px;
    border-bottom: 1px dashed var(--line);
}

.color-field {
    display: flex;
    gap: 8px;
    align-items: center;
}

.color-field .input:last-child {
    flex: 1;
    background: var(--surface-2);
}

/* ---------- 分段 / 标签 ---------- */
.segmented {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    background: var(--surface-3);
    border-radius: 11px;
}

.segmented--full {
    display: flex;
    width: 100%;
    margin-bottom: 4px;
}

.segmented__item {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border: 0;
    background: none;
    border-radius: 9px;
    font-size: calc(13.5px + var(--font-boost, 0px));
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    min-height: 34px;
    white-space: nowrap;
}

.segmented__item.is-active {
    background: var(--surface);
    color: var(--primary-strong);
    box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .segmented__item.is-active {
    color: var(--primary);
}

.chips {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chips__label {
    font-size: calc(11.5px + var(--font-boost, 0px));
    color: var(--muted);
    letter-spacing: 0.04em;
    margin-top: 2px;
}

.chips__row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    font-size: calc(13px + var(--font-boost, 0px));
    color: var(--text-soft);
    cursor: pointer;
    min-height: 36px;
}

.chip input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

/* 选项 input 是视觉隐藏而非 display:none，必须留在 Tab 序里；焦点环画在 label 上才看得见。 */
.chip:has(input:focus-visible),
.icon-picker__item:has(input:focus-visible),
.type-toggle__item:has(input:focus-visible) {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.chip.is-active {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary-strong);
    font-weight: 600;
}

[data-theme="dark"] .chip.is-active {
    color: var(--primary);
}

.chip__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: none;
}

.chip small {
    color: var(--muted);
    font-size: calc(10.5px + var(--font-boost, 0px));
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-strong);
    font-size: calc(12.5px + var(--font-boost, 0px));
    font-weight: 600;
}

.tag:hover {
    text-decoration: none;
    filter: brightness(0.97);
}

[data-theme="dark"] .tag {
    color: var(--primary);
}

.tag span {
    opacity: 0.65;
    font-size: calc(14px + var(--font-boost, 0px));
    line-height: 1;
}

.tag--clear {
    background: var(--surface-3);
    color: var(--muted);
}

.tag--saved {
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--text-soft);
    padding-right: 4px;
}

.tag--saved a {
    color: inherit;
}

.tag--saved form {
    display: inline-flex;
}

.tag--saved button {
    border: 0;
    background: none;
    color: var(--muted);
    font-size: calc(15px + var(--font-boost, 0px));
    cursor: pointer;
    padding: 0 5px;
}

.icon-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.icon-picker__item {
    position: relative;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    cursor: pointer;
    color: var(--text-soft);
}

.icon-picker__item.is-active {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary-strong);
}

.icon-picker__item input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

/* ---------- 首页 ---------- */
.hero {
    position: relative;
    border-radius: 20px;
    padding: 18px;
    color: #fff;
    background: linear-gradient(140deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 62%, #0a5b89) 100%);
    box-shadow: 0 12px 28px color-mix(in srgb, var(--primary) 28%, transparent);
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow: hidden;
}

.hero::after {
    content: "";
    position: absolute;
    right: -40px;
    top: -50px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
}

.hero--compact {
    padding: 16px 18px;
}

.hero__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.hero__greeting {
    font-size: calc(16px + var(--font-boost, 0px));
    font-weight: 700;
}

.hero__date {
    font-size: calc(12px + var(--font-boost, 0px));
    opacity: 0.82;
    margin-top: 2px;
}

.hero .btn--primary {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: none;
    backdrop-filter: blur(4px);
}

.hero .btn--primary:hover {
    background: rgba(255, 255, 255, 0.3);
}

.hero__balance {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hero__balance-label {
    font-size: calc(12px + var(--font-boost, 0px));
    opacity: 0.85;
}

.hero__balance-value {
    font-size: calc(32px + var(--font-boost, 0px));
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #fff !important;
    line-height: 1.2;
}

.hero__balance-sub {
    font-size: calc(12px + var(--font-boost, 0px));
    opacity: 0.82;
}

/* 年度报表顶部只保留年结余和收入/支出摘要，不再单独展示年收入/年支出分栏。 */
.metric-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px;
    border-radius: 12px;
    background: var(--surface-2);
}

.metric__label {
    font-size: calc(11.5px + var(--font-boost, 0px));
    color: var(--muted);
}

.metric__value {
    font-size: calc(16.5px + var(--font-boost, 0px));
    font-weight: 700;
    letter-spacing: -0.2px;
}

.metric__foot {
    margin-top: 8px;
    font-size: calc(11.5px + var(--font-boost, 0px));
    color: var(--muted);
}

.period-panel {
    display: none;
}

.period-panel.is-active {
    display: block;
}

.amount--income {
    color: var(--income);
}

.amount--expense {
    color: var(--expense);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.stat-grid--2,
.stat-grid--3 {
    grid-template-columns: 1fr;
}

.stat-card {
    padding: 13px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.stat-card__label {
    font-size: calc(11.5px + var(--font-boost, 0px));
    color: var(--muted);
}

.stat-card__value {
    font-size: calc(20px + var(--font-boost, 0px));
    font-weight: 700;
    margin-top: 2px;
}

.stat-card__meta {
    font-size: calc(11.5px + var(--font-boost, 0px));
    color: var(--muted);
    margin-top: 3px;
}

.structure {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chart {
    width: 100%;
    min-height: 220px;
}

.rank-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.rank-item {
    display: grid;
    grid-template-columns: 9px minmax(60px, 84px) 1fr auto auto;
    align-items: center;
    gap: 8px;
    font-size: calc(13px + var(--font-boost, 0px));
}

.rank-item__dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    flex: none;
}

.rank-item__name {
    color: var(--text-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-item__bar {
    height: 7px;
    border-radius: 999px;
    background: var(--surface-3);
    overflow: hidden;
}

.rank-item__bar i {
    display: block;
    height: 100%;
    border-radius: 999px;
    min-width: 2px;
}

.rank-item__amount {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.rank-item__percent {
    color: var(--muted);
    font-size: calc(11.5px + var(--font-boost, 0px));
    min-width: 42px;
    text-align: right;
}

/* 归档里的分类行整行可点：链接色只给名字，点行的任意空白处也能跳 */
.rank-item--link {
    cursor: pointer;
}

.rank-item--link a.rank-item__name {
    color: var(--primary-strong);
}

[data-theme="dark"] .rank-item--link a.rank-item__name {
    color: var(--primary);
}

.rank-item--link:hover,
.rank-item--link:active {
    background: var(--primary-soft);
}

.net-worth {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--line);
    margin-bottom: 12px;
    color: var(--muted);
    font-size: calc(13px + var(--font-boost, 0px));
}

.net-worth strong {
    font-size: calc(20px + var(--font-boost, 0px));
    color: var(--text);
}

.account-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.account-chip {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 8px 12px;
    border-radius: 11px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text-soft);
    font-size: calc(12px + var(--font-boost, 0px));
    min-width: 104px;
}

.account-chip:hover {
    text-decoration: none;
    border-color: var(--primary);
}

.account-chip strong {
    color: var(--text);
    font-size: calc(14px + var(--font-boost, 0px));
}

/* ---------- 明细 ---------- */
.summary-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.summary-bar__item {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.summary-bar__item span {
    font-size: calc(10.5px + var(--font-boost, 0px));
    color: var(--muted);
}

.summary-bar__item strong {
    font-size: calc(13.5px + var(--font-boost, 0px));
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.inline-form {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.inline-form--wrap {
    flex-wrap: wrap;
}

.txn-list {
    display: flex;
    flex-direction: column;
}

.txn-list-wrap {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.txn-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    position: relative;
    background: var(--surface);
    transition: transform 0.2s ease;
}

.txn-item:last-child {
    border-bottom: 0;
}

.txn-item__icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    flex: none;
}

.txn-item__icon svg {
    width: 19px;
    height: 19px;
}

.txn-item__main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    color: var(--text);
}

.txn-item__main:hover {
    text-decoration: none;
}

.txn-item__title {
    font-size: calc(14px + var(--font-boost, 0px));
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.txn-item__meta {
    font-size: calc(11.5px + var(--font-boost, 0px));
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.txn-item__amount {
    font-weight: 700;
    font-size: calc(14.5px + var(--font-boost, 0px));
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.txn-item__delete {
    display: none;
}

.txn-item.is-swiped {
    transform: translateX(-58px);
}

.txn-item.is-swiped .txn-item__delete {
    display: block;
    position: absolute;
    top: 0;
    bottom: 0;
    right: -58px;
    width: 58px;
    background: var(--expense);
}

.txn-item.is-swiped .txn-item__delete button {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: #fff;
}

.txn-item.is-swiped .txn-item__delete button svg {
    width: 18px;
    height: 18px;
}

.install-steps {
    margin: 0 0 14px;
    padding-left: 20px;
    font-size: calc(13.5px + var(--font-boost, 0px));
    line-height: 1.8;
    color: var(--text-soft);
}

.install-steps li + li {
    margin-top: 6px;
}

.txn-item__delete button {
    border: 0;
    background: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
}

@media (hover: hover) and (min-width: 1024px) {
    .txn-item__delete {
        display: block;
    }
}

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap;
}

.pager__num,
.pager__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 9px;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--text-soft);
    font-size: calc(13px + var(--font-boost, 0px));
}

.pager__num:hover,
.pager__btn:hover {
    text-decoration: none;
    border-color: var(--primary);
}

.pager__num.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 700;
}

.pager__btn.is-disabled {
    opacity: 0.4;
    pointer-events: none;
}

.pager__dots {
    color: var(--muted);
    font-size: calc(12px + var(--font-boost, 0px));
}

.txn-type {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 4px;
    border-radius: 12px;
    background: var(--surface-3);
}

.txn-type__item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 9px;
    border-radius: 9px;
    font-weight: 600;
    font-size: calc(14px + var(--font-boost, 0px));
    color: var(--muted);
    cursor: pointer;
    min-height: 40px;
}

.txn-type__item input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.txn-type__item.is-active {
    background: var(--surface);
    color: var(--primary-strong);
    box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .txn-type__item.is-active {
    color: var(--primary);
}

.amount-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid var(--line-strong);
    background: var(--surface-2);
    margin: 4px 0;
}

.amount-input__symbol {
    font-size: calc(22px + var(--font-boost, 0px));
    font-weight: 700;
    color: var(--muted);
}

.amount-input__field {
    flex: 1;
    min-width: 0;
    border: 0;
    background: none;
    outline: none;
    font-size: calc(30px + var(--font-boost, 0px));
    font-weight: 700;
    color: var(--text);
    padding: 2px 0;
    letter-spacing: -0.5px;
}

.amount-input__field::placeholder {
    color: var(--line-strong);
}

/* ---------- 分类 / 账户列表 ---------- */
.cat-list {
    display: flex;
    flex-direction: column;
}

.cat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}

.cat-item:last-child {
    border-bottom: 0;
}

.cat-item.is-disabled {
    opacity: 0.62;
}

.cat-item__icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex: none;
}

.cat-item__icon svg {
    width: 18px;
    height: 18px;
}

.cat-item__icon--account {
    background: var(--primary-soft);
    color: var(--primary-strong);
}

.cat-item__main {
    flex: 1;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.cat-item__name {
    font-weight: 600;
    font-size: calc(14px + var(--font-boost, 0px));
}

.cat-item__meta {
    font-size: calc(11.5px + var(--font-boost, 0px));
    color: var(--muted);
}

.cat-item__balance {
    font-weight: 700;
    font-size: calc(14px + var(--font-boost, 0px));
    font-variant-numeric: tabular-nums;
}

.cat-item__actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-left: auto;
}

.big-number {
    font-size: calc(26px + var(--font-boost, 0px));
    font-weight: 700;
    letter-spacing: -0.4px;
}

/* ---------- 表格 ---------- */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: calc(13px + var(--font-boost, 0px));
    min-width: 560px;
}

.table th,
.table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.table th {
    font-size: calc(11.5px + var(--font-boost, 0px));
    letter-spacing: 0.04em;
    color: var(--muted);
    font-weight: 600;
    background: var(--surface-2);
    white-space: nowrap;
}

.table tbody tr:nth-child(even) {
    background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}

.table:not(.table--fit) tbody tr:hover {
    background: var(--primary-soft);
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* 归档月度汇总：4 列窄表，手机上不横向滚动 */
.table--fit {
    min-width: 0;
}

.table--fit th,
.table--fit td {
    padding: 10px 8px;
}

.table tr.is-muted {
    color: var(--muted);
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.kv {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 12px;
}

.kv > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--line);
    font-size: calc(13px + var(--font-boost, 0px));
}

.kv dt {
    color: var(--muted);
    flex: none;
}

.kv dd {
    text-align: right;
    word-break: break-word;
}

.tips {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: calc(13px + var(--font-boost, 0px));
    color: var(--text-soft);
    padding-left: 2px;
}

.tips li {
    padding-left: 16px;
    position: relative;
    line-height: 1.6;
}

.tips li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 9px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--primary);
}

.code-block {
    padding: 11px 12px;
    border-radius: 10px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: calc(12px + var(--font-boost, 0px));
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ---------- 归档 ---------- */
.year-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.select--year {
    min-width: 108px;
    font-weight: 700;
    text-align: center;
}

/* ---------- 个人中心 ---------- */
.profile-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border-radius: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.profile-head__avatar {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: linear-gradient(140deg, var(--primary), color-mix(in srgb, var(--primary) 60%, #0a5b89));
    color: #fff;
    font-size: calc(24px + var(--font-boost, 0px));
    font-weight: 700;
    flex: none;
}

.profile-head__name {
    font-size: calc(19px + var(--font-boost, 0px));
    font-weight: 700;
}

.profile-head__meta {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: calc(13px + var(--font-boost, 0px));
    flex-wrap: wrap;
}

.quick-links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.quick-links a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 12px;
    border-radius: 11px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--text-soft);
    font-size: calc(13.5px + var(--font-boost, 0px));
    font-weight: 600;
}

.quick-links a:hover {
    text-decoration: none;
    border-color: var(--primary);
    color: var(--primary-strong);
}

.quick-links svg {
    color: var(--primary);
}

/* ---------- 弹层 ---------- */
.sheet {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.sheet__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(9, 24, 38, 0.48);
    backdrop-filter: blur(2px);
    animation: fade-in 0.18s ease;
}

.sheet__panel {
    position: relative;
    width: 100%;
    max-height: 88vh;
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    padding-bottom: var(--safe-bottom);
    display: flex;
    flex-direction: column;
    animation: slide-up 0.22s cubic-bezier(0.22, 0.8, 0.3, 1);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 16px 8px;
    flex: none;
}

.sheet__head h2 {
    font-size: calc(16px + var(--font-boost, 0px));
    font-weight: 700;
}

.sheet__actions {
    position: sticky;
    bottom: 0;
    display: flex;
    gap: 9px;
    padding: 12px 16px calc(12px + var(--safe-bottom));
    background: var(--surface);
    border-top: 1px solid var(--line);
    margin-top: 4px;
}

.sheet__actions .btn {
    flex: 1;
}

.sheet__actions .btn--ghost {
    flex: none;
    min-width: 88px;
}

.form--sheet {
    padding-bottom: 0;
    gap: 12px;
}

.subpanel {
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 10px 12px;
    background: var(--surface-2);
}

.subpanel summary {
    cursor: pointer;
    font-size: calc(13px + var(--font-boost, 0px));
    font-weight: 600;
    color: var(--text-soft);
}

@keyframes slide-up {
    from { transform: translateY(28px); opacity: 0.6; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---------- Toast ---------- */
.toast-stack {
    position: fixed;
    left: 50%;
    top: 14px;
    transform: translateX(-50%);
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(92vw, 460px);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    font-size: calc(13px + var(--font-boost, 0px));
    color: var(--text);
    pointer-events: auto;
    animation: slide-down 0.2s ease;
}

.toast--success {
    border-left: 3px solid var(--income);
}

.toast--error {
    border-left: 3px solid var(--danger);
}

.toast--info {
    border-left: 3px solid var(--primary);
}

.toast button {
    border: 0;
    background: none;
    color: var(--muted);
    font-size: calc(17px + var(--font-boost, 0px));
    line-height: 1;
    cursor: pointer;
}

@keyframes slide-down {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ---------- 登录 / 安装 ---------- */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background:
        radial-gradient(1200px 500px at 10% -10%, color-mix(in srgb, var(--primary) 26%, transparent), transparent 60%),
        var(--bg);
}

.auth-shell {
    width: 100%;
    max-width: 980px;
    display: grid;
    gap: 20px;
    align-items: stretch;
}

.auth-hero {
    display: none;
    flex-direction: column;
    gap: 16px;
    padding: 30px;
    border-radius: 24px;
    color: #fff;
    background: linear-gradient(150deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 55%, #083b57) 100%);
    box-shadow: 0 20px 50px color-mix(in srgb, var(--primary) 26%, transparent);
    position: relative;
    overflow: hidden;
}

.auth-hero::after {
    content: "";
    position: absolute;
    right: -60px;
    bottom: -80px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.auth-hero__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 700;
    font-size: calc(17px + var(--font-boost, 0px));
}

.auth-hero__brand:hover {
    text-decoration: none;
}

.auth-hero h2 {
    font-size: calc(30px + var(--font-boost, 0px));
    line-height: 1.3;
    font-weight: 700;
    margin-top: 6px;
}

.auth-hero p {
    font-size: calc(13.5px + var(--font-boost, 0px));
    opacity: 0.88;
    line-height: 1.8;
}

.auth-hero__points {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: calc(13px + var(--font-boost, 0px));
    margin-top: auto;
}

.auth-hero__points li {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.92;
}

.auth-hero__points li::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    padding: 24px 20px;
    border-radius: 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-card__head h1 {
    font-size: calc(22px + var(--font-boost, 0px));
    font-weight: 700;
}

.auth-card__head p {
    color: var(--muted);
    font-size: calc(13px + var(--font-boost, 0px));
    margin-top: 3px;
}

.auth-card__foot {
    text-align: center;
    color: var(--muted);
    font-size: calc(11.5px + var(--font-boost, 0px));
    padding-top: 6px;
    border-top: 1px dashed var(--line);
}

.auth-switch {
    text-align: center;
    font-size: calc(13px + var(--font-boost, 0px));
    color: var(--muted);
}

.captcha-row {
    display: flex;
    gap: 9px;
    align-items: stretch;
}

.captcha-row .input {
    flex: 1;
}

.captcha-img {
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    cursor: pointer;
    overflow: hidden;
    flex: none;
    width: 134px;
    height: 44px;
}

.captcha-img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.check-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 6px;
}

.check-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface-2);
    font-size: calc(12.5px + var(--font-boost, 0px));
}

.check-list li + li {
    border-top: 1px solid var(--line);
}

.check-list__icon {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    flex: none;
}

.check-list__icon svg {
    width: 11px;
    height: 11px;
}

.check-list .is-ok .check-list__icon {
    background: var(--income-soft);
    color: var(--income);
}

.check-list .is-bad .check-list__icon {
    background: var(--expense-soft);
    color: var(--expense);
}

.check-list__label {
    flex: 1;
    color: var(--text-soft);
}

.check-list__value {
    color: var(--muted);
    font-size: calc(11.5px + var(--font-boost, 0px));
}

/* ---------- 后台 ---------- */
.settings-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
}

.settings-tabs__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text-soft);
    font-size: calc(13px + var(--font-boost, 0px));
    font-weight: 600;
    white-space: nowrap;
}

.settings-tabs__item.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.settings-tabs__item:hover {
    text-decoration: none;
}

.admin-grid {
    display: grid;
    gap: 12px;
}

.bg-preview {
    width: 100%;
    max-width: 720px;
    aspect-ratio: 16 / 7;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-2);
}

.bg-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bg-preview--empty {
    display: grid;
    place-items: center;
    padding: 20px;
    color: var(--muted);
    font-size: calc(13px + var(--font-boost, 0px));
    text-align: center;
}

.bg-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.bg-meta code {
    max-width: 100%;
    overflow-wrap: anywhere;
}

.bg-upload {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px dashed var(--line);
}

.bg-upload input[type="file"] {
    padding: 8px 10px;
    background: var(--surface-2);
}

/* ---------- 错误页 ---------- */
.error-page {
    min-height: 52vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    padding: 30px 16px;
}

.error-page__code {
    font-size: calc(52px + var(--font-boost, 0px));
    font-weight: 800;
    letter-spacing: -2px;
    color: var(--primary);
    opacity: 0.85;
    line-height: 1;
}

.error-page__title {
    font-size: calc(20px + var(--font-boost, 0px));
    font-weight: 700;
}

.error-page__text {
    color: var(--muted);
    font-size: calc(13.5px + var(--font-boost, 0px));
    max-width: 420px;
}

/* ---------- 响应式 ---------- */
@media (min-width: 640px) {
    .page {
        padding: 20px 20px 110px;
        gap: 16px;
    }

    .field-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .stat-grid--2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-grid--3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .structure {
        flex-direction: row;
        align-items: center;
        gap: 20px;
    }

    .structure .chart {
        flex: 0 0 46%;
        max-width: 340px;
    }

    .structure .rank-list {
        flex: 1;
    }

    .quick-links {
        grid-template-columns: repeat(3, 1fr);
    }

    .admin-grid {
        grid-template-columns: 1.25fr 1fr;
    }

    .toast-stack {
        left: auto;
        right: 20px;
        top: 20px;
        transform: none;
    }

    .auth-card {
        max-width: 480px;
        padding: 30px 28px;
    }
}

@media (min-width: 1024px) {
    .sidebar {
        display: flex;
    }

    .app-main {
        margin-left: 238px;
    }

    .topbar {
        height: 64px;
        padding: 0 28px;
        justify-content: space-between;
    }

    .topbar__create {
        display: none;
    }

    .topbar__brand span {
        display: inline;
    }

    .topbar__title {
        order: -1;
        text-align: left;
        flex: none;
        font-size: calc(18px + var(--font-boost, 0px));
    }

    .topbar__brand {
        order: 0;
        margin-left: auto;
        margin-right: 14px;
        color: rgba(255, 255, 255, 0.92);
        font-size: calc(13px + var(--font-boost, 0px));
    }

    .topbar__actions {
        order: 2;
    }

    .page {
        padding: 26px 30px 40px;
        gap: 18px;
    }

    .page-foot {
        display: flex;
    }

    .bottom-nav,
    .admin-mobile-nav {
        display: none;
    }

    .hero {
        padding: 24px 26px;
    }

    .hero__balance-value {
        font-size: calc(38px + var(--font-boost, 0px));
    }

    .summary-bar__item strong {
        font-size: calc(15px + var(--font-boost, 0px));
    }

    .txn-item {
        padding: 12px 18px;
    }

    .txn-item__main:hover .txn-item__title {
        color: var(--primary-strong);
    }

    .sheet {
        align-items: center;
    }

    .sheet__panel {
        max-width: 560px;
        max-height: 86vh;
        border-radius: 18px;
        margin: 20px;
        animation: none;
    }

    .sheet__head {
        padding: 18px 20px 6px;
    }

    .form--sheet {
        padding: 0 20px 20px;
    }

    .sheet__actions {
        padding: 14px 20px;
        border-radius: 0 0 18px 18px;
    }

    .auth-shell {
        grid-template-columns: 1.05fr 0.95fr;
        gap: 0;
        background: var(--surface);
        border-radius: 26px;
        overflow: hidden;
        box-shadow: var(--shadow);
        border: 1px solid var(--line);
    }

    .auth-hero {
        display: flex;
        border-radius: 0;
        min-height: 560px;
        box-shadow: none;
    }

    .auth-card {
        max-width: none;
        margin: 0;
        border: 0;
        box-shadow: none;
        border-radius: 0;
        padding: 40px 36px;
        justify-content: center;
    }

    .table {
        min-width: 0;
    }
}

@media (min-width: 1280px) {
    .page {
        padding: 30px 40px 48px;
    }
}

/* 前台鼠标悬停反馈：仅对支持 hover 的指针设备生效 */
@media (hover: hover) and (pointer: fine) {
    body.app-v2 a,
    body.app-v2 button,
    body.auth-body a,
    body.auth-body button {
        transition: filter 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
    }

    body.app-v2 a:hover,
    body.auth-body a:hover {
        filter: brightness(0.92);
        transform: translateY(-1px);
    }

    body.app-v2 button:not(:disabled):hover,
    body.auth-body button:not(:disabled):hover {
        filter: brightness(0.96);
        transform: translateY(-1px);
    }

    body.app-v2 a.btn:hover,
    body.app-v2 button.btn:not(:disabled):hover,
    body.auth-body a.btn:hover,
    body.auth-body button.btn:not(:disabled):hover {
        filter: brightness(0.97);
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(13, 66, 101, 0.18);
    }

    body.app-v2 :is(.chip, .type-toggle__item, .segmented__item):hover {
        filter: brightness(0.97);
        transform: translateY(-1px);
    }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}
