:root {
  color-scheme: light;
  font-family: "Source Sans 3", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #162c28;
  background: #f3f7f4;
  font-synthesis: none;
  --ink: #162c28;
  --muted: #506861;
  --line: #d9e4df;
  --surface: #fff;
  --accent: #17654f;
  --accent-hover: #12523f;
  --focus: #067561;
  --radius: 12px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-underline-offset: .2em; }
:where(button, input, select, textarea, a):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.header-inner, .shell {
  max-width: 1350px;
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 48px);
}
.header-inner, .brand, .account-bar, .heading-actions, .worklist-heading,
.dialog-heading, .receipt-heading, .section-heading {
  display: flex;
  align-items: center;
}
.header-inner { min-height: 70px; justify-content: space-between; gap: 18px; }
.brand { gap: 11px; font-size: 15px; font-weight: 760; white-space: nowrap; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  color: #fff;
  background: #175c4a;
  font-size: 17px;
}
.brand-divider { color: #8ba298; margin-inline: 3px; }
.account-bar { gap: 12px; }
.account-name { font-size: 14px; overflow-wrap: anywhere; }
.shell { padding-block: clamp(28px, 5vw, 58px); }
.centered { text-align: center; color: var(--muted); }
.login-shell {
  display: grid;
  min-height: calc(100vh - 70px);
  align-content: center;
  justify-items: center;
}
.login-card {
  width: min(100%, 410px);
  padding: clamp(22px, 5vw, 36px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 12px 45px #234a3910;
}
.login-card > p, .workspace-heading p, .dialog-heading p, .section-heading p {
  color: var(--muted);
  margin: 7px 0 0;
  line-height: 1.55;
}
.login-card .stack { margin-top: 25px; }
.stack { display: grid; gap: 14px; align-content: start; }
.stack .button-primary { margin-top: 4px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(26px, 3.5vw, 37px); line-height: 1.16; letter-spacing: -.028em; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

label { display: grid; gap: 6px; color: #354e47; font-size: 13px; font-weight: 650; }
input, select, textarea {
  width: 100%;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid #c9d9d2;
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font-size: 14px;
  min-height: 40px;
}
input:disabled, select:disabled, textarea:disabled { opacity: .7; }
input[type="file"] { padding: 6px; }
input[type="file"]::file-selector-button {
  border: 0;
  border-radius: 5px;
  background: #e9f2ed;
  color: var(--ink);
  padding: 5px 8px;
  margin-right: 8px;
  cursor: pointer;
}
textarea { resize: vertical; }
.button {
  min-height: 40px;
  border: 1px solid #cbdcd3;
  border-radius: 7px;
  padding: 7px 13px;
  background: #fff;
  color: #234d40;
  cursor: pointer;
  font-weight: 680;
  white-space: nowrap;
}
.button:hover { border-color: #a4c5b5; background: #f1f8f3; }
.button:disabled { cursor: not-allowed; opacity: .6; }
.button-primary { border-color: var(--accent); color: #fff; background: var(--accent); }
.button-primary:hover { border-color: var(--accent-hover); background: var(--accent-hover); }
.button-small { min-height: 34px; padding: 5px 10px; font-size: 13px; }

.workspace-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.heading-actions { gap: 12px; }
.secondary-text { font-size: 13px; color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 19px; }
.metric {
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.metric:first-child { background: #e7f3ec; border-color: #caddd3; }
.metric-label { color: var(--muted); font-size: 13px; font-weight: 675; }
.metric-value {
  margin-top: 7px;
  display: block;
  font-size: clamp(20px, 3.2vw, 31px);
  font-weight: 760;
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.worklist { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.worklist-heading { justify-content: space-between; gap: 8px; padding: 18px 18px 12px; }
.filters {
  display: grid;
  align-items: end;
  gap: 10px;
  grid-template-columns: minmax(175px, 1.6fr) minmax(105px, 1fr) minmax(105px, 1fr) minmax(115px, 1fr) auto;
  padding: 0 18px 16px;
}
.filters .button { min-height: 40px; }
.order-list { min-height: 110px; }
.table-scroll { overflow-x: auto; border-radius: 0 0 var(--radius) var(--radius); }
.orders { width: 100%; border-collapse: collapse; text-align: left; min-width: 790px; font-size: 14px; }
.orders th { background: #eff5f1; color: #425e53; font-size: 12px; font-weight: 760; }
.orders :is(th, td) { padding: 13px 11px; }
.orders :is(th, td):first-child { padding-left: 18px; }
.orders :is(th, td):last-child { padding-right: 18px; }
.orders td { border-top: 1px solid #e5ece8; vertical-align: middle; }
.orders tbody tr:hover { background: #f8fbf9; }
.orders .amount-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }
.order-main { display: block; font-weight: 730; }
.order-sub { display: block; color: var(--muted); margin-top: 3px; font-size: 12px; line-height: 1.4; }
.orders .order-name { min-width: 145px; }
.orders .order-exam { min-width: 125px; }
.pill {
  display: inline-block;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 710;
  padding: 4px 8px;
  white-space: nowrap;
}
.pill-neutral { background: #ebf0ee; color: #42594f; }
.pill-pending { background: #f8efdc; color: #75470f; }
.pill-good { background: #e5f3e9; color: #1a6043; }
.pill-alert { background: #fbeae6; color: #953d2e; }
.empty-state { padding: 32px 18px; text-align: center; color: var(--muted); }
.message {
  border: 1px solid #c9dbd1;
  border-radius: 8px;
  background: #edf7f1;
  color: #205644;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.message-error { border-color: #f0d0c8; background: #ffefeb; color: #8e3327; }
#workspace-message { margin-bottom: 16px; }

dialog {
  width: min(860px, calc(100% - 26px));
  max-height: calc(100% - 24px);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 0;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 16px 60px #172f2b45;
}
dialog::backdrop { background: #132a25a0; }
.dialog-heading {
  justify-content: space-between;
  gap: 15px;
  padding: 18px 22px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.dialog-heading h2 { overflow-wrap: anywhere; }
.dialog-heading p { font-size: 13px; overflow-wrap: anywhere; }
.dialog-content { padding: 17px 22px 20px; }
#dialog-message { margin: 0 22px 19px; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 20px;
}
.detail-value { border-radius: 7px; background: #f0f5f2; padding: 9px 10px; }
.detail-value dt { color: var(--muted); font-size: 12px; }
.detail-value dd { margin: 4px 0 0; font-size: 15px; font-weight: 710; overflow-wrap: anywhere; }
.detail-section + .detail-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.section-heading { justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.detail-section .secondary-text { line-height: 1.5; }
.receipt-list { display: grid; gap: 9px; }
.receipt { padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; }
.receipt-heading { justify-content: space-between; gap: 8px; }
.receipt-heading strong { font-variant-numeric: tabular-nums; }
.receipt .order-sub { margin-top: 4px; }
.notice-inline {
  margin-top: 7px;
  color: #8f3e2e;
  background: #fff0eb;
  border-radius: 5px;
  padding: 5px 7px;
  font-size: 13px;
}
.receipt details { margin-top: 8px; }
.receipt summary { cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 690; }
.receipt .receipt-preview {
  display: block;
  max-width: min(100%, 420px);
  max-height: 380px;
  margin-top: 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  object-fit: contain;
}
.receipt-form, .finance-form, .commission-form, .review-form {
  display: grid;
  gap: 9px 12px;
  align-items: end;
}
.receipt-form { grid-template-columns: minmax(95px, .7fr) minmax(180px, 1.6fr) auto; }
.finance-form { grid-template-columns: repeat(2, minmax(0, 1fr)) auto; }
.commission-form { grid-template-columns: minmax(140px, .8fr) minmax(140px, 1.2fr) auto; }
.review-form { margin-top: 10px; grid-template-columns: minmax(100px, 1fr) auto auto; }
.receipt-actions { margin-top: 9px; }

@media (max-width: 740px) {
  .site-header .header-inner { min-height: 61px; }
  .workspace-heading { align-items: flex-start; }
  .heading-actions { align-items: flex-end; flex-direction: column-reverse; gap: 4px; }
  .metrics { gap: 7px; }
  .metric { padding: 11px 9px; }
  .metric-label { font-size: 12px; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .search-field { grid-column: 1 / -1; }
  .worklist-heading { padding-inline: 12px; }
  .filters { padding-inline: 12px; }
  .dialog-content, .dialog-heading { padding-inline: 13px; }
  #dialog-message { margin-inline: 13px; }
}
@media (max-width: 485px) {
  .brand { font-size: 13px; gap: 7px; }
  .brand-mark { width: 30px; height: 30px; }
  .account-bar { gap: 5px; }
  .account-name { font-size: 12px; }
  .workspace-heading { gap: 8px; }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .receipt-form, .finance-form, .commission-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .receipt-form button, .finance-form button, .commission-form button { grid-column: 1 / -1; }
  .review-form label { grid-column: 1 / -1; }
}
