:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-soft: #faf9f6;
  --ink: #242823;
  --muted: #72776f;
  --line: #e6e5de;
  --line-strong: #d7d9d0;
  --accent: #a34b32;
  --accent-dark: #813824;
  --accent-soft: #f5e9e3;
  --green: #287052;
  --green-soft: #e8f2ec;
  --amber: #946316;
  --amber-soft: #fbf1dd;
  --red: #ad4439;
  --red-soft: #faeae7;
  --blue: #426683;
  --blue-soft: #eaf0f5;
  --shadow: 0 12px 36px rgba(39, 43, 36, .08);
  --radius: 18px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
input, select, textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 11px; background: #fff; color: var(--ink); padding: 11px 12px; outline: none; transition: border .18s, box-shadow .18s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(163, 75, 50, .1); }
textarea { min-height: 92px; resize: vertical; }
input[type="date"] { min-height: 44px; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 26px; letter-spacing: -.4px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.eyebrow { color: var(--accent); font-size: 10px; letter-spacing: 1.8px; font-weight: 700; margin-bottom: 5px; }
.btn { min-height: 42px; border: 0; border-radius: 11px; padding: 10px 16px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 600; transition: transform .15s, background .15s, box-shadow .15s; white-space: nowrap; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 5px 14px rgba(163, 75, 50, .18); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); }
.btn-secondary:hover { background: var(--surface-soft); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-wechat { background: #16794c; color: #fff; }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 6px 11px; border-radius: 9px; font-size: 12px; }
.btn svg { width: 17px; height: 17px; }
.icon-btn { width: 40px; height: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--muted); }

.auth-view { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 30px 18px; background: radial-gradient(circle at 20% 0%, #eee8dd 0, transparent 42%), var(--bg); }
.auth-shell { width: min(100%, 460px); }
.auth-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 26px; }
.auth-brand h1 { font-size: 22px; }
.auth-brand p { color: var(--muted); margin-top: 2px; }
.brand-mark { width: 48px; height: 48px; border-radius: 15px 15px 15px 4px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 700; box-shadow: 0 8px 20px rgba(163, 75, 50, .2); }
.brand-mark.small { width: 39px; height: 39px; border-radius: 12px 12px 12px 4px; font-size: 18px; }
.auth-card { background: var(--surface); border: 1px solid rgba(230, 229, 222, .9); border-radius: 24px; padding: 30px; box-shadow: var(--shadow); }
.auth-card h2 { font-size: 24px; line-height: 1.3; margin-bottom: 10px; }
.auth-card > .muted { margin-bottom: 24px; }
.field-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 15px 0 6px; }
.phone-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.auth-card .btn-block { margin-top: 18px; }
.field-error { min-height: 18px; color: var(--red); font-size: 12px; padding-top: 3px; }
.inline-error { background: var(--red-soft); color: var(--red); border-radius: 10px; padding: 10px 12px; margin: 14px 0; font-size: 12px; }
.divider { height: 34px; display: flex; align-items: center; gap: 10px; color: #a0a49c; font-size: 12px; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.auth-note { color: var(--muted); font-size: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.auth-features { display: flex; justify-content: center; flex-wrap: wrap; gap: 18px; margin-top: 23px; color: var(--muted); font-size: 12px; }
.auth-features span::before { content: ""; display: inline-block; width: 5px; height: 5px; background: var(--accent); border-radius: 50%; margin-right: 6px; vertical-align: 2px; }

.app-view { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 224px; background: #f0eee8; border-right: 1px solid var(--line); padding: 25px 16px 18px; display: flex; flex-direction: column; z-index: 20; }
.side-brand { display: flex; gap: 10px; align-items: center; padding: 0 8px 28px; }
.side-brand strong, .side-brand span { display: block; }
.side-brand strong { font-size: 16px; }
.side-brand span { color: var(--muted); font-size: 11px; margin-top: 2px; }
.side-nav { display: grid; gap: 5px; }
.nav-item { width: 100%; border: 0; background: transparent; color: var(--muted); border-radius: 11px; display: flex; align-items: center; gap: 12px; padding: 12px 13px; text-align: left; font-weight: 500; }
.nav-item:hover { background: rgba(255, 255, 255, .55); color: var(--ink); }
.nav-item.active { background: var(--surface); color: var(--accent); box-shadow: 0 3px 12px rgba(39, 43, 36, .05); font-weight: 650; }
.side-bottom { margin-top: auto; display: grid; gap: 5px; }
.nav-item.subtle { font-size: 12px; }
.nav-text-icon { width: 20px; text-align: center; font-size: 18px; }
.main-shell { margin-left: 224px; padding: 0 34px 30px; max-width: 1540px; }
.topbar { min-height: 106px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.top-actions { display: flex; align-items: center; gap: 13px; }
.sync-status { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.sync-status i { width: 7px; height: 7px; background: var(--green); border-radius: 50%; }
.sync-status.error i { background: var(--red); }
.user-label { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.page { display: none; animation: pageIn .2s ease; }
.page.active { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.global-alert { border: 1px solid #e7d1a9; background: var(--amber-soft); color: #785016; border-radius: 13px; padding: 12px 15px; margin-bottom: 18px; font-size: 12px; }
.app-footer { color: #9b9f96; text-align: center; font-size: 11px; padding: 30px 0 8px; }
.bottom-nav { display: none; }

.hero-card { background: #29332d; color: #fff; border-radius: 22px; padding: 25px 27px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; align-items: center; overflow: hidden; position: relative; }
.hero-card::after { content: ""; position: absolute; width: 240px; height: 240px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 50%; right: -80px; top: -120px; box-shadow: 0 0 0 45px rgba(255, 255, 255, .025), 0 0 0 90px rgba(255, 255, 255, .018); pointer-events: none; }
.hero-label { color: #c4cec7; font-size: 12px; }
.hero-value { font-size: clamp(32px, 4vw, 45px); font-weight: 680; letter-spacing: -1.5px; margin: 5px 0 8px; font-variant-numeric: tabular-nums; }
.hero-sub { color: #c4cec7; font-size: 12px; }
.hero-sub strong { color: #ffd5c6; font-weight: 600; }
.hero-target { position: relative; z-index: 1; }
.progress-track { height: 8px; border-radius: 20px; background: #e7e8e2; overflow: hidden; }
.hero-card .progress-track { background: rgba(255, 255, 255, .13); margin: 14px 0 8px; }
.progress-bar { height: 100%; border-radius: inherit; background: var(--accent); min-width: 2px; }
.hero-card .progress-bar { background: #e8a186; }
.progress-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; }
.hero-card .progress-meta { color: #c4cec7; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 16px 0 22px; }
.kpi-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-height: 124px; }
.kpi-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.kpi-value { font-size: 24px; font-weight: 680; margin: 11px 0 5px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.kpi-note { color: var(--muted); font-size: 11px; }
.kpi-card.warn .kpi-value { color: var(--red); }
.kpi-card.green .kpi-value { color: var(--green); }
.kpi-card.blue .kpi-value { color: var(--blue); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(290px, .8fr); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-header h2, .card-header h3 { font-size: 16px; }
.card-header p { color: var(--muted); font-size: 11px; margin-top: 3px; }
.card-link { border: 0; background: transparent; color: var(--accent); font-size: 12px; padding: 4px; }
.alert-list { display: grid; gap: 10px; }
.alert-row { display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.alert-row:last-child { border-bottom: 0; }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.alert-dot.red { background: var(--red); }
.alert-dot.green { background: var(--green); }
.alert-title { font-weight: 600; font-size: 13px; }
.alert-note { color: var(--muted); font-size: 11px; margin-top: 2px; }
.alert-amount { font-weight: 650; color: var(--red); white-space: nowrap; }
.alert-amount.good { color: var(--green); }
.activity-list { display: grid; gap: 0; }
.activity-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: 0; }
.activity-top { display: flex; justify-content: space-between; gap: 12px; }
.activity-title { font-weight: 600; }
.activity-amount { font-weight: 650; white-space: nowrap; }
.activity-meta { color: var(--muted); font-size: 11px; margin-top: 4px; }
.empty-state { padding: 34px 18px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; color: var(--ink); margin-bottom: 5px; }

.section-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 16px; }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.search-input { max-width: 320px; }
.summary-strip { display: flex; gap: 22px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; margin-bottom: 16px; }
.summary-strip > div { min-width: 130px; }
.summary-label { display: block; color: var(--muted); font-size: 11px; }
.summary-value { display: block; font-size: 18px; font-weight: 680; margin-top: 3px; font-variant-numeric: tabular-nums; }
.summary-value.over { color: var(--red); }
.budget-list { display: grid; gap: 12px; }
.budget-category { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.category-head { width: 100%; border: 0; background: transparent; padding: 18px 20px; display: grid; grid-template-columns: minmax(170px, 1.3fr) repeat(3, minmax(100px, .8fr)) 24px; gap: 14px; align-items: center; text-align: left; color: var(--ink); }
.category-head:hover { background: var(--surface-soft); }
.category-name { display: flex; align-items: center; gap: 7px; font-weight: 650; font-size: 15px; }
.category-name svg { width: 14px; height: 14px; color: var(--muted); }
.category-sub { color: var(--muted); font-size: 11px; font-weight: 400; margin-top: 4px; }
.category-metric label { display: block; color: var(--muted); font-size: 10px; }
.category-metric strong { display: block; margin-top: 3px; font-size: 14px; font-variant-numeric: tabular-nums; }
.category-metric strong.over { color: var(--red); }
.category-metric strong.good { color: var(--green); }
.chevron { color: var(--muted); font-size: 20px; transition: transform .18s; }
.budget-category.open .chevron { transform: rotate(90deg); }
.category-body { display: none; border-top: 1px solid var(--line); background: var(--surface-soft); padding: 15px 20px 18px; }
.budget-category.open .category-body { display: block; }
.category-note { color: var(--muted); background: #fff; border-left: 3px solid var(--line-strong); padding: 9px 12px; margin-bottom: 13px; font-size: 11px; }
.group-title { color: var(--accent); font-size: 12px; font-weight: 700; margin: 18px 0 8px; }
.group-title:first-of-type { margin-top: 0; }
.item-table { width: 100%; border-collapse: collapse; }
.item-table th { color: var(--muted); font-size: 10px; font-weight: 500; text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
.item-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 12px; }
.item-table tr:last-child td { border-bottom: 0; }
.item-name { font-weight: 600; }
.item-spec { color: var(--muted); font-size: 11px; margin-top: 3px; max-width: 540px; }
.item-price { text-align: right; white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
.item-actions { display: inline-flex; align-items: center; gap: 2px; }
.item-actions .btn { padding-left: 7px; padding-right: 7px; }
.item-actions .danger { color: var(--red); }
.import-box { display: flex; flex-direction: column; gap: 12px; }
.import-box .muted { color: var(--muted); font-size: 12px; }
.import-box .btn { align-self: flex-start; }
.import-loading { color: var(--muted); font-size: 12px; padding: 10px 0; }
.import-error { background: var(--red-soft); color: var(--red); border-radius: 9px; padding: 10px 12px; font-size: 12px; }
.import-summary { font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.import-table-wrap { border: 1px solid var(--line); border-radius: 10px; overflow: auto; max-height: 50vh; }
.import-table-wrap .item-table { min-width: 480px; }
.invite-box { display: flex; flex-direction: column; gap: 12px; }
.invite-box .muted { color: var(--muted); font-size: 12px; }
.invite-code { font-size: 30px; font-weight: 700; letter-spacing: 6px; text-align: center; background: #fff; border: 1px dashed var(--line-strong); border-radius: 12px; padding: 18px; color: var(--accent); }
.tag { display: inline-flex; align-items: center; border-radius: 6px; padding: 2px 7px; font-size: 10px; background: #eff0eb; color: var(--muted); white-space: nowrap; }
.tag.warn { background: var(--amber-soft); color: var(--amber); }
.tag.good { background: var(--green-soft); color: var(--green); }
.tag.info { background: var(--blue-soft); color: var(--blue); }
.tag.red { background: var(--red-soft); color: var(--red); }

.supplier-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.supplier-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 19px; }
.supplier-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.supplier-head h3 { line-height: 1.4; }
.supplier-category { color: var(--muted); font-size: 11px; margin-top: 4px; }
.supplier-amount { font-size: 23px; font-weight: 680; margin: 17px 0 3px; }
.supplier-paid { color: var(--muted); font-size: 11px; }
.supplier-paid strong { color: var(--green); }
.supplier-info { margin: 15px 0; padding: 11px 12px; border-radius: 10px; background: var(--surface-soft); color: var(--muted); font-size: 11px; }
.supplier-info b { color: var(--ink); font-weight: 600; }
.supplier-next { font-size: 12px; margin-bottom: 14px; }
.supplier-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.shipment-box { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 13px; }
.shipment-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 12px; }
.shipment-meta { color: var(--muted); font-size: 11px; margin-top: 4px; }

.filter-row { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 15px; }
.filter-row select { width: auto; min-width: 140px; }
.payment-list { display: grid; gap: 10px; }
.payment-card { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 15px 17px; display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.payment-main { min-width: 0; }
.payment-title { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; font-weight: 650; }
.payment-note { color: var(--muted); font-size: 11px; margin-top: 5px; overflow-wrap: anywhere; }
.payment-meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 11px; margin-top: 8px; }
.payment-right { text-align: right; }
.payment-value { font-size: 18px; font-weight: 680; white-space: nowrap; }
.payment-value.refund { color: var(--green); }
.payment-actions { display: flex; justify-content: flex-end; gap: 5px; margin-top: 8px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(24, 28, 24, .48); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .16s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { width: min(100%, 680px); max-height: min(90vh, 860px); max-height: min(90dvh, 860px); overflow: auto; background: var(--surface); border-radius: 22px; box-shadow: 0 24px 70px rgba(20, 25, 20, .22); }
.modal.wide { width: min(100%, 800px); }
.modal-head { position: sticky; top: 0; z-index: 2; background: rgba(255, 255, 255, .97); display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 19px 22px 14px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 19px; }
.modal-body { padding: 20px 22px 22px; }
.modal-footer { position: sticky; bottom: 0; background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line); padding: 14px 22px calc(14px + env(safe-area-inset-bottom)); display: flex; justify-content: flex-end; gap: 9px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.form-field { min-width: 0; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { display: block; color: var(--muted); font-size: 11px; font-weight: 600; margin-bottom: 5px; }
.form-field label .required { color: var(--red); }
.form-hint { color: var(--muted); font-size: 10px; margin-top: 4px; }
.entry-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; padding: 4px; background: #f0f0eb; border-radius: 12px; margin-bottom: 18px; }
.entry-tab { border: 0; border-radius: 9px; background: transparent; padding: 9px 5px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; }
.entry-tab.active { background: #fff; color: var(--accent); box-shadow: 0 2px 8px rgba(39, 43, 36, .07); font-weight: 650; }
.entry-tab svg { width: 16px; height: 16px; }
.smart-panel { border: 1px solid var(--line); border-radius: 13px; background: var(--surface-soft); padding: 14px; margin-bottom: 17px; }
.smart-panel h3 { font-size: 13px; margin-bottom: 5px; }
.smart-panel p { color: var(--muted); font-size: 11px; margin-bottom: 11px; }
.smart-actions { display: flex; gap: 8px; margin-top: 9px; }
.voice-button.recording { background: var(--red-soft); color: var(--red); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(173, 68, 57, .1); } }
.file-drop { position: relative; border: 1px dashed var(--line-strong); border-radius: 12px; padding: 17px; text-align: center; background: #fff; }
.file-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-drop strong { display: block; color: var(--accent); }
.file-drop span { color: var(--muted); font-size: 11px; }
.file-list { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 9px; }
.file-chip { max-width: 100%; display: inline-flex; align-items: center; gap: 5px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; color: var(--muted); font-size: 10px; }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.review-banner { border-left: 3px solid var(--amber); background: var(--amber-soft); color: #785016; border-radius: 8px; padding: 9px 11px; font-size: 11px; margin-bottom: 14px; }
.attachment-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.attachment-item { border: 1px solid var(--line); border-radius: 11px; padding: 12px; background: var(--surface-soft); }
.attachment-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 12px; }
.attachment-meta { color: var(--muted); font-size: 10px; margin: 4px 0 10px; }
.attachment-preview { display: block; width: 100%; max-height: 65vh; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 10px; cursor: zoom-in; }
.attachment-pdf { display: block; width: 100%; height: 65vh; min-height: 320px; background: #fff; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 10px; }
.attachment-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.attachment-actions a { text-decoration: none; }
.ocr-text { white-space: pre-wrap; color: var(--muted); background: #fff; border-radius: 8px; padding: 9px; margin-top: 9px; font-size: 10px; max-height: 160px; overflow: auto; }

.toast-root { position: fixed; z-index: 200; top: 20px; right: 20px; display: grid; gap: 8px; pointer-events: none; }
.toast { max-width: min(380px, calc(100vw - 36px)); background: #29332d; color: #fff; border-radius: 12px; padding: 11px 15px; box-shadow: var(--shadow); font-size: 12px; animation: toastIn .2s ease; }
.toast.error { background: #843d34; }
.toast.success { background: #2e664e; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
.loading-view { position: fixed; inset: 0; z-index: 300; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--muted); }
.loading-logo { width: 52px; height: 52px; display: grid; place-items: center; background: var(--accent); color: #fff; border-radius: 16px 16px 16px 5px; font-size: 23px; font-weight: 700; }
.spinner { width: 24px; height: 24px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .category-head { grid-template-columns: minmax(160px, 1.2fr) repeat(2, minmax(100px, .8fr)) 24px; }
  .category-head .category-metric:nth-of-type(4) { display: none; }
}
@media (max-width: 760px) {
  body { font-size: 13px; }
  .sidebar { display: none; }
  .main-shell { margin-left: 0; padding: 0 14px calc(98px + env(safe-area-inset-bottom)); }
  .topbar { min-height: 80px; padding-top: 7px; }
  .topbar h1 { font-size: 21px; }
  .top-actions { gap: 8px; }
  .sync-status, .user-label, #add-top { display: none; }
  .top-actions::after { content: "已同步"; color: var(--muted); font-size: 10px; }
  .bottom-nav { position: fixed; z-index: 50; display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; left: 0; right: 0; bottom: 0; min-height: 68px; padding: 7px 5px calc(7px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line); backdrop-filter: blur(16px); }
  .bottom-nav button { border: 0; background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; padding: 3px; }
  .bottom-nav button.active { color: var(--accent); }
  .bottom-nav svg { width: 21px; height: 21px; }
  .bottom-nav .bottom-add { position: relative; }
  .bottom-add > span { width: 48px; height: 48px; border-radius: 16px; background: var(--accent); color: #fff; display: grid; place-items: center; margin-top: -26px; box-shadow: 0 7px 18px rgba(163, 75, 50, .25); }
  .bottom-add svg { width: 24px; height: 24px; }
  .hero-card { grid-template-columns: 1fr; gap: 18px; padding: 21px; border-radius: 19px; }
  .hero-value { font-size: 34px; }
  .hero-target { padding-top: 2px; }
  .kpi-grid { gap: 10px; margin: 12px 0 16px; }
  .kpi-card { min-height: 112px; padding: 14px; border-radius: 15px; }
  .kpi-value { font-size: 20px; }
  .kpi-top { font-size: 11px; }
  .card { padding: 16px; border-radius: 15px; }
  .dashboard-grid { gap: 12px; }
  .alert-row { grid-template-columns: 7px 1fr; }
  .alert-amount { grid-column: 2; }
  .section-toolbar { align-items: flex-start; }
  .section-toolbar h2 { font-size: 17px; }
  .section-toolbar .toolbar-actions .btn-label-optional { display: none; }
  .search-input { max-width: none; }
  .summary-strip { gap: 14px; padding: 13px 14px; }
  .summary-strip > div { min-width: calc(50% - 10px); }
  .summary-value { font-size: 16px; }
  .category-head { grid-template-columns: 1fr auto 18px; gap: 8px; padding: 15px; }
  .category-head .category-metric:nth-of-type(3), .category-head .category-metric:nth-of-type(4) { display: none; }
  .category-name { font-size: 14px; }
  .category-body { padding: 12px 13px 15px; overflow-x: auto; }
  .item-table { min-width: 680px; }
  .supplier-grid { grid-template-columns: 1fr; gap: 11px; }
  .supplier-card { padding: 16px; }
  .payment-card { padding: 14px; }
  .filter-row select { flex: 1; min-width: 120px; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal, .modal.wide { width: 100%; max-height: 94dvh; border-radius: 22px 22px 0 0; }
  .modal-head { padding: 17px 17px 13px; }
  .modal-body { padding: 16px 17px 18px; }
  .modal-footer { padding-left: 17px; padding-right: 17px; }
  .form-grid { grid-template-columns: 1fr; gap: 11px; }
  .form-field.full { grid-column: auto; }
  .entry-tabs { position: sticky; top: 61px; z-index: 1; }
  .attachment-grid { grid-template-columns: 1fr; }
  .toast-root { top: 12px; right: 12px; }
  .app-footer { padding-bottom: 4px; }
}
@media (max-width: 380px) {
  .auth-card { padding: 23px 19px; }
  .phone-row { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-card { min-height: 100px; }
}
@media print {
  .sidebar, .bottom-nav, .top-actions, .section-toolbar, .app-footer { display: none !important; }
  .main-shell { margin: 0; padding: 0; }
  .page { display: none; }
  .page.active { display: block; }
  body { background: #fff; }
  .card, .budget-category, .supplier-card { break-inside: avoid; }
}
