:root {
  color-scheme: light;
  --background: #f4f6f7;
  --surface: #fff;
  --ink: #182425;
  --muted: #526466;
  --line: #dfe7e7;
  --accent: #087565;
  --accent-dark: #06594d;
  --accent-soft: #e4f4ee;
  --amber: #80530d;
  --amber-soft: #fff1d9;
  --rose: #8d463b;
  --rose-soft: #fbece7;
  --radius: 16px;
  font: 16px/1.5 "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--background); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .46; cursor: default; }
button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #20a996; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; vertical-align: middle; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 216px minmax(0,1fr); }
.sidebar { display: flex; flex-direction: column; align-self: start; position: sticky; top: 0; height: 100vh; background: #fbfcfc; border-right: 1px solid var(--line); padding: 29px 18px 23px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand strong, .brand small, .sidebar-foot small { display: block; }
.brand strong { font-size: 1.18rem; line-height: 1.3; }
.brand small, .sidebar-foot small { color: var(--muted); font-size: .8rem; margin-top: 3px; }
.brand-mark { display: grid; place-items: center; width: 43px; height: 43px; background: #123c37; color: #e6fff4; border-radius: 12px; }
.brand-mark .icon { width: 23px; height: 23px; }
.nav { display: grid; gap: 6px; margin-top: 48px; }
.nav button { display: flex; align-items: center; gap: 11px; min-height: 47px; padding: 8px 11px; border: 0; border-radius: 9px; text-align: left; background: transparent; color: #485b5d; font-size: .93rem; white-space: nowrap; }
.nav button:hover { background: #eef3f2; }
.nav button[aria-current="page"] { background: #e5f1ed; color: #165a4e; font-weight: 700; }
.nav button .icon { width: 18px; height: 18px; }
.nav-count { margin-left: auto; background: #d6e9e3; color: #21564b; padding: 1px 7px; border-radius: 20px; font-size: .78rem; font-weight: 700; }
.sidebar-foot { margin-top: auto; display: flex; align-items: flex-start; gap: 9px; padding: 16px 6px 0; border-top: 1px solid var(--line); color: var(--muted); }
.sidebar-foot .icon { width: 17px; height: 17px; margin-top: 2px; }
.sidebar-foot strong { color: var(--ink); font-size: .87rem; font-weight: 650; }
.workspace { min-width: 0; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 73px; padding: 10px clamp(22px, 4vw, 60px); border-bottom: 1px solid var(--line); background: #fbfcfc; }
.breadcrumb, .role-control { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .875rem; }
.breadcrumb strong { color: var(--ink); font-weight: 650; }
.breadcrumb .icon { display: none; }
.divider { color: #899797; }
.roles { display: flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 10px; background: #eff3f3; }
.roles button { min-height: 34px; display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 1px solid transparent; border-radius: 7px; color: #485a5a; padding: 3px 8px 3px 5px; white-space: nowrap; }
.roles button[aria-pressed="true"] { background: white; border-color: #dde7e5; color: var(--ink); font-weight: 650; box-shadow: 0 1px 2px #0a2f2510; }
.avatar { display: inline-grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; font-size: .75rem; font-weight: 700; }
.avatar.me { background: #d8eee6; color: #215b50; }
.avatar.mq { background: #ede5f7; color: #6c4486; }
.content { width: min(100%, 1260px); margin: 0 auto; padding: 32px clamp(22px, 4vw, 60px) 40px; }
.page-head, .section-head { display: flex; gap: 14px; align-items: center; justify-content: space-between; }
.page-head { margin-bottom: 22px; }
h1 { font-size: clamp(1.65rem, 3.2vw, 2.12rem); line-height: 1.25; letter-spacing: -.035em; font-weight: 760; }
.page-head p { margin-top: 6px; color: var(--muted); font-size: .94rem; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 9px; border: 1px solid var(--line); padding: 8px 13px; min-height: 40px; background: var(--surface); color: var(--ink); font-size: .875rem; font-weight: 680; white-space: nowrap; }
.button .icon { width: 17px; height: 17px; }
.button:hover:not(:disabled) { border-color: #a7bbb9; background: #f5f8f7; }
.button.primary { color: white; background: var(--accent); border-color: var(--accent); }
.button.primary:hover:not(:disabled) { background: var(--accent-dark); border-color: var(--accent-dark); }
.new-entry { min-height: 43px; padding-inline: 15px; }
.button.quiet { background: transparent; border-color: transparent; }
.button.quiet:hover:not(:disabled) { border-color: transparent; background: #f1f5f4; }
.button.small { min-height: 34px; padding: 5px 9px; }

.hero { position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1fr) minmax(230px, 36%); align-items: center; gap: 28px; padding: 27px 30px; min-height: 240px; overflow: hidden; border-radius: var(--radius); background: linear-gradient(112deg, #102c2a 2%, #133a35 62%, #115247); color: white; box-shadow: 0 7px 16px #14362e15; }
.hero::before { content: ""; z-index: -1; position: absolute; inset: 0; opacity: .23; background: radial-gradient(circle, #9bdbbe 1px, transparent 1.1px) 0 0 / 15px 15px; mask-image: linear-gradient(90deg, transparent 37%, black); }
.hero::after { content: ""; z-index: -1; position: absolute; width: 410px; height: 410px; right: -127px; top: -100px; border: 1px solid #a4dfc733; border-radius: 50%; box-shadow: 0 0 0 24px #a4dfc715, 0 0 0 50px #a4dfc712; }
.hero-kicker { display: flex; align-items: center; gap: 7px; color: #c0ddd4; font-size: .9rem; }
.hero-kicker .icon { width: 16px; height: 16px; }
.balance { display: flex; align-items: baseline; gap: 5px; font-size: clamp(2.65rem, 5.3vw, 4rem); line-height: 1.12; font-weight: 720; letter-spacing: -.055em; font-variant-numeric: tabular-nums; margin: 5px 0 4px; overflow-wrap: anywhere; }
.balance .currency { font-size: .53em; font-weight: 530; letter-spacing: 0; color: #9cdfc6; }
.direction { font-size: .97rem; color: #e4f6ef; }
.hero-actions { margin-top: 18px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hero .button { color: #122e29; border-color: #b5ead5; background: #b5ead5; }
.hero .button:hover:not(:disabled) { background: #d2f6e6; border-color: #d2f6e6; }
.cycle { position: relative; display: inline-flex; align-items: center; }
.cycle select { appearance: none; background: #ffffff10; color: #ecfaf5; border: 1px solid #ffffff4d; border-radius: 9px; padding: 8px 29px 8px 11px; min-height: 40px; font-size: .875rem; cursor: pointer; }
.cycle option { color: var(--ink); background: var(--surface); }
.cycle .icon { position: absolute; right: 8px; width: 15px; height: 15px; pointer-events: none; }
.hero-ledger { position: relative; border: 1px solid #b0e4d24d; background: #123f36b3; border-radius: 13px; padding: 13px 15px; box-shadow: 0 10px 24px #0d252626; }
.hero-ledger-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 47px; font-size: .9rem; color: #d3ece2; }
.hero-ledger-row + .hero-ledger-row { border-top: 1px solid #b0e4d233; }
.hero-ledger-row strong { color: white; font-size: 1.05rem; text-align: right; font-variant-numeric: tabular-nums; }
.hero-ledger-row > span { display: flex; gap: 7px; align-items: center; }
.hero-ledger-row .avatar { width: 23px; height: 23px; }
.cycle-note { margin: 8px 0 0; padding-top: 9px; color: #c4e0d7; font-size: .81rem; border-top: 1px solid #b0e4d233; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; margin: 16px 0 25px; }
.stat { display: flex; align-items: center; text-align: left; gap: 12px; min-height: 78px; padding: 12px 15px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--ink); }
.stat:hover { border-color: #a4bdb7; }
.stat-icon, .entry-icon { display: grid; place-items: center; flex: 0 0 auto; width: 37px; height: 37px; border-radius: 10px; color: #237768; background: #e5f5ef; }
.stat-icon .icon, .entry-icon .icon { width: 18px; height: 18px; }
.stat-icon.wait, .entry-icon.wait { color: #80530d; background: #fff0d8; }
.stat-icon.question, .entry-icon.question { color: var(--rose); background: var(--rose-soft); }
.stat small { display: block; color: var(--muted); font-size: .875rem; }
.stat strong { display: block; color: var(--ink); font-size: 1.15rem; line-height: 1.35; }
.stat strong span { font-weight: 550; font-size: .83rem; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.section-head { padding: 16px 18px 12px; }
.section-head h2 { font-size: 1.11rem; letter-spacing: -.02em; }
.section-meta { color: var(--muted); font-size: .875rem; }
.panel-tools { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 0 18px 11px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; }
.filters button { padding: 5px 9px; min-height: 34px; border-radius: 7px; border: 0; background: transparent; color: var(--muted); font-size: .875rem; white-space: nowrap; }
.filters button:hover { color: var(--ink); background: #f2f5f5; }
.filters button[aria-pressed="true"] { color: #155c4f; background: var(--accent-soft); font-weight: 700; }
.batch { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-left: auto; }
.batch-select { color: var(--muted); font-size: .875rem; white-space: nowrap; }
input[type="checkbox"] { accent-color: var(--accent); width: 17px; height: 17px; vertical-align: middle; margin: 0 5px 0 0; }
.entry { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(100px, .85fr) minmax(100px, .7fr) minmax(92px, .7fr) 78px; align-items: center; min-height: 65px; gap: 12px; padding: 9px 18px; border-top: 1px solid #e9eeee; }
.entry.heading { min-height: 36px; padding-block: 6px; background: #f7f9f9; color: var(--muted); font-size: .81rem; }
.entry-label { display: flex; align-items: center; gap: 9px; min-width: 0; }
.entry-label > div { min-width: 0; }
.entry-label strong, .entry-label small { display: block; overflow-wrap: anywhere; }
.entry-label strong { font-size: .94rem; font-weight: 700; }
.entry-label small { color: var(--muted); font-size: .79rem; }
.entry .entry-icon { width: 32px; height: 32px; border-radius: 8px; }
.entry .entry-icon .icon { width: 16px; height: 16px; }
.entry .date { color: var(--muted); font-size: .875rem; white-space: nowrap; }
.entry .amount, .history-amount { font-weight: 720; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tag { display: inline-flex; align-items: center; width: fit-content; border-radius: 6px; padding: 3px 7px; font-size: .79rem; font-weight: 650; white-space: nowrap; }
.tag.confirmed { background: var(--accent-soft); color: #1b6658; }
.tag.pending { background: var(--amber-soft); color: var(--amber); }
.tag.disputed { background: var(--rose-soft); color: var(--rose); }
.tag.settled { background: #ecf0f0; color: #4b5d5e; }
.row-action { justify-self: end; }
.row-action .quiet { color: var(--accent-dark); }
.empty { text-align: center; color: var(--muted); padding: 43px 16px; border-top: 1px solid #e9eeee; }
.empty .icon { margin-bottom: 8px; color: #43887a; width: 25px; height: 25px; }
.history-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 13px; min-height: 73px; padding: 12px 18px; border-top: 1px solid #e9eeee; }
.history-row strong { overflow-wrap: anywhere; }
.history-row small { display: block; color: var(--muted); margin-top: 2px; }

dialog { max-width: min(480px, calc(100% - 28px)); width: 100%; max-height: calc(100dvh - 32px); overflow: auto; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); color: var(--ink); padding: 23px; box-shadow: 0 24px 65px #12242038; }
dialog::backdrop { background: #10272780; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.dialog-head h2 { font-size: 1.29rem; }
.dialog-sub { color: var(--muted); margin: 0 0 15px; font-size: .93rem; }
.field { display: grid; gap: 5px; margin-top: 12px; }
.field label { font-size: .875rem; font-weight: 680; }
.field label span { color: var(--muted); font-weight: 450; }
.field input, .field textarea { width: 100%; border: 1px solid #cddad8; background: #fbfdfc; border-radius: 8px; padding: 8px 10px; min-height: 42px; color: var(--ink); }
.field textarea { min-height: 71px; resize: vertical; }
.form-error { color: #8e352b; font-size: .875rem; margin-top: 9px; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; margin-top: 18px; }
.dialog-actions .left { margin-right: auto; }
.receipt { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f7faf9; }
.receipt div { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: .9rem; }
.receipt div span:first-child { flex: 0 0 auto; color: var(--muted); }
.receipt div span:last-child, .receipt div strong { overflow-wrap: anywhere; text-align: right; }
.receipt-list { list-style: none; margin: 12px 0 0; padding: 0; font-size: .87rem; }
.receipt-list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.receipt-list li span:first-child { overflow-wrap: anywhere; }
.toast { position: fixed; z-index: 1; right: 23px; bottom: 23px; max-width: calc(100% - 46px); padding: 10px 14px; border-radius: 9px; color: white; background: #173b33; box-shadow: 0 5px 20px #0e393330; font-size: .875rem; }

@media (max-width: 950px) {
  .shell { grid-template-columns: 172px minmax(0,1fr); }
  .sidebar { padding-inline: 12px; }
  .hero { grid-template-columns: minmax(0, 1fr) minmax(232px, 42%); padding-inline: 20px; gap: 15px; }
  .entry { grid-template-columns: minmax(0, 1.3fr) minmax(88px, .8fr) minmax(76px, .7fr) minmax(76px, .7fr) 62px; gap: 7px; }
}

@media (max-width: 720px) {
  .shell { display: flex; flex-direction: column; }
  .sidebar { position: static; height: auto; padding: 12px 15px 8px; width: 100%; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { display: none; }
  .nav { display: flex; gap: 4px; margin: 0; }
  .nav button { min-height: 40px; gap: 5px; padding: 6px 8px; font-size: .85rem; }
  .nav button .icon { width: 15px; height: 15px; }
  .nav-count { padding: 1px 5px; }
  .sidebar-foot { display: none; }
  .toolbar { min-height: 59px; padding: 7px 15px; }
  .breadcrumb .icon { display: block; width: 17px; height: 17px; color: var(--accent-dark); }
  .breadcrumb > span:not(.icon-wrap), .breadcrumb strong, .role-control > span { display: none; }
  .breadcrumb::after { content: "对账簿 · 本机演示"; }
  .content { padding: 22px 15px 28px; }
  .page-head { margin-bottom: 16px; }
  .page-head p { font-size: .85rem; }
  .entry { padding-inline: 12px; }
}

@media (max-width: 520px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding: 18px 15px 14px; gap: 14px; }
  .hero-actions { margin-top: 13px; }
  .hero-ledger { padding: 5px 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 0 9px; }
  .hero-ledger-row { display: grid; gap: 0; justify-content: stretch; min-height: 0; padding: 5px; }
  .hero-ledger-row + .hero-ledger-row { border-top: 0; border-left: 1px solid #b0e4d233; padding-left: 10px; }
  .hero-ledger-row strong { text-align: left; }
  .cycle-note { grid-column: 1 / -1; margin: 2px 0 0; padding: 4px 5px 2px; }
  .stats { gap: 6px; margin: 11px 0 17px; }
  .stat { padding: 8px 6px; gap: 5px; }
  .stat-icon { width: 26px; height: 26px; border-radius: 6px; }
  .stat-icon .icon { width: 15px; height: 15px; }
  .stat small { font-size: .81rem; white-space: nowrap; }
  .stat strong { font-size: 1rem; }
  .section-head, .panel-tools { padding-inline: 10px; }
  .panel-tools { gap: 5px; }
  .filters { gap: 0; }
  .filters button { font-size: .82rem; padding-inline: 6px; }
  .entry { grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 8px; }
  .entry.heading { display: none; }
  .entry .date { grid-column: 1; grid-row: 2; padding-left: 40px; font-size: .79rem; }
  .entry .amount { grid-column: 2; grid-row: 1; text-align: right; font-size: .9rem; }
  .entry .status { grid-column: 2; grid-row: 2; justify-self: end; }
  .entry .row-action { grid-column: 3; grid-row: 1 / span 2; }
  .history-row { padding-inline: 10px; gap: 7px; }
  .history-amount { font-size: .9rem; }
}

@media (prefers-reduced-motion: no-preference) {
  button { transition: background-color .13s ease, border-color .13s ease; }
}

@media (max-width: 365px) {
  .stat-icon { display: none; }
  .stat { justify-content: center; }
}
