:root {
  color-scheme: light;
  --ink: #173238;
  --muted: #6d7d80;
  --line: #dbe4e3;
  --paper: #ffffff;
  --canvas: #f4f7f6;
  --teal: #12343b;
  --teal-light: #dceceb;
  --orange: #ed8452;
  --orange-dark: #c86338;
  --yellow: #f4d57f;
  --shadow: 0 18px 45px rgba(18, 52, 59, 0.08);
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  line-height: 1.5;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

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

.topbar {
  min-height: 60px;
  padding: 0 4vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--teal);
  color: #fff;
}

.brand-lockup, .topbar-meta, .form-footer, .input-with-suffix, .history-strip { display: flex; align-items: center; }

.brand-lockup { gap: 12px; }

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .45);
  color: var(--yellow);
  font-size: 15px;
  font-weight: 700;
}

.brand-kicker, .eyebrow, .section-index {
  margin: 0;
  letter-spacing: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.brand-kicker { color: #a9c6c4; font-size: 9px; letter-spacing: .12em; }
.brand-name { margin-top: 1px; font-size: 15px; font-weight: 700; }
.topbar-meta { color: #b9cdcb; font-size: 12px; gap: 8px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #78d6a3; box-shadow: 0 0 0 4px rgba(120, 214, 163, .15); }
.logout-button { margin-left: 10px; padding: 4px 8px; border: 1px solid rgba(255, 255, 255, .24); border-radius: 0; background: transparent; color: #d2e0de; font-size: 11px; }
.logout-button:hover { border-color: rgba(255, 255, 255, .55); color: #fff; }

.workspace { width: min(1180px, 92vw); margin: 0 auto; padding: 28px 0 24px; }

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow { color: var(--orange-dark); }
.page-heading h1 { margin: 5px 0 5px; font-size: clamp(26px, 3vw, 34px); line-height: 1.12; letter-spacing: 0; }
.heading-copy { max-width: 580px; margin: 0; color: var(--muted); font-size: 13px; }
.file-count { min-width: 110px; padding-left: 20px; border-left: 1px solid var(--line); }
.file-count strong { display: block; color: var(--orange-dark); font-family: Georgia, serif; font-size: 34px; font-weight: 400; line-height: .95; }
.file-count span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, .85fr); gap: 18px; margin-top: 18px; align-items: start; }
.form-panel, .preview-panel, .files-panel { background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); }
.form-panel { padding: 22px; }
.preview-panel, .files-panel { padding: 19px; }
.side-column { display: grid; gap: 14px; }

.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.panel-header.compact { padding-bottom: 12px; }
.section-index { color: var(--orange); font-size: 10px; letter-spacing: .12em; }
.panel-header h2 { margin: 4px 0 0; font-size: 19px; letter-spacing: 0; }
.required-note, .preview-state, .file-total { color: var(--muted); font-size: 12px; white-space: nowrap; }
.required-note i, .field-label i { color: var(--orange-dark); font-style: normal; }
.preview-state { padding: 4px 8px; background: #f5f7f6; }
.file-total { color: var(--orange-dark); font-family: Georgia, serif; font-size: 14px; }

.form-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 18px; padding: 19px 0 22px; }
.field { display: block; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field-label { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; font-size: 13px; font-weight: 700; }
.optional-tag { padding: 2px 6px; color: var(--muted); background: #f1f4f3; font-size: 10px; font-weight: 400; }
.field input, .history-select-wrap input { width: 100%; border: 1px solid #cbd8d6; border-radius: 0; outline: 0; background: #fff; color: var(--ink); transition: border-color .18s, box-shadow .18s; }
.field input { height: 40px; padding: 0 12px; font-size: 13px; }
.field input::placeholder { color: #a8b5b4; }
.field input:focus, .history-select-wrap input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(237, 132, 82, .14); }
.field-hint { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.input-with-suffix { height: 40px; border: 1px solid #cbd8d6; background: #fff; transition: border-color .18s, box-shadow .18s; }
.input-with-suffix:focus-within { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(237, 132, 82, .14); }
.input-with-suffix input { height: 38px; border: 0; box-shadow: none !important; }
.input-with-suffix span { padding: 0 12px 0 0; color: var(--muted); font-size: 12px; }

.form-footer { justify-content: flex-end; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.button { min-height: 40px; border: 1px solid transparent; border-radius: 0; padding: 0 14px; font-size: 12px; font-weight: 700; transition: transform .18s, background .18s, border-color .18s; }
.button:active { transform: translateY(1px); }
.button:disabled { cursor: wait; opacity: .6; }
.button-secondary { color: var(--muted); background: #fff; border-color: var(--line); }
.button-secondary:hover { color: var(--ink); border-color: #b4c4c2; }
.button-primary { display: inline-flex; align-items: center; gap: 16px; color: #fff; background: var(--orange); }
.button-primary:hover { background: var(--orange-dark); }
.button-arrow { font-size: 20px; font-weight: 400; line-height: 1; }
.form-status { min-height: 17px; margin: 8px 0 0; color: var(--orange-dark); font-size: 11px; text-align: right; }
.form-status.success { color: #27815c; }
.form-status.error { color: #b3483c; }

.metric-list { padding: 7px 0 2px; }
.metric-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid #edf1f0; color: var(--muted); font-size: 11px; }
.metric-row:last-child { border-bottom: 0; }
.metric-row strong { color: var(--ink); font-family: Georgia, serif; font-size: 18px; font-weight: 400; white-space: nowrap; }
.metric-highlight { margin: 0 -8px; padding: 9px 8px; background: #fff7ee; color: #8e5e45; }
.metric-highlight strong { color: var(--orange-dark); font-size: 22px; }
.preview-note { margin: 8px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }

.file-list { display: grid; gap: 0; padding: 4px 0 0; margin: 0; list-style: none; }
.file-list li { display: flex; align-items: center; gap: 9px; min-height: 29px; color: #526467; font-size: 11px; border-bottom: 1px solid #edf1f0; }
.file-list li:last-child { border-bottom: 0; }
.file-type { width: 37px; padding: 3px 0; color: #fff; font-size: 9px; font-weight: 700; text-align: center; }
.file-type.xlsx { background: #4d9c78; }
.file-type.docx { background: #6186b4; }

.history-strip { justify-content: space-between; gap: 24px; margin-top: 16px; padding: 13px 18px; border-top: 2px solid var(--teal); background: #e9efed; }
.project-picker { margin-top: 0; }
.history-intro { min-width: 220px; }
.history-intro h2 { margin: 2px 0 0; font-size: 14px; }
.history-select-wrap { position: relative; display: block; flex: 1; max-width: 570px; }
.history-select-wrap input { height: 36px; padding: 0 12px; background-color: #fff; font-size: 12px; }
.history-select-wrap input::placeholder { color: #8b9b99; }
.history-options { position: absolute; z-index: 10; top: calc(100% + 4px); right: 0; left: 0; max-height: 280px; overflow-y: auto; border: 1px solid #cbd8d6; background: #fff; box-shadow: 0 12px 25px rgba(18, 52, 59, .12); }
.history-option { padding: 9px 12px; color: var(--ink); font-size: 12px; line-height: 1.45; cursor: pointer; }
.history-option:hover, .history-option.is-active { background: #eef5f3; }
.history-option-empty { color: var(--muted); cursor: default; }

.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; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: var(--canvas); }
.login-panel { width: min(440px, 100%); padding: 36px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 34px; }
.login-brand .brand-mark { background: var(--teal); color: var(--yellow); }
.login-panel h1 { margin: 0 0 9px; font-size: 27px; line-height: 1.2; }
.login-copy { margin: 0 0 28px; color: var(--muted); font-size: 13px; }
.login-form label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
.login-form input { width: 100%; height: 48px; padding: 0 13px; border: 1px solid #cbd8d6; border-radius: 0; outline: 0; background: #fff; color: var(--ink); }
.login-form input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(237, 132, 82, .14); }
.login-form .button { width: 100%; margin-top: 20px; }
.login-status { min-height: 20px; margin: 13px 0 0; color: #b3483c; font-size: 12px; }

@media (min-width: 761px) and (max-height: 800px) {
  .workspace { padding-top: 16px; padding-bottom: 14px; }
  .page-heading { padding-bottom: 12px; }
  .workspace-grid { gap: 14px; margin-top: 12px; }
  .form-panel { padding: 18px; }
  .preview-panel, .files-panel { padding: 16px; }
  .panel-header { padding-bottom: 10px; }
  .panel-header.compact { padding-bottom: 8px; }
  .form-fields { gap: 10px 14px; padding: 14px 0 16px; }
  .field-hint, .preview-note { display: none; }
  .field input, .input-with-suffix { height: 36px; }
  .input-with-suffix input { height: 34px; }
  .form-footer { padding-top: 10px; }
  .history-strip { margin-top: 10px; padding: 9px 14px; }
  .file-list li { min-height: 26px; }
}

@media (max-width: 760px) {
  .topbar { min-height: 64px; padding: 0 5vw; }
  .topbar-meta { display: none; }
  .workspace { width: min(92vw, 600px); padding-top: 38px; }
  .page-heading { align-items: flex-start; padding-bottom: 25px; }
  .page-heading h1 { font-size: 30px; }
  .heading-copy { font-size: 13px; }
  .file-count { min-width: 74px; padding-left: 12px; }
  .file-count strong { font-size: 31px; }
  .workspace-grid { grid-template-columns: 1fr; gap: 18px; margin-top: 20px; }
  .form-panel, .preview-panel, .files-panel { padding: 22px; }
  .form-fields { grid-template-columns: 1fr; gap: 20px; padding-top: 23px; }
  .field-wide { grid-column: auto; }
  .form-footer { align-items: stretch; flex-direction: column-reverse; }
  .button { width: 100%; }
  .form-status { text-align: left; }
  .history-strip { align-items: stretch; flex-direction: column; gap: 13px; padding: 18px; }
  .project-picker { margin-top: 0; }
  .history-intro { min-width: 0; }
  .history-select-wrap { max-width: none; }
}

@media (max-width: 400px) {
  .page-heading { gap: 14px; }
  .page-heading h1 { font-size: 26px; }
  .file-count strong { font-size: 26px; }
  .file-count span { font-size: 10px; }
}
