:root {
  color-scheme: light;
  --ink: #142824;
  --ink-soft: #38514b;
  --muted: #71817c;
  --canvas: #eeeae1;
  --paper: #fffdf8;
  --paper-deep: #f7f3e9;
  --line: #d9d8ce;
  --line-strong: #c9c9be;
  --green: #1d6759;
  --green-dark: #173f38;
  --green-soft: #e2eee9;
  --orange: #dc6a35;
  --orange-dark: #a74724;
  --orange-soft: #f8e9df;
  --red: #b54137;
  --red-soft: #f8e4e1;
  --blue: #315f77;
  --shadow: 0 22px 55px rgba(22, 44, 39, 0.09);
  --radius-large: 22px;
  --radius-medium: 14px;
  --radius-small: 9px;
  --font-sans: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  --font-mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
label[for] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
label[for]:focus-within,
a:focus-visible {
  outline: 3px solid rgba(29, 103, 89, 0.22);
  outline-offset: 3px;
}

.visually-hidden {
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}

.upload-page {
  background:
    linear-gradient(rgba(23, 63, 56, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 63, 56, 0.025) 1px, transparent 1px),
    var(--canvas);
  background-size: 30px 30px;
}

.overline {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  margin: 0;
}

.brand-mark {
  align-items: center;
  background: var(--green-dark);
  border-radius: 13px;
  color: #fff;
  display: inline-flex;
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 800;
  height: 52px;
  justify-content: center;
  letter-spacing: 0.08em;
  overflow: hidden;
  position: relative;
  width: 52px;
}

.brand-mark i {
  background: var(--orange);
  bottom: 0;
  height: 5px;
  left: 0;
  position: absolute;
  width: 62%;
}

.small-mark {
  border-radius: 10px;
  height: 42px;
  width: 42px;
}

.small-mark i {
  height: 4px;
}

.access-screen {
  align-items: center;
  background:
    radial-gradient(circle at 17% 18%, rgba(51, 139, 120, 0.2), transparent 30%),
    radial-gradient(circle at 85% 82%, rgba(220, 106, 53, 0.15), transparent 31%),
    linear-gradient(142deg, #102b27, #14211f 68%, #30271f);
  display: flex;
  min-height: 100vh;
  padding: 24px;
}

.access-screen::before {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 34px 34px;
  content: "";
  inset: 0;
  pointer-events: none;
  position: fixed;
}

.access-card {
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 24px;
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.32);
  margin: auto;
  max-width: 450px;
  padding: 40px;
  position: relative;
  width: 100%;
}

.access-card .brand-mark {
  margin-bottom: 28px;
}

.access-card h1 {
  font-size: 31px;
  letter-spacing: 0.03em;
  line-height: 1.25;
  margin: 7px 0 10px;
}

.access-intro {
  color: var(--muted);
  margin: 0;
}

.access-demo-warning {
  background: var(--red-soft);
  border: 1px solid #e5b8b2;
  border-radius: var(--radius-small);
  color: #7f3029;
  font-size: 11px;
  margin: 17px 0 -9px;
  padding: 10px 12px;
}

.access-demo-warning strong {
  display: block;
}

.access-loading {
  align-items: center;
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  gap: 10px;
  margin: 26px 0 18px;
  padding: 25px 0;
}

.spinner,
.button-spinner {
  animation: spin 0.8s linear infinite;
  border: 2px solid rgba(29, 103, 89, 0.2);
  border-radius: 50%;
  border-top-color: var(--green);
  display: inline-block;
  height: 17px;
  width: 17px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.access-form {
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  margin: 26px 0 18px;
  padding: 23px 0;
}

.access-note {
  color: var(--muted);
  font-size: 11px;
  margin: 0;
}

.access-note span {
  color: var(--green);
  font-size: 8px;
  margin-right: 5px;
}

.form-error,
.field-error {
  color: var(--red);
  font-size: 12px;
  margin: 7px 0;
  min-height: 20px;
}

.wide-button,
.primary-button {
  align-items: center;
  background: var(--green-dark);
  border: 0;
  border-radius: var(--radius-small);
  color: white;
  cursor: pointer;
  display: flex;
  font-weight: 700;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
}

.wide-button {
  width: 100%;
}

.primary-button:hover {
  background: var(--green);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.offline-banner {
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  left: 0;
  padding: 8px 18px;
  position: fixed;
  right: 0;
  text-align: center;
  top: 0;
  z-index: 80;
}

.demo-mode-banner {
  align-items: center;
  background: #8d342d;
  color: #fff;
  display: flex;
  font-size: 11px;
  gap: 12px;
  justify-content: center;
  padding: 7px 16px;
  text-align: center;
}

.demo-mode-banner strong {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 2px 8px;
}

.portal-header {
  align-items: center;
  backdrop-filter: blur(14px);
  background: rgba(255, 253, 248, 0.93);
  border-bottom: 1px solid var(--line);
  display: flex;
  height: 74px;
  justify-content: space-between;
  padding: 0 34px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.portal-brand {
  align-items: center;
  color: var(--ink);
  display: flex;
  gap: 12px;
  text-decoration: none;
}

.portal-brand strong,
.portal-brand small {
  display: block;
}

.portal-brand strong {
  font-size: 17px;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.portal-brand small {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  margin-top: 3px;
}

.header-actions {
  align-items: center;
  display: flex;
  gap: 16px;
}

.privacy-status,
.session-chip {
  align-items: center;
  background: var(--green-soft);
  border: 1px solid #cbded6;
  border-radius: 999px;
  color: #37685b;
  display: inline-flex;
  font-size: 11px;
  gap: 7px;
  padding: 6px 11px;
}

.privacy-status i,
.session-chip i {
  background: #3b966f;
  border-radius: 50%;
  height: 7px;
  width: 7px;
}

.quiet-button {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 8px;
}

.quiet-button:hover {
  color: var(--ink);
}

.upload-layout {
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 760px);
  gap: clamp(38px, 6vw, 92px);
  justify-content: center;
  margin: 0 auto;
  max-width: 1280px;
  padding: 58px 42px 80px;
}

.intro-rail {
  align-self: start;
  padding-top: 22px;
  position: sticky;
  top: 112px;
}

.intro-rail > h1 {
  font-size: clamp(34px, 4vw, 51px);
  letter-spacing: -0.035em;
  line-height: 1.12;
  margin: 15px 0 18px;
}

.intro-rail > p:not(.overline) {
  color: var(--ink-soft);
  font-size: 15px;
  margin: 0;
  max-width: 290px;
}

.process-list {
  border-bottom: 1px solid var(--line-strong);
  border-top: 1px solid var(--line-strong);
  list-style: none;
  margin: 34px 0 24px;
  padding: 15px 0;
}

.process-list li {
  align-items: center;
  display: flex;
  gap: 14px;
  padding: 10px 0;
}

.process-list > li > span {
  color: var(--orange);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
}

.process-list strong,
.process-list small {
  display: block;
}

.process-list strong {
  font-size: 13px;
}

.process-list small {
  color: var(--muted);
  font-size: 10px;
  margin-top: 1px;
}

.rail-notice {
  background: rgba(255, 253, 248, 0.6);
  border-left: 3px solid var(--green);
  padding: 12px 15px;
}

.rail-notice strong {
  font-size: 12px;
}

.rail-notice p {
  color: var(--muted);
  font-size: 11px;
  margin: 4px 0 0;
}

.collection-workspace {
  min-width: 0;
}

.workspace-heading {
  align-items: flex-end;
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
}

.workspace-heading h2 {
  font-size: 24px;
  line-height: 1.25;
  margin: 5px 0 0;
}

.module-switcher {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 24px;
}

.module-choice {
  align-items: center;
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 12px;
  grid-template-columns: auto auto 1fr auto;
  min-height: 88px;
  padding: 14px;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.module-choice:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.module-choice.active {
  background: var(--paper);
  box-shadow: 0 10px 30px rgba(20, 40, 36, 0.08);
}

.invoice-choice.active {
  border-color: #df936e;
}

.medical-choice.active {
  border-color: #71a396;
}

.module-number {
  align-self: start;
  color: #a1aaa6;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
}

.module-icon,
.drop-symbol,
.capture-symbol {
  align-items: center;
  border-radius: 10px;
  display: flex;
  flex: 0 0 auto;
  height: 42px;
  justify-content: center;
  position: relative;
  width: 42px;
}

.invoice-choice .module-icon,
.invoice-drop .drop-symbol {
  background: var(--orange-soft);
  color: var(--orange-dark);
}

.medical-choice .module-icon,
.capture-symbol {
  background: var(--green-soft);
  color: var(--green);
}

.file-icon::before {
  border: 2px solid currentColor;
  border-radius: 2px;
  content: "";
  height: 21px;
  position: absolute;
  width: 16px;
}

.file-icon::after {
  border-bottom: 2px solid currentColor;
  border-top: 2px solid currentColor;
  content: "";
  height: 5px;
  position: absolute;
  transform: translateY(3px);
  width: 8px;
}

.camera-icon::before {
  border: 2px solid currentColor;
  border-radius: 4px;
  content: "";
  height: 15px;
  position: absolute;
  width: 23px;
}

.camera-icon::after {
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow: -7px -9px 0 -5px currentColor;
  content: "";
  height: 6px;
  position: absolute;
  width: 6px;
}

.gallery-icon::before {
  border: 2px solid currentColor;
  border-radius: 3px;
  content: "";
  height: 19px;
  position: absolute;
  width: 22px;
}

.gallery-icon::after {
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  content: "";
  height: 9px;
  position: absolute;
  transform: rotate(45deg) translate(3px, 2px);
  width: 9px;
}

.module-copy strong,
.module-copy small {
  display: block;
}

.module-copy strong {
  font-size: 14px;
}

.module-copy small {
  color: var(--muted);
  font-size: 10px;
  margin-top: 2px;
}

.choice-arrow {
  color: #9ca7a3;
  font-family: var(--font-mono);
}

.invoice-choice.active .choice-arrow {
  color: var(--orange);
}

.medical-choice.active .choice-arrow {
  color: var(--green);
}

.module-panel {
  animation: panel-in 220ms ease both;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow);
  overflow: hidden;
  scroll-margin-top: 92px;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.invoice-panel {
  border-top: 4px solid var(--orange);
}

.medical-panel {
  border-top: 4px solid var(--green);
}

.module-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 17px;
  padding: 28px 30px 25px;
}

.module-title-mark {
  align-items: center;
  border-radius: 11px;
  display: flex;
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  height: 44px;
  justify-content: center;
  letter-spacing: 0.08em;
  width: 44px;
}

.invoice-title-mark {
  background: var(--orange-soft);
  color: var(--orange-dark);
}

.medical-title-mark {
  background: var(--green-soft);
  color: var(--green);
}

.module-kicker {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin: 0;
}

.module-header h2 {
  font-size: 24px;
  line-height: 1.2;
  margin: 4px 0;
}

.module-header p:last-child {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.collection-form {
  padding: 30px;
}

.collection-form fieldset {
  border: 0;
  border-bottom: 1px solid var(--line);
  margin: 0 0 27px;
  min-width: 0;
  padding: 0 0 28px;
}

.collection-form legend {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 17px;
  padding: 0;
}

.collection-form legend span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  margin-right: 9px;
}

.form-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.field b,
.consent-row b {
  color: var(--red);
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  appearance: none;
  background: #fffefa;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  color: var(--ink);
  min-height: 45px;
  padding: 10px 12px;
  width: 100%;
}

.field textarea {
  line-height: 1.6;
  min-height: 86px;
  resize: vertical;
}

.field select {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  padding-right: 34px;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #a8aeaa;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: #afb5ae;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(29, 103, 89, 0.1);
  outline: 0;
}

.full-field {
  grid-column: 1 / -1;
}

.drop-zone {
  align-items: center;
  background:
    linear-gradient(135deg, rgba(220, 106, 53, 0.035), transparent 55%),
    #fcfaf4;
  border: 1px dashed #cba88f;
  border-radius: var(--radius-medium);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 186px;
  padding: 26px;
  text-align: center;
  transition: background 150ms ease, border-color 150ms ease;
}

.drop-zone:hover {
  background-color: var(--orange-soft);
  border-color: var(--orange);
}

.drop-zone .drop-symbol {
  height: 48px;
  margin-bottom: 12px;
  width: 48px;
}

.drop-zone strong {
  font-size: 14px;
}

.drop-zone small {
  color: var(--muted);
  font-size: 10px;
  margin: 3px 0 13px;
}

.drop-action {
  background: var(--orange);
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 14px;
}

.medical-upload-actions {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.capture-action {
  align-items: center;
  background: #f4f8f5;
  border: 1px solid #c8ddd5;
  border-radius: var(--radius-medium);
  cursor: pointer;
  display: flex;
  gap: 13px;
  min-height: 96px;
  padding: 17px;
  transition: background 150ms ease, border-color 150ms ease;
}

.capture-action:hover {
  background: var(--green-soft);
  border-color: #83ac9f;
}

.secondary-capture {
  background: #faf9f4;
  border-color: var(--line-strong);
}

.capture-action strong,
.capture-action small {
  display: block;
}

.capture-action strong {
  font-size: 13px;
}

.capture-action small {
  color: var(--muted);
  font-size: 9px;
  margin-top: 2px;
}

.photo-guidance {
  align-items: flex-start;
  background: var(--green-soft);
  border-radius: var(--radius-small);
  color: var(--ink-soft);
  display: flex;
  gap: 10px;
  margin-top: 13px;
  padding: 10px 13px;
}

.photo-guidance > span {
  align-items: center;
  background: var(--green);
  border-radius: 50%;
  color: #fff;
  display: flex;
  flex: 0 0 auto;
  font-size: 9px;
  height: 18px;
  justify-content: center;
  margin-top: 2px;
  width: 18px;
}

.photo-guidance p {
  font-size: 10px;
  margin: 0;
}

.selected-files {
  margin-top: 12px;
}

.selected-files.has-files {
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
  overflow: hidden;
}

.file-summary {
  background: var(--paper-deep);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  padding: 8px 12px;
}

.selected-file-row {
  align-items: center;
  background: #fffefa;
  border-bottom: 1px solid #e8e6df;
  display: flex;
  gap: 11px;
  min-height: 62px;
  padding: 9px 12px;
}

.selected-file-row:last-child {
  border-bottom: 0;
}

.file-preview {
  align-items: center;
  border-radius: 7px;
  display: flex;
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 800;
  height: 39px;
  justify-content: center;
  overflow: hidden;
  width: 39px;
}

.pdf-preview {
  background: var(--orange-soft);
  color: var(--orange-dark);
}

.image-preview {
  background: var(--green-soft);
  color: var(--green);
}

.image-preview img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.preview-fallback img {
  display: none;
}

.selected-file-copy {
  min-width: 0;
}

.selected-file-copy strong,
.selected-file-copy small {
  display: block;
}

.selected-file-copy strong {
  font-size: 11px;
  max-width: 430px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-file-copy small {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  margin-top: 1px;
}

.remove-file {
  background: transparent;
  border: 0;
  color: var(--red);
  cursor: pointer;
  font-size: 10px;
  margin-left: auto;
  padding: 8px 4px;
}

.consent-row {
  align-items: flex-start;
  color: var(--ink-soft);
  cursor: pointer;
  display: grid;
  font-size: 11px;
  gap: 10px;
  grid-template-columns: 1px 20px 1fr;
  margin: -4px 0 17px;
}

.consent-row > input {
  height: 1px;
  opacity: 0;
  width: 1px;
}

.consent-row > span:nth-child(2) {
  align-items: center;
  background: #fffefa;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  display: flex;
  height: 20px;
  justify-content: center;
  margin-top: 1px;
  width: 20px;
}

.consent-row input:checked + span {
  background: var(--orange);
  border-color: var(--orange);
}

.medical-consent input:checked + span {
  background: var(--green);
  border-color: var(--green);
}

.consent-row input:checked + span i::after {
  border-bottom: 2px solid #fff;
  border-right: 2px solid #fff;
  content: "";
  display: block;
  height: 8px;
  transform: rotate(45deg) translate(-1px, -1px);
  width: 4px;
}

.consent-row input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(29, 103, 89, 0.18);
}

.submit-error {
  margin-bottom: 10px;
}

.submit-button {
  align-items: center;
  border: 0;
  border-radius: var(--radius-small);
  color: #fff;
  cursor: pointer;
  display: flex;
  font-size: 13px;
  font-weight: 700;
  justify-content: space-between;
  min-height: 51px;
  padding: 0 18px;
  width: 100%;
}

.invoice-submit {
  background: var(--orange);
}

.invoice-submit:hover {
  background: var(--orange-dark);
}

.medical-submit {
  background: var(--green);
}

.medical-submit:hover {
  background: var(--green-dark);
}

.submit-button:disabled {
  cursor: wait;
  opacity: 0.75;
}

.submit-button > i {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 18px;
}

.submit-button .button-spinner {
  border-color: rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
}

.receipt-card {
  align-items: flex-start;
  background: #fbefe7;
  border: 1px solid #eac4ae;
  border-radius: var(--radius-medium);
  display: flex;
  gap: 13px;
  margin-top: 15px;
  padding: 16px;
}

.medical-receipt {
  background: var(--green-soft);
  border-color: #c3dbd2;
}

.receipt-check {
  align-items: center;
  background: var(--orange);
  border-radius: 50%;
  color: white;
  display: flex;
  flex: 0 0 auto;
  font-size: 12px;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.medical-receipt .receipt-check {
  background: var(--green);
}

.receipt-card strong {
  font-size: 13px;
}

.receipt-card p {
  color: var(--ink-soft);
  font-size: 11px;
  margin: 2px 0 6px;
}

.receipt-card code {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(20, 40, 36, 0.12);
  border-radius: 5px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 7px;
}

.portal-footnote {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
  margin: 17px auto 0;
  max-width: 650px;
  text-align: center;
}

.noscript-message {
  background: var(--red);
  color: #fff;
  inset: 0;
  padding: 40px;
  position: fixed;
  text-align: center;
  z-index: 100;
}

/* Admin */
.admin-page {
  background: #e9ece8;
}

.admin-shell {
  min-height: 100vh;
}

.admin-header {
  align-items: center;
  background: var(--green-dark);
  color: #fff;
  display: flex;
  justify-content: space-between;
  min-height: 76px;
  padding: 0 34px;
}

.admin-brand {
  align-items: center;
  display: flex;
  gap: 13px;
}

.admin-brand .brand-mark {
  background: #fff;
  color: var(--green-dark);
}

.admin-brand strong,
.admin-brand small {
  display: block;
}

.admin-brand strong {
  font-size: 17px;
  letter-spacing: 0.04em;
}

.admin-brand small {
  color: #a9c3bb;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.admin-header-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.admin-link,
.refresh-button,
.copy-button,
.detail-button,
.dialog-close {
  border-radius: 7px;
  cursor: pointer;
  font-size: 11px;
  text-decoration: none;
}

.admin-link {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  padding: 7px 11px;
}

.admin-link:hover {
  background: rgba(255, 255, 255, 0.16);
}

.admin-main {
  margin: 0 auto;
  max-width: 1260px;
  padding: 36px 34px 70px;
}

.admin-locked {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: calc(100vh - 76px);
}

.locked-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow);
  max-width: 480px;
  padding: 36px;
  text-align: center;
}

.locked-card h1 {
  font-size: 24px;
  margin: 0 0 8px;
}

.locked-card p {
  color: var(--muted);
  margin: 0;
}

.admin-title-row {
  align-items: flex-end;
  display: flex;
  justify-content: space-between;
  margin-bottom: 24px;
}

.admin-title-row h1 {
  font-size: 29px;
  line-height: 1.2;
  margin: 5px 0 0;
}

.refresh-button {
  background: var(--paper);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  padding: 8px 13px;
}

.share-panel {
  background: var(--green-dark);
  border-radius: var(--radius-large);
  color: #fff;
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr auto;
  margin-bottom: 20px;
  overflow: hidden;
  padding: 24px 27px;
  position: relative;
}

.share-panel::after {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  content: "";
  height: 180px;
  position: absolute;
  right: -50px;
  top: -90px;
  width: 180px;
}

.share-panel h2 {
  font-size: 16px;
  margin: 0 0 4px;
}

.share-panel p {
  color: #b7cdc6;
  font-size: 11px;
  margin: 0;
}

.share-values {
  align-items: center;
  display: flex;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.share-value {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  min-width: 150px;
  padding: 8px 11px;
}

.share-value span,
.share-value strong {
  display: block;
}

.share-value span {
  color: #a9c3bb;
  font-size: 9px;
}

.share-value strong {
  font-family: var(--font-mono);
  font-size: 12px;
  margin-top: 2px;
  max-width: 350px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-button {
  background: var(--orange);
  border: 0;
  color: #fff;
  font-weight: 700;
  padding: 8px 11px;
}

.stats-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
}

.stat-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
  padding: 17px;
}

.stat-card span,
.stat-card strong,
.stat-card small {
  display: block;
}

.stat-card span {
  color: var(--muted);
  font-size: 10px;
}

.stat-card strong {
  font-family: var(--font-mono);
  font-size: 25px;
  line-height: 1.3;
  margin-top: 4px;
}

.stat-card small {
  color: var(--muted);
  font-size: 9px;
}

.records-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  box-shadow: 0 14px 35px rgba(22, 44, 39, 0.06);
  overflow: hidden;
}

.records-toolbar {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 15px;
  justify-content: space-between;
  padding: 18px 20px;
}

.filter-tabs {
  background: var(--paper-deep);
  border-radius: 9px;
  display: flex;
  padding: 3px;
}

.filter-tab {
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  padding: 7px 12px;
}

.filter-tab.active {
  background: #fff;
  box-shadow: 0 2px 7px rgba(20, 40, 36, 0.08);
  color: var(--ink);
  font-weight: 700;
}

.record-search {
  background: #fffefa;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  min-height: 36px;
  padding: 7px 11px;
  width: 260px;
}

.record-list {
  min-height: 180px;
}

.record-row {
  align-items: center;
  border-bottom: 1px solid #e7e6df;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(190px, 1.2fr) minmax(150px, 1fr) minmax(180px, 1fr) auto;
  padding: 17px 20px;
}

.record-row:last-child {
  border-bottom: 0;
}

.record-row:hover {
  background: #fbfaf5;
}

.record-primary,
.record-person,
.record-meta {
  min-width: 0;
}

.module-badge {
  border-radius: 999px;
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  margin-right: 7px;
  padding: 3px 7px;
}

.module-badge.invoice {
  background: var(--orange-soft);
  color: var(--orange-dark);
}

.module-badge.medical {
  background: var(--green-soft);
  color: var(--green);
}

.record-id {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
}

.record-primary strong,
.record-person strong,
.record-meta strong {
  display: block;
  font-size: 12px;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-primary small,
.record-person small,
.record-meta small {
  color: var(--muted);
  display: block;
  font-size: 9px;
  margin-top: 2px;
}

.detail-button {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  padding: 7px 10px;
}

.detail-button:hover {
  border-color: var(--green);
  color: var(--green);
}

.empty-records,
.loading-records {
  color: var(--muted);
  padding: 55px 20px;
  text-align: center;
}

.admin-notice {
  color: var(--muted);
  font-size: 10px;
  margin: 14px 4px 0;
}

.detail-dialog {
  background: var(--paper);
  border: 0;
  border-radius: var(--radius-large);
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.28);
  color: var(--ink);
  max-height: calc(100vh - 48px);
  max-width: 700px;
  padding: 0;
  width: calc(100% - 32px);
}

.detail-dialog::backdrop {
  backdrop-filter: blur(3px);
  background: rgba(12, 28, 24, 0.62);
}

.dialog-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 23px 25px;
}

.dialog-header h2 {
  font-size: 20px;
  margin: 4px 0 0;
}

.dialog-close {
  align-items: center;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  color: var(--ink);
  display: flex;
  font-size: 18px;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.dialog-body {
  max-height: calc(100vh - 170px);
  overflow-y: auto;
  padding: 23px 25px 28px;
}

.detail-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-fact {
  background: var(--paper-deep);
  border-radius: 8px;
  padding: 10px 12px;
}

.detail-fact span,
.detail-fact strong {
  display: block;
}

.detail-fact span {
  color: var(--muted);
  font-size: 9px;
}

.detail-fact strong {
  font-size: 12px;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.detail-section-title {
  border-top: 1px solid var(--line);
  font-size: 12px;
  margin: 20px 0 10px;
  padding-top: 17px;
}

.admin-file-row {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  display: flex;
  gap: 10px;
  margin-top: 8px;
  padding: 10px;
}

.admin-file-row .file-preview {
  height: 35px;
  width: 35px;
}

.admin-file-row a {
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  margin-left: auto;
  text-decoration: none;
}

.admin-file-copy {
  min-width: 0;
}

.admin-file-copy strong,
.admin-file-copy small {
  display: block;
}

.admin-file-copy strong {
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-file-copy small {
  color: var(--muted);
  font-size: 9px;
}

@media (max-width: 900px) {
  .upload-layout {
    display: block;
    max-width: 800px;
    padding-top: 34px;
  }

  .intro-rail {
    margin-bottom: 32px;
    padding: 0;
    position: static;
  }

  .intro-rail > h1 br {
    display: none;
  }

  .intro-rail > p:not(.overline) {
    max-width: none;
  }

  .process-list {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 15px 0;
  }

  .process-list li {
    align-items: flex-start;
  }

  .rail-notice {
    display: none;
  }

  .share-panel {
    grid-template-columns: 1fr;
  }

  .share-values {
    flex-wrap: wrap;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .record-row {
    grid-template-columns: minmax(160px, 1fr) minmax(140px, 1fr) auto;
  }

  .record-meta {
    display: none;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 13px;
  }

  .access-screen {
    align-items: flex-start;
    padding: max(24px, env(safe-area-inset-top)) 15px 24px;
  }

  .access-card {
    border-radius: 19px;
    margin-top: 7vh;
    padding: 29px 24px;
  }

  .access-card h1 {
    font-size: 27px;
  }

  .portal-header {
    height: 64px;
    padding: 0 15px;
  }

  .demo-mode-banner {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
    padding: 8px 15px;
    text-align: left;
  }

  .small-mark {
    height: 38px;
    width: 38px;
  }

  .portal-brand strong {
    font-size: 14px;
  }

  .portal-brand small,
  .privacy-status {
    display: none;
  }

  .header-actions {
    gap: 5px;
  }

  .upload-layout {
    padding: 26px 13px 55px;
  }

  .intro-rail {
    margin-bottom: 25px;
    padding: 0 5px;
  }

  .intro-rail > h1 {
    font-size: 34px;
    margin: 10px 0 12px;
  }

  .intro-rail > p:not(.overline) {
    font-size: 13px;
  }

  .process-list {
    display: block;
    margin: 22px 0 0;
  }

  .process-list li {
    padding: 7px 0;
  }

  .workspace-heading {
    align-items: flex-start;
    padding: 0 5px;
  }

  .workspace-heading h2 {
    font-size: 20px;
  }

  .session-chip {
    font-size: 9px;
    padding: 5px 8px;
  }

  .module-switcher {
    gap: 8px;
  }

  .module-choice {
    display: flex;
    gap: 9px;
    min-height: 80px;
    padding: 12px 10px;
  }

  .module-number,
  .choice-arrow {
    display: none;
  }

  .module-icon {
    border-radius: 8px;
    height: 36px;
    width: 36px;
  }

  .module-copy strong {
    font-size: 12px;
  }

  .module-copy small {
    font-size: 8px;
  }

  .module-panel {
    border-radius: 16px;
    scroll-margin-top: 74px;
  }

  .module-header {
    gap: 13px;
    padding: 21px 18px 19px;
  }

  .module-title-mark {
    height: 39px;
    width: 39px;
  }

  .module-header h2 {
    font-size: 20px;
  }

  .module-header p:last-child {
    font-size: 10px;
    line-height: 1.55;
  }

  .collection-form {
    padding: 21px 18px 24px;
  }

  .collection-form fieldset {
    margin-bottom: 22px;
    padding-bottom: 23px;
  }

  .form-grid {
    gap: 14px;
    grid-template-columns: 1fr;
  }

  .full-field {
    grid-column: auto;
  }

  .field input,
  .field select,
  .field textarea {
    font-size: 16px;
    min-height: 48px;
  }

  .field textarea {
    min-height: 90px;
  }

  .drop-zone {
    min-height: 175px;
    padding: 22px 15px;
  }

  .medical-upload-actions {
    grid-template-columns: 1fr;
  }

  .capture-action {
    min-height: 78px;
  }

  .selected-file-copy strong {
    max-width: 190px;
  }

  .consent-row {
    font-size: 10px;
    line-height: 1.65;
  }

  .submit-button {
    min-height: 54px;
  }

  .portal-footnote {
    padding: 0 8px;
  }

  .admin-header {
    padding: 0 15px;
  }

  .admin-brand small,
  .admin-link span {
    display: none;
  }

  .admin-main {
    padding: 25px 13px 50px;
  }

  .admin-title-row h1 {
    font-size: 23px;
  }

  .share-panel {
    padding: 20px;
  }

  .share-values {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .share-value {
    min-width: 0;
  }

  .stats-grid {
    gap: 8px;
  }

  .stat-card {
    padding: 13px;
  }

  .records-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .record-search {
    width: 100%;
  }

  .record-row {
    gap: 12px;
    grid-template-columns: 1fr auto;
    padding: 15px;
  }

  .record-person {
    grid-column: 1 / 2;
  }

  .record-row .detail-button {
    grid-column: 2;
    grid-row: 1 / 3;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .dialog-header,
  .dialog-body {
    padding-left: 18px;
    padding-right: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========== 云端版：本机登记与我的提交记录 ========== */

.device-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
  width: 100%;
}

@media (max-width: 560px) {
  .device-grid {
    grid-template-columns: 1fr;
  }
}

.active-history-toggle {
  background: var(--green-soft);
  color: var(--green);
}

.history-panel {
  margin-top: 26px;
}

.history-list {
  display: flex;
  flex-direction: column;
}

.history-card {
  border-bottom: 1px solid var(--line);
  padding: 14px 18px 16px;
}

.history-card:last-child {
  border-bottom: 0;
}

.history-head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  flex-wrap: wrap;
}

.history-head strong {
  color: var(--green-dark);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.history-date {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
}

.history-detail {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
  margin: 6px 0 10px;
}

.history-files {
  display: grid;
  gap: 6px;
}

.history-empty {
  color: var(--muted);
  font-size: 12px;
  padding: 34px 20px;
  text-align: center;
}

.history-workflow-notice {
  border-radius: 7px;
  font-size: 10px;
  margin: 6px 0 10px;
  padding: 8px 10px;
}

.returned-notice {
  background: var(--red-soft);
  color: var(--red);
}

.reimbursed-notice {
  background: var(--green-soft);
  color: var(--green-dark);
}

/* Staff workflow */
.staff-logout {
  font-family: inherit;
}

.staff-login-card .brand-mark {
  margin-bottom: 20px;
}

.staff-login-card .overline {
  margin-bottom: 5px;
}

.staff-token-field {
  margin-top: 22px;
  text-align: left;
}

.staff-login-card .field + .field {
  margin-top: 12px;
  text-align: left;
}

.staff-page-intro {
  color: var(--muted);
  font-size: 12px;
  margin: 7px 0 0;
  max-width: 680px;
}

.workflow-strip {
  align-items: stretch;
  background: var(--green-dark);
  border-radius: var(--radius-large);
  color: #fff;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  margin-bottom: 20px;
  padding: 18px 22px;
}

.workflow-strip > div {
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 10px;
  padding: 10px 12px;
}

.workflow-strip > div.active-workflow-step {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 -3px var(--orange);
}

.workflow-strip > i {
  align-self: center;
  color: #7fa49a;
  font-family: var(--font-mono);
  font-style: normal;
}

.workflow-strip span,
.workflow-strip strong,
.workflow-strip small {
  display: block;
}

.workflow-strip span {
  color: #89afa4;
  font-family: var(--font-mono);
  font-size: 9px;
}

.workflow-strip strong {
  font-size: 12px;
  margin-top: 2px;
}

.workflow-strip small {
  color: #a9c3bb;
  font-size: 9px;
}

.urgent-stat {
  border-color: #df936e;
  box-shadow: inset 0 3px var(--orange);
}

.staff-toolbar .filter-tabs {
  flex-wrap: wrap;
}

.staff-record-row {
  grid-template-columns: minmax(250px, 1.5fr) minmax(170px, 1fr) minmax(100px, 0.55fr) auto;
}

.staff-record-row .record-primary > div {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.workflow-status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 9px;
  font-weight: 700;
  margin-right: 3px;
  padding: 3px 7px;
}

.status-pending_medical_review {
  background: #fff0dd;
  color: #99551f;
}

.status-returned {
  background: var(--red-soft);
  color: var(--red);
}

.status-pending_reimbursement {
  background: #e1edf4;
  color: var(--blue);
}

.status-reimbursed {
  background: var(--green-soft);
  color: var(--green);
}

.primary-detail-button {
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: #fff;
}

.primary-detail-button:hover {
  background: var(--green);
  color: #fff;
}

.staff-detail-dialog {
  max-width: 780px;
}

.detail-status-line {
  align-items: center;
  background: var(--paper-deep);
  border-radius: 9px;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 10px 12px;
}

.detail-status-line > span:last-child {
  color: var(--muted);
  font-size: 9px;
}

.file-download-button {
  background: transparent;
  border: 0;
  color: var(--green);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  margin-left: auto;
  padding: 7px;
}

.file-download-button:disabled {
  color: var(--muted);
  cursor: wait;
}

.workflow-timeline {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 17px;
}

.workflow-timeline > h3,
.workflow-action-panel > h3 {
  font-size: 12px;
  margin: 0 0 12px;
}

.workflow-timeline article {
  display: grid;
  gap: 11px;
  grid-template-columns: 12px 1fr;
  padding: 4px 0 12px;
  position: relative;
}

.workflow-timeline article > i {
  background: var(--green);
  border: 3px solid var(--green-soft);
  border-radius: 50%;
  height: 11px;
  margin-top: 4px;
  width: 11px;
}

.workflow-timeline article:not(:last-child)::before {
  background: var(--line);
  content: "";
  height: calc(100% - 5px);
  left: 5px;
  position: absolute;
  top: 15px;
  width: 1px;
}

.workflow-timeline strong,
.workflow-timeline small,
.workflow-timeline code {
  display: block;
}

.workflow-timeline strong {
  font-size: 11px;
}

.workflow-timeline small {
  color: var(--muted);
  font-size: 9px;
}

.workflow-timeline p {
  background: var(--paper-deep);
  border-radius: 6px;
  color: var(--ink-soft);
  font-size: 10px;
  margin: 6px 0 0;
  padding: 7px 9px;
  white-space: pre-wrap;
}

.workflow-timeline code {
  color: var(--green-dark);
  font-family: var(--font-mono);
  font-size: 10px;
  margin-top: 5px;
}

.workflow-action-panel {
  background: #edf3f0;
  border: 1px solid #c9ddd5;
  border-radius: var(--radius-medium);
  margin-top: 18px;
  padding: 17px;
}

.workflow-action-fields {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workflow-action-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.workflow-action-buttons button {
  border-radius: 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  min-height: 42px;
  padding: 0 15px;
}

.secondary-action {
  background: #fff;
  border: 1px solid #d5aaa4;
  color: var(--red);
}

.approve-action {
  background: var(--green-dark);
  border: 1px solid var(--green-dark);
  color: #fff;
}

.workflow-action-buttons button:disabled {
  cursor: wait;
  opacity: 0.65;
}

@media (max-width: 900px) {
  .workflow-strip {
    grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
    overflow-x: auto;
  }

  .workflow-strip > div {
    min-width: 125px;
  }

  .staff-record-row {
    grid-template-columns: minmax(200px, 1fr) minmax(150px, 0.8fr) auto;
  }
}

@media (max-width: 640px) {
  .staff-title-row {
    align-items: flex-start;
    gap: 12px;
  }

  .staff-page-intro {
    font-size: 10px;
  }

  .workflow-strip {
    margin-left: -13px;
    margin-right: -13px;
    padding: 14px 13px;
  }

  .staff-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .staff-toolbar .filter-tabs {
    display: flex;
    overflow-x: auto;
  }

  .staff-toolbar .filter-tab {
    flex: 0 0 auto;
  }

  .staff-record-row {
    grid-template-columns: 1fr auto;
  }

  .staff-record-row .record-person {
    grid-column: 1;
  }

  .staff-record-row .detail-button {
    grid-column: 2;
    grid-row: 1 / 3;
  }

  .workflow-action-fields {
    grid-template-columns: 1fr;
  }

  .workflow-action-buttons {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .workflow-action-buttons button {
    width: 100%;
  }
}
