:root {
  --paper: #f5f7f4;
  --surface: #ffffff;
  --ink: #18231e;
  --muted: #66726c;
  --line: #d6ddd8;
  --jade: #276b4d;
  --jade-dark: #1e543c;
  --jade-soft: #e8f1ec;
  --cinnabar: #a44432;
  --cinnabar-soft: #f7ebe8;
  --brass: #9a762f;
  --brass-soft: #f5f0e3;
  --blue: #315f78;
  --shadow: 0 12px 40px rgba(24,35,30,.08);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif; letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(39,107,77,.24); outline-offset: 2px; }
[hidden] { display: none !important; }

.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(440px, .92fr) minmax(520px, 1.08fr); background: #fff; }
.auth-brand { position: relative; min-height: 100vh; display: flex; flex-direction: column; justify-content: space-between; padding: 56px clamp(42px, 6vw, 92px) 42px; overflow: hidden; background: #183126; color: #fff; isolation: isolate; }
.auth-brand::before { content: "易"; position: absolute; z-index: -1; right: -32px; bottom: -80px; color: rgba(255,255,255,.035); font: 700 430px/1 "Songti SC", "STSong", serif; }
.auth-brand::after { content: ""; position: absolute; z-index: -1; inset: 0; background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px); background-size: 72px 72px; }
.auth-index { position: absolute; top: 0; right: 26px; height: 100%; display: flex; flex-direction: column; justify-content: space-between; padding: 48px 0; border-left: 1px solid rgba(210,180,108,.55); color: #d8bd79; font: 600 10px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; writing-mode: vertical-rl; letter-spacing: 0; }
.auth-index span { margin-left: 10px; }
.auth-brand-content { margin: auto 0; max-width: 620px; }
.seal-mark { width: 82px; height: 82px; display: grid; place-items: center; margin-bottom: 34px; border: 1px solid rgba(216,189,121,.65); background: rgba(255,255,255,.045); }
.seal-mark img { width: 68px; height: 68px; object-fit: contain; }
.eyebrow { margin: 0 0 8px; color: var(--jade); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.auth-brand .eyebrow { margin-bottom: 18px; color: #d8bd79; font: 600 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.auth-brand h1 { margin: 0; max-width: 560px; font: 700 clamp(38px, 4.3vw, 64px)/1.22 "Songti SC", "STSong", serif; }
.auth-system-name { margin: 16px 0 0; color: #dbe5df; font: 400 22px/1.5 "Songti SC", "STSong", serif; }
.auth-brand-meta { display: flex; gap: 0; margin-top: 36px; border-top: 1px solid rgba(255,255,255,.16); border-bottom: 1px solid rgba(255,255,255,.16); }
.auth-brand-meta span { padding: 12px 22px; border-right: 1px solid rgba(255,255,255,.16); color: #b8c8bf; font-size: 12px; }
.auth-brand-meta span:first-child { padding-left: 0; }
.auth-brand-foot { display: flex; justify-content: space-between; padding-right: 22px; color: #82988d; font: 600 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.test-badge, .environment { width: fit-content; border: 1px solid currentColor; padding: 5px 9px; color: #d8bd79; font: 700 11px/1 monospace; }
.auth-panel { display: grid; place-items: center; padding: 48px clamp(34px, 7vw, 112px); background: #fbfcfb; }
.auth-panel-inner { width: min(100%, 430px); }
.auth-panel-head { margin-bottom: 38px; }
.auth-panel-head .test-badge { margin-bottom: 44px; color: var(--cinnabar); }
.auth-panel-head .eyebrow { margin-bottom: 12px; color: var(--brass); font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.auth-panel-head h2 { margin: 0; font: 700 32px/1.25 "Songti SC", "STSong", serif; }
.auth-panel-head > p:last-child { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 30px; border-bottom: 1px solid var(--line); }
.auth-tab { border: 0; border-bottom: 2px solid transparent; padding: 13px 4px; background: transparent; color: var(--muted); text-align: left; }
.auth-tab:last-child { text-align: right; }
.auth-tab.active { border-bottom-color: var(--jade); color: var(--ink); font-weight: 700; }
.auth-panel .stack-form { gap: 18px; }
.auth-panel label { color: #34433b; }
.auth-panel input { min-height: 50px; border-color: #bcc8c1; padding: 12px 14px; background: #fff; }
.auth-panel input::placeholder { color: #9aa69f; }
.auth-panel input:hover { border-color: #91a399; }
.auth-panel input:focus { border-color: var(--jade); box-shadow: 0 0 0 3px rgba(39,107,77,.1); outline: 0; }
.auth-submit { min-height: 50px; margin-top: 8px; font-weight: 700; }
.auth-panel-foot { display: flex; justify-content: space-between; margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--line); color: #849089; font: 600 10px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; }
.stack-form { display: grid; gap: 20px; }
label { display: grid; gap: 7px; color: #3d4943; font-size: 13px; font-weight: 600; }
input, select, textarea { width: 100%; min-height: 42px; border: 1px solid #c7d0ca; border-radius: 4px; padding: 9px 11px; background: #fff; color: var(--ink); }
textarea { min-height: 110px; resize: vertical; line-height: 1.65; }
input:disabled, select:disabled, textarea:disabled { background: #edf0ee; color: #727c77; }
.primary, .secondary, .danger, .quiet, .nav-button, .table-action { min-height: 40px; border-radius: 4px; border: 1px solid transparent; padding: 9px 14px; }
.primary { background: var(--jade); color: #fff; }
.primary:hover { background: var(--jade-dark); }
.secondary { border-color: var(--jade); background: #fff; color: var(--jade); }
.danger { background: var(--cinnabar); color: #fff; }
.quiet { border-color: var(--line); background: transparent; color: inherit; }
.action-link { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; text-decoration: none; }
.form-note { margin: -8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: #1c2c24; color: #e9efeb; }
.side-brand { height: 86px; display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid rgba(255,255,255,.1); }
.side-brand > span { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid #c7a95f; color: #e2cb8d; font: 700 22px/1 "Songti SC", serif; }
.side-brand strong, .side-brand small { display: block; }
.side-brand small { margin-top: 3px; color: #9fb0a7; font-size: 11px; }
#mainNav { flex: 1; overflow-y: auto; padding: 16px 10px; }
.nav-button { width: 100%; display: flex; justify-content: space-between; margin-bottom: 4px; border: 0; background: transparent; color: #bdcac3; text-align: left; }
.nav-button:hover, .nav-button.active { background: #2a4336; color: #fff; }
.nav-button small { color: #8fa298; }
.side-user { padding: 16px; border-top: 1px solid rgba(255,255,255,.1); }
.side-user strong, .side-user small { display: block; }
.side-user small { color: #9fb0a7; margin: 4px 0 12px; }
.side-user .quiet { width: 100%; color: #dce5e0; border-color: #53695e; }
.side-user-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.workspace { min-width: 0; }
.workspace-head { min-height: 86px; display: flex; align-items: center; justify-content: space-between; padding: 18px 30px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.86); }
.workspace-head h1 { margin: 0; font: 700 26px/1.2 "Songti SC", "STSong", serif; }
.environment { color: var(--cinnabar); }
.content { max-width: 1500px; padding: 24px 30px 60px; }

.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); border: 1px solid var(--line); background: var(--surface); }
.metric { min-height: 118px; padding: 20px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric strong { display: block; margin-top: 10px; font: 700 30px/1 monospace; }
.metric span { color: var(--muted); font-size: 12px; }
.section { margin-top: 24px; }
.notice { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 16px; padding: 13px 16px; border-left: 4px solid var(--brass); background: var(--brass-soft); }
.notice span { color: var(--muted); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-size: 17px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; padding: 14px; border: 1px solid var(--line); border-bottom: 0; background: #fbfcfb; }
.toolbar label { min-width: 150px; flex: 1; }
.toolbar button, .toolbar a { flex: 0 0 auto; }
.data-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 11px 12px; background: #edf1ee; color: #4d5953; text-align: left; white-space: nowrap; }
td { padding: 12px; border-top: 1px solid #e2e7e4; vertical-align: middle; }
tbody tr:hover { background: #f7faf8; }
.table-action { min-height: 32px; padding: 5px 9px; border-color: var(--line); background: #fff; color: var(--jade); white-space: nowrap; }
.status { display: inline-flex; align-items: center; min-height: 25px; padding: 3px 8px; border-radius: 999px; background: #edf1ee; color: #4e5d55; font-size: 12px; white-space: nowrap; }
.status.pending, .status.returned { background: var(--brass-soft); color: #76591d; }
.status.approved, .status.active, .status.paid { background: var(--jade-soft); color: var(--jade-dark); }
.status.rejected, .status.left, .status.unpaid { background: var(--cinnabar-soft); color: #853526; }

.form-section { padding: 20px; border: 1px solid var(--line); border-bottom: 0; background: #fff; }
.form-section:last-of-type { border-bottom: 1px solid var(--line); }
.form-section h2 { margin: 0 0 16px; font-size: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border: 1px solid var(--line); background: rgba(255,255,255,.95); box-shadow: 0 -8px 24px rgba(24,35,30,.06); }
.photo-upload { display: flex; align-items: center; gap: 20px; }
.portrait-frame { width: 120px; aspect-ratio: 3 / 4; flex: 0 0 auto; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); background: #f3f6f4; color: var(--muted); font-size: 12px; }
.portrait-frame img { width: 100%; height: 100%; display: block; object-fit: cover; }
.portrait-frame-small { width: 54px; }
.photo-controls { display: grid; align-content: center; gap: 10px; min-width: min(280px,100%); }
.photo-controls small { color: var(--muted); line-height: 1.55; }
.photo-upload-side { align-items: flex-start; }
.photo-upload-side .photo-controls { min-width: 0; flex: 1; }
.check-row { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; line-height: 1.7; }
.check-row input { width: 18px; min-height: 18px; margin-top: 3px; }
.reviewer-list { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.reviewer-list .check-row { min-height: 58px; padding: 12px; border: 1px solid var(--line); background: #fbfcfb; }
.reviewer-list strong, .reviewer-list small { display: block; }
.reviewer-list small { margin-top: 3px; color: var(--muted); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; }
.detail-main, .detail-side { min-width: 0; }
.record { border: 1px solid var(--line); background: #fff; }
.record-head { display: flex; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.record-head h2 { margin: 0; font: 700 22px/1.3 "Songti SC", serif; }
.member-identity { display: flex; align-items: center; gap: 14px; min-width: 0; }
.record-status { display: flex; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.definition-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
.definition-grid div { padding: 12px 16px; border-right: 1px solid #e5e9e6; border-bottom: 1px solid #e5e9e6; }
.definition-grid dt { color: var(--muted); font-size: 11px; }
.definition-grid dd { margin: 5px 0 0; line-height: 1.55; word-break: break-word; }
.approval-strip { display: grid; grid-template-columns: repeat(4,1fr); gap: 2px; margin-bottom: 18px; background: var(--line); border: 1px solid var(--line); }
.approval-strip.single { grid-template-columns: 1fr; }
.approval-node { min-height: 92px; padding: 13px; background: #fff; }
.approval-node.done { box-shadow: inset 0 3px var(--jade); }
.approval-node.wait { box-shadow: inset 0 3px var(--brass); }
.approval-node.fail { box-shadow: inset 0 3px var(--cinnabar); }
.approval-node strong, .approval-node small { display: block; }
.approval-node small { margin-top: 8px; color: var(--muted); line-height: 1.45; }
.side-panel { padding: 16px; border: 1px solid var(--line); background: #fff; margin-bottom: 14px; }
.side-panel h3 { margin: 0 0 12px; font-size: 15px; }
.side-panel .stack-form { gap: 12px; }
.file-list { display: grid; gap: 8px; }
.file-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid #edf0ee; font-size: 12px; }
.file-row a { color: var(--jade); }
.empty, .loading { padding: 50px 20px; border: 1px dashed #c8d1cb; color: var(--muted); text-align: center; background: rgba(255,255,255,.5); }
.toast { position: fixed; z-index: 20; top: 20px; right: 20px; max-width: min(420px,calc(100vw - 40px)); padding: 13px 16px; border-left: 4px solid var(--jade); background: #fff; box-shadow: var(--shadow); }
.toast.error { border-left-color: var(--cinnabar); }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.readiness-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border: 1px solid var(--line); background: #fff; }
.readiness-item { min-height: 82px; padding: 14px; border-right: 1px solid var(--line); box-shadow: inset 0 3px var(--brass); }
.readiness-item:last-child { border-right: 0; }
.readiness-item.ready { box-shadow: inset 0 3px var(--jade); }
.readiness-item strong, .readiness-item small { display: block; }
.readiness-item small { margin-top: 7px; color: var(--muted); }
.import-preview { margin: 16px 0; padding: 18px; border: 1px solid var(--line); background: #fff; }
.preview-counts { display: flex; gap: 18px; margin-bottom: 14px; }
.error-text { color: var(--cinnabar); }
.error-list { max-height: 260px; overflow: auto; margin-bottom: 14px; padding: 10px 14px; background: var(--cinnabar-soft); color: #713329; }
.error-list p { margin: 6px 0; }
.report-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.report-link { display: block; padding: 16px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; }
.report-link strong, .report-link small { display: block; }
.report-link small { margin-top: 7px; color: var(--muted); }
.fee-batch { border: 1px solid var(--line); background: #fff; }
.fee-batch-head, .fee-batch-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; }
.fee-batch-head { border-bottom: 1px solid var(--line); background: #f6f9f7; }
.fee-batch-head strong, .fee-batch-head small { display: block; }
.fee-batch-head small { margin-top: 4px; color: var(--muted); }
.fee-batch-foot { border-top: 1px solid var(--line); }
.fee-batch .data-wrap { border: 0; }
.fee-table { min-width: 1120px; }
.fee-table th { white-space: nowrap; }
.fee-table td { vertical-align: middle; white-space: nowrap; }
.fee-table td input, .fee-table td select { width: 100%; min-width: 108px; min-height: 38px; padding: 8px 9px; border: 1px solid #cbd5cf; background: #fff; color: var(--ink); }
.fee-table td select { min-width: 100px; }
.fee-table td input:focus, .fee-table td select:focus { border-color: var(--jade); outline: 2px solid rgba(39,107,77,.14); }
.fee-table td input:disabled, .fee-table td select:disabled { background: #f3f5f4; color: var(--muted); }
.roster-controls { display: grid; gap: 18px; }
.roster-controls > label { max-width: 320px; }
.field-label { display: block; margin-bottom: 9px; font-weight: 600; }
.roster-fields { display: grid; grid-template-columns: repeat(4,minmax(150px,1fr)); gap: 8px; }
.roster-fields .check-row { min-height: 42px; padding: 9px 11px; border: 1px solid var(--line); background: #fbfcfb; }
.roster-fields .check-row:has(input:checked) { border-color: var(--jade); background: #eef6f0; }
.roster-preview { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 18px; }
.roster-preview .section-head { margin-bottom: 12px; }
.roster-preview h3 { margin: 0 0 4px; }

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(3,1fr); }
  .metric { border-bottom: 1px solid var(--line); }
  .detail-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .readiness-grid { grid-template-columns: repeat(3,1fr); }
}
@media (max-width: 760px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-brand { min-height: 270px; padding: 28px 28px 24px; }
  .auth-brand::before { right: -12px; bottom: -34px; font-size: 230px; }
  .auth-brand::after { background-size: 54px 54px; }
  .auth-index { display: none; }
  .auth-brand-content { margin: 0; }
  .seal-mark { width: 58px; height: 58px; margin-bottom: 18px; }
  .seal-mark img { width: 48px; height: 48px; }
  .auth-brand .eyebrow { margin-bottom: 8px; }
  .auth-brand h1 { font-size: 30px; }
  .auth-system-name { margin-top: 7px; font-size: 17px; }
  .auth-brand-meta { margin-top: 18px; }
  .auth-brand-meta span { padding: 9px 13px; }
  .auth-brand-foot { display: none; }
  .auth-panel { place-items: start center; padding: 32px 24px 50px; }
  .auth-panel-head { margin-bottom: 24px; }
  .auth-panel-head .test-badge { margin-bottom: 28px; }
  .auth-panel-head h2 { font-size: 28px; }
  .auth-panel-foot { margin-top: 36px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  #mainNav { display: flex; gap: 4px; overflow-x: auto; }
  .nav-button { width: auto; white-space: nowrap; }
  .side-user { display: grid; grid-template-columns: minmax(100px,1fr) auto; align-items: center; gap: 4px 10px; }
  .side-user small { margin: 0; }
  .side-user-actions { grid-column: 2; grid-row: 1 / span 2; }
  .side-user-actions .quiet { white-space: nowrap; }
  .workspace-head { padding: 16px 18px; }
  .content { padding: 18px 14px 50px; }
  .metric-grid { grid-template-columns: repeat(2,1fr); }
  .readiness-grid { grid-template-columns: 1fr; }
  .readiness-item { border-right: 0; border-bottom: 1px solid var(--line); }
  .form-grid, .definition-grid, .report-grid, .reviewer-list { grid-template-columns: 1fr; }
  .roster-fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .form-grid .wide { grid-column: auto; }
  .approval-strip { grid-template-columns: 1fr 1fr; }
  .toolbar { align-items: stretch; }
  .toolbar label { min-width: 100%; }
  .notice { flex-direction: column; }
  .record-head { align-items: flex-start; }
  .photo-upload { align-items: flex-start; }
}

@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toast-in .2s ease-out; }
  @keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
}
