:root {
  color-scheme: light;
  --paper: #f3f5f1;
  --panel: #fff;
  --ink: #1b2822;
  --muted: #5d6d64;
  --line: #dce5dd;
  --green: #184934;
  --mint: #e5efe6;
  --mint-deep: #cde5d0;
  --amber: #875716;
  --amber-light: #fff2d8;
  --red: #9e3039;
  --red-light: #fce9e8;
  --shadow: 0 4px 16px #153b2910;
  font-family: "Instrument Sans", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  font-size: 15px;
  background: var(--paper);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
button, input, textarea, select { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
input, select, textarea { color: var(--ink); }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .66; }
button:focus-visible, input:focus-visible, a:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible { outline: 2px solid #247841; outline-offset: 3px; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.6rem, 3vw, 2.35rem); font-weight: 750; line-height: 1.18; }
h2 { font-size: 1.1rem; font-weight: 720; }
h3 { font-size: .99rem; font-weight: 680; }
p { line-height: 1.6; }
small, .muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.loading-screen { min-height: 100dvh; display: grid; align-content: center; justify-items: center; gap: 14px; color: var(--muted); }

.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 11px 11px 11px 4px; font-size: 1.33rem; font-weight: 780; font-style: italic; background: #d6edce; color: #16422b; }
.brand-name { display: block; font-size: 1rem; font-weight: 720; letter-spacing: .01em; }
.brand-en { display: block; margin-top: 3px; font-size: .69rem; letter-spacing: .12em; opacity: .75; }
.login { min-height: 100dvh; display: grid; grid-template-columns: minmax(330px, .8fr) 1fr; }
.login-identity { color: #eff9ef; background: #183c2b; padding: clamp(24px, 7vw, 104px); display: flex; flex-direction: column; justify-content: space-between; gap: 34px; position: relative; }
.login-identity::after { content: ""; position: absolute; bottom: 0; left: 0; right: 0; height: 9px; background: #cbe7c5; }
.login-identity h1 { font-size: clamp(2rem, 5vw, 4.5rem); font-weight: 690; letter-spacing: -.045em; max-width: 9em; }
.login-identity p { margin-top: 14px; color: #c8ddca; }
.login-content { display: grid; place-items: center; padding: clamp(23px, 7vw, 100px); }
.login-form { width: min(100%, 378px); }
.login-form h2 { font-size: 1.55rem; margin-bottom: 22px; }
.login-form .button { width: 100%; justify-content: center; margin-top: 8px; }

.shell { min-height: 100dvh; display: grid; grid-template-columns: 218px minmax(0, 1fr); }
.sidebar { background: #163a2a; color: #eef7ee; min-height: 100dvh; min-width: 0; display: flex; flex-direction: column; padding: 26px 14px 14px; position: sticky; top: 0; align-self: start; }
.sidebar .brand { margin: 0 8px 32px; white-space: nowrap; }
.sidebar ul { padding: 0; margin: 0; list-style: none; display: grid; gap: 3px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 8px; text-decoration: none; color: #d0e3d5; font-weight: 610; }
.nav-link:hover { background: #ffffff12; color: #fff; }
.nav-link[aria-current="page"] { color: #143a27; background: #e1efda; }
.nav-link .icon { flex: 0 0 auto; }
.workspace { min-width: 0; }
.topbar { min-height: 62px; display: flex; align-items: center; justify-content: space-between; padding: 9px clamp(15px, 3vw, 36px); gap: 8px; border-bottom: 1px solid var(--line); background: #fbfcfa; }
.topbar-brand { display: none; }
.topbar-meta { display: flex; align-items: center; gap: 11px; min-width: 0; }
.topbar-meta strong { white-space: nowrap; }
.topbar-date { color: var(--muted); font-size: .86rem; }
.avatar { flex: 0 0 auto; width: 33px; height: 33px; border-radius: 50%; color: var(--green); background: var(--mint-deep); display: grid; place-items: center; font-size: .78rem; font-weight: 700; }
.content { padding: 29px clamp(15px, 3vw, 36px) 50px; max-width: 1480px; margin: 0 auto; }
.page-header { display: flex; align-items: end; justify-content: space-between; gap: 13px; margin-bottom: 21px; }
.page-header p { color: var(--muted); margin-top: 7px; }
.page-header .actions { flex-shrink: 0; }
.mobile-title { display: none; }
.icon { width: 19px; height: 19px; display: inline-block; vertical-align: middle; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 8px; min-height: 41px; padding: 8px 13px; text-decoration: none; font-weight: 680; line-height: 1.25; white-space: nowrap; }
.button.primary { color: #fff; background: var(--green); }
.button.primary:hover { background: #236045; }
.button.secondary { color: var(--green); background: #fff; border-color: #bdcdbf; }
.button.secondary:hover { background: var(--mint); }
.button.clear { color: var(--green); background: transparent; }
.button.clear:hover { background: var(--mint); }
.button.danger { color: var(--red); border-color: #e3babc; background: #fff; }
.button.compact { min-height: 35px; padding: 6px 9px; font-size: .87rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.panel-pad { padding: clamp(13px, 2.4vw, 22px); }
.panel + .panel, .blocks > * + * { margin-top: 16px; }
.section-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 15px; }
.section-heading p { margin-top: 4px; font-size: .88rem; color: var(--muted); }
.grid { display: grid; gap: 13px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.split { display: grid; gap: 16px; grid-template-columns: 1.25fr minmax(0, 1fr); }
.split > .panel { margin: 0; min-width: 0; }
.split .chart-panel { min-height: 300px; }
.metric { padding: 16px 17px; min-width: 0; }
.metric strong { display: block; margin-top: 10px; font-size: clamp(1.23rem, 2vw, 1.73rem); line-height: 1.17; overflow-wrap: anywhere; }
.metric .muted { display: block; margin-top: 5px; font-size: .84rem; }
.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-bottom: 16px; }
.toolbar label { min-width: 120px; }
.field, .toolbar label { display: grid; align-content: start; gap: 6px; min-width: 0; color: #3d5145; font-size: .88rem; font-weight: 650; }
.field + .field { margin-top: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.form-grid .field { margin: 0; }
.full { grid-column: 1 / -1; }
input:not([type="checkbox"]), textarea, select { width: 100%; border-radius: 7px; border: 1px solid #c5d1c8; background: #fff; min-height: 41px; padding: 8px 10px; min-width: 0; font-weight: 430; }
input[type="checkbox"] { accent-color: var(--green); width: 16px; height: 16px; }
textarea { resize: vertical; min-height: 94px; }
.hint { line-height: 1.5; color: var(--muted); font-weight: 450; }
.banner { padding: 11px 13px; color: var(--green); background: var(--mint); border: 1px solid #d7e6d4; border-radius: 8px; margin-bottom: 15px; overflow-wrap: anywhere; }
.banner.error { background: var(--red-light); color: var(--red); border-color: #f0c7c6; }
.banner.warn { background: var(--amber-light); color: var(--amber); border-color: #efd7aa; }
.empty { padding: 26px 18px; text-align: center; border: 1px dashed #cbd8ce; border-radius: 8px; color: var(--muted); }
.tag { padding: 4px 8px; border-radius: 5px; background: #e9eeeb; color: #466154; white-space: nowrap; font-size: .78rem; font-weight: 680; display: inline-block; }
.tag.approved { background: var(--mint); color: var(--green); }
.tag.pending { background: var(--amber-light); color: var(--amber); }
.tag.returned, .tag.rejected { background: var(--red-light); color: var(--red); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .9rem; }
th, td { border-bottom: 1px solid var(--line); padding: 12px 10px; vertical-align: top; }
th { font-size: .79rem; color: var(--muted); font-weight: 660; background: #f8faf7; white-space: nowrap; }
td:first-child, th:first-child { padding-left: 13px; }
td:last-child, th:last-child { padding-right: 13px; }
tr:last-child td { border-bottom: 0; }
.nowrap { white-space: nowrap; }
.row-copy { min-width: 150px; max-width: 360px; overflow-wrap: anywhere; }
.row-copy small { display: block; margin-top: 4px; }

.bar-chart { display: grid; gap: 12px; margin-top: 20px; }
.bar-row { display: grid; grid-template-columns: minmax(56px, 17%) minmax(25px, 1fr) minmax(76px, max-content); align-items: center; gap: 8px; font-size: .87rem; }
.bar-row .num { justify-self: end; }
.bar-rail { height: 11px; background: #edf1ed; border-radius: 2px; overflow: hidden; }
.bar-rail span { display: block; width: var(--share, 0%); height: 100%; background: var(--chart, #236045); border-radius: 2px; }
.pie-layout { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px 20px; }
.pie { width: min(100%, 155px); aspect-ratio: 1; border-radius: 50%; background: var(--pie-bg, #edf1ed); flex: 0 0 auto; display: grid; place-items: center; }
.pie span { width: 64%; aspect-ratio: 1; border-radius: 50%; background: #fff; display: grid; place-content: center; text-align: center; padding: 4px; }
.pie span strong { font-size: .93rem; overflow-wrap: anywhere; }
.legend { display: grid; align-content: start; gap: 7px; min-width: 120px; padding: 0; list-style: none; }
.legend li { display: grid; grid-template-columns: 11px minmax(42px, 1fr) auto; align-items: center; gap: 7px; font-size: .84rem; }
.legend i { width: 9px; height: 9px; background: var(--chart); border-radius: 3px; }
.negative { color: var(--red); }
.bar-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(40px, 1fr)); gap: 8px; min-width: 0; max-width: 760px; padding: 0; margin: 10px auto 0; list-style: none; }
.bar-column { display: grid; grid-template-rows: minmax(14px, auto) 135px minmax(26px, auto); gap: 6px; align-items: end; align-content: start; text-align: center; color: var(--muted); font-size: .77rem; overflow-wrap: anywhere; }
.bar-column > span:last-child { align-self: start; }
.bar-space { height: 100%; width: 100%; display: flex; justify-content: center; align-items: end; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to top, #f7f9f6, #f7f9f6 32px, #edf2ec 33px, #f7f9f6 34px); }
.bar-fill { display: block; width: clamp(13px, 58%, 45px); height: var(--height, 0%); background: var(--chart, #236045); border-radius: 4px 4px 0 0; }
.compose-actions, .submit-entries { margin-top: 12px; }
.submit-entries { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.submit-entries > label { width: min(100%, 180px); }
.batch-actions { margin-bottom: 12px; }
.audit-details { margin: 6px 0 0; font-size: .75rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.conversation { display: grid; gap: 13px; margin-bottom: 14px; max-height: 530px; overflow-y: auto; align-items: start; }
.message { border-radius: 10px 10px 10px 3px; background: #eef3ee; padding: 11px 13px; max-width: min(95%, 740px); white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user { justify-self: end; border-radius: 10px 10px 3px 10px; background: #dcebdc; }
.draft { border: 1px solid var(--line); border-radius: 9px; padding: 13px; margin-bottom: 12px; min-inline-size: 0; }
.draft legend { padding: 0 5px; color: var(--green); font-size: .91rem; font-weight: 700; }
.draft .actions { margin-top: 12px; }
.allocation-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(85px, .55fr) auto; gap: 7px; align-items: end; margin-top: 7px; }
.allocation-row label { margin-top: 0; }
.notice-list { display: grid; gap: 9px; padding: 0; list-style: none; margin: 0; }
.notice-list li { border: 1px solid var(--line); padding: 12px; border-radius: 8px; overflow-wrap: anywhere; }
.notice-list li p { margin-top: 4px; }
.account-card { border: 1px solid var(--line); border-radius: 9px; padding: 13px; overflow-wrap: anywhere; }
.account-card h3 { margin-bottom: 8px; }
.account-card strong.balance { display: block; font-size: 1.3rem; line-height: 1.25; }
.account-card small { display: block; margin-top: 5px; }
.account-card .actions { margin-top: 11px; }
.entry-check { display: inline-flex; align-items: center; gap: 7px; }

dialog { width: min(560px, calc(100% - 26px)); max-height: calc(100dvh - 28px); padding: 21px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); box-shadow: 0 16px 60px #0c1d1680; overflow: auto; }
dialog::backdrop { background: #15241bd1; }
dialog .actions { justify-content: end; margin-top: 16px; }
dialog .draft .actions { justify-content: start; margin-top: 10px; }
dialog h2 { margin-bottom: 5px; }
dialog .banner { margin-top: 12px; margin-bottom: 0; }
dialog .dialog-body { margin: 14px 0 0; }
.dialog-description { color: var(--muted); font-size: .89rem; }

@media (max-width: 910px) {
  .shell { grid-template-columns: 168px minmax(0, 1fr); }
  .sidebar { padding-inline: 10px; }
  .sidebar .brand { margin-inline: 3px; gap: 7px; }
  .split { grid-template-columns: 1fr; }
  .split .chart-panel { min-height: 0; }
}

@media (max-width: 660px) {
  .login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-identity { padding: 25px 23px 27px; gap: 24px; }
  .login-identity h1 { font-size: 2.15rem; }
  .login-content { align-items: start; padding: 32px 23px; }
  .shell { display: flex; flex-direction: column; }
  .topbar { min-height: 54px; padding: 7px 12px; }
  .topbar-brand { display: inline-flex; }
  .topbar-brand .brand-mark { width: 29px; height: 29px; font-size: .92rem; }
  .topbar-brand .brand-name { font-size: .82rem; }
  .topbar-date, .topbar-meta .avatar, .topbar-meta > strong { display: none; }
  .workspace { order: 0; }
  .sidebar { min-height: 0; width: 100%; background: #f9fbf8; color: var(--ink); order: 1; position: fixed; top: auto; bottom: 0; z-index: 3; padding: 0 5px env(safe-area-inset-bottom, 0); border-top: 1px solid var(--line); }
  .sidebar .brand { display: none; }
  .sidebar ul { display: flex; gap: 0; overflow-x: auto; }
  .sidebar li { flex: 1 0 auto; min-width: 53px; }
  .nav-link { border-radius: 0; min-height: 53px; gap: 3px; flex-direction: column; justify-content: center; padding: 4px 5px; font-size: .68rem; white-space: nowrap; color: var(--muted); }
  .nav-link:hover { background: var(--mint); color: var(--green); }
  .nav-link .icon { width: 17px; height: 17px; }
  .content { padding: 18px 11px calc(82px + env(safe-area-inset-bottom, 0)); }
  .page-header { align-items: start; margin-bottom: 13px; }
  .page-header p { font-size: .83rem; }
  .toolbar { gap: 7px; }
  .toolbar label { min-width: min(110px, 100%); flex: 1 1 auto; }
  .panel-pad { padding: 13px 10px; }
  .bar-row { grid-template-columns: minmax(46px, 60px) minmax(24px, 1fr) minmax(66px, max-content); font-size: .8rem; }
  .bar-columns { gap: 4px; }
  .bar-column { font-size: .69rem; grid-template-rows: minmax(30px, auto) 100px minmax(25px, auto); }
  .bar-column .num { min-width: 0; }
}

@media (max-width: 374px) {
  .form-grid { display: block; }
  .form-grid .field + .field { margin-top: 9px; }
  .page-header { flex-wrap: wrap; }
}
