:root {
  --ink: #17202b;
  --muted: #637083;
  --line: #d8dee8;
  --paper: #ffffff;
  --page: #f3f6f9;
  --soft: #edf3f7;
  --brand: #1f6f68;
  --brand-strong: #14534e;
  --blue: #265f9c;
  --green: #287d5b;
  --red: #b83b3b;
  --focus: rgba(31, 111, 104, 0.22);
  --shadow: 0 20px 50px rgba(26, 42, 58, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-header {
  color: #ffffff;
  background:
    linear-gradient(120deg, rgba(9, 38, 47, 0.94), rgba(24, 89, 82, 0.9)),
    url("https://images.unsplash.com/photo-1554224155-6726b3ff858f?auto=format&fit=crop&w=1800&q=80") center/cover;
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 18px 32px;
}

.brand,
.nav-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-size: 18px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--brand-strong);
  background: #f7fbfb;
  border-radius: 8px;
}

.nav-actions {
  gap: 6px;
}

.nav-actions a {
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 7px;
  color: rgba(255, 255, 255, 0.88);
}

.nav-actions a:hover {
  background: rgba(255, 255, 255, 0.14);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 32px;
  align-items: end;
  max-width: 1240px;
  margin: 0 auto;
  padding: 54px 32px 42px;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: #9ee0d7;
}

.hero h1 {
  margin: 12px 0 16px;
  max-width: 820px;
  font-size: clamp(36px, 6vw, 64px);
  line-height: 1.05;
  letter-spacing: 0;
}

.hero-text {
  max-width: 690px;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 17px;
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.primary-link,
.secondary-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  font-weight: 800;
}

.primary-link {
  color: var(--brand-strong);
  background: #ffffff;
}

.secondary-link {
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.36);
}

.summary-strip {
  display: grid;
  gap: 12px;
}

.summary-strip div {
  padding: 18px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  backdrop-filter: blur(12px);
}

.summary-strip span {
  display: block;
  font-size: 30px;
  font-weight: 800;
}

.summary-strip small {
  color: rgba(255, 255, 255, 0.76);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 20px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 32px 42px;
}

.workspace,
.side-panel,
.records {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.workspace,
.side-panel {
  padding: 22px;
}

.records {
  grid-column: 1 / -1;
  padding: 20px 22px 22px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 4px 0 0;
  font-size: 20px;
}

#pdfStatus {
  padding: 5px 10px;
  color: var(--muted);
  background: var(--soft);
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
}

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

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

.group-title {
  margin: 24px 0 12px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--brand);
  font-weight: 800;
}

label,
.wide-label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 14px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fbfcfe;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  outline: none;
  font-weight: 500;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--focus);
}

.wide-label {
  margin-top: 16px;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

button {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  color: #ffffff;
  background: var(--brand);
}

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

.secondary-button {
  color: var(--brand-strong);
  background: #e8f4f2;
  border-color: #b7d8d2;
}

.ghost-button {
  color: #475467;
  background: #ffffff;
  border-color: var(--line);
}

.small-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.full-width {
  width: 100%;
  margin-top: 10px;
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 164px;
  padding: 20px;
  text-align: center;
  border: 1px dashed #87aaa4;
  border-radius: 8px;
  background: #f3faf8;
  cursor: pointer;
}

.drop-zone input {
  display: none;
}

.drop-zone strong {
  display: block;
  font-size: 16px;
}

.drop-zone span {
  max-width: 300px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.drop-zone.dragging {
  border-color: var(--green);
  background: #e8f7f1;
}

.recognized-box {
  margin-top: 16px;
}

.candidate-box {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.recognized-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: #374151;
  font-weight: 800;
}

.candidate-list {
  display: grid;
  gap: 12px;
  max-height: 340px;
  overflow: auto;
}

.candidate-group {
  display: grid;
  gap: 7px;
}

.candidate-title {
  color: #475467;
  font-size: 13px;
  font-weight: 800;
}

.candidate-pill {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  color: var(--ink);
  text-align: left;
  word-break: break-word;
  background: #f7f9fc;
  border: 1px solid #d9e2ef;
  border-radius: 7px;
  font-weight: 600;
}

.candidate-pill:hover {
  border-color: var(--brand);
  background: #eef8f6;
}

.empty-hint {
  padding: 12px;
  color: var(--muted);
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 13px;
  line-height: 1.5;
}

.search-input {
  max-width: 340px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1100px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 14px;
}

th {
  color: #475467;
  background: #f7f9fc;
  white-space: nowrap;
}

tbody tr:hover {
  background: #fbfdfc;
}

td.money {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.link-button {
  min-height: 30px;
  padding: 0 8px;
  color: var(--blue);
  background: transparent;
  border-color: transparent;
}

.danger-button {
  color: var(--red);
}

.empty-cell {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 980px) {
  .nav-bar,
  .hero,
  .layout {
    padding-left: 18px;
    padding-right: 18px;
  }

  .hero,
  .layout {
    grid-template-columns: 1fr;
  }

  .summary-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .nav-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-actions {
    width: 100%;
    justify-content: space-between;
  }

  .hero {
    padding-top: 34px;
  }

  .hero h1 {
    font-size: 34px;
  }

  .form-grid,
  .compact-grid,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    flex-direction: column;
  }
}
