:root {
  color-scheme: light;
  --ink: #18332d;
  --muted: #4c625b;
  --paper: #fff;
  --canvas: #f3f6f2;
  --border: #cdd9d1;
  --line: #e3eae4;
  --green: #1b5948;
  --green-dark: #123f33;
  --tint: #e8f1ea;
  --error: #a13222;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --display: "Songti SC", "Noto Serif CJK SC", "SimSun", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 1rem/1.6 var(--sans);
}
h1, h2, h3, h4, p { margin: 0; }
:focus-visible { outline: 3px solid #398a72; outline-offset: 3px; }
.shell { max-width: 1120px; width: calc(100% - 80px); margin-inline: auto; }

.masthead { background: var(--paper); border-bottom: 1px solid var(--line); }
.masthead-inner { min-height: 66px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.site-name { display: flex; align-items: center; gap: 12px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-size: 1.02rem; font-weight: 700; cursor: pointer; }
.document-mark { position: relative; display: block; width: 34px; height: 34px; border-radius: 8px; background: var(--green-dark); }
.document-mark::before {
  position: absolute;
  inset: 7px 10px;
  border: 1.5px solid #eef8f0;
  border-radius: 2px;
  content: "";
}
.document-mark::after {
  position: absolute;
  top: 13px;
  left: 13px;
  width: 8px;
  height: 5px;
  border-block: 1px solid #eef8f0;
  content: "";
}
.mode-label {
  background: var(--tint);
  border-radius: 5px;
  color: var(--green-dark);
  padding: 3px 10px;
  font-size: .8125rem;
  font-weight: 700;
}
.main { padding-block: 40px 56px; }
.page-intro { margin-bottom: 27px; }
.page-intro h1 {
  font: 700 clamp(2rem, 4vw, 3rem)/1.2 var(--display);
  letter-spacing: .01em;
}
.page-intro p { margin-top: 10px; color: var(--muted); }
.page-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 28%); align-items: start; gap: 28px; }
.workspace, .sidebar { min-width: 0; }
.panel {
  --gutter: clamp(20px, 3vw, 36px);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 23px var(--gutter) 21px;
  border-bottom: 1px solid var(--line);
}
.stage-label { color: var(--green); font-size: .875rem; font-weight: 700; }
.panel-heading h2 { margin-top: 3px; font: 700 1.625rem/1.3 var(--display); }
.section { padding: 18px var(--gutter) 20px; border-bottom: 1px solid var(--line); }
.section h3 { font-size: 1rem; line-height: 1.4; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; margin-top: 11px; }
.field { min-width: 0; }
.field label { display: block; margin-bottom: 5px; color: var(--muted); font-size: .875rem; font-weight: 650; }
.field label span, .required-note span { margin-left: 1px; color: var(--error); }
input, select, button, textarea { font: inherit; }
input:not([type="file"]):not([type="checkbox"]), select, textarea {
  display: block;
  width: 100%;
  min-width: 0;
  height: 45px;
  padding: 8px 11px;
  border: 1px solid #bbc9c0;
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  font-size: 1rem;
}
textarea { height: auto; min-height: 66px; resize: vertical; }
textarea::placeholder { color: #62776e; opacity: 1; }
input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--green); }
.field .checkbox-label { display: flex; align-items: center; gap: 8px; min-height: 42px; }
input::placeholder { color: #62776e; opacity: 1; }
input[type="datetime-local"] { -webkit-appearance: none; appearance: none; }
input[type="datetime-local"]::-webkit-date-and-time-value { margin: 0; text-align: start; }
.amount-control, .select-control { position: relative; }
.amount-control span { position: absolute; inset: 0 auto 0 12px; display: flex; align-items: center; color: var(--green); pointer-events: none; }
.amount-control input { padding-left: 31px; font-variant-numeric: tabular-nums; }
.select-control select { appearance: none; padding-right: 38px; }
.select-control::after {
  position: absolute;
  inset: 17px 15px auto auto;
  width: 8px;
  height: 8px;
  transform: rotate(45deg);
  border-right: 1.5px solid var(--green);
  border-bottom: 1.5px solid var(--green);
  pointer-events: none;
  content: "";
}
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--error); }
.field-error { margin-top: 6px; color: var(--error); font-size: .875rem; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.optional { margin-left: 4px; color: var(--muted); font-size: .875rem; font-weight: 400; }

.attachment-box {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #f9fbf9;
  border: 1px dashed #a6bcb0;
  border-radius: 9px;
}
.attachment-placeholder, .attachment-preview {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: var(--tint);
  color: var(--green);
}
.attachment-icon { display: block; position: relative; width: 19px; height: 16px; overflow: hidden; border: 1.5px solid currentColor; border-radius: 2px; }
.attachment-icon::before { position: absolute; top: 2px; right: 3px; width: 3px; height: 3px; border-radius: 50%; background: currentColor; content: ""; }
.attachment-icon::after { position: absolute; top: 8px; left: 3px; width: 11px; height: 11px; border: 1.5px solid currentColor; transform: rotate(45deg); content: ""; }
.attachment-preview { overflow: hidden; cursor: zoom-in; }
.attachment-preview img { width: 100%; height: 100%; object-fit: cover; }
.attachment-name { overflow-wrap: anywhere; font-size: .9375rem; font-weight: 650; }
.attachment-note { margin-top: 2px; color: var(--muted); font-size: .8125rem; }
.attachment-actions { display: flex; flex-wrap: wrap; gap: 3px 8px; }
.panel-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px var(--gutter); }
.required-note { color: var(--muted); font-size: .875rem; }
.notice { margin-top: 12px; padding: 9px 13px; border-radius: 7px; background: var(--tint); color: var(--green-dark); }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: .9375rem;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}
.button:disabled { opacity: .48; cursor: default; }
.button-primary { min-width: 128px; min-height: 46px; background: var(--green-dark); color: #fff; }
.button-primary:hover { background: var(--green); }
.button-secondary { border-color: #b2c6ba; background: var(--paper); color: var(--green-dark); }
.button-secondary:hover { background: var(--tint); }
.button-text { padding-inline: 5px; background: transparent; color: var(--green); }
.button-text:hover { text-decoration: underline; }

.side-panel { padding: 22px; background: #e8f0e8; border: 1px solid #d5e2d7; border-radius: 12px; }
.side-panel h2 { margin-bottom: 12px; font-size: 1.0625rem; }
.step-list { display: grid; gap: 11px; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: .9375rem; }
.step-list li { display: flex; align-items: center; gap: 9px; }
.step-list li span { display: grid; width: 23px; height: 23px; place-items: center; border: 1px solid #adc1b3; border-radius: 50%; font-size: .8125rem; }
.step-list li[aria-current="step"] { color: var(--green-dark); font-weight: 700; }
.step-list li[aria-current="step"] span { background: var(--green-dark); border-color: var(--green-dark); color: white; }
.privacy-note { margin-top: 14px; padding-inline: 2px; color: var(--muted); font-size: .875rem; }

dialog {
  width: min(520px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 19px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
}
dialog::backdrop { background: rgba(17, 38, 32, .62); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.dialog-heading h2 { font-size: 1.125rem; }
.dialog-image { display: block; margin-inline: auto; max-width: 100%; max-height: 70vh; object-fit: contain; }
.example-receipt { padding: 20px; background: var(--canvas); border: 1px dashed #9bb1a3; border-radius: 9px; }
.receipt-kicker { color: var(--green); font-size: .875rem; font-weight: 700; }
.example-amount { margin-top: 9px; font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.example-status { color: var(--muted); font-size: .875rem; }
.summary { margin: 14px 0 0; }
.summary > div { display: grid; grid-template-columns: minmax(6em, .62fr) minmax(0, 1fr); gap: 8px; padding-block: 9px; border-top: 1px solid var(--line); }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; overflow-wrap: anywhere; font-weight: 650; }
.section-note { margin-top: 6px; color: var(--muted); font-size: .875rem; }
.home-panel .section:last-child { border-bottom: 0; }
.home-start { padding-block: 31px; }
.home-start h2, .lookup-section h2 { font: 700 1.45rem/1.35 var(--display); }
.home-start p { margin-top: 7px; color: var(--muted); }
.home-start .button, #password-submit { margin-top: 16px; }
.lookup-section { padding-block: 25px; }
.lookup-form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 12px; margin-top: 12px; }
.lookup-form .button { min-width: 88px; min-height: 45px; }
#lookup-example { margin-left: -5px; }
.lookup-results, .plan-list { display: grid; gap: 12px; margin-top: 12px; }
.plan-list { margin-bottom: 0; padding: 0; list-style: none; }
.plan-list:empty { display: none; }
.totals { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 17px; }
.totals > div { padding: 13px 15px; min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--canvas); }
.totals dt { color: var(--muted); font-size: .875rem; }
.totals dd { margin: 0; color: var(--green-dark); font-weight: 700; font-size: clamp(1.125rem, 3vw, 1.625rem); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.totals dd[data-complete="false"] { color: #8e4327; }
.plan-types, .dialog-actions, .choices { display: flex; flex-wrap: wrap; gap: 8px; }
.plan-types .button { min-width: 84px; }
.plan-card, .status-record { padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; }
.plan-card header, .status-record header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.plan-card .summary, .status-record .summary { margin-top: 8px; }
.plan-card .summary > div, .status-record .summary > div { padding-block: 6px; font-size: .9rem; }
.plan-card .summary dd { white-space: pre-wrap; }
.plan-card-actions { display: flex; gap: 12px; }
.status-pill { padding: 3px 9px; border-radius: 5px; background: var(--tint); color: var(--green-dark); font-weight: 650; font-size: .8125rem; white-space: nowrap; }
.status-pill[data-pending="true"] { background: #f8ede3; color: #823d28; }
.allocation-actions > div { display: flex; align-items: center; gap: 12px; justify-content: end; flex-wrap: wrap; }
.dialog-actions { justify-content: flex-end; margin-top: 13px; }
.plan-available { margin-bottom: 11px; padding: 8px 12px; border-radius: 7px; background: var(--tint); }
.plan-detail { margin-top: 12px; }
.reference-panel { padding: 12px; border-radius: 7px; background: var(--canvas); }
.reference-panel h3 { font-size: 1rem; }
.reference-panel p { margin: 8px 0 4px; font-size: .875rem; color: var(--muted); }
.choices .button { min-height: 34px; white-space: normal; padding-inline: 8px; text-align: left; font-size: .875rem; }

@media (max-width: 820px) {
  .shell { width: calc(100% - 40px); }
  .page-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .main { padding-top: 30px; }
}
@media (max-width: 540px) {
  .shell { width: calc(100% - 28px); }
  .masthead-inner { min-height: 57px; }
  .document-mark { width: 32px; height: 32px; }
  .document-mark::before { inset-inline: 9px; }
  .document-mark::after { left: 12px; }
  .main { padding-block: 23px 32px; }
  .page-intro { margin-bottom: 17px; }
  .page-intro p { margin-top: 6px; font-size: .9375rem; }
  .panel { --gutter: 16px; border-radius: 11px; }
  .panel-heading { padding-block: 16px; }
  .panel-heading h2 { font-size: 1.375rem; }
  .section { padding-block: 15px 17px; }
  .fields { grid-template-columns: minmax(0, 1fr); gap: 11px; }
  .attachment-box { grid-template-columns: 36px minmax(0, 1fr); gap: 9px; }
  .attachment-placeholder, .attachment-preview { width: 36px; height: 36px; }
  .attachment-actions { grid-column: 2; }
  .side-panel { padding: 16px; }
  .home-start, .lookup-section { padding-block: 19px; }
  .allocation-actions { align-items: flex-end; }
  .allocation-actions > div { justify-items: end; display: grid; gap: 6px; text-align: right; }
}
